Browse Source

Fix empty program names in some cases; Fix null program on bridge load

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.1-rc1
falkTX 4 years ago
parent
commit
ddff565c71
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
6 changed files with 22 additions and 16 deletions
  1. +5
    -2
      source/backend/engine/CarlaEngineBridge.cpp
  2. +1
    -0
      source/backend/engine/CarlaEngineNative.cpp
  3. +2
    -2
      source/backend/plugin/CarlaPlugin.cpp
  4. +2
    -2
      source/backend/plugin/CarlaPluginBridge.cpp
  5. +6
    -4
      source/backend/plugin/CarlaPluginJuce.cpp
  6. +6
    -6
      source/backend/plugin/CarlaPluginVST2.cpp

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

@@ -299,6 +299,9 @@ public:
return new CarlaEngineBridgeClient(*this, pData->graph, plugin, this);
#else
return new CarlaEngineBridgeClient(*this, this);

// unused
(void)plugin;
#endif
}

@@ -549,7 +552,7 @@ public:
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerProgramName);
fShmNonRtServerControl.writeUInt(i);

if (plugin->getProgramName(i, bufStr))
if (! plugin->getProgramName(i, bufStr))
bufStr[0] = '\0';
bufStrSize = carla_fixedValue(1U, 32U, static_cast<uint32_t>(std::strlen(bufStr)));
fShmNonRtServerControl.writeUInt(bufStrSize);
@@ -645,7 +648,7 @@ public:
{
CarlaEngine::callback(sendHost, sendOsc, action, pluginId, value1, value2, value3, valuef, valueStr);

if (fClosingDown)
if (fClosingDown || ! sendHost)
return;

switch (action)


+ 1
- 0
source/backend/engine/CarlaEngineNative.cpp View File

@@ -746,6 +746,7 @@ protected:

case ENGINE_CALLBACK_RELOAD_ALL:
case ENGINE_CALLBACK_PLUGIN_ADDED:
case ENGINE_CALLBACK_PLUGIN_RENAMED:
plugin = getPlugin(pluginId);

if (plugin != nullptr && plugin->isEnabled())


+ 2
- 2
source/backend/plugin/CarlaPlugin.cpp View File

@@ -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(pData->prog.names[index] != nullptr, false);
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
@@ -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(pData->midiprog.data[index].name != nullptr, false);
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


+ 2
- 2
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -2075,7 +2075,7 @@ public:
pData->prog.clear();

if (const uint32_t count = fShmNonRtServerControl.readUInt())
pData->prog.createNew(static_cast<uint32_t>(count));
pData->prog.createNew(count);

} break;

@@ -2084,7 +2084,7 @@ public:
pData->midiprog.clear();

if (const uint32_t count = fShmNonRtServerControl.readUInt())
pData->midiprog.createNew(static_cast<uint32_t>(count));
pData->midiprog.createNew(count);

} break;



+ 6
- 4
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -324,7 +324,7 @@ public:
uint8_t* const dataCompat = (uint8_t*)std::malloc(dataSize + 160);
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::memcpy(dataCompat+160, data, dataSize);

@@ -665,15 +665,17 @@ public:
pData->prog.clear();

// 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)
{
pData->prog.createNew(newCount);

// 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)


+ 6
- 6
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -988,11 +988,11 @@ public:
for (int32_t i=0; i < fEffect->numPrograms; ++i)
{
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
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);
}
@@ -1003,7 +1003,7 @@ public:
if (newCount > 0)
setProgram(0, false, false, false, true);
else
dispatcher(effSetProgram);
dispatcher(effSetProgram, 0, 0);
}
else
{
@@ -1048,7 +1048,7 @@ public:
{
// Program was changed during update, re-set it
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);
@@ -2686,7 +2686,7 @@ private:
if (static_cast<std::size_t>(chunkSize + 160) > dataSize)
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));
return true;
}


Loading…
Cancel
Save