@@ -41,17 +41,16 @@ struct ParamSymbol { | |||
uint32_t index; | |||
const char* symbol; | |||
ParamSymbol(uint32_t index_, const char* symbol_) | |||
: index(index_), | |||
symbol(carla_strdup(symbol_)) {} | |||
ParamSymbol(uint32_t i, const char* s) | |||
: index(i), | |||
symbol(carla_strdup(s)) {} | |||
void free() | |||
~ParamSymbol() | |||
{ | |||
if (symbol != nullptr) | |||
{ | |||
delete[] symbol; | |||
symbol = nullptr; | |||
} | |||
CARLA_SAFE_ASSERT_RETURN(symbol != nullptr,) | |||
delete[] symbol; | |||
symbol = nullptr; | |||
} | |||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||
@@ -109,6 +108,8 @@ const char* CarlaPluginProtectedData::libError(const char* const filename) | |||
// ------------------------------------------------------------------- | |||
// Settings functions, defined in CarlaPluginInternal.hpp | |||
// FIXME - this doesn't work!! | |||
void CarlaPluginProtectedData::saveSetting(const unsigned int option, const bool yesNo) | |||
{ | |||
PropertiesFile::Options opts; | |||
@@ -226,7 +227,7 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned int id) | |||
fIconName("plugin"), | |||
pData(new CarlaPluginProtectedData(engine, this)) | |||
{ | |||
CARLA_ASSERT(engine != nullptr); | |||
CARLA_SAFE_ASSERT_RETURN(engine != nullptr,); | |||
CARLA_ASSERT(id < engine->getMaxPluginNumber()); | |||
CARLA_ASSERT(id == engine->getCurrentPluginCount()); | |||
carla_debug("CarlaPlugin::CarlaPlugin(%p, %i)", engine, id); | |||
@@ -776,7 +777,6 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) | |||
for (NonRtList<ParamSymbol*>::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) | |||
{ | |||
ParamSymbol* const paramSymbol(*it); | |||
paramSymbol->free(); | |||
delete paramSymbol; | |||
} | |||
@@ -658,10 +658,10 @@ struct CarlaPluginProtectedData { | |||
if (client != nullptr) | |||
{ | |||
CARLA_ASSERT(! client->isActive()); | |||
if (client->isActive()) | |||
client->deactivate(); | |||
else | |||
carla_assert("client->isActive()", __FILE__, __LINE__); | |||
clearBuffers(); | |||
@@ -673,27 +673,29 @@ struct CarlaPluginProtectedData { | |||
{ | |||
CustomData& cData(*it); | |||
CARLA_ASSERT(cData.type != nullptr); | |||
CARLA_ASSERT(cData.key != nullptr); | |||
CARLA_ASSERT(cData.value != nullptr); | |||
if (cData.type != nullptr) | |||
{ | |||
delete[] cData.type; | |||
cData.type = nullptr; | |||
} | |||
else | |||
carla_assert("cData.type != nullptr", __FILE__, __LINE__); | |||
if (cData.key != nullptr) | |||
{ | |||
delete[] cData.key; | |||
cData.key = nullptr; | |||
} | |||
else | |||
carla_assert("cData.key != nullptr", __FILE__, __LINE__); | |||
if (cData.value != nullptr) | |||
{ | |||
delete[] cData.value; | |||
cData.value = nullptr; | |||
} | |||
else | |||
carla_assert("cData.value != nullptr", __FILE__, __LINE__); | |||
} | |||
prog.clear(); | |||
@@ -719,13 +721,10 @@ struct CarlaPluginProtectedData { | |||
for (uint32_t i=0; i < audioIn.count; ++i) | |||
{ | |||
CARLA_ASSERT(latencyBuffers[i] != nullptr); | |||
CARLA_SAFE_ASSERT_CONTINUE(latencyBuffers[i] != nullptr); | |||
if (latencyBuffers[i] != nullptr) | |||
{ | |||
delete[] latencyBuffers[i]; | |||
latencyBuffers[i] = nullptr; | |||
} | |||
delete[] latencyBuffers[i]; | |||
latencyBuffers[i] = nullptr; | |||
} | |||
delete[] latencyBuffers; | |||
@@ -751,13 +750,10 @@ struct CarlaPluginProtectedData { | |||
for (uint32_t i=0; i < audioIn.count; ++i) | |||
{ | |||
CARLA_ASSERT(latencyBuffers[i] != nullptr); | |||
CARLA_SAFE_ASSERT_CONTINUE(latencyBuffers[i] != nullptr); | |||
if (latencyBuffers[i] != nullptr) | |||
{ | |||
delete[] latencyBuffers[i]; | |||
latencyBuffers[i] = nullptr; | |||
} | |||
delete[] latencyBuffers[i]; | |||
latencyBuffers[i] = nullptr; | |||
} | |||
delete[] latencyBuffers; | |||
@@ -72,6 +72,11 @@ if __name__ == '__main__': | |||
# ------------------------------------------------------------- | |||
# Init host backend | |||
Carla.isControl = False | |||
Carla.isLocal = True | |||
Carla.isPlugin = False | |||
Carla.processMode = PROCESS_MODE_MULTIPLE_CLIENTS | |||
initHost(appName, libPrefix) | |||
# ------------------------------------------------------------- | |||