Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-alpha2
@@ -990,7 +990,7 @@ public: | |||||
*/ | */ | ||||
virtual void callback(const EngineCallbackOpcode action, const uint pluginId, | virtual void callback(const EngineCallbackOpcode action, const uint pluginId, | ||||
const int value1, const int value2, const int value3, | const int value1, const int value2, const int value3, | ||||
const float valueF, const char* const valueStr) noexcept; | |||||
const float valuef, const char* const valueStr) noexcept; | |||||
/*! | /*! | ||||
* Set the main engine callback to @a func. | * Set the main engine callback to @a func. | ||||
@@ -1308,15 +1308,15 @@ float CarlaEngine::getOutputPeak(const uint pluginId, const bool isLeft) const n | |||||
void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginId, | void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginId, | ||||
const int value1, const int value2, const int value3, | const int value1, const int value2, const int value3, | ||||
const float valueF, const char* const valueStr) noexcept | |||||
const float valuef, const char* const valueStr) noexcept | |||||
{ | { | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (pData->isIdling) | if (pData->isIdling) | ||||
carla_stdout("CarlaEngine::callback [while idling] (%i:%s, %i, %i, %i, %i, %f, \"%s\")", | carla_stdout("CarlaEngine::callback [while idling] (%i:%s, %i, %i, %i, %i, %f, \"%s\")", | ||||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueF, valueStr); | |||||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valuef, valueStr); | |||||
else if (action != ENGINE_CALLBACK_IDLE && action != ENGINE_CALLBACK_NOTE_ON && action != ENGINE_CALLBACK_NOTE_OFF) | else if (action != ENGINE_CALLBACK_IDLE && action != ENGINE_CALLBACK_NOTE_ON && action != ENGINE_CALLBACK_NOTE_OFF) | ||||
carla_debug("CarlaEngine::callback(%i:%s, %i, %i, %i, %i, %f, \"%s\")", | carla_debug("CarlaEngine::callback(%i:%s, %i, %i, %i, %i, %f, \"%s\")", | ||||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueF, valueStr); | |||||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valuef, valueStr); | |||||
#endif | #endif | ||||
if (pData->callback != nullptr) | if (pData->callback != nullptr) | ||||
@@ -1325,7 +1325,7 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI | |||||
++pData->isIdling; | ++pData->isIdling; | ||||
try { | try { | ||||
pData->callback(pData->callbackPtr, action, pluginId, value1, value2, value3, valueF, valueStr); | |||||
pData->callback(pData->callbackPtr, action, pluginId, value1, value2, value3, valuef, valueStr); | |||||
#if defined(CARLA_OS_LINUX) && defined(__arm__) | #if defined(CARLA_OS_LINUX) && defined(__arm__) | ||||
} catch (__cxxabiv1::__forced_unwind&) { | } catch (__cxxabiv1::__forced_unwind&) { | ||||
carla_stderr2("Caught forced unwind exception in callback"); | carla_stderr2("Caught forced unwind exception in callback"); | ||||
@@ -582,9 +582,9 @@ public: | |||||
void callback(const EngineCallbackOpcode action, const uint pluginId, | void callback(const EngineCallbackOpcode action, const uint pluginId, | ||||
const int value1, const int value2, const int value3, | const int value1, const int value2, const int value3, | ||||
const float valueF, const char* const valueStr) noexcept override | |||||
const float valuef, const char* const valueStr) noexcept override | |||||
{ | { | ||||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valuef, valueStr); | |||||
if (fClosingDown) | if (fClosingDown) | ||||
return; | return; | ||||
@@ -597,7 +597,7 @@ public: | |||||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | ||||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterValue); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterValue); | ||||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | ||||
fShmNonRtServerControl.writeFloat(valueF); | |||||
fShmNonRtServerControl.writeFloat(valuef); | |||||
fShmNonRtServerControl.commitWrite(); | fShmNonRtServerControl.commitWrite(); | ||||
} break; | } break; | ||||
@@ -607,7 +607,7 @@ public: | |||||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | ||||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerDefaultValue); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerDefaultValue); | ||||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | ||||
fShmNonRtServerControl.writeFloat(valueF); | |||||
fShmNonRtServerControl.writeFloat(valuef); | |||||
fShmNonRtServerControl.commitWrite(); | fShmNonRtServerControl.commitWrite(); | ||||
} break; | } break; | ||||
@@ -810,9 +810,9 @@ protected: | |||||
void callback(const EngineCallbackOpcode action, const uint pluginId, | void callback(const EngineCallbackOpcode action, const uint pluginId, | ||||
const int value1, const int value2, const int value3, | const int value1, const int value2, const int value3, | ||||
const float valueF, const char* const valueStr) noexcept override | |||||
const float valuef, const char* const valueStr) noexcept override | |||||
{ | { | ||||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valuef, valueStr); | |||||
if (action == ENGINE_CALLBACK_IDLE && ! pData->aboutToClose) { | if (action == ENGINE_CALLBACK_IDLE && ! pData->aboutToClose) { | ||||
pHost->dispatcher(pHost->handle, | pHost->dispatcher(pHost->handle, | ||||
@@ -1138,7 +1138,7 @@ protected: | |||||
void uiServerCallback(const EngineCallbackOpcode action, const uint pluginId, | void uiServerCallback(const EngineCallbackOpcode action, const uint pluginId, | ||||
const int value1, const int value2, const int value3, | const int value1, const int value2, const int value3, | ||||
const float valueF, const char* const valueStr) | |||||
const float valuef, const char* const valueStr) | |||||
{ | { | ||||
if (! fIsRunning) | if (! fIsRunning) | ||||
return; | return; | ||||
@@ -1229,7 +1229,7 @@ protected: | |||||
return; | return; | ||||
{ | { | ||||
const CarlaScopedLocale csl; | const CarlaScopedLocale csl; | ||||
std::sprintf(tmpBuf, "%f\n", static_cast<double>(valueF)); | |||||
std::sprintf(tmpBuf, "%f\n", static_cast<double>(valuef)); | |||||
} | } | ||||
if (! fUiServer.writeMessage(tmpBuf)) | if (! fUiServer.writeMessage(tmpBuf)) | ||||
return; | return; | ||||
@@ -2121,9 +2121,9 @@ public: | |||||
static void _ui_server_callback(void* handle, EngineCallbackOpcode action, uint pluginId, | static void _ui_server_callback(void* handle, EngineCallbackOpcode action, uint pluginId, | ||||
int value1, int value2, int value3, | int value1, int value2, int value3, | ||||
float valueF, const char* valueStr) | |||||
float valuef, const char* valueStr) | |||||
{ | { | ||||
handlePtr->uiServerCallback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||||
handlePtr->uiServerCallback(action, pluginId, value1, value2, value3, valuef, valueStr); | |||||
} | } | ||||
static const char* _ui_file_callback(void* handle, FileCallbackOpcode action, bool isDir, | static const char* _ui_file_callback(void* handle, FileCallbackOpcode action, bool isDir, | ||||
@@ -1524,7 +1524,7 @@ void CarlaPlugin::setDryWetRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.dryWet = fixedValue; | pData->postProc.dryWet = fixedValue; | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 1, 0, fixedValue); | |||||
} | } | ||||
void CarlaPlugin::setVolumeRT(const float value) noexcept | void CarlaPlugin::setVolumeRT(const float value) noexcept | ||||
@@ -1537,7 +1537,7 @@ void CarlaPlugin::setVolumeRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.volume = fixedValue; | pData->postProc.volume = fixedValue; | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 1, 0, fixedValue); | |||||
} | } | ||||
void CarlaPlugin::setBalanceLeftRT(const float value) noexcept | void CarlaPlugin::setBalanceLeftRT(const float value) noexcept | ||||
@@ -1550,7 +1550,7 @@ void CarlaPlugin::setBalanceLeftRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.balanceLeft = fixedValue; | pData->postProc.balanceLeft = fixedValue; | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 1, 0, fixedValue); | |||||
} | } | ||||
void CarlaPlugin::setBalanceRightRT(const float value) noexcept | void CarlaPlugin::setBalanceRightRT(const float value) noexcept | ||||
@@ -1563,7 +1563,7 @@ void CarlaPlugin::setBalanceRightRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.balanceRight = fixedValue; | pData->postProc.balanceRight = fixedValue; | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 1, 0, fixedValue); | |||||
} | } | ||||
void CarlaPlugin::setPanningRT(const float value) noexcept | void CarlaPlugin::setPanningRT(const float value) noexcept | ||||
@@ -1647,7 +1647,7 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu | |||||
void CarlaPlugin::setParameterValueRT(const uint32_t parameterId, const float value) noexcept | void CarlaPlugin::setParameterValueRT(const uint32_t parameterId, const float value) noexcept | ||||
{ | { | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(parameterId), 0, 0, value); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(parameterId), 1, 0, value); | |||||
} | } | ||||
void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept | void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept | ||||
@@ -2002,10 +2002,7 @@ void CarlaPlugin::idle() | |||||
case kPluginPostRtEventDebug: { | case kPluginPostRtEventDebug: { | ||||
pData->engine->callback(ENGINE_CALLBACK_DEBUG, pData->id, | pData->engine->callback(ENGINE_CALLBACK_DEBUG, pData->id, | ||||
event.value1, event.value2, | |||||
0, | |||||
event.valueF, | |||||
nullptr); | |||||
event.value1, event.value2, event.value3, event.valuef, nullptr); | |||||
} break; | } break; | ||||
case kPluginPostRtEventParameterChange: { | case kPluginPostRtEventParameterChange: { | ||||
@@ -2015,22 +2012,22 @@ void CarlaPlugin::idle() | |||||
if (needsUiMainThread) | if (needsUiMainThread) | ||||
pData->postUiEvents.append(event); | pData->postUiEvents.append(event); | ||||
else | else | ||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valueF); | |||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valuef); | |||||
} | } | ||||
if (event.value2 != 1) | |||||
if (event.value2 != 0) | |||||
{ | { | ||||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | #if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | ||||
// Update OSC control client | // Update OSC control client | ||||
if (sendOsc) | if (sendOsc) | ||||
pData->engine->oscSend_control_set_parameter_value(pData->id, event.value1, event.valueF); | |||||
pData->engine->oscSend_control_set_parameter_value(pData->id, event.value1, event.valuef); | |||||
#endif | #endif | ||||
// Update Host | // Update Host | ||||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | ||||
pData->id, | pData->id, | ||||
event.value1, | event.value1, | ||||
0, 0, | 0, 0, | ||||
event.valueF, | |||||
event.valuef, | |||||
nullptr); | nullptr); | ||||
} | } | ||||
} break; | } break; | ||||
@@ -2138,11 +2135,11 @@ void CarlaPlugin::idle() | |||||
case kPluginPostRtEventNoteOn: { | case kPluginPostRtEventNoteOn: { | ||||
CARLA_SAFE_ASSERT_BREAK(event.value1 >= 0 && event.value1 < MAX_MIDI_CHANNELS); | CARLA_SAFE_ASSERT_BREAK(event.value1 >= 0 && event.value1 < MAX_MIDI_CHANNELS); | ||||
CARLA_SAFE_ASSERT_BREAK(event.value2 >= 0 && event.value2 < MAX_MIDI_NOTE); | CARLA_SAFE_ASSERT_BREAK(event.value2 >= 0 && event.value2 < MAX_MIDI_NOTE); | ||||
CARLA_SAFE_ASSERT_BREAK(event.value4 >= 0 && event.value4 < MAX_MIDI_VALUE); | |||||
CARLA_SAFE_ASSERT_BREAK(event.value3 >= 0 && event.value3 < MAX_MIDI_VALUE); | |||||
const uint8_t channel = static_cast<uint8_t>(event.value1); | const uint8_t channel = static_cast<uint8_t>(event.value1); | ||||
const uint8_t note = static_cast<uint8_t>(event.value2); | const uint8_t note = static_cast<uint8_t>(event.value2); | ||||
const uint8_t velocity = static_cast<uint8_t>(event.value4); | |||||
const uint8_t velocity = static_cast<uint8_t>(event.value3); | |||||
// Update UI | // Update UI | ||||
if (hasUI) | if (hasUI) | ||||
@@ -2163,9 +2160,8 @@ void CarlaPlugin::idle() | |||||
pData->id, | pData->id, | ||||
event.value1, | event.value1, | ||||
event.value2, | event.value2, | ||||
event.value4, | |||||
event.value3, | |||||
0.0f, nullptr); | 0.0f, nullptr); | ||||
} break; | } break; | ||||
case kPluginPostRtEventNoteOff: { | case kPluginPostRtEventNoteOff: { | ||||
@@ -2195,7 +2191,6 @@ void CarlaPlugin::idle() | |||||
event.value1, | event.value1, | ||||
event.value2, | event.value2, | ||||
0, 0.0f, nullptr); | 0, 0.0f, nullptr); | ||||
} break; | } break; | ||||
} | } | ||||
} | } | ||||
@@ -2434,8 +2429,8 @@ void CarlaPlugin::sendMidiAllNotesOffToCallback() | |||||
postEvent.type = kPluginPostRtEventNoteOff; | postEvent.type = kPluginPostRtEventNoteOff; | ||||
postEvent.value1 = pData->ctrlChannel; | postEvent.value1 = pData->ctrlChannel; | ||||
postEvent.value2 = 0; | postEvent.value2 = 0; | ||||
postEvent.value4 = 0; | |||||
postEvent.valueF = 0.0f; | |||||
postEvent.value3 = 0; | |||||
postEvent.valuef = 0.0f; | |||||
for (int32_t i=0; i < MAX_MIDI_NOTE; ++i) | for (int32_t i=0; i < MAX_MIDI_NOTE; ++i) | ||||
{ | { | ||||
@@ -2480,7 +2475,7 @@ void CarlaPlugin::uiIdle() | |||||
break; | break; | ||||
case kPluginPostRtEventParameterChange: | case kPluginPostRtEventParameterChange: | ||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valueF); | |||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valuef); | |||||
break; | break; | ||||
case kPluginPostRtEventProgramChange: | case kPluginPostRtEventProgramChange: | ||||
@@ -2494,7 +2489,7 @@ void CarlaPlugin::uiIdle() | |||||
case kPluginPostRtEventNoteOn: | case kPluginPostRtEventNoteOn: | ||||
uiNoteOn(static_cast<uint8_t>(event.value1), | uiNoteOn(static_cast<uint8_t>(event.value1), | ||||
static_cast<uint8_t>(event.value2), | static_cast<uint8_t>(event.value2), | ||||
static_cast<uint8_t>(event.value4)); | |||||
static_cast<uint8_t>(event.value3)); | |||||
break; | break; | ||||
case kPluginPostRtEventNoteOff: | case kPluginPostRtEventNoteOff: | ||||
@@ -560,6 +560,7 @@ public: | |||||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | ||||
} | } | ||||
// FIXME: this is never used | |||||
void setMidiProgramRT(const uint32_t uindex) noexcept override | void setMidiProgramRT(const uint32_t uindex) noexcept override | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,); | ||||
@@ -753,11 +753,11 @@ void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEventType typ | |||||
const int32_t value1, | const int32_t value1, | ||||
const int32_t value2, | const int32_t value2, | ||||
const int32_t value3, | const int32_t value3, | ||||
const float valueF) noexcept | |||||
const float valuef) noexcept | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); | CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); | ||||
PluginPostRtEvent rtEvent = { type, value1, value2, value3, valueF }; | |||||
PluginPostRtEvent rtEvent = { type, value1, value2, value3, valuef }; | |||||
postRtEvents.appendRT(rtEvent); | postRtEvents.appendRT(rtEvent); | ||||
} | } | ||||
@@ -67,14 +67,14 @@ enum SpecialParameterType { | |||||
* Post-RT event type. | * Post-RT event type. | ||||
* These are events postponned from within the process function, | * These are events postponned from within the process function, | ||||
* | * | ||||
* During process, we cannot lock, allocate memory or do UI stuff, | |||||
* so events have to be postponned to be executed later, on a separate thread. | |||||
* During process, we cannot lock, allocate memory or do UI stuff. | |||||
* Events have to be postponned to be executed later, on a separate thread. | |||||
* @see PluginPostRtEvent | * @see PluginPostRtEvent | ||||
*/ | */ | ||||
enum PluginPostRtEventType { | enum PluginPostRtEventType { | ||||
kPluginPostRtEventNull = 0, | kPluginPostRtEventNull = 0, | ||||
kPluginPostRtEventDebug, | kPluginPostRtEventDebug, | ||||
kPluginPostRtEventParameterChange, // param, SP (*), value (SP: if 1 only report change to UI, don't report to Callback and OSC) | |||||
kPluginPostRtEventParameterChange, // param, SP (*), unused, value (SP: if 1 report to Callback and OSC) | |||||
kPluginPostRtEventProgramChange, // index | kPluginPostRtEventProgramChange, // index | ||||
kPluginPostRtEventMidiProgramChange, // index | kPluginPostRtEventMidiProgramChange, // index | ||||
kPluginPostRtEventNoteOn, // channel, note, velo | kPluginPostRtEventNoteOn, // channel, note, velo | ||||
@@ -89,8 +89,8 @@ struct PluginPostRtEvent { | |||||
PluginPostRtEventType type; | PluginPostRtEventType type; | ||||
int32_t value1; | int32_t value1; | ||||
int32_t value2; | int32_t value2; | ||||
int32_t value4; | |||||
float valueF; | |||||
int32_t value3; | |||||
float valuef; | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -361,7 +361,7 @@ struct CarlaPlugin::ProtectedData { | |||||
void postponeRtEvent(const PluginPostRtEvent& rtEvent) noexcept; | void postponeRtEvent(const PluginPostRtEvent& rtEvent) noexcept; | ||||
void postponeRtEvent(const PluginPostRtEventType type, | void postponeRtEvent(const PluginPostRtEventType type, | ||||
const int32_t value1, const int32_t value2, const int32_t value3, | const int32_t value1, const int32_t value2, const int32_t value3, | ||||
const float valueF) noexcept; | |||||
const float valuef) noexcept; | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Library functions | // Library functions | ||||
@@ -279,6 +279,17 @@ public: | |||||
CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); | CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); | ||||
} | } | ||||
void setParameterValueRT(const uint32_t parameterId, const float value) noexcept override | |||||
{ | |||||
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); | |||||
CARLA_SAFE_ASSERT_RETURN(fInstance != nullptr,); | |||||
const float fixedValue(pData->param.getFixedValue(parameterId, value)); | |||||
fInstance->setParameter(static_cast<int>(parameterId), value); | |||||
CarlaPlugin::setParameterValueRT(parameterId, fixedValue); | |||||
} | |||||
void setChunkData(const void* const data, const std::size_t dataSize) override | void setChunkData(const void* const data, const std::size_t dataSize) override | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS,); | CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS,); | ||||
@@ -815,15 +826,13 @@ public: | |||||
if (MIDI_IS_CONTROL_BREATH_CONTROLLER(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_DRYWET) != 0) | if (MIDI_IS_CONTROL_BREATH_CONTROLLER(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_DRYWET) != 0) | ||||
{ | { | ||||
value = ctrlEvent.value; | value = ctrlEvent.value; | ||||
setDryWet(value, false, false); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, 0, value); | |||||
setDryWetRT(value); | |||||
} | } | ||||
if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) | if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) | ||||
{ | { | ||||
value = ctrlEvent.value*127.0f/100.0f; | value = ctrlEvent.value*127.0f/100.0f; | ||||
setVolume(value, false, false); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, 0, value); | |||||
setVolumeRT(value); | |||||
} | } | ||||
if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) | if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) | ||||
@@ -847,10 +856,8 @@ public: | |||||
right = 1.0f; | right = 1.0f; | ||||
} | } | ||||
setBalanceLeft(left, false, false); | |||||
setBalanceRight(right, false, false); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, 0, left); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, 0, right); | |||||
setBalanceLeftRT(left); | |||||
setBalanceRightRT(right); | |||||
} | } | ||||
} | } | ||||
#endif | #endif | ||||
@@ -884,8 +891,7 @@ public: | |||||
value = std::rint(value); | value = std::rint(value); | ||||
} | } | ||||
setParameterValue(k, value, false, false, false); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, 0, value); | |||||
setParameterValueRT(k, value); | |||||
} | } | ||||
if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param < MAX_MIDI_CONTROL) | if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param < MAX_MIDI_CONTROL) | ||||
@@ -910,7 +916,6 @@ public: | |||||
if (ctrlEvent.param < pData->prog.count) | if (ctrlEvent.param < pData->prog.count) | ||||
{ | { | ||||
setProgramRT(ctrlEvent.param); | setProgramRT(ctrlEvent.param); | ||||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, ctrlEvent.param, 0, 0, 0.0f); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -3188,7 +3188,7 @@ public: | |||||
if (doPostRt) | if (doPostRt) | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | pData->postponeRtEvent(kPluginPostRtEventParameterChange, | ||||
static_cast<int32_t>(k), | static_cast<int32_t>(k), | ||||
1, | |||||
0, | |||||
0, | 0, | ||||
fParamBuffers[k]); | fParamBuffers[k]); | ||||
} | } | ||||
@@ -3985,7 +3985,7 @@ public: | |||||
fParamBuffers[k] = pData->param.ranges[k].def; | fParamBuffers[k] = pData->param.ranges[k].def; | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | pData->postponeRtEvent(kPluginPostRtEventParameterChange, | ||||
static_cast<int32_t>(k), | static_cast<int32_t>(k), | ||||
0, 0, | |||||
1, 0, | |||||
fParamBuffers[k]); | fParamBuffers[k]); | ||||
} | } | ||||
} | } | ||||
@@ -4256,7 +4256,7 @@ public: | |||||
fParamBuffers[k] = sampleRatef; | fParamBuffers[k] = sampleRatef; | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | pData->postponeRtEvent(kPluginPostRtEventParameterChange, | ||||
static_cast<int32_t>(k), | static_cast<int32_t>(k), | ||||
1, | |||||
0, | |||||
0, | 0, | ||||
fParamBuffers[k]); | fParamBuffers[k]); | ||||
break; | break; | ||||
@@ -4274,7 +4274,7 @@ public: | |||||
fParamBuffers[k] = isOffline ? pData->param.ranges[k].max : pData->param.ranges[k].min; | fParamBuffers[k] = isOffline ? pData->param.ranges[k].max : pData->param.ranges[k].min; | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | pData->postponeRtEvent(kPluginPostRtEventParameterChange, | ||||
static_cast<int32_t>(k), | static_cast<int32_t>(k), | ||||
1, | |||||
0, | |||||
0, | 0, | ||||
fParamBuffers[k]); | fParamBuffers[k]); | ||||
break; | break; | ||||
@@ -819,6 +819,7 @@ public: | |||||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); | ||||
} | } | ||||
// FIXME: this is never used | |||||
void setMidiProgramRT(const uint32_t index) noexcept override | void setMidiProgramRT(const uint32_t index) noexcept override | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); | ||||
@@ -1907,19 +1907,19 @@ protected: | |||||
else if (pthread_equal(thisThread, fProcThread)) | else if (pthread_equal(thisThread, fProcThread)) | ||||
{ | { | ||||
CARLA_SAFE_ASSERT(fIsProcessing); | CARLA_SAFE_ASSERT(fIsProcessing); | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 1, 0, fixedValue); | |||||
} | } | ||||
// Called from effSetChunk or effSetProgram | // Called from effSetChunk or effSetProgram | ||||
else if (pthread_equal(thisThread, fChangingValuesThread)) | else if (pthread_equal(thisThread, fChangingValuesThread)) | ||||
{ | { | ||||
carla_debug("audioMasterAutomate called while setting state"); | carla_debug("audioMasterAutomate called while setting state"); | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 1, 0, fixedValue); | |||||
} | } | ||||
// Called from effIdle | // Called from effIdle | ||||
else if (pthread_equal(thisThread, fIdleThread)) | else if (pthread_equal(thisThread, fIdleThread)) | ||||
{ | { | ||||
carla_debug("audioMasterAutomate called from idle thread"); | carla_debug("audioMasterAutomate called from idle thread"); | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 1, 0, fixedValue); | |||||
} | } | ||||
// Called from UI? | // Called from UI? | ||||
else if (fUI.isVisible) | else if (fUI.isVisible) | ||||
@@ -325,15 +325,15 @@ private: | |||||
static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, | static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, | ||||
int value1, int value2, int value3, | int value1, int value2, int value3, | ||||
float valueF, const char* valueStr) | |||||
float valuef, const char* valueStr) | |||||
{ | { | ||||
carla_debug("CarlaBridgePlugin::callback(%p, %i:%s, %i, %i, %i, %i, %f, \"%s\")", | carla_debug("CarlaBridgePlugin::callback(%p, %i:%s, %i, %i, %i, %i, %f, \"%s\")", | ||||
ptr, action, EngineCallbackOpcode2Str(action), | ptr, action, EngineCallbackOpcode2Str(action), | ||||
pluginId, value1, value2, value3, valueF, valueStr); | |||||
pluginId, value1, value2, value3, valuef, valueStr); | |||||
CARLA_SAFE_ASSERT_RETURN(ptr != nullptr,); | CARLA_SAFE_ASSERT_RETURN(ptr != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId == 0,); | CARLA_SAFE_ASSERT_RETURN(pluginId == 0,); | ||||
return ((CarlaBridgePlugin*)ptr)->handleCallback(action, value1, value2, value3, valueF, valueStr); | |||||
return ((CarlaBridgePlugin*)ptr)->handleCallback(action, value1, value2, value3, valuef, valueStr); | |||||
} | } | ||||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgePlugin) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgePlugin) | ||||
@@ -413,7 +413,7 @@ protected: | |||||
void engineCallback(const EngineCallbackOpcode action, const uint pluginId, | void engineCallback(const EngineCallbackOpcode action, const uint pluginId, | ||||
const int value1, const int value2, const int value3, | const int value1, const int value2, const int value3, | ||||
const float valueF, const char* const valueStr) | |||||
const float valuef, const char* const valueStr) | |||||
{ | { | ||||
switch (action) | switch (action) | ||||
{ | { | ||||
@@ -425,7 +425,7 @@ protected: | |||||
{ | { | ||||
fUI.writeFunction(fUI.controller, | fUI.writeFunction(fUI.controller, | ||||
static_cast<uint32_t>(value1)+fPorts.indexOffset, | static_cast<uint32_t>(value1)+fPorts.indexOffset, | ||||
sizeof(float), 0, &valueF); | |||||
sizeof(float), 0, &valuef); | |||||
} | } | ||||
break; | break; | ||||
@@ -442,7 +442,7 @@ protected: | |||||
carla_stdout("engineCallback(%i:%s, %u, %i, %i, %f, %s)", | carla_stdout("engineCallback(%i:%s, %u, %i, %i, %f, %s)", | ||||
action, EngineCallbackOpcode2Str(action), pluginId, | action, EngineCallbackOpcode2Str(action), pluginId, | ||||
value1, value2, value3, | value1, value2, value3, | ||||
static_cast<double>(valueF), valueStr); | |||||
static_cast<double>(valuef), valueStr); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -546,9 +546,9 @@ private: | |||||
static void _engine_callback(void* handle, EngineCallbackOpcode action, uint pluginId, | static void _engine_callback(void* handle, EngineCallbackOpcode action, uint pluginId, | ||||
int value1, int value2, int value3, | int value1, int value2, int value3, | ||||
float valueF, const char* valueStr) | |||||
float valuef, const char* valueStr) | |||||
{ | { | ||||
handlePtr->engineCallback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||||
handlePtr->engineCallback(action, pluginId, value1, value2, value3, valuef, valueStr); | |||||
} | } | ||||
#undef handlePtr | #undef handlePtr | ||||