Browse Source

Finally implement PLUGIN_OPTION_SEND_CONTROL_CHANGES

tags/1.9.4
falkTX 11 years ago
parent
commit
8932a21c76
6 changed files with 69 additions and 0 deletions
  1. +10
    -0
      source/backend/plugin/BridgePlugin.cpp
  2. +17
    -0
      source/backend/plugin/DssiPlugin.cpp
  3. +5
    -0
      source/backend/plugin/FluidSynthPlugin.cpp
  4. +5
    -0
      source/backend/plugin/LinuxSamplerPlugin.cpp
  5. +15
    -0
      source/backend/plugin/NativePlugin.cpp
  6. +17
    -0
      source/backend/plugin/VstPlugin.cpp

+ 10
- 0
source/backend/plugin/BridgePlugin.cpp View File

@@ -778,6 +778,16 @@ public:
postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}

if ((fOptions & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
rdwr_writeOpcode(&fShmControl.data->ringBuffer, kPluginBridgeOpcodeMidiEvent);
rdwr_writeLong(&fShmControl.data->ringBuffer, event.time);
rdwr_writeInt(&fShmControl.data->ringBuffer, 3);
rdwr_writeChar(&fShmControl.data->ringBuffer, MIDI_STATUS_CONTROL_CHANGE + event.channel);
rdwr_writeChar(&fShmControl.data->ringBuffer, ctrlEvent.param);
rdwr_writeChar(&fShmControl.data->ringBuffer, ctrlEvent.value*127.0f);
}

break;
}



+ 17
- 0
source/backend/plugin/DssiPlugin.cpp View File

@@ -1196,6 +1196,23 @@ public:
postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}

if ((fOptions & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
if (midiEventCount >= MAX_MIDI_EVENTS)
continue;

carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);

fMidiEvents[midiEventCount].time.tick = sampleAccurate ? startTime : time;

fMidiEvents[midiEventCount].type = SND_SEQ_EVENT_CONTROLLER;
fMidiEvents[midiEventCount].data.control.channel = event.channel;
fMidiEvents[midiEventCount].data.control.param = ctrlEvent.param;
fMidiEvents[midiEventCount].data.control.value = ctrlEvent.value*127.0f;

midiEventCount += 1;
}

break;
}



+ 5
- 0
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -1190,6 +1190,11 @@ public:
postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}

if ((fOptions & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
fluid_synth_cc(fSynth, event.channel, ctrlEvent.param, ctrlEvent.value*127.0f);
}

break;
}



+ 5
- 0
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -701,6 +701,11 @@ public:
postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}

if ((fOptions & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
fMidiInputPort->DispatchControlChange(ctrlEvent.param, ctrlEvent.value*127.0f, event.channel, sampleAccurate ? startTime : time);
}

break;
}



+ 15
- 0
source/backend/plugin/NativePlugin.cpp View File

@@ -1498,6 +1498,21 @@ public:
postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}

if ((fOptions & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
if (fMidiEventCount >= MAX_MIDI_EVENTS*2)
continue;

fMidiEvents[fMidiEventCount].port = 0;
fMidiEvents[fMidiEventCount].time = sampleAccurate ? startTime : time;
fMidiEvents[fMidiEventCount].data[0] = MIDI_STATUS_CONTROL_CHANGE + event.channel;
fMidiEvents[fMidiEventCount].data[1] = ctrlEvent.param;
fMidiEvents[fMidiEventCount].data[2] = ctrlEvent.value*127.0f;
fMidiEvents[fMidiEventCount].size = 3;

fMidiEventCount += 1;
}

break;
}



+ 17
- 0
source/backend/plugin/VstPlugin.cpp View File

@@ -1279,6 +1279,23 @@ public:
postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value);
}

if ((fOptions & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param <= 0x5F)
{
if (fMidiEventCount >= MAX_MIDI_EVENTS*2)
continue;

carla_zeroStruct<VstMidiEvent>(fMidiEvents[fMidiEventCount]);

fMidiEvents[fMidiEventCount].type = kVstMidiType;
fMidiEvents[fMidiEventCount].byteSize = sizeof(VstMidiEvent);
fMidiEvents[fMidiEventCount].midiData[0] = MIDI_STATUS_CONTROL_CHANGE + event.channel;
fMidiEvents[fMidiEventCount].midiData[1] = ctrlEvent.param;
fMidiEvents[fMidiEventCount].midiData[2] = ctrlEvent.value*127.0f;
fMidiEvents[fMidiEventCount].deltaFrames = sampleAccurate ? startTime : time;

fMidiEventCount += 1;
}

break;
}



Loading…
Cancel
Save