Browse Source

Fix plugins having wrong id when switched around in patchbay mode

Closes #1259

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.3.0-RC1
falkTX 4 years ago
parent
commit
83acd850a2
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 26 additions and 1 deletions
  1. +1
    -1
      source/backend/engine/CarlaEngine.cpp
  2. +23
    -0
      source/backend/engine/CarlaEngineGraph.cpp
  3. +1
    -0
      source/backend/engine/CarlaEngineGraph.hpp
  4. +1
    -0
      source/backend/engine/CarlaEngineInternal.hpp

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

@@ -992,7 +992,7 @@ bool CarlaEngine::switchPlugins(const uint idA, const uint idB) noexcept
const ScopedThreadStopper sts(this);

if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY)
pData->graph.replacePlugin(pluginA, pluginB);
pData->graph.switchPlugins(pluginA, pluginB);

const ScopedActionLock sal(this, kEnginePostActionSwitchPlugins, idA, idB);



+ 23
- 0
source/backend/engine/CarlaEngineGraph.cpp View File

@@ -1932,6 +1932,23 @@ void PatchbayGraph::renamePlugin(const CarlaPluginPtr plugin, const char* const
newName);
}

void PatchbayGraph::switchPlugins(CarlaPluginPtr pluginA, CarlaPluginPtr pluginB)
{
CARLA_SAFE_ASSERT_RETURN(pluginA.get() != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pluginB.get() != nullptr,);
CARLA_SAFE_ASSERT_RETURN(pluginA != pluginB,);
CARLA_SAFE_ASSERT_RETURN(pluginA->getId() != pluginB->getId(),);

AudioProcessorGraph::Node* const nodeA(graph.getNodeForId(pluginA->getPatchbayNodeId()));
CARLA_SAFE_ASSERT_RETURN(nodeA != nullptr,);

AudioProcessorGraph::Node* const nodeB(graph.getNodeForId(pluginB->getPatchbayNodeId()));
CARLA_SAFE_ASSERT_RETURN(nodeB != nullptr,);

nodeA->properties.set("pluginId", static_cast<int>(pluginB->getId()));
nodeB->properties.set("pluginId", static_cast<int>(pluginA->getId()));
}

void PatchbayGraph::reconfigureForCV(const CarlaPluginPtr plugin, const uint portIndex, bool added)
{
CARLA_SAFE_ASSERT_RETURN(plugin.get() != nullptr,);
@@ -2733,6 +2750,12 @@ void EngineInternalGraph::renamePlugin(const CarlaPluginPtr plugin, const char*
fPatchbay->renamePlugin(plugin, newName);
}

void EngineInternalGraph::switchPlugins(CarlaPluginPtr pluginA, CarlaPluginPtr pluginB)
{
CARLA_SAFE_ASSERT_RETURN(fPatchbay != nullptr,);
fPatchbay->switchPlugins(pluginA, pluginB);
}

void EngineInternalGraph::removePlugin(const CarlaPluginPtr plugin)
{
CARLA_SAFE_ASSERT_RETURN(fPatchbay != nullptr,);


+ 1
- 0
source/backend/engine/CarlaEngineGraph.hpp View File

@@ -193,6 +193,7 @@ public:
void addPlugin(CarlaPluginPtr plugin);
void replacePlugin(CarlaPluginPtr oldPlugin, CarlaPluginPtr newPlugin);
void renamePlugin(CarlaPluginPtr plugin, const char* newName);
void switchPlugins(CarlaPluginPtr pluginA, CarlaPluginPtr pluginB);
void reconfigureForCV(CarlaPluginPtr plugin, const uint portIndex, bool added);
void reconfigurePlugin(CarlaPluginPtr plugin, bool portsAdded);
void removePlugin(CarlaPluginPtr plugin);


+ 1
- 0
source/backend/engine/CarlaEngineInternal.hpp View File

@@ -115,6 +115,7 @@ public:
void addPlugin(CarlaPluginPtr plugin);
void replacePlugin(CarlaPluginPtr oldPlugin, CarlaPluginPtr newPlugin);
void renamePlugin(CarlaPluginPtr plugin, const char* newName);
void switchPlugins(CarlaPluginPtr pluginA, CarlaPluginPtr pluginB);
void removePlugin(CarlaPluginPtr plugin);
void removeAllPlugins();



Loading…
Cancel
Save