Browse Source

Disable bridge ping checks when loading state, add some debug prints

tags/1.9.6
falkTX 9 years ago
parent
commit
18b79346e4
3 changed files with 44 additions and 7 deletions
  1. +25
    -1
      source/backend/engine/CarlaEngine.cpp
  2. +7
    -0
      source/backend/engine/CarlaEngineBridge.cpp
  3. +12
    -6
      source/backend/plugin/CarlaPluginBridge.cpp

+ 25
- 1
source/backend/engine/CarlaEngine.cpp View File

@@ -1525,7 +1525,14 @@ void CarlaEngine::saveProjectInternal(juce::MemoryOutputStream& outStream) const
CarlaPlugin* const plugin(pData->plugins[i].plugin);

if (plugin != nullptr && plugin->isEnabled())
{
#ifndef BUILD_BRIDGE
// deactivate bridge client-side ping check, since some plugins block during save
if (plugin->getHints() & PLUGIN_IS_BRIDGE)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "false", false);
#endif
plugin->prepareForSave();
}
}

outStream << "<?xml version='1.0' encoding='UTF-8'?>\n";
@@ -1599,7 +1606,7 @@ void CarlaEngine::saveProjectInternal(juce::MemoryOutputStream& outStream) const
CarlaPlugin* const plugin(pData->plugins[i].plugin);

if (plugin != nullptr && plugin->isEnabled() && (plugin->getHints() & PLUGIN_IS_BRIDGE) != 0)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "SavedComplete", "", false);
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false);
}

bool saveConnections = true;
@@ -1817,7 +1824,15 @@ bool CarlaEngine::loadProjectInternal(juce::XmlDocument& xmlDoc)
if (addPlugin(btype, ptype, stateSave.binary, stateSave.name, stateSave.label, stateSave.uniqueId, extraStuff))
{
if (CarlaPlugin* const plugin = getPlugin(pData->curPluginCount-1))
{
#ifndef BUILD_BRIDGE
// deactivate bridge client-side ping check, since some plugins block during load
if ((plugin->getHints() & PLUGIN_IS_BRIDGE) != 0 && ! isPreset)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "false", false);
#endif

plugin->loadStateSave(stateSave);
}
}
else
carla_stderr2("Failed to load a plugin, error was:\n%s", getLastError());
@@ -1828,6 +1843,15 @@ bool CarlaEngine::loadProjectInternal(juce::XmlDocument& xmlDoc)
}

#ifndef BUILD_BRIDGE
// tell bridges we're done loading
for (uint i=0; i < pData->curPluginCount; ++i)
{
CarlaPlugin* const plugin(pData->plugins[i].plugin);

if (plugin != nullptr && plugin->isEnabled() && (plugin->getHints() & PLUGIN_IS_BRIDGE) != 0)
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false);
}

callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr);

// if we're running inside some session-manager, let them handle the connections


+ 7
- 0
source/backend/engine/CarlaEngineBridge.cpp View File

@@ -904,6 +904,8 @@ public:
const uint32_t onOff(fShmNonRtClientControl.readBool());

fLastPingTime = onOff ? Time::currentTimeMillis() : -1;

carla_stdout("Carla bridge client side, OnOff ping checks => %s", bool2str(onOff));
} break;

case kPluginBridgeNonRtClientActivate:
@@ -1018,6 +1020,8 @@ public:
CARLA_SAFE_ASSERT_BREAK(chunkFilePathTry[0] != '\0');
if (plugin == nullptr || ! plugin->isEnabled()) break;

carla_stdout("Carla bridge client side setChunkData 001");

String chunkFilePath(chunkFilePathTry);

#ifdef CARLA_OS_WIN
@@ -1034,7 +1038,10 @@ public:
CARLA_SAFE_ASSERT_BREAK(chunkDataBase64.isNotEmpty());

std::vector<uint8_t> chunk(carla_getChunkFromBase64String(chunkDataBase64.toRawUTF8()));
carla_stdout("Carla bridge client side setChunkData 002");

plugin->setChunkData(chunk.data(), chunk.size());
carla_stdout("Carla bridge client side setChunkData done");
break;
}



+ 12
- 6
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -923,10 +923,6 @@ public:
{
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex);

fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientPingOnOff);
fShmNonRtClientControl.writeBool(false);
fShmNonRtClientControl.commitWrite();

fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientPrepareForSave);
fShmNonRtClientControl.commitWrite();
}
@@ -1089,13 +1085,15 @@ public:
CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',);
CARLA_SAFE_ASSERT_RETURN(value != nullptr,);

if (std::strcmp(type, CUSTOM_DATA_TYPE_STRING) == 0 && std::strcmp(key, "SavedComplete") == 0)
if (std::strcmp(type, CUSTOM_DATA_TYPE_STRING) == 0 && std::strcmp(key, "__CarlaPingOnOff__") == 0)
{
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex);

fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientPingOnOff);
fShmNonRtClientControl.writeBool(true);
fShmNonRtClientControl.writeBool(std::strcmp(value, "true") == 0);
fShmNonRtClientControl.commitWrite();

carla_stdout("Carla bridge server side, OnOff ping checks => %s", value);
return;
}

@@ -1129,6 +1127,8 @@ public:
CARLA_SAFE_ASSERT_RETURN(data != nullptr,);
CARLA_SAFE_ASSERT_RETURN(dataSize > 0,);

carla_stdout("Carla bridge server side, setChunkData 001");

CarlaString dataBase64(CarlaString::asBase64(data, dataSize));
CARLA_SAFE_ASSERT_RETURN(dataBase64.length() > 0,);

@@ -1139,6 +1139,8 @@ public:

if (File(filePath).replaceWithText(dataBase64.buffer()))
{
carla_stdout("Carla bridge server side, setChunkData 002");

const uint32_t ulength(static_cast<uint32_t>(filePath.length()));

const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex);
@@ -1147,11 +1149,15 @@ public:
fShmNonRtClientControl.writeUInt(ulength);
fShmNonRtClientControl.writeCustomData(filePath.toRawUTF8(), ulength);
fShmNonRtClientControl.commitWrite();

carla_stdout("Carla bridge server side, setChunkData sent");
}

// save data internally as well
fInfo.chunk.resize(dataSize);
std::memcpy(fInfo.chunk.data(), data, dataSize);

carla_stdout("Carla bridge server side, setChunkData saved locally too");
}

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


Loading…
Cancel
Save