Browse Source

Implement MAP_PROGRAM_CHANGES on plugins; fix VST program changes

tags/1.9.4
falkTX 11 years ago
parent
commit
a4c146850c
6 changed files with 20 additions and 28 deletions
  1. +7
    -3
      source/backend/native/zynaddsubfx.cpp
  2. +2
    -2
      source/backend/plugin/DssiPlugin.cpp
  3. +2
    -2
      source/backend/plugin/FluidSynthPlugin.cpp
  4. +2
    -2
      source/backend/plugin/LinuxSamplerPlugin.cpp
  5. +2
    -2
      source/backend/plugin/NativePlugin.cpp
  6. +5
    -17
      source/backend/plugin/VstPlugin.cpp

+ 7
- 3
source/backend/native/zynaddsubfx.cpp View File

@@ -174,14 +174,16 @@ protected:
if (program >= BANK_SIZE)
return;

const std::string bankdir(kMaster->bank.banks[bank].dir);
const std::string& bankdir(kMaster->bank.banks[bank].dir);

if (! bankdir.empty())
{
pthread_mutex_lock(&kMaster->mutex);

kMaster->bank.loadbank(bankdir);
kMaster->bank.loadfromslot(program, kMaster->part[0]);

for (int i=0; i < NUM_MIDI_PARTS; i++)
kMaster->bank.loadfromslot(program, kMaster->part[i]);

pthread_mutex_unlock(&kMaster->mutex);
}
@@ -192,7 +194,9 @@ protected:

void activate()
{
kMaster->setController(0, MIDI_CONTROL_ALL_SOUND_OFF, 0);
// broken
//for (int i=0; i < NUM_MIDI_PARTS; i++)
// kMaster->setController(0, MIDI_CONTROL_ALL_SOUND_OFF, 0);
}

void process(float**, float** const outBuffer, const uint32_t frames, const uint32_t midiEventCount, const MidiEvent* const midiEvents)


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

@@ -1178,12 +1178,12 @@ public:
}

case kEngineControlEventTypeMidiBank:
if (event.channel == kData->ctrlChannel)
if (event.channel == kData->ctrlChannel && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
nextBankId = ctrlEvent.param;
break;

case kEngineControlEventTypeMidiProgram:
if (event.channel == kData->ctrlChannel)
if (event.channel == kData->ctrlChannel && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
{
const uint32_t nextProgramId = ctrlEvent.param;



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

@@ -1065,12 +1065,12 @@ public:
}

case kEngineControlEventTypeMidiBank:
if (event.channel < 16)
if (event.channel < 16 && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
nextBankIds[event.channel] = ctrlEvent.param;
break;

case kEngineControlEventTypeMidiProgram:
if (event.channel < 16)
if (event.channel < 16 && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
{
const uint32_t bankId = nextBankIds[event.channel];
const uint32_t progId = ctrlEvent.param;


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

@@ -656,12 +656,12 @@ public:
}

case kEngineControlEventTypeMidiBank:
if (event.channel == kData->ctrlChannel)
if (event.channel == kData->ctrlChannel && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
nextBankId = ctrlEvent.param;
break;

case kEngineControlEventTypeMidiProgram:
if (event.channel == kData->ctrlChannel)
if (event.channel == kData->ctrlChannel && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
{
const uint32_t nextProgramId = ctrlEvent.param;



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

@@ -1347,12 +1347,12 @@ public:
}

case kEngineControlEventTypeMidiBank:
if (event.channel == kData->ctrlChannel)
if (event.channel == kData->ctrlChannel && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
nextBankId = ctrlEvent.param;
break;

case kEngineControlEventTypeMidiProgram:
if (event.channel == kData->ctrlChannel)
if (event.channel == kData->ctrlChannel && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
{
const uint32_t nextProgramId = ctrlEvent.param;



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

@@ -1070,10 +1070,6 @@ public:
uint32_t startTime = 0;
uint32_t timeOffset = 0;

uint32_t nextBankId = 0;
if (kData->midiprog.current >= 0 && kData->midiprog.count > 0)
nextBankId = kData->midiprog.data[kData->midiprog.current].bank;

for (i=0; i < nEvents; i++)
{
const EngineEvent& event = kData->event.portIn->getEvent(i);
@@ -1095,7 +1091,6 @@ public:
fMidiEventCount = 0;
}

nextBankId = 0;
timeOffset = time;
}
else
@@ -1203,23 +1198,16 @@ public:
}

case kEngineControlEventTypeMidiBank:
if (event.channel == kData->ctrlChannel)
nextBankId = ctrlEvent.param;
break;

case kEngineControlEventTypeMidiProgram:
if (event.channel == kData->ctrlChannel)
if (event.channel == kData->ctrlChannel && (fOptions & PLUGIN_OPTION_MAP_PROGRAM_CHANGES) != 0)
{
const uint32_t nextProgramId = ctrlEvent.param;

for (k=0; k < kData->midiprog.count; k++)
if (ctrlEvent.param < kData->prog.count)
{
if (kData->midiprog.data[k].bank == nextBankId && kData->midiprog.data[k].program == nextProgramId)
{
setMidiProgram(k, false, false, false);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, k, 0, 0.0f);
break;
}
setProgram(ctrlEvent.param, false, false, false);
postponeRtEvent(kPluginPostRtEventMidiProgramChange, ctrlEvent.param, 0, 0.0f);
break;
}
}
break;


Loading…
Cancel
Save