From 0286271dc8d549529adb8bf01160aa74026a8304 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 12 Mar 2016 11:58:35 +0100 Subject: [PATCH] Allow the same midi-cc in multiple parameters for the same plugin Closes #345 --- source/backend/plugin/CarlaPluginBridge.cpp | 3 --- source/backend/plugin/CarlaPluginDSSI.cpp | 9 +-------- source/backend/plugin/CarlaPluginJuce.cpp | 9 +-------- source/backend/plugin/CarlaPluginLADSPA.cpp | 5 +---- source/backend/plugin/CarlaPluginLV2.cpp | 9 +-------- source/backend/plugin/CarlaPluginNative.cpp | 3 ++- source/backend/plugin/CarlaPluginVST2.cpp | 8 -------- 7 files changed, 6 insertions(+), 40 deletions(-) diff --git a/source/backend/plugin/CarlaPluginBridge.cpp b/source/backend/plugin/CarlaPluginBridge.cpp index 45d9d1045..1d747779f 100644 --- a/source/backend/plugin/CarlaPluginBridge.cpp +++ b/source/backend/plugin/CarlaPluginBridge.cpp @@ -1498,7 +1498,6 @@ public: value = ctrlEvent.value; setDryWet(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, value); - break; } if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) @@ -1506,7 +1505,6 @@ public: value = ctrlEvent.value*127.0f/100.0f; setVolume(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, value); - break; } if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) @@ -1534,7 +1532,6 @@ public: setBalanceRight(right, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, left); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right); - break; } } #endif diff --git a/source/backend/plugin/CarlaPluginDSSI.cpp b/source/backend/plugin/CarlaPluginDSSI.cpp index 2fa0fff12..01d535674 100644 --- a/source/backend/plugin/CarlaPluginDSSI.cpp +++ b/source/backend/plugin/CarlaPluginDSSI.cpp @@ -1475,7 +1475,6 @@ public: value = ctrlEvent.value; setDryWet(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, value); - break; } if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) @@ -1483,7 +1482,6 @@ public: value = ctrlEvent.value*127.0f/100.0f; setVolume(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, value); - break; } if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) @@ -1511,7 +1509,6 @@ public: setBalanceRight(right, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, left); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right); - break; } } #endif @@ -1544,13 +1541,8 @@ public: setParameterValue(k, value, false, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast(k), 0, value); - break; } - // check if event is already handled - if (k != pData->param.count) - break; - if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param < MAX_MIDI_CONTROL) { if (midiEventCount >= kPluginMaxMidiEvents) @@ -1565,6 +1557,7 @@ public: seqEvent.data.control.param = ctrlEvent.param; seqEvent.data.control.value = int8_t(ctrlEvent.value*127.0f); } + break; } // case kEngineControlEventTypeParameter diff --git a/source/backend/plugin/CarlaPluginJuce.cpp b/source/backend/plugin/CarlaPluginJuce.cpp index ab6e235ff..ec2bc5b8f 100644 --- a/source/backend/plugin/CarlaPluginJuce.cpp +++ b/source/backend/plugin/CarlaPluginJuce.cpp @@ -766,7 +766,6 @@ public: value = ctrlEvent.value; setDryWet(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, value); - break; } if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) @@ -774,7 +773,6 @@ public: value = ctrlEvent.value*127.0f/100.0f; setVolume(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, value); - break; } if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) @@ -802,7 +800,6 @@ public: setBalanceRight(right, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, left); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right); - break; } } #endif @@ -835,13 +832,8 @@ public: setParameterValue(k, value, false, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast(k), 0, value); - break; } - // check if event is already handled - if (k != pData->param.count) - break; - if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param < MAX_MIDI_CONTROL) { uint8_t midiData[3]; @@ -851,6 +843,7 @@ public: fMidiBuffer.addEvent(midiData, 3, static_cast(event.time)); } + break; } // case kEngineControlEventTypeParameter diff --git a/source/backend/plugin/CarlaPluginLADSPA.cpp b/source/backend/plugin/CarlaPluginLADSPA.cpp index 2bc68f75f..ade264bcb 100644 --- a/source/backend/plugin/CarlaPluginLADSPA.cpp +++ b/source/backend/plugin/CarlaPluginLADSPA.cpp @@ -969,7 +969,6 @@ public: value = ctrlEvent.value; setDryWet(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, value); - break; } if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) @@ -977,7 +976,6 @@ public: value = ctrlEvent.value*127.0f/100.0f; setVolume(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, value); - break; } if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) @@ -1005,7 +1003,6 @@ public: setBalanceRight(right, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, left); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right); - break; } } #endif @@ -1037,8 +1034,8 @@ public: setParameterValue(k, value, false, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast(k), 0, value); - break; } + break; } // case kEngineControlEventTypeParameter diff --git a/source/backend/plugin/CarlaPluginLV2.cpp b/source/backend/plugin/CarlaPluginLV2.cpp index 699a07122..f7c82a0f8 100644 --- a/source/backend/plugin/CarlaPluginLV2.cpp +++ b/source/backend/plugin/CarlaPluginLV2.cpp @@ -3092,7 +3092,6 @@ public: value = ctrlEvent.value; setDryWet(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, value); - break; } if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) @@ -3100,7 +3099,6 @@ public: value = ctrlEvent.value*127.0f/100.0f; setVolume(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, value); - break; } if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) @@ -3128,7 +3126,6 @@ public: setBalanceRight(right, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, left); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right); - break; } } #endif @@ -3161,13 +3158,8 @@ public: setParameterValue(k, value, false, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast(k), 0, value); - break; } - // check if event is already handled - if (k != pData->param.count) - break; - if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param < MAX_MIDI_CONTROL) { uint8_t midiData[3]; @@ -3186,6 +3178,7 @@ public: else if (fEventsIn.ctrl->type & CARLA_EVENT_DATA_MIDI_LL) lv2midi_put_event(&evInMidiStates[fEventsIn.ctrlIndex], mtime, 3, midiData); } + break; } // case kEngineControlEventTypeParameter diff --git a/source/backend/plugin/CarlaPluginNative.cpp b/source/backend/plugin/CarlaPluginNative.cpp index 59c42ed4b..01e5cde84 100644 --- a/source/backend/plugin/CarlaPluginNative.cpp +++ b/source/backend/plugin/CarlaPluginNative.cpp @@ -1584,8 +1584,9 @@ public: nativeEvent.data[2] = uint8_t(ctrlEvent.value*127.0f); nativeEvent.size = 3; } + break; - } + } // case kEngineControlEventTypeParameter case kEngineControlEventTypeMidiBank: if (pData->options & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) diff --git a/source/backend/plugin/CarlaPluginVST2.cpp b/source/backend/plugin/CarlaPluginVST2.cpp index 3298a698e..ce9cdd682 100644 --- a/source/backend/plugin/CarlaPluginVST2.cpp +++ b/source/backend/plugin/CarlaPluginVST2.cpp @@ -1221,7 +1221,6 @@ public: value = ctrlEvent.value; setDryWet(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, value); - break; } if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) @@ -1229,7 +1228,6 @@ public: value = ctrlEvent.value*127.0f/100.0f; setVolume(value, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, value); - break; } if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) @@ -1257,7 +1255,6 @@ public: setBalanceRight(right, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, left); pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right); - break; } } #endif @@ -1290,13 +1287,8 @@ public: setParameterValue(k, value, false, false, false); pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast(k), 0, value); - break; } - // check if event is already handled - if (k != pData->param.count) - break; - if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param < MAX_MIDI_CONTROL) { if (fMidiEventCount >= kPluginMaxMidiEvents*2)