| @@ -33,6 +33,8 @@ | |||||
| #include <QtCore/QMutex> | #include <QtCore/QMutex> | ||||
| #include <QtCore/QString> | #include <QtCore/QString> | ||||
| // TODO - check and try '#ifndef BUILD_BRIDGE' in all global_jack_client | |||||
| #define CARLA_PROCESS_CONTINUE_CHECK if (m_id != plugin_id) { return callback_action(CALLBACK_DEBUG, plugin_id, m_id, 0, 0.0); } | #define CARLA_PROCESS_CONTINUE_CHECK if (m_id != plugin_id) { return callback_action(CALLBACK_DEBUG, plugin_id, m_id, 0, 0.0); } | ||||
| const unsigned short MAX_POST_EVENTS = 128; | const unsigned short MAX_POST_EVENTS = 128; | ||||
| @@ -652,7 +654,7 @@ public: | |||||
| { | { | ||||
| } | } | ||||
| virtual void set_program(uint32_t index, bool, bool osc_send, bool callback_send, bool) | |||||
| virtual void set_program(int32_t index, bool, bool osc_send, bool callback_send, bool) | |||||
| { | { | ||||
| prog.current = index; | prog.current = index; | ||||
| @@ -683,7 +685,7 @@ public: | |||||
| callback_action(CALLBACK_PROGRAM_CHANGED, m_id, prog.current, 0, 0.0); | callback_action(CALLBACK_PROGRAM_CHANGED, m_id, prog.current, 0, 0.0); | ||||
| } | } | ||||
| virtual void set_midi_program(uint32_t index, bool, bool osc_send, bool callback_send, bool) | |||||
| virtual void set_midi_program(int32_t index, bool, bool osc_send, bool callback_send, bool) | |||||
| { | { | ||||
| midiprog.current = index; | midiprog.current = index; | ||||
| @@ -754,11 +756,11 @@ public: | |||||
| callback_action(onoff ? CALLBACK_NOTE_ON : CALLBACK_NOTE_OFF, m_id, note, velo, 0.0); | callback_action(onoff ? CALLBACK_NOTE_ON : CALLBACK_NOTE_OFF, m_id, note, velo, 0.0); | ||||
| } | } | ||||
| virtual void set_gui_data(int, void*) | |||||
| virtual void set_gui_data(int /*data*/, void* /*ptr*/) | |||||
| { | { | ||||
| } | } | ||||
| virtual void show_gui(bool) | |||||
| virtual void show_gui(bool /*yesno*/) | |||||
| { | { | ||||
| } | } | ||||
| @@ -211,20 +211,23 @@ public: | |||||
| descriptor->set_custom_data(handle, chunk.data(), chunk.size()); | descriptor->set_custom_data(handle, chunk.data(), chunk.size()); | ||||
| } | } | ||||
| virtual void set_midi_program(uint32_t index, bool gui_send, bool osc_send, bool callback_send, bool block) | |||||
| virtual void set_midi_program(int32_t index, bool gui_send, bool osc_send, bool callback_send, bool block) | |||||
| { | { | ||||
| if (! descriptor->select_program) | if (! descriptor->select_program) | ||||
| return; | return; | ||||
| // TODO - go for id -1 so we don't block audio | |||||
| if (block) carla_proc_lock(); | |||||
| descriptor->select_program(handle, midiprog.data[index].bank, midiprog.data[index].program); | |||||
| if (block) carla_proc_unlock(); | |||||
| if (index >= 0) | |||||
| { | |||||
| // TODO - go for id -1 so we don't block audio | |||||
| if (block) carla_proc_lock(); | |||||
| descriptor->select_program(handle, midiprog.data[index].bank, midiprog.data[index].program); | |||||
| if (block) carla_proc_unlock(); | |||||
| #ifndef BUILD_BRIDGE | #ifndef BUILD_BRIDGE | ||||
| if (gui_send) | |||||
| osc_send_program_as_midi(&osc.data, midiprog.data[index].bank, midiprog.data[index].program); | |||||
| if (gui_send) | |||||
| osc_send_program_as_midi(&osc.data, midiprog.data[index].bank, midiprog.data[index].program); | |||||
| #endif | #endif | ||||
| } | |||||
| CarlaPlugin::set_midi_program(index, gui_send, osc_send, callback_send, block); | CarlaPlugin::set_midi_program(index, gui_send, osc_send, callback_send, block); | ||||
| } | } | ||||
| @@ -315,6 +318,7 @@ public: | |||||
| if (LADSPA_IS_PORT_AUDIO(PortType)) | if (LADSPA_IS_PORT_AUDIO(PortType)) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (carla_options.global_jack_client) | if (carla_options.global_jack_client) | ||||
| { | { | ||||
| strcpy(port_name, m_name); | strcpy(port_name, m_name); | ||||
| @@ -322,6 +326,7 @@ public: | |||||
| strncat(port_name, ldescriptor->PortNames[i], port_name_size/2); | strncat(port_name, ldescriptor->PortNames[i], port_name_size/2); | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| strncpy(port_name, ldescriptor->PortNames[i], port_name_size/2); | strncpy(port_name, ldescriptor->PortNames[i], port_name_size/2); | ||||
| if (LADSPA_IS_PORT_INPUT(PortType)) | if (LADSPA_IS_PORT_INPUT(PortType)) | ||||
| @@ -530,12 +535,14 @@ public: | |||||
| if (needs_cin) | if (needs_cin) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (carla_options.global_jack_client) | if (carla_options.global_jack_client) | ||||
| { | { | ||||
| strcpy(port_name, m_name); | strcpy(port_name, m_name); | ||||
| strcat(port_name, ":control-in"); | strcat(port_name, ":control-in"); | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| strcpy(port_name, "control-in"); | strcpy(port_name, "control-in"); | ||||
| param.port_cin = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | param.port_cin = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | ||||
| @@ -543,12 +550,14 @@ public: | |||||
| if (needs_cout) | if (needs_cout) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (carla_options.global_jack_client) | if (carla_options.global_jack_client) | ||||
| { | { | ||||
| strcpy(port_name, m_name); | strcpy(port_name, m_name); | ||||
| strcat(port_name, ":control-out"); | strcat(port_name, ":control-out"); | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| strcpy(port_name, "control-out"); | strcpy(port_name, "control-out"); | ||||
| param.port_cout = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); | param.port_cout = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); | ||||
| @@ -556,12 +565,14 @@ public: | |||||
| if (mins == 1) | if (mins == 1) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (carla_options.global_jack_client) | if (carla_options.global_jack_client) | ||||
| { | { | ||||
| strcpy(port_name, m_name); | strcpy(port_name, m_name); | ||||
| strcat(port_name, ":midi-in"); | strcat(port_name, ":midi-in"); | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| strcpy(port_name, "midi-in"); | strcpy(port_name, "midi-in"); | ||||
| midi.port_min = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | midi.port_min = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | ||||
| @@ -335,6 +335,7 @@ public: | |||||
| if (LADSPA_IS_PORT_AUDIO(PortType)) | if (LADSPA_IS_PORT_AUDIO(PortType)) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (carla_options.global_jack_client) | if (carla_options.global_jack_client) | ||||
| { | { | ||||
| strcpy(port_name, m_name); | strcpy(port_name, m_name); | ||||
| @@ -342,6 +343,7 @@ public: | |||||
| strncat(port_name, descriptor->PortNames[i], port_name_size/2); | strncat(port_name, descriptor->PortNames[i], port_name_size/2); | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| strncpy(port_name, descriptor->PortNames[i], port_name_size/2); | strncpy(port_name, descriptor->PortNames[i], port_name_size/2); | ||||
| if (LADSPA_IS_PORT_INPUT(PortType)) | if (LADSPA_IS_PORT_INPUT(PortType)) | ||||
| @@ -549,12 +551,14 @@ public: | |||||
| if (needs_cin) | if (needs_cin) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (carla_options.global_jack_client) | if (carla_options.global_jack_client) | ||||
| { | { | ||||
| strcpy(port_name, m_name); | strcpy(port_name, m_name); | ||||
| strcat(port_name, ":control-in"); | strcat(port_name, ":control-in"); | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| strcpy(port_name, "control-in"); | strcpy(port_name, "control-in"); | ||||
| param.port_cin = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | param.port_cin = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | ||||
| @@ -562,12 +566,14 @@ public: | |||||
| if (needs_cout) | if (needs_cout) | ||||
| { | { | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (carla_options.global_jack_client) | if (carla_options.global_jack_client) | ||||
| { | { | ||||
| strcpy(port_name, m_name); | strcpy(port_name, m_name); | ||||
| strcat(port_name, ":control-out"); | strcat(port_name, ":control-out"); | ||||
| } | } | ||||
| else | else | ||||
| #endif | |||||
| strcpy(port_name, "control-out"); | strcpy(port_name, "control-out"); | ||||
| param.port_cout = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); | param.port_cout = jack_port_register(jack_client, port_name, JACK_DEFAULT_MIDI_TYPE, JackPortIsOutput, 0); | ||||
| @@ -15,6 +15,10 @@ | |||||
| * For a full copy of the GNU General Public License see the COPYING file | * For a full copy of the GNU General Public License see the COPYING file | ||||
| */ | */ | ||||
| #ifdef BUILD_BRIDGE | |||||
| #error You should not use bridge for soundfonts | |||||
| #endif | |||||
| #include "carla_plugin.h" | #include "carla_plugin.h" | ||||
| #include <fluidsynth.h> | #include <fluidsynth.h> | ||||
| @@ -261,9 +265,10 @@ public: | |||||
| CarlaPlugin::set_parameter_value(param_id, value, gui_send, osc_send, callback_send); | CarlaPlugin::set_parameter_value(param_id, value, gui_send, osc_send, callback_send); | ||||
| } | } | ||||
| virtual void set_midi_program(uint32_t index, bool gui_send, bool osc_send, bool callback_send, bool block) | |||||
| virtual void set_midi_program(int32_t index, bool gui_send, bool osc_send, bool callback_send, bool block) | |||||
| { | { | ||||
| fluid_synth_program_select(f_synth, 0, f_id, midiprog.data[index].bank, midiprog.data[index].program); | |||||
| if (index >= 0) | |||||
| fluid_synth_program_select(f_synth, 0, f_id, midiprog.data[index].bank, midiprog.data[index].program); | |||||
| CarlaPlugin::set_midi_program(index, gui_send, osc_send, callback_send, block); | CarlaPlugin::set_midi_program(index, gui_send, osc_send, callback_send, block); | ||||
| } | } | ||||
| @@ -1033,6 +1038,18 @@ public: | |||||
| m_active_before = m_active; | m_active_before = m_active; | ||||
| } | } | ||||
| virtual void delete_buffers() | |||||
| { | |||||
| qDebug("Sf2Plugin::delete_buffers() - start"); | |||||
| if (param.count > 0) | |||||
| delete[] param_buffers; | |||||
| param_buffers = nullptr; | |||||
| qDebug("Sf2Plugin::delete_buffers() - end"); | |||||
| } | |||||
| bool init(const char* filename, const char* label) | bool init(const char* filename, const char* label) | ||||
| { | { | ||||
| f_id = fluid_synth_sfload(f_synth, filename, 0); | f_id = fluid_synth_sfload(f_synth, filename, 0); | ||||