@@ -914,7 +914,7 @@ public: | |||
* Call the main engine callback, if set. | |||
* May be called by plugins. | |||
*/ | |||
void callback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept; | |||
virtual void callback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept; | |||
/*! | |||
* Set the main engine callback to @a func. | |||
@@ -1087,50 +1087,18 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI | |||
carla_stdout("callback while idling (%i:%s, %i, %i, %i, %f, \"%s\")", action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | |||
} | |||
if (action == ENGINE_CALLBACK_IDLE) | |||
{ | |||
++pData->isIdling; | |||
} | |||
#if 0 //def BUILD_BRIDGE | |||
else if (pData->oscData != nullptr) | |||
{ | |||
switch (action) | |||
{ | |||
case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= 0); | |||
oscSend_bridge_parameter_value(static_cast<uint>(value1), value3); | |||
break; | |||
case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= 0); | |||
oscSend_bridge_default_value(static_cast<uint>(value1), value3); | |||
break; | |||
case ENGINE_CALLBACK_PROGRAM_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= -1); | |||
oscSend_bridge_current_program(value1); | |||
break; | |||
case ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= -1); | |||
oscSend_bridge_current_midi_program(value1); | |||
break; | |||
case ENGINE_CALLBACK_UI_STATE_CHANGED: | |||
if (value1 != 1) | |||
oscSend_bridge_configure("CarlaBridgeHideGUI", ""); | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
#endif | |||
if (pData->callback != nullptr) | |||
{ | |||
if (action == ENGINE_CALLBACK_IDLE) | |||
++pData->isIdling; | |||
try { | |||
pData->callback(pData->callbackPtr, action, pluginId, value1, value2, value3, valueStr); | |||
} CARLA_SAFE_EXCEPTION("callback"); | |||
} | |||
if (action == ENGINE_CALLBACK_IDLE) | |||
--pData->isIdling; | |||
if (action == ENGINE_CALLBACK_IDLE) | |||
--pData->isIdling; | |||
} | |||
} | |||
void CarlaEngine::setCallback(const EngineCallbackFunc func, void* const ptr) noexcept | |||
@@ -751,6 +751,62 @@ public: | |||
} | |||
} | |||
void callback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept override | |||
{ | |||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valueStr); | |||
if (fLastPingCounter < 0) | |||
return; | |||
switch (action) | |||
{ | |||
// uint/index float/value | |||
case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= 0); | |||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterValue); | |||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | |||
fShmNonRtServerControl.writeFloat(value3); | |||
fShmNonRtServerControl.commitWrite(); | |||
break; | |||
// uint/index float/value | |||
case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= 0); | |||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerDefaultValue); | |||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | |||
fShmNonRtServerControl.writeFloat(value3); | |||
fShmNonRtServerControl.commitWrite(); | |||
break; | |||
// int/index | |||
case ENGINE_CALLBACK_PROGRAM_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= -1); | |||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerCurrentProgram); | |||
fShmNonRtServerControl.writeInt(value1); | |||
fShmNonRtServerControl.commitWrite(); | |||
break; | |||
// int/index | |||
case ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: | |||
CARLA_SAFE_ASSERT_BREAK(value1 >= -1); | |||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerCurrentMidiProgram); | |||
fShmNonRtServerControl.writeInt(value1); | |||
fShmNonRtServerControl.commitWrite(); | |||
break; | |||
case ENGINE_CALLBACK_UI_STATE_CHANGED: | |||
if (value1 != 1) | |||
{ | |||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerUiClosed); | |||
fShmNonRtServerControl.commitWrite(); | |||
} | |||
break; | |||
default: | |||
break; | |||
} | |||
} | |||
// ------------------------------------------------------------------- | |||
void clear() noexcept | |||
@@ -2047,7 +2047,7 @@ public: | |||
} break; | |||
case kPluginBridgeNonRtServerParameterValue: { | |||
// uint/index float/value | |||
// uint/index, float/value | |||
const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
const float value = fShmNonRtServerControl.readFloat(); | |||
@@ -2063,7 +2063,7 @@ public: | |||
} break; | |||
case kPluginBridgeNonRtServerParameterValue2: { | |||
// uint/index float/value | |||
// uint/index, float/value | |||
const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
const float value = fShmNonRtServerControl.readFloat(); | |||
@@ -2077,7 +2077,7 @@ public: | |||
} break; | |||
case kPluginBridgeNonRtServerDefaultValue: { | |||
// uint/index float/value | |||
// uint/index, float/value | |||
const uint32_t index = fShmNonRtServerControl.readUInt(); | |||
const float value = fShmNonRtServerControl.readFloat(); | |||
@@ -85,9 +85,9 @@ enum PluginBridgeNonRtServerOpcode { | |||
kPluginBridgeNonRtServerParameterData1, // uint/index, int/rindex, uint/type, uint/hints, short/cc | |||
kPluginBridgeNonRtServerParameterData2, // uint/index, uint/size, str[] (name), uint/size, str[] (unit) | |||
kPluginBridgeNonRtServerParameterRanges, // uint/index, float/def, float/min, float/max, float/step, float/stepSmall, float/stepLarge | |||
kPluginBridgeNonRtServerParameterValue, // uint/index float/value | |||
kPluginBridgeNonRtServerParameterValue2, // uint/index float/value (used for init/output parameters only, don't resend values) | |||
kPluginBridgeNonRtServerDefaultValue, // uint/index float/value | |||
kPluginBridgeNonRtServerParameterValue, // uint/index, float/value | |||
kPluginBridgeNonRtServerParameterValue2, // uint/index, float/value (used for init/output parameters only, don't resend values) | |||
kPluginBridgeNonRtServerDefaultValue, // uint/index, float/value | |||
kPluginBridgeNonRtServerCurrentProgram, // int/index | |||
kPluginBridgeNonRtServerCurrentMidiProgram, // int/index | |||
kPluginBridgeNonRtServerProgramName, // uint/index, uint/size, str[] (name) | |||