Browse Source

Cleanup

tags/1.9.4
falkTX 11 years ago
parent
commit
647c8502b8
6 changed files with 108 additions and 73 deletions
  1. +31
    -21
      source/backend/plugin/DssiPlugin.cpp
  2. +28
    -17
      source/backend/plugin/FluidSynthPlugin.cpp
  3. +2
    -2
      source/backend/plugin/LadspaPlugin.cpp
  4. +15
    -11
      source/backend/plugin/LinuxSamplerPlugin.cpp
  5. +30
    -22
      source/backend/plugin/NativePlugin.cpp
  6. +2
    -0
      source/backend/plugin/VstPlugin.cpp

+ 31
- 21
source/backend/plugin/DssiPlugin.cpp View File

@@ -471,6 +471,8 @@ public:
const LADSPA_PortDescriptor portType = fDescriptor->PortDescriptors[i]; const LADSPA_PortDescriptor portType = fDescriptor->PortDescriptors[i];
const LADSPA_PortRangeHint portRangeHints = fDescriptor->PortRangeHints[i]; const LADSPA_PortRangeHint portRangeHints = fDescriptor->PortRangeHints[i];


CARLA_ASSERT(fDescriptor->PortNames[i] != nullptr);

if (LADSPA_IS_PORT_AUDIO(portType)) if (LADSPA_IS_PORT_AUDIO(portType))
{ {
portName.clear(); portName.clear();
@@ -948,7 +950,7 @@ public:


if (kData->needsReset || ! kData->activeBefore) if (kData->needsReset || ! kData->activeBefore)
{ {
if (kData->event.portIn != nullptr)
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{ {
for (unsigned char j=0, l=MAX_MIDI_CHANNELS; j < MAX_MIDI_CHANNELS; j++) for (unsigned char j=0, l=MAX_MIDI_CHANNELS; j < MAX_MIDI_CHANNELS; j++)
{ {
@@ -1181,7 +1183,7 @@ public:
if (kData->midiprog.data[k].bank == nextBankId && kData->midiprog.data[k].program == nextProgramId) if (kData->midiprog.data[k].bank == nextBankId && kData->midiprog.data[k].program == nextProgramId)
{ {
setMidiProgram(k, false, false, false); setMidiProgram(k, false, false, false);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0f);
break; break;
} }
} }
@@ -1192,7 +1194,10 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
sendMidiAllNotesOff(); sendMidiAllNotesOff();
allNotesOffSent = true;
}


if (fDescriptor->deactivate != nullptr) if (fDescriptor->deactivate != nullptr)
{ {
@@ -1210,24 +1215,25 @@ public:
fDescriptor->activate(fHandle2); fDescriptor->activate(fHandle2);
} }


postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0);

allNotesOffSent = true;
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0f);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0f);
} }


if (midiEventCount >= MAX_MIDI_EVENTS) if (midiEventCount >= MAX_MIDI_EVENTS)
continue; continue;


carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);


fMidiEvents[midiEventCount].time.tick = sampleAccurate ? startTime : time;
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 = MIDI_CONTROL_ALL_SOUND_OFF;
fMidiEvents[midiEventCount].type = SND_SEQ_EVENT_CONTROLLER;
fMidiEvents[midiEventCount].data.control.channel = event.channel;
fMidiEvents[midiEventCount].data.control.param = MIDI_CONTROL_ALL_SOUND_OFF;


midiEventCount += 1;
midiEventCount += 1;
}


break; break;


@@ -1235,23 +1241,27 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOff(); sendMidiAllNotesOff();

allNotesOffSent = true;
}
} }


if (midiEventCount >= MAX_MIDI_EVENTS) if (midiEventCount >= MAX_MIDI_EVENTS)
continue; continue;


carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
carla_zeroStruct<snd_seq_event_t>(fMidiEvents[midiEventCount]);


fMidiEvents[midiEventCount].time.tick = sampleAccurate ? startTime : time;
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 = MIDI_CONTROL_ALL_NOTES_OFF;
fMidiEvents[midiEventCount].type = SND_SEQ_EVENT_CONTROLLER;
fMidiEvents[midiEventCount].data.control.channel = event.channel;
fMidiEvents[midiEventCount].data.control.param = MIDI_CONTROL_ALL_NOTES_OFF;


midiEventCount += 1;
midiEventCount += 1;
}


break; break;
} }
@@ -1285,7 +1295,7 @@ public:
fMidiEvents[midiEventCount].data.note.channel = channel; fMidiEvents[midiEventCount].data.note.channel = channel;
fMidiEvents[midiEventCount].data.note.note = note; fMidiEvents[midiEventCount].data.note.note = note;


postponeRtEvent(kPluginPostRtEventNoteOff, channel, note, 0.0);
postponeRtEvent(kPluginPostRtEventNoteOff, channel, note, 0.0f);
} }
else if (MIDI_IS_STATUS_NOTE_ON(status)) else if (MIDI_IS_STATUS_NOTE_ON(status))
{ {


+ 28
- 17
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -886,15 +886,18 @@ public:


if (kData->needsReset || ! kData->activeBefore) if (kData->needsReset || ! kData->activeBefore)
{ {
for (int c=0; c < MAX_MIDI_CHANNELS; c++)
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{ {
for (int c=0; c < MAX_MIDI_CHANNELS; c++)
{
#ifdef FLUIDSYNTH_VERSION_NEW_API #ifdef FLUIDSYNTH_VERSION_NEW_API
fluid_synth_all_notes_off(fSynth, c);
fluid_synth_all_sounds_off(fSynth, c);
fluid_synth_all_notes_off(fSynth, c);
fluid_synth_all_sounds_off(fSynth, c);
#else #else
fluid_synth_cc(f_synth, c, MIDI_CONTROL_ALL_SOUND_OFF, 0);
fluid_synth_cc(f_synth, c, MIDI_CONTROL_ALL_NOTES_OFF, 0);
fluid_synth_cc(f_synth, c, MIDI_CONTROL_ALL_SOUND_OFF, 0);
fluid_synth_cc(f_synth, c, MIDI_CONTROL_ALL_NOTES_OFF, 0);
#endif #endif
}
} }


kData->needsReset = false; kData->needsReset = false;
@@ -1079,7 +1082,7 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
setMidiProgram(k, false, false, false); setMidiProgram(k, false, false, false);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0f);
} }
else else
fluid_synth_program_select(fSynth, event.channel, fSynthId, bankId, progId); fluid_synth_program_select(fSynth, event.channel, fSynthId, bankId, progId);
@@ -1094,18 +1097,22 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOff(); sendMidiAllNotesOff();
}


postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0);

allNotesOffSent = true;
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0f);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0f);


if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifdef FLUIDSYNTH_VERSION_NEW_API #ifdef FLUIDSYNTH_VERSION_NEW_API
fluid_synth_all_sounds_off(fSynth, event.channel);
fluid_synth_all_sounds_off(fSynth, event.channel);
#else #else
fluid_synth_cc(f_synth, event.channel, MIDI_CONTROL_ALL_SOUND_OFF, 0);
fluid_synth_cc(f_synth, event.channel, MIDI_CONTROL_ALL_SOUND_OFF, 0);
#endif #endif
}
} }
break; break;


@@ -1113,15 +1120,19 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOff(); sendMidiAllNotesOff();
}


allNotesOffSent = true;
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
#ifdef FLUIDSYNTH_VERSION_NEW_API #ifdef FLUIDSYNTH_VERSION_NEW_API
fluid_synth_all_notes_off(fSynth, event.channel);
fluid_synth_all_notes_off(fSynth, event.channel);
#else #else
fluid_synth_cc(f_synth, event.channel, MIDI_CONTROL_ALL_NOTES_OFF, 0);
fluid_synth_cc(f_synth, event.channel, MIDI_CONTROL_ALL_NOTES_OFF, 0);
#endif #endif
}
} }
break; break;
} }
@@ -1146,7 +1157,7 @@ public:


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


postponeRtEvent(kPluginPostRtEventNoteOff, channel, note, 0.0);
postponeRtEvent(kPluginPostRtEventNoteOff, channel, note, 0.0f);
} }
else if (MIDI_IS_STATUS_NOTE_ON(status)) else if (MIDI_IS_STATUS_NOTE_ON(status))
{ {


+ 2
- 2
source/backend/plugin/LadspaPlugin.cpp View File

@@ -986,8 +986,8 @@ public:
fDescriptor->activate(fHandle2); fDescriptor->activate(fHandle2);
} }


postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0f);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0f);
} }
break; break;




+ 15
- 11
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -472,7 +472,7 @@ public:


if (kData->needsReset || ! kData->activeBefore) if (kData->needsReset || ! kData->activeBefore)
{ {
if (kData->event.portIn != nullptr)
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{ {
for (k=0, i=MAX_MIDI_CHANNELS; k < MAX_MIDI_CHANNELS; k++) for (k=0, i=MAX_MIDI_CHANNELS; k < MAX_MIDI_CHANNELS; k++)
{ {
@@ -670,7 +670,7 @@ public:
if (kData->midiprog.data[k].bank == nextBankId && kData->midiprog.data[k].program == nextProgramId) if (kData->midiprog.data[k].bank == nextBankId && kData->midiprog.data[k].program == nextProgramId)
{ {
setMidiProgram(k, false, false, false); setMidiProgram(k, false, false, false);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0f);
break; break;
} }
} }
@@ -681,18 +681,20 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOff(); sendMidiAllNotesOff();
}


fAudioOutputDevice->Stop(); fAudioOutputDevice->Stop();
fAudioOutputDevice->Play(); fAudioOutputDevice->Play();


postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0);

allNotesOffSent = true;
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0f);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0f);
} }


fMidiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_SOUND_OFF, 0, k, sampleAccurate ? startTime : time);
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
fMidiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_SOUND_OFF, 0, k, sampleAccurate ? startTime : time);


break; break;


@@ -700,12 +702,14 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOff(); sendMidiAllNotesOff();

allNotesOffSent = true;
}
} }


fMidiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_NOTES_OFF, 0, k, sampleAccurate ? startTime : time);
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
fMidiInputPort->DispatchControlChange(MIDI_CONTROL_ALL_NOTES_OFF, 0, k, sampleAccurate ? startTime : time);


break; break;
} }
@@ -732,7 +736,7 @@ public:


fMidiInputPort->DispatchNoteOff(note, 0, channel, fragmentPos); fMidiInputPort->DispatchNoteOff(note, 0, channel, fragmentPos);


postponeRtEvent(kPluginPostRtEventNoteOff, channel, note, 0.0);
postponeRtEvent(kPluginPostRtEventNoteOff, channel, note, 0.0f);
} }
else if (MIDI_IS_STATUS_NOTE_ON(status)) else if (MIDI_IS_STATUS_NOTE_ON(status))
{ {


+ 30
- 22
source/backend/plugin/NativePlugin.cpp View File

@@ -1061,9 +1061,9 @@ public:
// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
// Check if not active before // Check if not active before


if (! kData->activeBefore)
if (kData->needsReset || ! kData->activeBefore)
{ {
if (kData->event.portIn != nullptr)
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{ {
for (k=0, i=MAX_MIDI_CHANNELS; k < MAX_MIDI_CHANNELS; k++) for (k=0, i=MAX_MIDI_CHANNELS; k < MAX_MIDI_CHANNELS; k++)
{ {
@@ -1304,7 +1304,7 @@ public:
if (kData->midiprog.data[k].bank == nextBankId && kData->midiprog.data[k].program == nextProgramId) if (kData->midiprog.data[k].bank == nextBankId && kData->midiprog.data[k].program == nextProgramId)
{ {
setMidiProgram(k, false, false, false); setMidiProgram(k, false, false, false);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0f);
break; break;
} }
} }
@@ -1315,7 +1315,10 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOff(); sendMidiAllNotesOff();
}


if (fDescriptor->deactivate != nullptr) if (fDescriptor->deactivate != nullptr)
{ {
@@ -1333,22 +1336,23 @@ public:
fDescriptor->activate(fHandle2); fDescriptor->activate(fHandle2);
} }


postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0);

allNotesOffSent = true;
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 0.0f);
postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_ACTIVE, 0, 1.0f);
} }


if (fMidiEventCount >= MAX_MIDI_EVENTS*2) if (fMidiEventCount >= MAX_MIDI_EVENTS*2)
continue; 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] = MIDI_CONTROL_ALL_SOUND_OFF;
fMidiEvents[fMidiEventCount].data[2] = 0;
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
fMidiEvents[fMidiEventCount].port = 0;
fMidiEvents[fMidiEventCount].time = sampleAccurate ? startTime : time;
fMidiEvents[fMidiEventCount].data[0] = MIDI_STATUS_CONTROL_CHANGE + event.channel;
fMidiEvents[fMidiEventCount].data[1] = MIDI_CONTROL_ALL_SOUND_OFF;
fMidiEvents[fMidiEventCount].data[2] = 0;


fMidiEventCount += 1;
fMidiEventCount += 1;
}


break; break;


@@ -1356,21 +1360,25 @@ public:
if (event.channel == kData->ctrlChannel) if (event.channel == kData->ctrlChannel)
{ {
if (! allNotesOffSent) if (! allNotesOffSent)
{
allNotesOffSent = true;
sendMidiAllNotesOff(); sendMidiAllNotesOff();

allNotesOffSent = true;
}
} }


if (fMidiEventCount >= MAX_MIDI_EVENTS*2) if (fMidiEventCount >= MAX_MIDI_EVENTS*2)
continue; 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] = MIDI_CONTROL_ALL_NOTES_OFF;
fMidiEvents[fMidiEventCount].data[2] = 0;
if (fOptions & PLUGIN_OPTION_SEND_ALL_SOUND_OFF)
{
fMidiEvents[fMidiEventCount].port = 0;
fMidiEvents[fMidiEventCount].time = sampleAccurate ? startTime : time;
fMidiEvents[fMidiEventCount].data[0] = MIDI_STATUS_CONTROL_CHANGE + event.channel;
fMidiEvents[fMidiEventCount].data[1] = MIDI_CONTROL_ALL_NOTES_OFF;
fMidiEvents[fMidiEventCount].data[2] = 0;


fMidiEventCount += 1;
fMidiEventCount += 1;
}


break; break;
} }
@@ -1413,7 +1421,7 @@ public:
if (status == MIDI_STATUS_NOTE_ON) if (status == MIDI_STATUS_NOTE_ON)
postponeRtEvent(kPluginPostRtEventNoteOn, channel, midiEvent.data[1], midiEvent.data[2]); postponeRtEvent(kPluginPostRtEventNoteOn, channel, midiEvent.data[1], midiEvent.data[2]);
else if (status == MIDI_STATUS_NOTE_OFF) else if (status == MIDI_STATUS_NOTE_OFF)
postponeRtEvent(kPluginPostRtEventNoteOff, channel, midiEvent.data[1], 0.0);
postponeRtEvent(kPluginPostRtEventNoteOff, channel, midiEvent.data[1], 0.0f);


break; break;
} }


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

@@ -97,6 +97,8 @@ public:
dispatcher(effStopProcess, 0, 0, nullptr, 0.0f); dispatcher(effStopProcess, 0, 0, nullptr, 0.0f);
dispatcher(effMainsChanged, 0, 0, nullptr, 0.0f); dispatcher(effMainsChanged, 0, 0, nullptr, 0.0f);
dispatcher(effClose, 0, 0, nullptr, 0.0f); dispatcher(effClose, 0, 0, nullptr, 0.0f);

fEffect = nullptr;
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------


Loading…
Cancel
Save