@@ -179,14 +179,14 @@ typedef struct _PluginDescriptor { | |||
const MidiProgram* (*get_midi_program_info)(PluginHandle handle, uint32_t index); | |||
void (*set_parameter_value)(PluginHandle handle, uint32_t index, float value); | |||
void (*set_midi_program)(PluginHandle handle, uint32_t bank, uint32_t program); | |||
void (*set_midi_program)(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program); | |||
void (*set_custom_data)(PluginHandle handle, const char* key, const char* value); | |||
void (*ui_show)(PluginHandle handle, bool show); | |||
void (*ui_idle)(PluginHandle handle); | |||
void (*ui_set_parameter_value)(PluginHandle handle, uint32_t index, float value); | |||
void (*ui_set_midi_program)(PluginHandle handle, uint32_t bank, uint32_t program); | |||
void (*ui_set_midi_program)(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program); | |||
void (*ui_set_custom_data)(PluginHandle handle, const char* key, const char* value); | |||
void (*activate)(PluginHandle handle); | |||
@@ -19,6 +19,7 @@ | |||
#define __CARLA_NATIVE_HPP__ | |||
#include "CarlaNative.h" | |||
#include "CarlaMIDI.h" | |||
#include "CarlaJuceUtils.hpp" | |||
/*! | |||
@@ -203,11 +204,13 @@ protected: | |||
(void)value; | |||
} | |||
virtual void setMidiProgram(const uint32_t bank, const uint32_t program) | |||
virtual void setMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) | |||
{ | |||
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
return; | |||
// unused | |||
(void)channel; | |||
(void)bank; | |||
(void)program; | |||
} | |||
@@ -260,11 +263,13 @@ protected: | |||
(void)value; | |||
} | |||
virtual void uiSetMidiProgram(const uint32_t bank, const uint32_t program) | |||
virtual void uiSetMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) | |||
{ | |||
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
return; | |||
// unused | |||
(void)channel; | |||
(void)bank; | |||
(void)program; | |||
} | |||
@@ -357,9 +362,9 @@ public: | |||
return handlePtr->setParameterValue(index, value); | |||
} | |||
static void _set_midi_program(PluginHandle handle, uint32_t bank, uint32_t program) | |||
static void _set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | |||
{ | |||
return handlePtr->setMidiProgram(bank, program); | |||
return handlePtr->setMidiProgram(channel, bank, program); | |||
} | |||
static void _set_custom_data(PluginHandle handle, const char* key, const char* value) | |||
@@ -382,9 +387,9 @@ public: | |||
return handlePtr->uiSetParameterValue(index, value); | |||
} | |||
static void _ui_set_midi_program(PluginHandle handle, uint32_t bank, uint32_t program) | |||
static void _ui_set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | |||
{ | |||
return handlePtr->uiSetMidiProgram(bank, program); | |||
return handlePtr->uiSetMidiProgram(channel, bank, program); | |||
} | |||
static void _ui_set_custom_data(PluginHandle handle, const char* key, const char* value) | |||
@@ -479,7 +479,7 @@ static void audiofile_set_parameter_value(PluginHandle handle, uint32_t index, f | |||
handlePtr->needsRead = true; | |||
} | |||
static void audiofile_set_program(PluginHandle handle, uint32_t bank, uint32_t program) | |||
static void audiofile_set_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | |||
{ | |||
AudioFileInstance* const handlePtr = (AudioFileInstance*)handle; | |||
@@ -491,6 +491,11 @@ static void audiofile_set_program(PluginHandle handle, uint32_t bank, uint32_t p | |||
audiofile_load_filename(handlePtr, handlePtr->programs.fullNames[program]); | |||
handlePtr->programs.current = program; | |||
} | |||
return; | |||
// unused | |||
(void)channel; | |||
} | |||
static void audiofile_set_custom_data(PluginHandle handle, const char* key, const char* value) | |||
@@ -334,7 +334,7 @@ protected: | |||
} | |||
#if DISTRHO_PLUGIN_WANT_PROGRAMS | |||
void setMidiProgram(const uint32_t bank, const uint32_t program) override | |||
void setMidiProgram(const uint8_t, const uint32_t bank, const uint32_t program) override | |||
{ | |||
const uint32_t realProgram = bank * 128 + program; | |||
@@ -426,7 +426,7 @@ protected: | |||
} | |||
# if DISTRHO_PLUGIN_WANT_PROGRAMS | |||
void uiSetMidiProgram(const uint32_t bank, const uint32_t program) override | |||
void uiSetMidiProgram(const uint8_t, const uint32_t bank, const uint32_t program) override | |||
{ | |||
CARLA_ASSERT(fUiPtr != nullptr); | |||
@@ -220,7 +220,7 @@ protected: | |||
(void)value; | |||
} | |||
void setMidiProgram(const uint32_t bank, const uint32_t program) override | |||
void setMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) override | |||
{ | |||
if (bank >= kMaster->bank.banks.size()) | |||
return; | |||
@@ -230,9 +230,9 @@ protected: | |||
bool isOffline = false; | |||
if (isOffline) | |||
loadProgram(kMaster, bank, program); | |||
loadProgram(kMaster, channel, bank, program); | |||
else | |||
fThread.loadLater(bank, program); | |||
fThread.loadLater(channel, bank, program); | |||
} | |||
void setCustomData(const char* const key, const char* const value) | |||
@@ -385,8 +385,9 @@ private: | |||
CARLA_ASSERT(fQuit); | |||
} | |||
void loadLater(const uint32_t bank, const uint32_t program) | |||
void loadLater(const uint8_t channel, const uint32_t bank, const uint32_t program) | |||
{ | |||
// TODO | |||
fNextBank = bank; | |||
fNextProgram = program; | |||
fChangeProgram = true; | |||
@@ -488,7 +489,7 @@ private: | |||
if (fChangeProgram) | |||
{ | |||
fChangeProgram = false; | |||
loadProgram(kMaster, fNextBank, fNextProgram); | |||
loadProgram(kMaster, 0, fNextBank, fNextProgram); // TODO | |||
fNextBank = 0; | |||
fNextProgram = 0; | |||
} | |||
@@ -626,7 +627,7 @@ public: | |||
pthread_mutex_unlock(&master->mutex); | |||
} | |||
static void loadProgram(Master* const master, const uint32_t bank, const uint32_t program) | |||
static void loadProgram(Master* const master, const uint8_t channel, const uint32_t bank, const uint32_t program) | |||
{ | |||
const std::string& bankdir(master->bank.banks[bank].dir); | |||
@@ -635,9 +636,7 @@ public: | |||
pthread_mutex_lock(&master->mutex); | |||
master->bank.loadbank(bankdir); | |||
for (int i=0; i < NUM_MIDI_PARTS; i++) | |||
master->bank.loadfromslot(program, master->part[i]); | |||
master->bank.loadfromslot(program, master->part[channel]); | |||
master->applyparameters(false); | |||
@@ -610,10 +610,10 @@ public: | |||
const ScopedSingleProcessLocker spl(this, (sendGui || sendOsc || sendCallback)); | |||
fDescriptor->set_midi_program(fHandle, bank, program); | |||
fDescriptor->set_midi_program(fHandle, 0, bank, program); // TODO | |||
if (fHandle2 != nullptr) | |||
fDescriptor->set_midi_program(fHandle2, bank, program); | |||
fDescriptor->set_midi_program(fHandle2, 0, bank, program); // TODO | |||
} | |||
CarlaPlugin::setMidiProgram(index, sendGui, sendOsc, sendCallback); | |||
@@ -650,7 +650,7 @@ public: | |||
if (fDescriptor->ui_set_midi_program != nullptr && kData->midiprog.current >= 0) | |||
{ | |||
const MidiProgramData& mpData = kData->midiprog.getCurrent(); | |||
fDescriptor->ui_set_midi_program(fHandle, mpData.bank, mpData.program); | |||
fDescriptor->ui_set_midi_program(fHandle, 0, mpData.bank, mpData.program); // TODO | |||
} | |||
if (fDescriptor->ui_set_parameter_value != nullptr) | |||
@@ -1869,8 +1869,8 @@ public: | |||
if (index >= kData->midiprog.count) | |||
return; | |||
if (fDescriptor->ui_set_midi_program != nullptr) | |||
fDescriptor->ui_set_midi_program(fHandle, kData->midiprog.data[index].bank, kData->midiprog.data[index].program); | |||
if (fDescriptor->ui_set_midi_program != nullptr) // TODO | |||
fDescriptor->ui_set_midi_program(fHandle, 0, kData->midiprog.data[index].bank, kData->midiprog.data[index].program); | |||
} | |||
void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) override | |||