Browse Source

Skip graph CV source reconfigure when loading plugin state

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
18554a3692
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
10 changed files with 29 additions and 19 deletions
  1. +1
    -1
      source/backend/CarlaEngine.hpp
  2. +4
    -2
      source/backend/CarlaPlugin.hpp
  3. +1
    -1
      source/backend/CarlaStandalone.cpp
  4. +1
    -1
      source/backend/engine/CarlaEngineBridge.cpp
  5. +3
    -3
      source/backend/engine/CarlaEngineJack.cpp
  6. +1
    -1
      source/backend/engine/CarlaEngineNative.cpp
  7. +1
    -1
      source/backend/engine/CarlaEngineOscHandlers.cpp
  8. +5
    -3
      source/backend/engine/CarlaEnginePorts.cpp
  9. +8
    -4
      source/backend/plugin/CarlaPlugin.cpp
  10. +4
    -2
      source/backend/plugin/CarlaPluginBridge.cpp

+ 1
- 1
source/backend/CarlaEngine.hpp View File

@@ -642,7 +642,7 @@ public:
/*!
* Add a CV port as a source of events.
*/
virtual bool addCVSource(CarlaEngineCVPort* port, uint32_t portIndexOffset);
virtual bool addCVSource(CarlaEngineCVPort* port, uint32_t portIndexOffset, bool reconfigureNow);

/*!
* Remove a CV port as a source of events.


+ 4
- 2
source/backend/CarlaPlugin.hpp View File

@@ -603,12 +603,14 @@ public:
* Set parameter's @a parameterId mapped control index to @a index.
* @see ParameterData::mappedControlIndex
*/
virtual void setParameterMappedControlIndex(uint32_t parameterId, int16_t index, bool sendOsc, bool sendCallback) noexcept;
virtual void setParameterMappedControlIndex(uint32_t parameterId, int16_t index,
bool sendOsc, bool sendCallback, bool reconfigureNow) noexcept;

/*!
* Set parameter's @a parameterId mapped range to @a minimum and @a maximum.
*/
virtual void setParameterMappedRange(uint32_t parameterId, float minimum, float maximum, bool sendOsc, bool sendCallback) noexcept;
virtual void setParameterMappedRange(uint32_t parameterId, float minimum, float maximum,
bool sendOsc, bool sendCallback) noexcept;

/*!
* Add a custom data set.


+ 1
- 1
source/backend/CarlaStandalone.cpp View File

@@ -2032,7 +2032,7 @@ void carla_set_parameter_mapped_control_index(CarlaHostHandle handle, uint plugi
{
CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(),);

plugin->setParameterMappedControlIndex(parameterId, index, true, false);
plugin->setParameterMappedControlIndex(parameterId, index, true, false, true);
}
}



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

@@ -828,7 +828,7 @@ public:
const int16_t ctrl(fShmNonRtClientControl.readShort());

if (plugin->isEnabled())
plugin->setParameterMappedControlIndex(index, ctrl, false, false);
plugin->setParameterMappedControlIndex(index, ctrl, false, false, true);
break;
}



+ 3
- 3
source/backend/engine/CarlaEngineJack.cpp View File

@@ -625,14 +625,14 @@ public:
}
}

bool addCVSource(CarlaEngineCVPort* const port, const uint32_t portIndexOffset) override
bool addCVSource(CarlaEngineCVPort* const port, const uint32_t portIndexOffset, const bool reconfigureNow) override
{
if (! fUseClient)
return CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset);
return CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset, reconfigureNow);

const CarlaRecursiveMutexLocker crml(pData->rmutex);

if (! CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset))
if (! CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset, reconfigureNow))
return false;

if (pData->cvs.size() == 1 && fBuffer == nullptr)


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

@@ -2150,7 +2150,7 @@ bool CarlaEngineNativeUI::msgReceived(const char* const msg) noexcept
CARLA_SAFE_ASSERT_RETURN(ctrl >= CONTROL_INDEX_NONE && ctrl <= CONTROL_INDEX_MAX_ALLOWED, true);

if (const CarlaPluginPtr plugin = fEngine->getPlugin(pluginId))
plugin->setParameterMappedControlIndex(parameterId, static_cast<int16_t>(ctrl), true, false);
plugin->setParameterMappedControlIndex(parameterId, static_cast<int16_t>(ctrl), true, false, true);
}
else if (std::strcmp(msg, "set_parameter_mapped_range") == 0)
{


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

@@ -662,7 +662,7 @@ int CarlaEngineOsc::handleMsgSetParameterMappedControlIndex(CARLA_ENGINE_OSC_HAN
CARLA_SAFE_ASSERT_RETURN(index >= 0, 0);
CARLA_SAFE_ASSERT_RETURN(ctrl >= CONTROL_INDEX_NONE && ctrl <= CONTROL_INDEX_MAX_ALLOWED, 0);

plugin->setParameterMappedControlIndex(static_cast<uint32_t>(index), static_cast<int16_t>(ctrl), false, true);
plugin->setParameterMappedControlIndex(static_cast<uint32_t>(index), static_cast<int16_t>(ctrl), false, true, true);
return 0;
}



+ 5
- 3
source/backend/engine/CarlaEnginePorts.cpp View File

@@ -342,11 +342,13 @@ CarlaEngineCVSourcePorts::~CarlaEngineCVSourcePorts()
delete pData;
}

bool CarlaEngineCVSourcePorts::addCVSource(CarlaEngineCVPort* const port, const uint32_t portIndexOffset)
bool CarlaEngineCVSourcePorts::addCVSource(CarlaEngineCVPort* const port,
const uint32_t portIndexOffset,
const bool reconfigureNow)
{
CARLA_SAFE_ASSERT_RETURN(port != nullptr, false);
CARLA_SAFE_ASSERT_RETURN(port->isInput(), false);
carla_debug("CarlaEngineCVSourcePorts::addCVSource(%p)", port);
carla_debug("CarlaEngineCVSourcePorts::addCVSource(%p, %u)", port, portIndexOffset);

{
const CarlaRecursiveMutexLocker crml(pData->rmutex);
@@ -355,7 +357,7 @@ bool CarlaEngineCVSourcePorts::addCVSource(CarlaEngineCVPort* const port, const
if (! pData->cvs.add(ecv))
return false;

if (pData->graph != nullptr && pData->plugin.get() != nullptr)
if (reconfigureNow && pData->graph != nullptr && pData->plugin.get() != nullptr)
pData->graph->reconfigureForCV(pData->plugin, static_cast<uint>(pData->cvs.size()-1), true);
}



+ 8
- 4
source/backend/plugin/CarlaPlugin.cpp View File

@@ -847,7 +847,8 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave)
stateParameter->mappedMaximum, true, true);
}

setParameterMappedControlIndex(static_cast<uint32_t>(index), stateParameter->mappedControlIndex, true, true);
setParameterMappedControlIndex(static_cast<uint32_t>(index),
stateParameter->mappedControlIndex, true, true, false);
setParameterMidiChannel(static_cast<uint32_t>(index), stateParameter->midiChannel, true, true);
#endif
}
@@ -1721,7 +1722,9 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, const uint
#endif
}

void CarlaPlugin::setParameterMappedControlIndex(const uint32_t parameterId, const int16_t index, const bool sendOsc, const bool sendCallback) noexcept
void CarlaPlugin::setParameterMappedControlIndex(const uint32_t parameterId, const int16_t index,
const bool sendOsc, const bool sendCallback,
const bool reconfigureNow) noexcept
{
if (pData->engineBridged) {
CARLA_SAFE_ASSERT_RETURN(!sendOsc && !sendCallback,);
@@ -1760,7 +1763,7 @@ void CarlaPlugin::setParameterMappedControlIndex(const uint32_t parameterId, con
CarlaEngineCVPort* const cvPort =
(CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, strBuf, true, parameterId);
cvPort->setRange(paramData.mappedMinimum, paramData.mappedMaximum);
pData->event.cvSourcePorts->addCVSource(cvPort, parameterId);
pData->event.cvSourcePorts->addCVSource(cvPort, parameterId, reconfigureNow);
}
else if (paramData.mappedControlIndex == CONTROL_INDEX_CV)
{
@@ -1792,7 +1795,8 @@ void CarlaPlugin::setParameterMappedControlIndex(const uint32_t parameterId, con
#endif
}

void CarlaPlugin::setParameterMappedRange(const uint32_t parameterId, const float minimum, const float maximum, const bool sendOsc, const bool sendCallback) noexcept
void CarlaPlugin::setParameterMappedRange(const uint32_t parameterId, const float minimum, const float maximum,
const bool sendOsc, const bool sendCallback) noexcept
{
if (pData->engineBridged) {
CARLA_SAFE_ASSERT_RETURN(!sendOsc && !sendCallback,);


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

@@ -770,7 +770,9 @@ public:
CarlaPlugin::setParameterMidiChannel(parameterId, channel, sendOsc, sendCallback);
}

void setParameterMappedControlIndex(const uint32_t parameterId, const int16_t index, const bool sendOsc, const bool sendCallback) noexcept override
void setParameterMappedControlIndex(const uint32_t parameterId, const int16_t index,
const bool sendOsc, const bool sendCallback,
const bool reconfigureNow) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
CARLA_SAFE_ASSERT_RETURN(index >= CONTROL_INDEX_NONE && index <= CONTROL_INDEX_MAX_ALLOWED,);
@@ -785,7 +787,7 @@ public:
fShmNonRtClientControl.commitWrite();
}

CarlaPlugin::setParameterMappedControlIndex(parameterId, index, sendOsc, sendCallback);
CarlaPlugin::setParameterMappedControlIndex(parameterId, index, sendOsc, sendCallback, reconfigureNow);
}

void setParameterMappedRange(const uint32_t parameterId, const float minimum, const float maximum, const bool sendOsc, const bool sendCallback) noexcept override


Loading…
Cancel
Save