Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-rc1
@@ -299,6 +299,9 @@ public: | |||||
return new CarlaEngineBridgeClient(*this, pData->graph, plugin, this); | return new CarlaEngineBridgeClient(*this, pData->graph, plugin, this); | ||||
#else | #else | ||||
return new CarlaEngineBridgeClient(*this, this); | return new CarlaEngineBridgeClient(*this, this); | ||||
// unused | |||||
(void)plugin; | |||||
#endif | #endif | ||||
} | } | ||||
@@ -549,7 +552,7 @@ public: | |||||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerProgramName); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerProgramName); | ||||
fShmNonRtServerControl.writeUInt(i); | fShmNonRtServerControl.writeUInt(i); | ||||
if (plugin->getProgramName(i, bufStr)) | |||||
if (! plugin->getProgramName(i, bufStr)) | |||||
bufStr[0] = '\0'; | bufStr[0] = '\0'; | ||||
bufStrSize = carla_fixedValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr))); | bufStrSize = carla_fixedValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr))); | ||||
fShmNonRtServerControl.writeUInt(bufStrSize); | fShmNonRtServerControl.writeUInt(bufStrSize); | ||||
@@ -645,7 +648,7 @@ public: | |||||
{ | { | ||||
CarlaEngine::callback(sendHost, sendOsc, action, pluginId, value1, value2, value3, valuef, valueStr); | CarlaEngine::callback(sendHost, sendOsc, action, pluginId, value1, value2, value3, valuef, valueStr); | ||||
if (fClosingDown) | |||||
if (fClosingDown || ! sendHost) | |||||
return; | return; | ||||
switch (action) | switch (action) | ||||
@@ -746,6 +746,7 @@ protected: | |||||
case ENGINE_CALLBACK_RELOAD_ALL: | case ENGINE_CALLBACK_RELOAD_ALL: | ||||
case ENGINE_CALLBACK_PLUGIN_ADDED: | case ENGINE_CALLBACK_PLUGIN_ADDED: | ||||
case ENGINE_CALLBACK_PLUGIN_RENAMED: | |||||
plugin = getPlugin(pluginId); | plugin = getPlugin(pluginId); | ||||
if (plugin != nullptr && plugin->isEnabled()) | if (plugin != nullptr && plugin->isEnabled()) | ||||
@@ -411,7 +411,7 @@ bool CarlaPlugin::getProgramName(const uint32_t index, char* const strBuf) const | |||||
CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count, false); | CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count, false); | ||||
CARLA_SAFE_ASSERT_RETURN(pData->prog.names[index] != nullptr, false); | CARLA_SAFE_ASSERT_RETURN(pData->prog.names[index] != nullptr, false); | ||||
std::strncpy(strBuf, pData->prog.names[index], STR_MAX); | std::strncpy(strBuf, pData->prog.names[index], STR_MAX); | ||||
return false; | |||||
return true; | |||||
} | } | ||||
bool CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept | bool CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) const noexcept | ||||
@@ -419,7 +419,7 @@ bool CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) c | |||||
CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count, false); | CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count, false); | ||||
CARLA_SAFE_ASSERT_RETURN(pData->midiprog.data[index].name != nullptr, false); | CARLA_SAFE_ASSERT_RETURN(pData->midiprog.data[index].name != nullptr, false); | ||||
std::strncpy(strBuf, pData->midiprog.data[index].name, STR_MAX); | std::strncpy(strBuf, pData->midiprog.data[index].name, STR_MAX); | ||||
return false; | |||||
return true; | |||||
} | } | ||||
void CarlaPlugin::getParameterCountInfo(uint32_t& ins, uint32_t& outs) const noexcept | void CarlaPlugin::getParameterCountInfo(uint32_t& ins, uint32_t& outs) const noexcept | ||||
@@ -2075,7 +2075,7 @@ public: | |||||
pData->prog.clear(); | pData->prog.clear(); | ||||
if (const uint32_t count = fShmNonRtServerControl.readUInt()) | if (const uint32_t count = fShmNonRtServerControl.readUInt()) | ||||
pData->prog.createNew(static_cast<uint32_t>(count)); | |||||
pData->prog.createNew(count); | |||||
} break; | } break; | ||||
@@ -2084,7 +2084,7 @@ public: | |||||
pData->midiprog.clear(); | pData->midiprog.clear(); | ||||
if (const uint32_t count = fShmNonRtServerControl.readUInt()) | if (const uint32_t count = fShmNonRtServerControl.readUInt()) | ||||
pData->midiprog.createNew(static_cast<uint32_t>(count)); | |||||
pData->midiprog.createNew(count); | |||||
} break; | } break; | ||||
@@ -324,7 +324,7 @@ public: | |||||
uint8_t* const dataCompat = (uint8_t*)std::malloc(dataSize + 160); | uint8_t* const dataCompat = (uint8_t*)std::malloc(dataSize + 160); | ||||
CARLA_SAFE_ASSERT_RETURN(dataCompat != nullptr,); | CARLA_SAFE_ASSERT_RETURN(dataCompat != nullptr,); | ||||
carla_stdout("NOTE: Loading plugin state in Carla compatibiity mode"); | |||||
carla_stdout("NOTE: Loading plugin state in Carla JUCE/VST2 compatibility mode"); | |||||
std::memset(dataCompat, 0, 160); | std::memset(dataCompat, 0, 160); | ||||
std::memcpy(dataCompat+160, data, dataSize); | std::memcpy(dataCompat+160, data, dataSize); | ||||
@@ -665,15 +665,17 @@ public: | |||||
pData->prog.clear(); | pData->prog.clear(); | ||||
// Query new programs | // Query new programs | ||||
uint32_t newCount = (fInstance->getNumPrograms() > 0) ? static_cast<uint32_t>(fInstance->getNumPrograms()) : 0; | |||||
const uint32_t newCount = (fInstance->getNumPrograms() > 0) | |||||
? static_cast<uint32_t>(fInstance->getNumPrograms()) | |||||
: 0; | |||||
if (newCount > 0) | if (newCount > 0) | ||||
{ | { | ||||
pData->prog.createNew(newCount); | pData->prog.createNew(newCount); | ||||
// Update names | // Update names | ||||
for (int i=0, count=fInstance->getNumPrograms(); i<count; ++i) | |||||
pData->prog.names[i] = carla_strdup(fInstance->getProgramName(i).toRawUTF8()); | |||||
for (uint32_t i=0; i < newCount; ++i) | |||||
pData->prog.names[i] = carla_strdup(fInstance->getProgramName(static_cast<int>(i)).toRawUTF8()); | |||||
} | } | ||||
if (doInit) | if (doInit) | ||||
@@ -988,11 +988,11 @@ public: | |||||
for (int32_t i=0; i < fEffect->numPrograms; ++i) | for (int32_t i=0; i < fEffect->numPrograms; ++i) | ||||
{ | { | ||||
char strBuf[STR_MAX+1] = { '\0' }; | char strBuf[STR_MAX+1] = { '\0' }; | ||||
if (dispatcher(effGetProgramNameIndexed, i, 0, strBuf, 0.0f) != 1) | |||||
if (dispatcher(effGetProgramNameIndexed, i, 0, strBuf) != 1) | |||||
{ | { | ||||
// program will be [re-]changed later | // program will be [re-]changed later | ||||
dispatcher(effSetProgram, 0, i, nullptr, 0.0f); | |||||
dispatcher(effGetProgramName, 0, 0, strBuf, 0.0f); | |||||
dispatcher(effSetProgram, 0, i); | |||||
dispatcher(effGetProgramName, 0, 0, strBuf); | |||||
} | } | ||||
pData->prog.names[i] = carla_strdup(strBuf); | pData->prog.names[i] = carla_strdup(strBuf); | ||||
} | } | ||||
@@ -1003,7 +1003,7 @@ public: | |||||
if (newCount > 0) | if (newCount > 0) | ||||
setProgram(0, false, false, false, true); | setProgram(0, false, false, false, true); | ||||
else | else | ||||
dispatcher(effSetProgram); | |||||
dispatcher(effSetProgram, 0, 0); | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
@@ -1048,7 +1048,7 @@ public: | |||||
{ | { | ||||
// Program was changed during update, re-set it | // Program was changed during update, re-set it | ||||
if (pData->prog.current >= 0) | if (pData->prog.current >= 0) | ||||
dispatcher(effSetProgram, 0, pData->prog.current, nullptr, 0.0f); | |||||
dispatcher(effSetProgram, 0, pData->prog.current); | |||||
} | } | ||||
pData->engine->callback(true, true, ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0f, nullptr); | pData->engine->callback(true, true, ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0f, nullptr); | ||||
@@ -2686,7 +2686,7 @@ private: | |||||
if (static_cast<std::size_t>(chunkSize + 160) > dataSize) | if (static_cast<std::size_t>(chunkSize + 160) > dataSize) | ||||
return false; | return false; | ||||
carla_stdout("NOTE: Loading plugin state in Juce compatibiity mode"); | |||||
carla_stdout("NOTE: Loading plugin state in VST2/JUCE compatibility mode"); | |||||
setChunkData(&set[40], static_cast<std::size_t>(chunkSize)); | setChunkData(&set[40], static_cast<std::size_t>(chunkSize)); | ||||
return true; | return true; | ||||
} | } | ||||