Browse Source

Tweak CarlaPlugin API to make RT engine callbacks optional

tags/v2.1-rc1
falkTX 6 years ago
parent
commit
9bc526c1a6
15 changed files with 205 additions and 152 deletions
  1. +8
    -8
      source/backend/CarlaPlugin.hpp
  2. +10
    -7
      source/backend/engine/CarlaEngineNative.cpp
  3. +64
    -52
      source/backend/plugin/CarlaPlugin.cpp
  4. +23
    -6
      source/backend/plugin/CarlaPluginBridge.cpp
  5. +12
    -12
      source/backend/plugin/CarlaPluginDSSI.cpp
  6. +12
    -11
      source/backend/plugin/CarlaPluginFluidSynth.cpp
  7. +2
    -1
      source/backend/plugin/CarlaPluginInternal.cpp
  8. +3
    -1
      source/backend/plugin/CarlaPluginInternal.hpp
  9. +6
    -4
      source/backend/plugin/CarlaPluginJack.cpp
  10. +7
    -5
      source/backend/plugin/CarlaPluginJuce.cpp
  11. +6
    -6
      source/backend/plugin/CarlaPluginLADSPA.cpp
  12. +17
    -11
      source/backend/plugin/CarlaPluginLV2.cpp
  13. +13
    -10
      source/backend/plugin/CarlaPluginNative.cpp
  14. +7
    -5
      source/backend/plugin/CarlaPluginSFZero.cpp
  15. +15
    -13
      source/backend/plugin/CarlaPluginVST2.cpp

+ 8
- 8
source/backend/CarlaPlugin.hpp View File

@@ -542,11 +542,11 @@ public:
/*! /*!
* Overloaded functions, to be called from within RT context only. * Overloaded functions, to be called from within RT context only.
*/ */
void setDryWetRT(const float value) noexcept;
void setVolumeRT(const float value) noexcept;
void setBalanceLeftRT(const float value) noexcept;
void setBalanceRightRT(const float value) noexcept;
void setPanningRT(const float value) noexcept;
void setDryWetRT(const float value, const bool sendCallbackLater) noexcept;
void setVolumeRT(const float value, const bool sendCallbackLater) noexcept;
void setBalanceLeftRT(const float value, const bool sendCallbackLater) noexcept;
void setBalanceRightRT(const float value, const bool sendCallbackLater) noexcept;
void setPanningRT(const float value, const bool sendCallbackLater) noexcept;
#endif // ! BUILD_BRIDGE_ALTERNATIVE_ARCH #endif // ! BUILD_BRIDGE_ALTERNATIVE_ARCH


/*! /*!
@@ -576,7 +576,7 @@ public:
/*! /*!
* Overloaded function, to be called from within RT context only. * Overloaded function, to be called from within RT context only.
*/ */
virtual void setParameterValueRT(const uint32_t parameterId, const float value) noexcept;
virtual void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept;


/*! /*!
* Set a plugin's parameter value, including internal parameters. * Set a plugin's parameter value, including internal parameters.
@@ -660,8 +660,8 @@ public:
/*! /*!
* Overloaded functions, to be called from within RT context only. * Overloaded functions, to be called from within RT context only.
*/ */
virtual void setProgramRT(const uint32_t index) noexcept;
virtual void setMidiProgramRT(const uint32_t index) noexcept;
virtual void setProgramRT(const uint32_t index, const bool sendCallbackLater) noexcept;
virtual void setMidiProgramRT(const uint32_t index, const bool sendCallbackLater) noexcept;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin state // Plugin state


+ 10
- 7
source/backend/engine/CarlaEngineNative.cpp View File

@@ -571,12 +571,12 @@ protected:
CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),);


std::snprintf(tmpBuf, STR_MAX, "%f:%f:%f:%f:%f:%f\n", std::snprintf(tmpBuf, STR_MAX, "%f:%f:%f:%f:%f:%f\n",
static_cast<double>(paramRanges.def),
static_cast<double>(paramRanges.min),
static_cast<double>(paramRanges.max),
static_cast<double>(paramRanges.step),
static_cast<double>(paramRanges.stepSmall),
static_cast<double>(paramRanges.stepLarge));
static_cast<double>(paramRanges.def),
static_cast<double>(paramRanges.min),
static_cast<double>(paramRanges.max),
static_cast<double>(paramRanges.step),
static_cast<double>(paramRanges.stepSmall),
static_cast<double>(paramRanges.stepLarge));
CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),); CARLA_SAFE_ASSERT_RETURN(fUiServer.writeMessage(tmpBuf),);


std::snprintf(tmpBuf, STR_MAX, "PARAMVAL_%i:%i\n", pluginId, i); std::snprintf(tmpBuf, STR_MAX, "PARAMVAL_%i:%i\n", pluginId, i);
@@ -1042,7 +1042,10 @@ protected:
if (CarlaPlugin* const plugin = _getFirstPlugin()) if (CarlaPlugin* const plugin = _getFirstPlugin())
{ {
if (index < plugin->getParameterCount()) if (index < plugin->getParameterCount())
plugin->setParameterValueRT(index, value);
{
const float rvalue = plugin->getParameterRanges(index).getUnnormalizedValue(value);
plugin->setParameterValueRT(index, rvalue, false);
}
} }


fParameters[index] = value; fParameters[index] = value;


+ 64
- 52
source/backend/plugin/CarlaPlugin.cpp View File

@@ -50,7 +50,7 @@ static const MidiProgramData kMidiProgramDataNull = { 0, 0, nullptr };


static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr }; static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr };
static /* */ CustomData kCustomDataFallbackNC = { nullptr, nullptr, nullptr }; static /* */ CustomData kCustomDataFallbackNC = { nullptr, nullptr, nullptr };
static const PluginPostRtEvent kPluginPostRtEventFallback = { kPluginPostRtEventNull, 0, 0, 0, 0.0f };
static const PluginPostRtEvent kPluginPostRtEventFallback = { kPluginPostRtEventNull, false, 0, 0, 0, 0.0f };


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// ParamSymbol struct, needed for CarlaPlugin::loadStateSave() // ParamSymbol struct, needed for CarlaPlugin::loadStateSave()
@@ -1508,7 +1508,7 @@ void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool s
nullptr); nullptr);
} }


void CarlaPlugin::setDryWetRT(const float value) noexcept
void CarlaPlugin::setDryWetRT(const float value, const bool sendCallbackLater) noexcept
{ {
CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.0f); CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.0f);


@@ -1518,10 +1518,10 @@ void CarlaPlugin::setDryWetRT(const float value) noexcept
return; return;


pData->postProc.dryWet = fixedValue; pData->postProc.dryWet = fixedValue;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 1, 0, fixedValue);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, sendCallbackLater, PARAMETER_DRYWET, 0, 0, fixedValue);
} }


void CarlaPlugin::setVolumeRT(const float value) noexcept
void CarlaPlugin::setVolumeRT(const float value, const bool sendCallbackLater) noexcept
{ {
CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.27f); CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.27f);


@@ -1531,10 +1531,10 @@ void CarlaPlugin::setVolumeRT(const float value) noexcept
return; return;


pData->postProc.volume = fixedValue; pData->postProc.volume = fixedValue;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 1, 0, fixedValue);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, sendCallbackLater, PARAMETER_VOLUME, 0, 0, fixedValue);
} }


void CarlaPlugin::setBalanceLeftRT(const float value) noexcept
void CarlaPlugin::setBalanceLeftRT(const float value, const bool sendCallbackLater) noexcept
{ {
CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f); CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f);


@@ -1544,10 +1544,10 @@ void CarlaPlugin::setBalanceLeftRT(const float value) noexcept
return; return;


pData->postProc.balanceLeft = fixedValue; pData->postProc.balanceLeft = fixedValue;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 1, 0, fixedValue);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, sendCallbackLater, PARAMETER_BALANCE_LEFT, 0, 0, fixedValue);
} }


void CarlaPlugin::setBalanceRightRT(const float value) noexcept
void CarlaPlugin::setBalanceRightRT(const float value, const bool sendCallbackLater) noexcept
{ {
CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f); CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f);


@@ -1557,10 +1557,10 @@ void CarlaPlugin::setBalanceRightRT(const float value) noexcept
return; return;


pData->postProc.balanceRight = fixedValue; pData->postProc.balanceRight = fixedValue;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 1, 0, fixedValue);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, sendCallbackLater, PARAMETER_BALANCE_RIGHT, 0, 0, fixedValue);
} }


void CarlaPlugin::setPanningRT(const float value) noexcept
void CarlaPlugin::setPanningRT(const float value, const bool sendCallbackLater) noexcept
{ {
CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f); CARLA_SAFE_ASSERT(value >= -1.0f && value <= 1.0f);


@@ -1570,6 +1570,7 @@ void CarlaPlugin::setPanningRT(const float value) noexcept
return; return;


pData->postProc.panning = fixedValue; pData->postProc.panning = fixedValue;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, sendCallbackLater, PARAMETER_PANNING, 0, 0, fixedValue);
} }
#endif // ! BUILD_BRIDGE_ALTERNATIVE_ARCH #endif // ! BUILD_BRIDGE_ALTERNATIVE_ARCH


@@ -1626,9 +1627,10 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu
nullptr); nullptr);
} }


void CarlaPlugin::setParameterValueRT(const uint32_t parameterId, const float value) noexcept
void CarlaPlugin::setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept
{ {
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(parameterId), 1, 0, value);
pData->postponeRtEvent(kPluginPostRtEventParameterChange,
sendCallbackLater, static_cast<int32_t>(parameterId), 0, 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
@@ -1832,7 +1834,7 @@ void CarlaPlugin::setMidiProgramById(const uint32_t bank, const uint32_t program
} }
} }


void CarlaPlugin::setProgramRT(const uint32_t uindex) noexcept
void CarlaPlugin::setProgramRT(const uint32_t uindex, const bool sendCallbackLater) noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(uindex < pData->prog.count,); CARLA_SAFE_ASSERT_RETURN(uindex < pData->prog.count,);


@@ -1851,10 +1853,10 @@ void CarlaPlugin::setProgramRT(const uint32_t uindex) noexcept
break; break;
} }


pData->postponeRtEvent(kPluginPostRtEventProgramChange, index, 0, 0, 0.0f);
pData->postponeRtEvent(kPluginPostRtEventProgramChange, sendCallbackLater, index, 0, 0, 0.0f);
} }


void CarlaPlugin::setMidiProgramRT(const uint32_t uindex) noexcept
void CarlaPlugin::setMidiProgramRT(const uint32_t uindex, const bool sendCallbackLater) noexcept
{ {
CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,); CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,);


@@ -1873,7 +1875,7 @@ void CarlaPlugin::setMidiProgramRT(const uint32_t uindex) noexcept
break; break;
} }


pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, index, 0, 0, 0.0f);
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, sendCallbackLater, index, 0, 0, 0.0f);
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -1962,7 +1964,7 @@ void CarlaPlugin::idle()
uiParameterChange(static_cast<uint32_t>(event.value1), event.valuef); uiParameterChange(static_cast<uint32_t>(event.value1), event.valuef);
} }


if (event.value2 != 0)
if (event.sendCallback)
{ {
// Update Host // Update Host
pData->engine->callback(true, true, pData->engine->callback(true, true,
@@ -2007,13 +2009,15 @@ void CarlaPlugin::idle()
nullptr); nullptr);
} }


// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_PROGRAM_CHANGED,
pData->id,
event.value1,
0, 0, 0.0f, nullptr);

if (event.sendCallback)
{
// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_PROGRAM_CHANGED,
pData->id,
event.value1,
0, 0, 0.0f, nullptr);
}
} break; } break;


case kPluginPostRtEventMidiProgramChange: { case kPluginPostRtEventMidiProgramChange: {
@@ -2048,13 +2052,15 @@ void CarlaPlugin::idle()
nullptr); nullptr);
} }


// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED,
pData->id,
event.value1,
0, 0, 0.0f, nullptr);

if (event.sendCallback)
{
// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED,
pData->id,
event.value1,
0, 0, 0.0f, nullptr);
}
} break; } break;


case kPluginPostRtEventNoteOn: { case kPluginPostRtEventNoteOn: {
@@ -2075,14 +2081,17 @@ void CarlaPlugin::idle()
uiNoteOn(channel, note, velocity); uiNoteOn(channel, note, velocity);
} }


// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_NOTE_ON,
pData->id,
event.value1,
event.value2,
event.value3,
0.0f, nullptr);
if (event.sendCallback)
{
// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_NOTE_ON,
pData->id,
event.value1,
event.value2,
event.value3,
0.0f, nullptr);
}
} break; } break;


case kPluginPostRtEventNoteOff: { case kPluginPostRtEventNoteOff: {
@@ -2101,13 +2110,16 @@ void CarlaPlugin::idle()
uiNoteOff(channel, note); uiNoteOff(channel, note);
} }


// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_NOTE_OFF,
pData->id,
event.value1,
event.value2,
0, 0.0f, nullptr);
if (event.sendCallback)
{
// Update Host
pData->engine->callback(true, true,
ENGINE_CALLBACK_NOTE_OFF,
pData->id,
event.value1,
event.value2,
0, 0.0f, nullptr);
}
} break; } break;
} }
} }
@@ -2201,12 +2213,12 @@ void CarlaPlugin::postponeRtAllNotesOff()
if (pData->ctrlChannel < 0 || pData->ctrlChannel >= MAX_MIDI_CHANNELS) if (pData->ctrlChannel < 0 || pData->ctrlChannel >= MAX_MIDI_CHANNELS)
return; return;


PluginPostRtEvent postEvent;
postEvent.type = kPluginPostRtEventNoteOff;
postEvent.value1 = pData->ctrlChannel;
postEvent.value2 = 0;
postEvent.value3 = 0;
postEvent.valuef = 0.0f;
PluginPostRtEvent postEvent = {
kPluginPostRtEventNoteOff,
true,
pData->ctrlChannel,
0, 0, 0.0f
};


for (int32_t i=0; i < MAX_MIDI_NOTE; ++i) for (int32_t i=0; i < MAX_MIDI_NOTE; ++i)
{ {


+ 23
- 6
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -781,6 +781,21 @@ public:
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit); CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit);
} }


void setProgramRT(const uint32_t index, const bool sendCallbackLater) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count,);

{
const CarlaMutexLocker _cml(fShmNonRtClientControl.mutex);

fShmNonRtClientControl.writeOpcode(kPluginBridgeNonRtClientSetProgram);
fShmNonRtClientControl.writeInt(static_cast<int32_t>(index));
fShmNonRtClientControl.commitWrite();
}

CarlaPlugin::setProgramRT(index, sendCallbackLater);
}

void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override void setMidiProgram(const int32_t index, const bool sendGui, const bool sendOsc, const bool sendCallback, const bool doingInit) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),); CARLA_SAFE_ASSERT_RETURN(index >= -1 && index < static_cast<int32_t>(pData->midiprog.count),);
@@ -797,7 +812,7 @@ public:
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit);
} }


void setMidiProgramRT(const uint32_t uindex) noexcept override
void setMidiProgramRT(const uint32_t uindex, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,); CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,);


@@ -809,7 +824,7 @@ public:
fShmNonRtClientControl.commitWrite(); fShmNonRtClientControl.commitWrite();
} }


CarlaPlugin::setMidiProgramRT(uindex);
CarlaPlugin::setMidiProgramRT(uindex, sendCallbackLater);
} }


void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override
@@ -1244,13 +1259,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -1274,8 +1289,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -1399,6 +1414,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOn, pData->postponeRtEvent(kPluginPostRtEventNoteOn,
true,
event.channel, event.channel,
midiData[1], midiData[1],
midiData[2], midiData[2],
@@ -1407,6 +1423,7 @@ public:
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOff, pData->postponeRtEvent(kPluginPostRtEventNoteOff,
true,
event.channel, event.channel,
midiData[1], midiData[1],
0, 0.0f); 0, 0.0f);


+ 12
- 12
source/backend/plugin/CarlaPluginDSSI.cpp View File

@@ -564,7 +564,7 @@ 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
void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -572,7 +572,7 @@ public:
const float fixedValue(pData->param.getFixedValue(parameterId, value)); const float fixedValue(pData->param.getFixedValue(parameterId, value));
fParamBuffers[parameterId] = fixedValue; fParamBuffers[parameterId] = fixedValue;


CarlaPlugin::setParameterValueRT(parameterId, fixedValue);
CarlaPlugin::setParameterValueRT(parameterId, fixedValue, sendCallbackLater);
} }


void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override
@@ -661,7 +661,7 @@ public:
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit);
} }


void setMidiProgramRT(const uint32_t uindex) noexcept override
void setMidiProgramRT(const uint32_t uindex, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->select_program != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor->select_program != nullptr,);
@@ -669,7 +669,7 @@ public:


setMidiProgramInDSSI(uindex); setMidiProgramInDSSI(uindex);


CarlaPlugin::setMidiProgramRT(uindex);
CarlaPlugin::setMidiProgramRT(uindex, sendCallbackLater);
} }


void setMidiProgramInDSSI(const uint32_t uindex) noexcept void setMidiProgramInDSSI(const uint32_t uindex) noexcept
@@ -1459,13 +1459,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -1489,8 +1489,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -1523,7 +1523,7 @@ public:
value = std::rint(value); value = std::rint(value);
} }


setParameterValueRT(k, value);
setParameterValueRT(k, value, true);
} }


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)
@@ -1558,7 +1558,7 @@ public:
{ {
if (pData->midiprog.data[k].bank == nextBankId && pData->midiprog.data[k].program == nextProgramId) if (pData->midiprog.data[k].bank == nextBankId && pData->midiprog.data[k].program == nextProgramId)
{ {
setMidiProgramRT(k);
setMidiProgramRT(k, true);
break; break;
} }
} }
@@ -1636,7 +1636,7 @@ public:
seqEvent.data.note.channel = event.channel; seqEvent.data.note.channel = event.channel;
seqEvent.data.note.note = note; seqEvent.data.note.note = note;


pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0, 0.0f);
pData->postponeRtEvent(kPluginPostRtEventNoteOff, true, event.channel, note, 0, 0.0f);
break; break;
} }


@@ -1649,7 +1649,7 @@ public:
seqEvent.data.note.note = note; seqEvent.data.note.note = note;
seqEvent.data.note.velocity = velo; seqEvent.data.note.velocity = velo;


pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo, 0.0f);
pData->postponeRtEvent(kPluginPostRtEventNoteOn, true, event.channel, note, velo, 0.0f);
break; break;
} }




+ 12
- 11
source/backend/plugin/CarlaPluginFluidSynth.cpp View File

@@ -409,11 +409,11 @@ 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
void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept override
{ {
const float fixedValue = setParameterValueInFluidSynth(parameterId, value); const float fixedValue = setParameterValueInFluidSynth(parameterId, value);


CarlaPlugin::setParameterValueRT(parameterId, fixedValue);
CarlaPlugin::setParameterValueRT(parameterId, fixedValue, sendCallbackLater);
} }


float setParameterValueInFluidSynth(const uint32_t parameterId, const float value) noexcept float setParameterValueInFluidSynth(const uint32_t parameterId, const float value) noexcept
@@ -564,7 +564,7 @@ public:
} }


// FIXME: this is never used // FIXME: this is never used
void setMidiProgramRT(const uint32_t uindex) noexcept override
void setMidiProgramRT(const uint32_t uindex, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,); CARLA_SAFE_ASSERT_RETURN(fSynth != nullptr,);
CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,); CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,);
@@ -581,7 +581,7 @@ public:
fCurMidiProgs[pData->ctrlChannel] = static_cast<int32_t>(uindex); fCurMidiProgs[pData->ctrlChannel] = static_cast<int32_t>(uindex);
} }


CarlaPlugin::setMidiProgramRT(uindex);
CarlaPlugin::setMidiProgramRT(uindex, sendCallbackLater);
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -1198,13 +1198,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -1228,8 +1228,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -1262,7 +1262,7 @@ public:
value = std::rint(value); value = std::rint(value);
} }


setParameterValueRT(k, value);
setParameterValueRT(k, value, true);
} }


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)
@@ -1294,6 +1294,7 @@ public:
if (event.channel == pData->ctrlChannel) if (event.channel == pData->ctrlChannel)
{ {
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange,
true,
static_cast<int32_t>(k), static_cast<int32_t>(k),
0, 0, 0.0f); 0, 0, 0.0f);
} }
@@ -1347,7 +1348,7 @@ public:


fluid_synth_noteoff(fSynth, event.channel, note); fluid_synth_noteoff(fSynth, event.channel, note);


pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0, 0.0f);
pData->postponeRtEvent(kPluginPostRtEventNoteOff, true, event.channel, note, 0, 0.0f);
break; break;
} }


@@ -1357,7 +1358,7 @@ public:


fluid_synth_noteon(fSynth, event.channel, note, velo); fluid_synth_noteon(fSynth, event.channel, note, velo);


pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo, 0.0f);
pData->postponeRtEvent(kPluginPostRtEventNoteOn, true, event.channel, note, velo, 0.0f);
break; break;
} }




+ 2
- 1
source/backend/plugin/CarlaPluginInternal.cpp View File

@@ -750,6 +750,7 @@ void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEvent& rtEven
} }


void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEventType type, void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEventType type,
const bool sendCallbackLater,
const int32_t value1, const int32_t value1,
const int32_t value2, const int32_t value2,
const int32_t value3, const int32_t value3,
@@ -757,7 +758,7 @@ void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEventType typ
{ {
CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,);


PluginPostRtEvent rtEvent = { type, value1, value2, value3, valuef };
PluginPostRtEvent rtEvent = { type, sendCallbackLater, value1, value2, value3, valuef };


postRtEvents.appendRT(rtEvent); postRtEvents.appendRT(rtEvent);
} }


+ 3
- 1
source/backend/plugin/CarlaPluginInternal.hpp View File

@@ -74,7 +74,7 @@ enum SpecialParameterType {
enum PluginPostRtEventType { enum PluginPostRtEventType {
kPluginPostRtEventNull = 0, kPluginPostRtEventNull = 0,
kPluginPostRtEventDebug, kPluginPostRtEventDebug,
kPluginPostRtEventParameterChange, // param, SP (*), unused, value (SP: if 1 report to Callback and OSC)
kPluginPostRtEventParameterChange, // param, (unused), (unused), value
kPluginPostRtEventProgramChange, // index kPluginPostRtEventProgramChange, // index
kPluginPostRtEventMidiProgramChange, // index kPluginPostRtEventMidiProgramChange, // index
kPluginPostRtEventNoteOn, // channel, note, velo kPluginPostRtEventNoteOn, // channel, note, velo
@@ -87,6 +87,7 @@ enum PluginPostRtEventType {
*/ */
struct PluginPostRtEvent { struct PluginPostRtEvent {
PluginPostRtEventType type; PluginPostRtEventType type;
bool sendCallback;
int32_t value1; int32_t value1;
int32_t value2; int32_t value2;
int32_t value3; int32_t value3;
@@ -360,6 +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 bool sendCallbackLater,
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;




+ 6
- 4
source/backend/plugin/CarlaPluginJack.cpp View File

@@ -1008,13 +1008,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -1038,8 +1038,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -1136,6 +1136,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOn, pData->postponeRtEvent(kPluginPostRtEventNoteOn,
true,
event.channel, event.channel,
midiData[1], midiData[1],
midiData[2], midiData[2],
@@ -1144,6 +1145,7 @@ public:
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOff, pData->postponeRtEvent(kPluginPostRtEventNoteOff,
true,
event.channel, event.channel,
midiData[1], midiData[1],
0, 0.0f); 0, 0.0f);


+ 7
- 5
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -821,13 +821,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -851,8 +851,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -886,7 +886,7 @@ public:
value = std::rint(value); value = std::rint(value);
} }


setParameterValueRT(k, value);
setParameterValueRT(k, value, true);
} }


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)
@@ -999,6 +999,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOn, pData->postponeRtEvent(kPluginPostRtEventNoteOn,
true,
event.channel, event.channel,
midiData[1], midiData[1],
midiData[2], midiData[2],
@@ -1007,6 +1008,7 @@ public:
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOff, pData->postponeRtEvent(kPluginPostRtEventNoteOff,
true,
event.channel, event.channel,
midiData[1], midiData[1],
0, 0.0f); 0, 0.0f);


+ 6
- 6
source/backend/plugin/CarlaPluginLADSPA.cpp View File

@@ -400,7 +400,7 @@ 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
void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater = true) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -408,7 +408,7 @@ public:
const float fixedValue(pData->param.getFixedValue(parameterId, value)); const float fixedValue(pData->param.getFixedValue(parameterId, value));
fParamBuffers[parameterId] = fixedValue; fParamBuffers[parameterId] = fixedValue;


CarlaPlugin::setParameterValueRT(parameterId, fixedValue);
CarlaPlugin::setParameterValueRT(parameterId, fixedValue, sendCallbackLater);
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -979,13 +979,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -1009,8 +1009,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif


+ 17
- 11
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -1365,14 +1365,14 @@ 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
void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,); CARLA_SAFE_ASSERT_RETURN(fParamBuffers != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);


const float fixedValue = setParamterValueCommon(parameterId, value); const float fixedValue = setParamterValueCommon(parameterId, value);


CarlaPlugin::setParameterValueRT(parameterId, fixedValue);
CarlaPlugin::setParameterValueRT(parameterId, fixedValue, sendCallbackLater);
} }


void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override
@@ -1455,7 +1455,7 @@ public:
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit); CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback, doingInit);
} }


void setMidiProgramRT(const uint32_t uindex) noexcept override
void setMidiProgramRT(const uint32_t uindex, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,); CARLA_SAFE_ASSERT_RETURN(uindex < pData->midiprog.count,);
@@ -1477,7 +1477,7 @@ public:
} }
} }


CarlaPlugin::setMidiProgramRT(uindex);
CarlaPlugin::setMidiProgramRT(uindex, sendCallbackLater);
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -3342,6 +3342,7 @@ public:


if (doPostRt) if (doPostRt)
pData->postponeRtEvent(kPluginPostRtEventParameterChange, pData->postponeRtEvent(kPluginPostRtEventParameterChange,
true,
static_cast<int32_t>(k), static_cast<int32_t>(k),
0, 0,
0, 0,
@@ -3604,13 +3605,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -3634,8 +3635,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -3669,7 +3670,7 @@ public:
value = std::rint(value); value = std::rint(value);
} }


setParameterValueRT(k, value);
setParameterValueRT(k, value, true);
} }


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)
@@ -3731,7 +3732,7 @@ public:
{ {
if (pData->midiprog.data[k].bank == nextBankId && pData->midiprog.data[k].program == nextProgramId) if (pData->midiprog.data[k].bank == nextBankId && pData->midiprog.data[k].program == nextProgramId)
{ {
setMidiProgramRT(k);
setMidiProgramRT(k, true);
break; break;
} }
} }
@@ -3849,6 +3850,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOn, pData->postponeRtEvent(kPluginPostRtEventNoteOn,
true,
event.channel, event.channel,
midiData[1], midiData[1],
midiData[2], midiData[2],
@@ -3857,6 +3859,7 @@ public:
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOff, pData->postponeRtEvent(kPluginPostRtEventNoteOff,
true,
event.channel, event.channel,
midiData[1], midiData[1],
0, 0.0f); 0, 0.0f);
@@ -4139,6 +4142,7 @@ public:
{ {
fParamBuffers[k] = pData->param.ranges[k].def; fParamBuffers[k] = pData->param.ranges[k].def;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, pData->postponeRtEvent(kPluginPostRtEventParameterChange,
true,
static_cast<int32_t>(k), static_cast<int32_t>(k),
1, 0, 1, 0,
fParamBuffers[k]); fParamBuffers[k]);
@@ -4411,6 +4415,7 @@ public:


fParamBuffers[k] = sampleRatef; fParamBuffers[k] = sampleRatef;
pData->postponeRtEvent(kPluginPostRtEventParameterChange, pData->postponeRtEvent(kPluginPostRtEventParameterChange,
true,
static_cast<int32_t>(k), static_cast<int32_t>(k),
0, 0,
0, 0,
@@ -4429,6 +4434,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,
true,
static_cast<int32_t>(k), static_cast<int32_t>(k),
0, 0,
0, 0,
@@ -5459,7 +5465,7 @@ public:
{ {
if (pData->param.data[i].rindex == rindex) if (pData->param.data[i].rindex == rindex)
{ {
setParameterValueRT(i, paramValue);
setParameterValueRT(i, paramValue, true);
break; break;
} }
} }


+ 13
- 10
source/backend/plugin/CarlaPluginNative.cpp View File

@@ -688,7 +688,7 @@ 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
void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fDescriptor->set_parameter_value != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor->set_parameter_value != nullptr,);
@@ -703,7 +703,7 @@ public:
if (fHandle2 != nullptr) if (fHandle2 != nullptr)
fDescriptor->set_parameter_value(fHandle2, parameterId, fixedValue); fDescriptor->set_parameter_value(fHandle2, parameterId, fixedValue);


CarlaPlugin::setParameterValueRT(parameterId, fixedValue);
CarlaPlugin::setParameterValueRT(parameterId, fixedValue, sendCallbackLater);
} }


void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) override
@@ -826,7 +826,7 @@ public:
} }


// FIXME: this is never used // FIXME: this is never used
void setMidiProgramRT(const uint32_t index) noexcept override
void setMidiProgramRT(const uint32_t index, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,);
CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,);
@@ -834,7 +834,7 @@ public:


// TODO, put into check below // TODO, put into check below
if ((pData->hints & PLUGIN_IS_SYNTH) != 0 && (pData->ctrlChannel < 0 || pData->ctrlChannel >= MAX_MIDI_CHANNELS)) if ((pData->hints & PLUGIN_IS_SYNTH) != 0 && (pData->ctrlChannel < 0 || pData->ctrlChannel >= MAX_MIDI_CHANNELS))
return CarlaPlugin::setMidiProgramRT(index);
return CarlaPlugin::setMidiProgramRT(index, sendCallbackLater);


const uint8_t channel = uint8_t((pData->ctrlChannel >= 0 && pData->ctrlChannel < MAX_MIDI_CHANNELS) ? pData->ctrlChannel : 0); const uint8_t channel = uint8_t((pData->ctrlChannel >= 0 && pData->ctrlChannel < MAX_MIDI_CHANNELS) ? pData->ctrlChannel : 0);
const uint32_t bank = pData->midiprog.data[index].bank; const uint32_t bank = pData->midiprog.data[index].bank;
@@ -853,7 +853,7 @@ public:


fCurMidiProgs[channel] = static_cast<int32_t>(index); fCurMidiProgs[channel] = static_cast<int32_t>(index);


CarlaPlugin::setMidiProgramRT(index);
CarlaPlugin::setMidiProgramRT(index, sendCallbackLater);
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -1816,13 +1816,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -1846,8 +1846,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -1880,7 +1880,7 @@ public:
value = std::rint(value); value = std::rint(value);
} }


setParameterValueRT(k, value);
setParameterValueRT(k, value, true);
} }


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)
@@ -1944,6 +1944,7 @@ public:
if (event.channel == pData->ctrlChannel) if (event.channel == pData->ctrlChannel)
{ {
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange,
true,
static_cast<int32_t>(k), static_cast<int32_t>(k),
0, 0, 0.0f); 0, 0, 0.0f);
} }
@@ -2055,6 +2056,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOn, pData->postponeRtEvent(kPluginPostRtEventNoteOn,
true,
event.channel, event.channel,
midiEvent.data[1], midiEvent.data[1],
midiEvent.data[2], midiEvent.data[2],
@@ -2063,6 +2065,7 @@ public:
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOff, pData->postponeRtEvent(kPluginPostRtEventNoteOff,
true,
event.channel, event.channel,
midiEvent.data[1], midiEvent.data[1],
0, 0.0f); 0, 0.0f);


+ 7
- 5
source/backend/plugin/CarlaPluginSFZero.cpp View File

@@ -416,13 +416,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -446,8 +446,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -477,7 +477,7 @@ public:
value = std::rint(value); value = std::rint(value);
} }


setParameterValueRT(k, value);
setParameterValueRT(k, value, true);
} }


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)
@@ -543,6 +543,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOn, pData->postponeRtEvent(kPluginPostRtEventNoteOn,
true,
event.channel, event.channel,
midiData[1], midiData[1],
midiData[2], midiData[2],
@@ -551,6 +552,7 @@ public:
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOff, pData->postponeRtEvent(kPluginPostRtEventNoteOff,
true,
event.channel, event.channel,
midiData[1], midiData[1],
0, 0.0f); 0, 0.0f);


+ 15
- 13
source/backend/plugin/CarlaPluginVST2.cpp View File

@@ -388,7 +388,7 @@ 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
void setParameterValueRT(const uint32_t parameterId, const float value, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,);
@@ -396,7 +396,7 @@ public:
const float fixedValue(pData->param.getFixedValue(parameterId, value)); const float fixedValue(pData->param.getFixedValue(parameterId, value));
fEffect->setParameter(fEffect, static_cast<int32_t>(parameterId), fixedValue); fEffect->setParameter(fEffect, static_cast<int32_t>(parameterId), fixedValue);


CarlaPlugin::setParameterValueRT(parameterId, fixedValue);
CarlaPlugin::setParameterValueRT(parameterId, fixedValue, sendCallbackLater);
} }


void setChunkData(const void* const data, const std::size_t dataSize) override void setChunkData(const void* const data, const std::size_t dataSize) override
@@ -459,7 +459,7 @@ public:
CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit); CarlaPlugin::setProgram(index, sendGui, sendOsc, sendCallback, doingInit);
} }


void setProgramRT(const uint32_t uindex) noexcept override
void setProgramRT(const uint32_t uindex, const bool sendCallbackLater) noexcept override
{ {
CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,); CARLA_SAFE_ASSERT_RETURN(fEffect != nullptr,);
CARLA_SAFE_ASSERT_RETURN(uindex < pData->prog.count,); CARLA_SAFE_ASSERT_RETURN(uindex < pData->prog.count,);
@@ -476,7 +476,7 @@ public:
dispatcher(effEndSetProgram); dispatcher(effEndSetProgram);
} CARLA_SAFE_EXCEPTION("effEndSetProgram"); } CARLA_SAFE_EXCEPTION("effEndSetProgram");


CarlaPlugin::setProgramRT(uindex);
CarlaPlugin::setProgramRT(uindex, sendCallbackLater);
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -1310,13 +1310,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;
setDryWetRT(value);
setDryWetRT(value, true);
} }


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;
setVolumeRT(value);
setVolumeRT(value, true);
} }


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)
@@ -1340,8 +1340,8 @@ public:
right = 1.0f; right = 1.0f;
} }


setBalanceLeftRT(left);
setBalanceRightRT(right);
setBalanceLeftRT(left, true);
setBalanceRightRT(right, true);
} }
} }
#endif #endif
@@ -1375,7 +1375,7 @@ public:
value = std::rint(value); value = std::rint(value);
} }


setParameterValueRT(k, value);
setParameterValueRT(k, value, true);
} }


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)
@@ -1428,7 +1428,7 @@ public:
{ {
if (ctrlEvent.param < pData->prog.count) if (ctrlEvent.param < pData->prog.count)
{ {
setProgramRT(ctrlEvent.param);
setProgramRT(ctrlEvent.param, true);
break; break;
} }
} }
@@ -1533,6 +1533,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOn, pData->postponeRtEvent(kPluginPostRtEventNoteOn,
true,
event.channel, event.channel,
midiEvent.data[1], midiEvent.data[1],
midiEvent.data[2], midiEvent.data[2],
@@ -1541,6 +1542,7 @@ public:
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
{ {
pData->postponeRtEvent(kPluginPostRtEventNoteOff, pData->postponeRtEvent(kPluginPostRtEventNoteOff,
true,
event.channel, event.channel,
midiEvent.data[1], midiEvent.data[1],
0, 0.0f); 0, 0.0f);
@@ -1911,19 +1913,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, 1, 0, fixedValue);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, true, index, 0, 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, 1, 0, fixedValue);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, true, index, 0, 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, 1, 0, fixedValue);
pData->postponeRtEvent(kPluginPostRtEventParameterChange, true, index, 0, 0, fixedValue);
} }
// Called from UI? // Called from UI?
else if (fUI.isVisible) else if (fUI.isVisible)


Loading…
Cancel
Save