Browse Source

Fix for last commit, misc changes

tags/1.9.4
falkTX 12 years ago
parent
commit
fe9c7ca22b
8 changed files with 70 additions and 44 deletions
  1. +2
    -2
      source/backend/carla_engine.hpp
  2. +5
    -2
      source/backend/engine/carla_engine.cpp
  3. +16
    -14
      source/backend/engine/carla_engine_osc.cpp
  4. +18
    -15
      source/backend/plugin/carla_plugin.cpp
  5. +5
    -2
      source/backend/plugin/carla_plugin_internal.hpp
  6. +8
    -2
      source/backend/standalone/carla_standalone.cpp
  7. +8
    -7
      source/bridges/carla_bridge_osc.cpp
  8. +8
    -0
      source/utils/carla_utils.hpp

+ 2
- 2
source/backend/carla_engine.hpp View File

@@ -754,12 +754,12 @@ public:
* Load \a filename session.
* \note Already loaded plugins are not removed; call removeAllPlugins() first if needed.
*/
void loadProject(const char* const filename);
bool loadProject(const char* const filename);

/*!
* Save current session to \a filename.
*/
void saveProject(const char* const filename);
bool saveProject(const char* const filename);

// -------------------------------------------------------------------
// Information (base)


+ 5
- 2
source/backend/engine/carla_engine.cpp View File

@@ -953,7 +953,7 @@ void CarlaEngine::__bridgePluginRegister(const unsigned short id, CarlaPlugin* c
// -----------------------------------------------------------------------
// Information (base)

void CarlaEngine::loadProject(const char* const filename)
bool CarlaEngine::loadProject(const char* const filename)
{
CARLA_ASSERT(filename != nullptr);

@@ -963,9 +963,10 @@ void CarlaEngine::loadProject(const char* const filename)
// return;

//getSaveStateDictFromXML
return true;
}

void CarlaEngine::saveProject(const char* const filename)
bool CarlaEngine::saveProject(const char* const filename)
{
CARLA_ASSERT(filename != nullptr);

@@ -991,6 +992,8 @@ void CarlaEngine::saveProject(const char* const filename)
out << "</CARLA-PRESET>\n";

file.close();

return true;
}

// -----------------------------------------------------------------------


+ 16
- 14
source/backend/engine/carla_engine_osc.cpp View File

@@ -66,7 +66,7 @@ void CarlaEngineOsc::init(const char* const name)
{
fServerPathTCP = tmpServerPathTCP;
fServerPathTCP += fName;
free(tmpServerPathTCP);
std::free(tmpServerPathTCP);
}

lo_server_add_method(fServerTCP, nullptr, nullptr, osc_message_handler, this);
@@ -80,7 +80,7 @@ void CarlaEngineOsc::init(const char* const name)
{
fServerPathUDP = tmpServerPathUDP;
fServerPathUDP += fName;
free(tmpServerPathUDP);
std::free(tmpServerPathUDP);
}

lo_server_add_method(fServerUDP, nullptr, nullptr, osc_message_handler, this);
@@ -367,23 +367,25 @@ int CarlaEngineOsc::handleMsgRegister(const int argc, const lo_arg* const* const
return 1;
}

const char* const url = (const char*)&argv[0]->s;
const char* host;
const char* port;
const char* const url = &argv[0]->s;

qDebug("CarlaEngineOsc::handleMsgRegister() - OSC backend registered to %s", url);

host = lo_address_get_hostname(source);
port = lo_address_get_port(source);
fControlData.source = lo_address_new_with_proto(LO_TCP, host, port);
{
const char* host = lo_address_get_hostname(source);
const char* port = lo_address_get_port(source);
fControlData.source = lo_address_new_with_proto(LO_TCP, host, port);
}

host = lo_url_get_hostname(url);
port = lo_url_get_port(url);
fControlData.path = lo_url_get_path(url);
fControlData.target = lo_address_new_with_proto(LO_TCP, host, port);
{
char* host = lo_url_get_hostname(url);
char* port = lo_url_get_port(url);
fControlData.path = carla_strdup_free(lo_url_get_path(url));
fControlData.target = lo_address_new_with_proto(LO_TCP, host, port);

free((void*)host);
free((void*)port);
std::free(host);
std::free(port);
}

for (unsigned short i=0; i < kEngine->currentPluginCount(); i++)
{


+ 18
- 15
source/backend/plugin/carla_plugin.cpp View File

@@ -1005,25 +1005,28 @@ void CarlaPlugin::updateOscData(const lo_address& source, const char* const url)
// FIXME - remove debug prints later
qWarning("CarlaPlugin::updateOscData(%p, \"%s\")", source, url);

const char* host;
const char* port;
const int proto = lo_address_get_protocol(source);

kData->osc.data.free();

host = lo_address_get_hostname(source);
port = lo_address_get_port(source);
kData->osc.data.source = lo_address_new_with_proto(proto, host, port);
qWarning("CarlaPlugin::updateOscData() - source: host \"%s\", port \"%s\"", host, port);
const int proto = lo_address_get_protocol(source);

{
const char* host = lo_address_get_hostname(source);
const char* port = lo_address_get_port(source);
kData->osc.data.source = lo_address_new_with_proto(proto, host, port);

host = lo_url_get_hostname(url);
port = lo_url_get_port(url);
kData->osc.data.path = lo_url_get_path(url);
kData->osc.data.target = lo_address_new_with_proto(proto, host, port);
qWarning("CarlaPlugin::updateOscData() - target: host \"%s\", port \"%s\", path \"%s\"", host, port, kData->osc.data.path);
qWarning("CarlaPlugin::updateOscData() - source: host \"%s\", port \"%s\"", host, port);
}

free((void*)host);
free((void*)port);
{
char* host = lo_url_get_hostname(url);
char* port = lo_url_get_port(url);
kData->osc.data.path = carla_strdup_free(lo_url_get_path(url));
kData->osc.data.target = lo_address_new_with_proto(proto, host, port);
qWarning("CarlaPlugin::updateOscData() - target: host \"%s\", port \"%s\", path \"%s\"", host, port, kData->osc.data.path);

std::free(host);
std::free(port);
}

#ifndef BUILD_BRIDGE
if (fHints & PLUGIN_IS_BRIDGE)


+ 5
- 2
source/backend/plugin/carla_plugin_internal.hpp View File

@@ -279,13 +279,16 @@ struct PluginProgramData {
if (names != nullptr)
{
for (uint32_t i=0; i < count; i++)
std::free((void*)names[i]);
{
if (names[i] != nullptr)
delete[] names[i];
}

delete[] names;
names = nullptr;
}

count = 0;
count = 0;
current = -1;
}



+ 8
- 2
source/backend/standalone/carla_standalone.cpp View File

@@ -303,7 +303,10 @@ bool carla_load_project(const char* filename)
CARLA_ASSERT(filename != nullptr);

if (standalone.engine != nullptr)
standalone.engine->loadProject(filename);
return standalone.engine->loadProject(filename);

standalone.lastError = "Engine is not started";
return false;
}

bool carla_save_project(const char* filename)
@@ -312,7 +315,10 @@ bool carla_save_project(const char* filename)
CARLA_ASSERT(filename != nullptr);

if (standalone.engine != nullptr)
standalone.engine->saveProject(filename);
return standalone.engine->saveProject(filename);

standalone.lastError = "Engine is not started";
return false;
}

// -------------------------------------------------------------------------------------------------------------------


+ 8
- 7
source/bridges/carla_bridge_osc.cpp View File

@@ -82,24 +82,25 @@ bool CarlaBridgeOsc::init(const char* const url)

if (! path)
{
free(host);
std::free(host);
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url path", url);
return false;
}

if (! port)
{
free(host);
free(path);
std::free(host);
std::free(path);
qCritical("CarlaBridgeOsc::init(\"%s\") - failed to get url port", url);
return false;
}

m_controlData.path = path;
m_controlData.path = carla_strdup(path);
m_controlData.target = lo_address_new_with_proto(LO_TCP, host, port);

free(host);
free(port);
std::free(path);
std::free(host);
std::free(port);

if (! m_controlData.target)
{
@@ -118,7 +119,7 @@ bool CarlaBridgeOsc::init(const char* const url)
if (char* const serverUrl = lo_server_get_url(m_server))
{
m_serverPath = strdup(QString("%1%2").arg(serverUrl).arg(m_name).toUtf8().constData());
free(serverUrl);
std::free(serverUrl);
}
else
m_serverPath = strdup(QString("%1carla-bridge").arg(serverUrl).toUtf8().constData());


+ 8
- 0
source/utils/carla_utils.hpp View File

@@ -147,6 +147,14 @@ const char* carla_strdup(const char* const strBuf)
return buffer;
}

static inline
const char* carla_strdup_free(const char* const strBuf)
{
const char* const buffer = carla_strdup(strBuf);
std::free((void*)strBuf);
return buffer;
}

// -------------------------------------------------
// math functions



Loading…
Cancel
Save