Signed-off-by: falkTX <falktx@falktx.com>tags/v2.2.0-RC1
@@ -642,7 +642,7 @@ public: | |||||
/*! | /*! | ||||
* Add a CV port as a source of events. | * 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. | * Remove a CV port as a source of events. | ||||
@@ -603,12 +603,14 @@ public: | |||||
* Set parameter's @a parameterId mapped control index to @a index. | * Set parameter's @a parameterId mapped control index to @a index. | ||||
* @see ParameterData::mappedControlIndex | * @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. | * 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. | * Add a custom data set. | ||||
@@ -2032,7 +2032,7 @@ void carla_set_parameter_mapped_control_index(CarlaHostHandle handle, uint plugi | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(),); | CARLA_SAFE_ASSERT_RETURN(parameterId < plugin->getParameterCount(),); | ||||
plugin->setParameterMappedControlIndex(parameterId, index, true, false); | |||||
plugin->setParameterMappedControlIndex(parameterId, index, true, false, true); | |||||
} | } | ||||
} | } | ||||
@@ -828,7 +828,7 @@ public: | |||||
const int16_t ctrl(fShmNonRtClientControl.readShort()); | const int16_t ctrl(fShmNonRtClientControl.readShort()); | ||||
if (plugin->isEnabled()) | if (plugin->isEnabled()) | ||||
plugin->setParameterMappedControlIndex(index, ctrl, false, false); | |||||
plugin->setParameterMappedControlIndex(index, ctrl, false, false, true); | |||||
break; | break; | ||||
} | } | ||||
@@ -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) | if (! fUseClient) | ||||
return CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset); | |||||
return CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset, reconfigureNow); | |||||
const CarlaRecursiveMutexLocker crml(pData->rmutex); | const CarlaRecursiveMutexLocker crml(pData->rmutex); | ||||
if (! CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset)) | |||||
if (! CarlaEngineCVSourcePorts::addCVSource(port, portIndexOffset, reconfigureNow)) | |||||
return false; | return false; | ||||
if (pData->cvs.size() == 1 && fBuffer == nullptr) | if (pData->cvs.size() == 1 && fBuffer == nullptr) | ||||
@@ -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); | CARLA_SAFE_ASSERT_RETURN(ctrl >= CONTROL_INDEX_NONE && ctrl <= CONTROL_INDEX_MAX_ALLOWED, true); | ||||
if (const CarlaPluginPtr plugin = fEngine->getPlugin(pluginId)) | 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) | else if (std::strcmp(msg, "set_parameter_mapped_range") == 0) | ||||
{ | { | ||||
@@ -662,7 +662,7 @@ int CarlaEngineOsc::handleMsgSetParameterMappedControlIndex(CARLA_ENGINE_OSC_HAN | |||||
CARLA_SAFE_ASSERT_RETURN(index >= 0, 0); | CARLA_SAFE_ASSERT_RETURN(index >= 0, 0); | ||||
CARLA_SAFE_ASSERT_RETURN(ctrl >= CONTROL_INDEX_NONE && ctrl <= CONTROL_INDEX_MAX_ALLOWED, 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; | return 0; | ||||
} | } | ||||
@@ -342,11 +342,13 @@ CarlaEngineCVSourcePorts::~CarlaEngineCVSourcePorts() | |||||
delete pData; | 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 != nullptr, false); | ||||
CARLA_SAFE_ASSERT_RETURN(port->isInput(), 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); | const CarlaRecursiveMutexLocker crml(pData->rmutex); | ||||
@@ -355,7 +357,7 @@ bool CarlaEngineCVSourcePorts::addCVSource(CarlaEngineCVPort* const port, const | |||||
if (! pData->cvs.add(ecv)) | if (! pData->cvs.add(ecv)) | ||||
return false; | 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); | pData->graph->reconfigureForCV(pData->plugin, static_cast<uint>(pData->cvs.size()-1), true); | ||||
} | } | ||||
@@ -847,7 +847,8 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) | |||||
stateParameter->mappedMaximum, true, true); | 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); | setParameterMidiChannel(static_cast<uint32_t>(index), stateParameter->midiChannel, true, true); | ||||
#endif | #endif | ||||
} | } | ||||
@@ -1721,7 +1722,9 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, const uint | |||||
#endif | #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) { | if (pData->engineBridged) { | ||||
CARLA_SAFE_ASSERT_RETURN(!sendOsc && !sendCallback,); | CARLA_SAFE_ASSERT_RETURN(!sendOsc && !sendCallback,); | ||||
@@ -1760,7 +1763,7 @@ void CarlaPlugin::setParameterMappedControlIndex(const uint32_t parameterId, con | |||||
CarlaEngineCVPort* const cvPort = | CarlaEngineCVPort* const cvPort = | ||||
(CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, strBuf, true, parameterId); | (CarlaEngineCVPort*)pData->client->addPort(kEnginePortTypeCV, strBuf, true, parameterId); | ||||
cvPort->setRange(paramData.mappedMinimum, paramData.mappedMaximum); | 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) | else if (paramData.mappedControlIndex == CONTROL_INDEX_CV) | ||||
{ | { | ||||
@@ -1792,7 +1795,8 @@ void CarlaPlugin::setParameterMappedControlIndex(const uint32_t parameterId, con | |||||
#endif | #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) { | if (pData->engineBridged) { | ||||
CARLA_SAFE_ASSERT_RETURN(!sendOsc && !sendCallback,); | CARLA_SAFE_ASSERT_RETURN(!sendOsc && !sendCallback,); | ||||
@@ -770,7 +770,9 @@ public: | |||||
CarlaPlugin::setParameterMidiChannel(parameterId, channel, sendOsc, sendCallback); | 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(parameterId < pData->param.count,); | ||||
CARLA_SAFE_ASSERT_RETURN(index >= CONTROL_INDEX_NONE && index <= CONTROL_INDEX_MAX_ALLOWED,); | CARLA_SAFE_ASSERT_RETURN(index >= CONTROL_INDEX_NONE && index <= CONTROL_INDEX_MAX_ALLOWED,); | ||||
@@ -785,7 +787,7 @@ public: | |||||
fShmNonRtClientControl.commitWrite(); | 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 | void setParameterMappedRange(const uint32_t parameterId, const float minimum, const float maximum, const bool sendOsc, const bool sendCallback) noexcept override | ||||