| @@ -609,6 +609,30 @@ uint32_t get_custom_data_count(unsigned short plugin_id) | |||
| return 0; | |||
| } | |||
| const char* get_parameter_text(unsigned short plugin_id, uint32_t parameter_id) | |||
| { | |||
| qDebug("get_parameter_text(%i, %i)", plugin_id, parameter_id); | |||
| static char buf_text[STR_MAX] = { 0 }; | |||
| memset(buf_text, 0, sizeof(char)*STR_MAX); | |||
| for (unsigned short i=0; i<MAX_PLUGINS; i++) | |||
| { | |||
| CarlaPlugin* plugin = CarlaPlugins[i]; | |||
| if (plugin && plugin->id() == plugin_id) | |||
| { | |||
| if (parameter_id < plugin->param_count()) | |||
| plugin->get_parameter_text(parameter_id, buf_text); | |||
| else | |||
| qCritical("get_parameter_text(%i, %i) - parameter_id out of bounds", plugin_id, parameter_id); | |||
| break; | |||
| } | |||
| } | |||
| return buf_text; | |||
| } | |||
| const char* get_program_name(unsigned short plugin_id, uint32_t program_id) | |||
| { | |||
| qDebug("get_program_name(%i, %i)", plugin_id, program_id); | |||
| @@ -47,6 +47,7 @@ const unsigned int PARAMETER_IS_ENABLED = 0x08; | |||
| const unsigned int PARAMETER_IS_AUTOMABLE = 0x10; | |||
| const unsigned int PARAMETER_USES_SAMPLERATE = 0x20; | |||
| const unsigned int PARAMETER_USES_SCALEPOINTS = 0x40; | |||
| const unsigned int PARAMETER_USES_CUSTOM_TEXT = 0x80; | |||
| enum BinaryType { | |||
| BINARY_NONE = 0, | |||
| @@ -258,6 +259,7 @@ CARLA_EXPORT quint32 get_program_count(unsigned short plugin_id); | |||
| CARLA_EXPORT quint32 get_midi_program_count(unsigned short plugin_id); | |||
| CARLA_EXPORT quint32 get_custom_data_count(unsigned short plugin_id); | |||
| CARLA_EXPORT const char* get_parameter_text(unsigned short plugin_id, uint32_t parameter_id); | |||
| CARLA_EXPORT const char* get_program_name(unsigned short plugin_id, quint32 program_id); | |||
| CARLA_EXPORT const char* get_midi_program_name(unsigned short plugin_id, quint32 midi_program_id); | |||
| CARLA_EXPORT const char* get_real_plugin_name(unsigned short plugin_id); | |||
| @@ -19,9 +19,11 @@ | |||
| #include "carla_plugin.h" | |||
| // Global JACK stuff | |||
| jack_client_t* carla_jack_client = nullptr; | |||
| jack_nframes_t carla_buffer_size = 512; | |||
| jack_nframes_t carla_sample_rate = 44100; | |||
| static jack_client_t* carla_jack_client = nullptr; | |||
| static jack_nframes_t carla_buffer_size = 512; | |||
| static jack_nframes_t carla_sample_rate = 44100; | |||
| static jack_position_t carla_jack_pos; | |||
| static jack_transport_state_t carla_jack_state; | |||
| const char* carla_client_name = nullptr; | |||
| @@ -87,6 +89,10 @@ static int carla_jack_srate_callback(jack_nframes_t new_sample_rate, void*) | |||
| static int carla_jack_process_callback(jack_nframes_t nframes, void* arg) | |||
| { | |||
| // request time info once (arg only null on global client) | |||
| if (carla_jack_client && arg == nullptr) | |||
| carla_jack_state = jack_transport_query(carla_jack_client, &carla_jack_pos); | |||
| #ifndef BUILD_BRIDGE | |||
| if (carla_options.global_jack_client) | |||
| { | |||
| @@ -102,8 +108,6 @@ static int carla_jack_process_callback(jack_nframes_t nframes, void* arg) | |||
| } | |||
| return 0; | |||
| } | |||
| #else | |||
| Q_UNUSED(arg); | |||
| #endif | |||
| #ifdef BUILD_BRIDGE | |||
| @@ -237,7 +241,8 @@ bool carla_jack_register_plugin(CarlaPlugin* plugin, jack_client_t** client) | |||
| return false; | |||
| } | |||
| int carla_jack_max_client_name_size() | |||
| bool carla_jack_transport_query(jack_position_t** pos) | |||
| { | |||
| return jack_client_name_size()-1; | |||
| *pos = &carla_jack_pos; | |||
| return (carla_jack_state != JackTransportStopped); | |||
| } | |||
| @@ -28,6 +28,6 @@ class CarlaPlugin; | |||
| bool carla_jack_init(const char* client_name); | |||
| bool carla_jack_close(); | |||
| bool carla_jack_register_plugin(CarlaPlugin* plugin, jack_client_t** client); | |||
| int carla_jack_max_client_name_size(); | |||
| bool carla_jack_transport_query(jack_position_t** pos); | |||
| #endif // CARLA_JACK_H | |||
| @@ -409,6 +409,11 @@ public: | |||
| *buf_str = 0; | |||
| } | |||
| virtual void get_parameter_text(uint32_t /*param_id*/, char* buf_str) | |||
| { | |||
| *buf_str = 0; | |||
| } | |||
| virtual void get_parameter_scalepoint_label(uint32_t /*param_id*/, uint32_t /*scalepoint_id*/, char* buf_str) | |||
| { | |||
| *buf_str = 0; | |||
| @@ -693,17 +698,6 @@ public: | |||
| { | |||
| prog.current = index; | |||
| // Change default value | |||
| for (uint32_t i=0; i < param.count; i++) | |||
| { | |||
| param.ranges[i].def = get_parameter_value(i); | |||
| #ifndef BUILD_BRIDGE | |||
| if (osc_send) | |||
| osc_global_send_set_default_value(m_id, i, param.ranges[i].def); | |||
| #endif | |||
| } | |||
| #ifndef BUILD_BRIDGE | |||
| if (osc_send) | |||
| { | |||
| @@ -719,25 +713,22 @@ public: | |||
| Q_UNUSED(osc_send); | |||
| Q_UNUSED(callback_send); | |||
| #endif | |||
| } | |||
| virtual void set_midi_program(int32_t index, bool /*gui_send*/, bool osc_send, bool callback_send, bool /*block*/) | |||
| { | |||
| midiprog.current = index; | |||
| // Change default value | |||
| if (m_type != PLUGIN_SF2) | |||
| for (uint32_t i=0; i < param.count; i++) | |||
| { | |||
| for (uint32_t i=0; i < param.count; i++) | |||
| { | |||
| param.ranges[i].def = get_parameter_value(i); | |||
| param.ranges[i].def = get_parameter_value(i); | |||
| #ifndef BUILD_BRIDGE | |||
| if (osc_send) | |||
| osc_global_send_set_default_value(m_id, i, param.ranges[i].def); | |||
| if (osc_send) | |||
| osc_global_send_set_default_value(m_id, i, param.ranges[i].def); | |||
| #endif | |||
| } | |||
| } | |||
| } | |||
| virtual void set_midi_program(int32_t index, bool /*gui_send*/, bool osc_send, bool callback_send, bool /*block*/) | |||
| { | |||
| midiprog.current = index; | |||
| #ifndef BUILD_BRIDGE | |||
| if (osc_send) | |||
| @@ -754,6 +745,21 @@ public: | |||
| Q_UNUSED(osc_send); | |||
| Q_UNUSED(callback_send); | |||
| #endif | |||
| // SF2 never change defaults | |||
| if (m_type != PLUGIN_SF2) | |||
| return; | |||
| // Change default value | |||
| for (uint32_t i=0; i < param.count; i++) | |||
| { | |||
| param.ranges[i].def = get_parameter_value(i); | |||
| #ifndef BUILD_BRIDGE | |||
| if (osc_send) | |||
| osc_global_send_set_default_value(m_id, i, param.ranges[i].def); | |||
| #endif | |||
| } | |||
| } | |||
| virtual void set_gui_data(int /*data*/, void* /*ptr*/) | |||
| @@ -51,7 +51,7 @@ QMutex carla_proc_lock_var; | |||
| QMutex carla_midi_lock_var; | |||
| // define max possible client name | |||
| const unsigned short max_client_name_size = carla_jack_max_client_name_size() - 5; // 5 = strlen(" (10)") | |||
| const unsigned short max_client_name_size = jack_client_name_size() - 1 - 5; // 5 = strlen(" (10)") | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // Exported symbols (API) | |||
| @@ -174,7 +174,8 @@ public: | |||
| void set_chunk_data(const char* string_data) | |||
| { | |||
| QByteArray chunk = QByteArray::fromBase64(string_data); | |||
| static QByteArray chunk; | |||
| chunk = QByteArray::fromBase64(string_data); | |||
| descriptor->set_custom_data(handle, chunk.data(), chunk.size()); | |||
| } | |||
| @@ -183,8 +184,10 @@ public: | |||
| if (! descriptor->select_program) | |||
| return; | |||
| // TODO - don't block when freewheeling | |||
| if (index >= 0) | |||
| { | |||
| // block plugin so we don't change programs during run() | |||
| short _id = m_id; | |||
| if (block) | |||
| @@ -659,9 +662,9 @@ public: | |||
| for (i=0; i < midiprog.count; i++) | |||
| osc_global_send_set_midi_program_data(m_id, i, midiprog.data[i].bank, midiprog.data[i].program, midiprog.data[i].name); | |||
| #endif | |||
| callback_action(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0); | |||
| #endif | |||
| if (init) | |||
| { | |||
| @@ -947,8 +950,8 @@ public: | |||
| if (jack_midi_event_get(&min_event, min_buffer, k) != 0) | |||
| break; | |||
| jack_midi_data_t status = min_event.buffer[0]; | |||
| unsigned char channel = status & 0x0F; | |||
| jack_midi_data_t status = min_event.buffer[0]; | |||
| jack_midi_data_t channel = status & 0x0F; | |||
| // Fix bad note-off | |||
| if (MIDI_IS_STATUS_NOTE_ON(status) && min_event.buffer[2] == 0) | |||
| @@ -20,19 +20,6 @@ | |||
| #include "ladspa/ladspa.h" | |||
| #include "ladspa_rdf.h" | |||
| #if 0 | |||
| short add_plugin_dssi(const char* filename, const char* label, const void* extra_stuff); | |||
| int main() | |||
| { | |||
| short id = add_plugin_dssi("/usr/lib/dssi/calf.so", "eq5", nullptr); | |||
| set_active(id, true); | |||
| carla_sleep(3); | |||
| remove_plugin(id); | |||
| return 0; | |||
| } | |||
| #endif | |||
| bool is_rdf_port_good(int Type1, int Type2) | |||
| { | |||
| if (LADSPA_IS_PORT_INPUT(Type1) && ! LADSPA_IS_PORT_INPUT(Type2)) | |||