| @@ -330,7 +330,7 @@ const PortCountInfo* get_parameter_count_info(unsigned short plugin_id) | |||||
| return &info; | return &info; | ||||
| } | } | ||||
| const ParameterInfo* get_parameter_info(unsigned short plugin_id, quint32 parameter_id) | |||||
| const ParameterInfo* get_parameter_info(unsigned short plugin_id, uint32_t parameter_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_parameter_info(%i, %i)", plugin_id, parameter_id); | qDebug("CarlaBackendStandalone::get_parameter_info(%i, %i)", plugin_id, parameter_id); | ||||
| @@ -388,7 +388,7 @@ const ParameterInfo* get_parameter_info(unsigned short plugin_id, quint32 parame | |||||
| return &info; | return &info; | ||||
| } | } | ||||
| const ScalePointInfo* get_parameter_scalepoint_info(unsigned short plugin_id, quint32 parameter_id, quint32 scalepoint_id) | |||||
| const ScalePointInfo* get_parameter_scalepoint_info(unsigned short plugin_id, uint32_t parameter_id, uint32_t scalepoint_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_parameter_scalepoint_info(%i, %i, %i)", plugin_id, parameter_id, scalepoint_id); | qDebug("CarlaBackendStandalone::get_parameter_scalepoint_info(%i, %i, %i)", plugin_id, parameter_id, scalepoint_id); | ||||
| @@ -453,7 +453,7 @@ const GuiInfo* get_gui_info(unsigned short plugin_id) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| const CarlaBackend::ParameterData* get_parameter_data(unsigned short plugin_id, quint32 parameter_id) | |||||
| const CarlaBackend::ParameterData* get_parameter_data(unsigned short plugin_id, uint32_t parameter_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_parameter_data(%i, %i)", plugin_id, parameter_id); | qDebug("CarlaBackendStandalone::get_parameter_data(%i, %i)", plugin_id, parameter_id); | ||||
| @@ -474,7 +474,7 @@ const CarlaBackend::ParameterData* get_parameter_data(unsigned short plugin_id, | |||||
| return &data; | return &data; | ||||
| } | } | ||||
| const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_id, quint32 parameter_id) | |||||
| const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_id, uint32_t parameter_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_parameter_ranges(%i, %i)", plugin_id, parameter_id); | qDebug("CarlaBackendStandalone::get_parameter_ranges(%i, %i)", plugin_id, parameter_id); | ||||
| @@ -495,7 +495,7 @@ const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_ | |||||
| return &ranges; | return &ranges; | ||||
| } | } | ||||
| const CarlaBackend::midi_program_t* get_midi_program_data(unsigned short plugin_id, quint32 midi_program_id) | |||||
| const CarlaBackend::midi_program_t* get_midi_program_data(unsigned short plugin_id, uint32_t midi_program_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_midi_program_data(%i, %i)", plugin_id, midi_program_id); | qDebug("CarlaBackendStandalone::get_midi_program_data(%i, %i)", plugin_id, midi_program_id); | ||||
| @@ -516,7 +516,7 @@ const CarlaBackend::midi_program_t* get_midi_program_data(unsigned short plugin_ | |||||
| return &data; | return &data; | ||||
| } | } | ||||
| const CarlaBackend::CustomData* get_custom_data(unsigned short plugin_id, quint32 custom_data_id) | |||||
| const CarlaBackend::CustomData* get_custom_data(unsigned short plugin_id, uint32_t custom_data_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_custom_data(%i, %i)", plugin_id, custom_data_id); | qDebug("CarlaBackendStandalone::get_custom_data(%i, %i)", plugin_id, custom_data_id); | ||||
| @@ -637,7 +637,7 @@ uint32_t get_custom_data_count(unsigned short plugin_id) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| const char* get_parameter_text(unsigned short plugin_id, quint32 parameter_id) | |||||
| const char* get_parameter_text(unsigned short plugin_id, uint32_t parameter_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_parameter_text(%i, %i)", plugin_id, parameter_id); | qDebug("CarlaBackendStandalone::get_parameter_text(%i, %i)", plugin_id, parameter_id); | ||||
| @@ -664,7 +664,7 @@ const char* get_parameter_text(unsigned short plugin_id, quint32 parameter_id) | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| const char* get_program_name(unsigned short plugin_id, quint32 program_id) | |||||
| const char* get_program_name(unsigned short plugin_id, uint32_t program_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_program_name(%i, %i)", plugin_id, program_id); | qDebug("CarlaBackendStandalone::get_program_name(%i, %i)", plugin_id, program_id); | ||||
| @@ -703,7 +703,7 @@ const char* get_program_name(unsigned short plugin_id, quint32 program_id) | |||||
| return nullptr; | return nullptr; | ||||
| } | } | ||||
| const char* get_midi_program_name(unsigned short plugin_id, quint32 midi_program_id) | |||||
| const char* get_midi_program_name(unsigned short plugin_id, uint32_t midi_program_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_midi_program_name(%i, %i)", plugin_id, midi_program_id); | qDebug("CarlaBackendStandalone::get_midi_program_name(%i, %i)", plugin_id, midi_program_id); | ||||
| @@ -776,7 +776,7 @@ const char* get_real_plugin_name(unsigned short plugin_id) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| qint32 get_current_program_index(unsigned short plugin_id) | |||||
| int32_t get_current_program_index(unsigned short plugin_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_current_program_index(%i)", plugin_id); | qDebug("CarlaBackendStandalone::get_current_program_index(%i)", plugin_id); | ||||
| @@ -789,7 +789,7 @@ qint32 get_current_program_index(unsigned short plugin_id) | |||||
| return -1; | return -1; | ||||
| } | } | ||||
| qint32 get_current_midi_program_index(unsigned short plugin_id) | |||||
| int32_t get_current_midi_program_index(unsigned short plugin_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_current_midi_program_index(%i)", plugin_id); | qDebug("CarlaBackendStandalone::get_current_midi_program_index(%i)", plugin_id); | ||||
| @@ -804,7 +804,7 @@ qint32 get_current_midi_program_index(unsigned short plugin_id) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| double get_default_parameter_value(unsigned short plugin_id, quint32 parameter_id) | |||||
| double get_default_parameter_value(unsigned short plugin_id, uint32_t parameter_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_default_parameter_value(%i, %i)", plugin_id, parameter_id); | qDebug("CarlaBackendStandalone::get_default_parameter_value(%i, %i)", plugin_id, parameter_id); | ||||
| @@ -823,7 +823,7 @@ double get_default_parameter_value(unsigned short plugin_id, quint32 parameter_i | |||||
| return 0.0; | return 0.0; | ||||
| } | } | ||||
| double get_current_parameter_value(unsigned short plugin_id, quint32 parameter_id) | |||||
| double get_current_parameter_value(unsigned short plugin_id, uint32_t parameter_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_current_parameter_value(%i, %i)", plugin_id, parameter_id); | qDebug("CarlaBackendStandalone::get_current_parameter_value(%i, %i)", plugin_id, parameter_id); | ||||
| @@ -926,7 +926,7 @@ void set_balance_right(unsigned short plugin_id, double value) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| void set_parameter_value(unsigned short plugin_id, quint32 parameter_id, double value) | |||||
| void set_parameter_value(unsigned short plugin_id, uint32_t parameter_id, double value) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::set_parameter_value(%i, %i, %g)", plugin_id, parameter_id, value); | qDebug("CarlaBackendStandalone::set_parameter_value(%i, %i, %g)", plugin_id, parameter_id, value); | ||||
| @@ -944,7 +944,7 @@ void set_parameter_value(unsigned short plugin_id, quint32 parameter_id, double | |||||
| qCritical("CarlaBackendStandalone::set_parameter_value(%i, %i, %g) - could not find plugin", plugin_id, parameter_id, value); | qCritical("CarlaBackendStandalone::set_parameter_value(%i, %i, %g) - could not find plugin", plugin_id, parameter_id, value); | ||||
| } | } | ||||
| void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, quint8 channel) | |||||
| void set_parameter_midi_channel(unsigned short plugin_id, uint32_t parameter_id, uint8_t channel) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i)", plugin_id, parameter_id, channel); | qDebug("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i)", plugin_id, parameter_id, channel); | ||||
| @@ -968,7 +968,7 @@ void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, | |||||
| qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, channel); | qCritical("CarlaBackendStandalone::set_parameter_midi_channel(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, channel); | ||||
| } | } | ||||
| void set_parameter_midi_cc(unsigned short plugin_id, quint32 parameter_id, int16_t cc) | |||||
| void set_parameter_midi_cc(unsigned short plugin_id, uint32_t parameter_id, int16_t cc) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i)", plugin_id, parameter_id, cc); | qDebug("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i)", plugin_id, parameter_id, cc); | ||||
| @@ -996,7 +996,7 @@ void set_parameter_midi_cc(unsigned short plugin_id, quint32 parameter_id, int16 | |||||
| qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, cc); | qCritical("CarlaBackendStandalone::set_parameter_midi_cc(%i, %i, %i) - could not find plugin", plugin_id, parameter_id, cc); | ||||
| } | } | ||||
| void set_program(unsigned short plugin_id, quint32 program_id) | |||||
| void set_program(unsigned short plugin_id, uint32_t program_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::set_program(%i, %i)", plugin_id, program_id); | qDebug("CarlaBackendStandalone::set_program(%i, %i)", plugin_id, program_id); | ||||
| @@ -1014,7 +1014,7 @@ void set_program(unsigned short plugin_id, quint32 program_id) | |||||
| qCritical("CarlaBackendStandalone::set_program(%i, %i) - could not find plugin", plugin_id, program_id); | qCritical("CarlaBackendStandalone::set_program(%i, %i) - could not find plugin", plugin_id, program_id); | ||||
| } | } | ||||
| void set_midi_program(unsigned short plugin_id, quint32 midi_program_id) | |||||
| void set_midi_program(unsigned short plugin_id, uint32_t midi_program_id) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::set_midi_program(%i, %i)", plugin_id, midi_program_id); | qDebug("CarlaBackendStandalone::set_midi_program(%i, %i)", plugin_id, midi_program_id); | ||||
| @@ -1064,23 +1064,23 @@ void set_chunk_data(unsigned short plugin_id, const char* chunk_data) | |||||
| qCritical("CarlaBackendStandalone::set_chunk_data(%i, \"%s\") - could not find plugin", plugin_id, chunk_data); | qCritical("CarlaBackendStandalone::set_chunk_data(%i, \"%s\") - could not find plugin", plugin_id, chunk_data); | ||||
| } | } | ||||
| void set_gui_data(unsigned short plugin_id, int data, quintptr gui_addr) | |||||
| void set_gui_data(unsigned short plugin_id, uintptr_t gui_addr) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::set_gui_data(%i, %i, " P_UINTPTR ")", plugin_id, data, gui_addr); | |||||
| qDebug("CarlaBackendStandalone::set_gui_data(%i, " P_UINTPTR ")", plugin_id, gui_addr); | |||||
| CarlaBackend::CarlaPlugin* const plugin = carlaEngine->getPlugin(plugin_id); | CarlaBackend::CarlaPlugin* const plugin = carlaEngine->getPlugin(plugin_id); | ||||
| if (plugin) | if (plugin) | ||||
| { | { | ||||
| #ifdef __WINE__ | #ifdef __WINE__ | ||||
| plugin->setGuiData(data, (HWND)gui_addr); | |||||
| plugin->setGuiData((HWND)gui_addr); | |||||
| #else | #else | ||||
| plugin->setGuiData(data, (QDialog*)CarlaBackend::getPointer(gui_addr)); | |||||
| plugin->setGuiData((QDialog*)CarlaBackend::getPointer(gui_addr)); | |||||
| #endif | #endif | ||||
| return; | return; | ||||
| } | } | ||||
| qCritical("CarlaBackendStandalone::set_gui_data(%i, %i, " P_UINTPTR ") - could not find plugin", plugin_id, data, gui_addr); | |||||
| qCritical("CarlaBackendStandalone::set_gui_data(%i, " P_UINTPTR ") - could not find plugin", plugin_id, gui_addr); | |||||
| } | } | ||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| @@ -1104,7 +1104,7 @@ void idle_guis() | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| void send_midi_note(unsigned short plugin_id, quint8 channel, quint8 note, quint8 velocity) | |||||
| void send_midi_note(unsigned short plugin_id, uint8_t channel, uint8_t note, uint8_t velocity) | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::send_midi_note(%i, %i, %i, %i)", plugin_id, channel, note, velocity); | qDebug("CarlaBackendStandalone::send_midi_note(%i, %i, %i, %i)", plugin_id, channel, note, velocity); | ||||
| @@ -1130,7 +1130,7 @@ void prepare_for_save(unsigned short plugin_id) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| quint32 get_buffer_size() | |||||
| uint32_t get_buffer_size() | |||||
| { | { | ||||
| qDebug("CarlaBackendStandalone::get_buffer_size()"); | qDebug("CarlaBackendStandalone::get_buffer_size()"); | ||||
| @@ -1456,7 +1456,7 @@ void run_tests_standalone(short idMax) | |||||
| //set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, nullptr, nullptr); | //set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, nullptr, nullptr); | ||||
| set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, "", ""); | set_custom_data(id, CarlaBackend::CUSTOM_DATA_INVALID, "", ""); | ||||
| set_chunk_data(id, nullptr); | set_chunk_data(id, nullptr); | ||||
| set_gui_data(id, 0, (quintptr)1); | |||||
| set_gui_data(id, 0, (uintptr_t)1); | |||||
| qDebug("------------------- TEST @%i: gui stuff --------------------", id); | qDebug("------------------- TEST @%i: gui stuff --------------------", id); | ||||
| show_gui(id, false); | show_gui(id, false); | ||||
| @@ -1519,7 +1519,7 @@ int main(int argc, char* argv[]) | |||||
| //const GuiInfo* const guiInfo = get_gui_info(id); | //const GuiInfo* const guiInfo = get_gui_info(id); | ||||
| //if (guiInfo->type == CarlaBackend::GUI_INTERNAL_QT4 || guiInfo->type == CarlaBackend::GUI_INTERNAL_X11) | //if (guiInfo->type == CarlaBackend::GUI_INTERNAL_QT4 || guiInfo->type == CarlaBackend::GUI_INTERNAL_X11) | ||||
| //{ | //{ | ||||
| // set_gui_data(id, 0, (quintptr)gui); | |||||
| // set_gui_data(id, 0, (uintptr_t)gui); | |||||
| //gui->show(); | //gui->show(); | ||||
| //} | //} | ||||
| @@ -18,6 +18,8 @@ | |||||
| #ifndef CARLA_BACKEND_STANDALONE_H | #ifndef CARLA_BACKEND_STANDALONE_H | ||||
| #define CARLA_BACKEND_STANDALONE_H | #define CARLA_BACKEND_STANDALONE_H | ||||
| #include <cstdint> | |||||
| #include "carla_backend.h" | #include "carla_backend.h" | ||||
| /*! | /*! | ||||
| @@ -52,9 +54,9 @@ struct PluginInfo { | |||||
| }; | }; | ||||
| struct PortCountInfo { | struct PortCountInfo { | ||||
| quint32 ins; | |||||
| quint32 outs; | |||||
| quint32 total; | |||||
| uint32_t ins; | |||||
| uint32_t outs; | |||||
| uint32_t total; | |||||
| PortCountInfo() | PortCountInfo() | ||||
| : ins(0), | : ins(0), | ||||
| @@ -66,7 +68,7 @@ struct ParameterInfo { | |||||
| const char* name; | const char* name; | ||||
| const char* symbol; | const char* symbol; | ||||
| const char* unit; | const char* unit; | ||||
| quint32 scalePointCount; | |||||
| uint32_t scalePointCount; | |||||
| ParameterInfo() | ParameterInfo() | ||||
| : name(nullptr), | : name(nullptr), | ||||
| @@ -94,44 +96,44 @@ struct GuiInfo { | |||||
| }; | }; | ||||
| CARLA_EXPORT unsigned int get_engine_driver_count(); | CARLA_EXPORT unsigned int get_engine_driver_count(); | ||||
| CARLA_EXPORT const char* get_engine_driver_name(unsigned int index); | |||||
| CARLA_EXPORT const char* get_engine_driver_name(unsigned int index); | |||||
| CARLA_EXPORT bool engine_init(const char* driver_name, const char* client_name); | CARLA_EXPORT bool engine_init(const char* driver_name, const char* client_name); | ||||
| CARLA_EXPORT bool engine_close(); | CARLA_EXPORT bool engine_close(); | ||||
| CARLA_EXPORT bool is_engine_running(); | CARLA_EXPORT bool is_engine_running(); | ||||
| CARLA_EXPORT short add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* name, const char* label, void* extra_stuff); | CARLA_EXPORT short add_plugin(CarlaBackend::BinaryType btype, CarlaBackend::PluginType ptype, const char* filename, const char* name, const char* label, void* extra_stuff); | ||||
| CARLA_EXPORT bool remove_plugin(unsigned short plugin_id); | |||||
| CARLA_EXPORT bool remove_plugin(unsigned short plugin_id); | |||||
| CARLA_EXPORT const PluginInfo* get_plugin_info(unsigned short plugin_id); | CARLA_EXPORT const PluginInfo* get_plugin_info(unsigned short plugin_id); | ||||
| CARLA_EXPORT const PortCountInfo* get_audio_port_count_info(unsigned short plugin_id); | CARLA_EXPORT const PortCountInfo* get_audio_port_count_info(unsigned short plugin_id); | ||||
| CARLA_EXPORT const PortCountInfo* get_midi_port_count_info(unsigned short plugin_id); | CARLA_EXPORT const PortCountInfo* get_midi_port_count_info(unsigned short plugin_id); | ||||
| CARLA_EXPORT const PortCountInfo* get_parameter_count_info(unsigned short plugin_id); | CARLA_EXPORT const PortCountInfo* get_parameter_count_info(unsigned short plugin_id); | ||||
| CARLA_EXPORT const ParameterInfo* get_parameter_info(unsigned short plugin_id, quint32 parameter_id); | |||||
| CARLA_EXPORT const ScalePointInfo* get_parameter_scalepoint_info(unsigned short plugin_id, quint32 parameter_id, quint32 scalepoint_id); | |||||
| CARLA_EXPORT const ParameterInfo* get_parameter_info(unsigned short plugin_id, uint32_t parameter_id); | |||||
| CARLA_EXPORT const ScalePointInfo* get_parameter_scalepoint_info(unsigned short plugin_id, uint32_t parameter_id, uint32_t scalepoint_id); | |||||
| CARLA_EXPORT const GuiInfo* get_gui_info(unsigned short plugin_id); | CARLA_EXPORT const GuiInfo* get_gui_info(unsigned short plugin_id); | ||||
| CARLA_EXPORT const CarlaBackend::ParameterData* get_parameter_data(unsigned short plugin_id, quint32 parameter_id); | |||||
| CARLA_EXPORT const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_id, quint32 parameter_id); | |||||
| CARLA_EXPORT const CarlaBackend::midi_program_t* get_midi_program_data(unsigned short plugin_id, quint32 midi_program_id); | |||||
| CARLA_EXPORT const CarlaBackend::CustomData* get_custom_data(unsigned short plugin_id, quint32 custom_data_id); | |||||
| CARLA_EXPORT const CarlaBackend::ParameterData* get_parameter_data(unsigned short plugin_id, uint32_t parameter_id); | |||||
| CARLA_EXPORT const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_id, uint32_t parameter_id); | |||||
| CARLA_EXPORT const CarlaBackend::midi_program_t* get_midi_program_data(unsigned short plugin_id, uint32_t midi_program_id); | |||||
| CARLA_EXPORT const CarlaBackend::CustomData* get_custom_data(unsigned short plugin_id, uint32_t custom_data_id); | |||||
| CARLA_EXPORT const char* get_chunk_data(unsigned short plugin_id); | CARLA_EXPORT const char* get_chunk_data(unsigned short plugin_id); | ||||
| CARLA_EXPORT quint32 get_parameter_count(unsigned short plugin_id); | |||||
| 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 uint32_t get_parameter_count(unsigned short plugin_id); | |||||
| CARLA_EXPORT uint32_t get_program_count(unsigned short plugin_id); | |||||
| CARLA_EXPORT uint32_t get_midi_program_count(unsigned short plugin_id); | |||||
| CARLA_EXPORT uint32_t get_custom_data_count(unsigned short plugin_id); | |||||
| CARLA_EXPORT const char* get_parameter_text(unsigned short plugin_id, quint32 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_parameter_text(unsigned short plugin_id, uint32_t parameter_id); | |||||
| CARLA_EXPORT const char* get_program_name(unsigned short plugin_id, uint32_t program_id); | |||||
| CARLA_EXPORT const char* get_midi_program_name(unsigned short plugin_id, uint32_t midi_program_id); | |||||
| CARLA_EXPORT const char* get_real_plugin_name(unsigned short plugin_id); | CARLA_EXPORT const char* get_real_plugin_name(unsigned short plugin_id); | ||||
| CARLA_EXPORT qint32 get_current_program_index(unsigned short plugin_id); | |||||
| CARLA_EXPORT qint32 get_current_midi_program_index(unsigned short plugin_id); | |||||
| CARLA_EXPORT int32_t get_current_program_index(unsigned short plugin_id); | |||||
| CARLA_EXPORT int32_t get_current_midi_program_index(unsigned short plugin_id); | |||||
| CARLA_EXPORT double get_default_parameter_value(unsigned short plugin_id, quint32 parameter_id); | |||||
| CARLA_EXPORT double get_current_parameter_value(unsigned short plugin_id, quint32 parameter_id); | |||||
| CARLA_EXPORT double get_default_parameter_value(unsigned short plugin_id, uint32_t parameter_id); | |||||
| CARLA_EXPORT double get_current_parameter_value(unsigned short plugin_id, uint32_t parameter_id); | |||||
| CARLA_EXPORT double get_input_peak_value(unsigned short plugin_id, unsigned short port_id); | CARLA_EXPORT double get_input_peak_value(unsigned short plugin_id, unsigned short port_id); | ||||
| CARLA_EXPORT double get_output_peak_value(unsigned short plugin_id, unsigned short port_id); | CARLA_EXPORT double get_output_peak_value(unsigned short plugin_id, unsigned short port_id); | ||||
| @@ -142,24 +144,24 @@ CARLA_EXPORT void set_volume(unsigned short plugin_id, double value); | |||||
| CARLA_EXPORT void set_balance_left(unsigned short plugin_id, double value); | CARLA_EXPORT void set_balance_left(unsigned short plugin_id, double value); | ||||
| CARLA_EXPORT void set_balance_right(unsigned short plugin_id, double value); | CARLA_EXPORT void set_balance_right(unsigned short plugin_id, double value); | ||||
| CARLA_EXPORT void set_parameter_value(unsigned short plugin_id, quint32 parameter_id, double value); | |||||
| CARLA_EXPORT void set_parameter_midi_channel(unsigned short plugin_id, quint32 parameter_id, quint8 channel); | |||||
| CARLA_EXPORT void set_parameter_midi_cc(unsigned short plugin_id, quint32 parameter_id, qint16 cc); | |||||
| CARLA_EXPORT void set_program(unsigned short plugin_id, quint32 program_id); | |||||
| CARLA_EXPORT void set_midi_program(unsigned short plugin_id, quint32 midi_program_id); | |||||
| CARLA_EXPORT void set_parameter_value(unsigned short plugin_id, uint32_t parameter_id, double value); | |||||
| CARLA_EXPORT void set_parameter_midi_channel(unsigned short plugin_id, uint32_t parameter_id, uint8_t channel); | |||||
| CARLA_EXPORT void set_parameter_midi_cc(unsigned short plugin_id, uint32_t parameter_id, int16_t cc); | |||||
| CARLA_EXPORT void set_program(unsigned short plugin_id, uint32_t program_id); | |||||
| CARLA_EXPORT void set_midi_program(unsigned short plugin_id, uint32_t midi_program_id); | |||||
| CARLA_EXPORT void set_custom_data(unsigned short plugin_id, CarlaBackend::CustomDataType dtype, const char* key, const char* value); | CARLA_EXPORT void set_custom_data(unsigned short plugin_id, CarlaBackend::CustomDataType dtype, const char* key, const char* value); | ||||
| CARLA_EXPORT void set_chunk_data(unsigned short plugin_id, const char* chunk_data); | CARLA_EXPORT void set_chunk_data(unsigned short plugin_id, const char* chunk_data); | ||||
| CARLA_EXPORT void set_gui_data(unsigned short plugin_id, int data, quintptr gui_addr); | |||||
| CARLA_EXPORT void set_gui_data(unsigned short plugin_id, uintptr_t gui_addr); | |||||
| CARLA_EXPORT void show_gui(unsigned short plugin_id, bool yesno); | CARLA_EXPORT void show_gui(unsigned short plugin_id, bool yesno); | ||||
| CARLA_EXPORT void idle_guis(); | CARLA_EXPORT void idle_guis(); | ||||
| CARLA_EXPORT void send_midi_note(unsigned short plugin_id, quint8 channel, quint8 note, quint8 velocity); | |||||
| CARLA_EXPORT void send_midi_note(unsigned short plugin_id, uint8_t channel, uint8_t note, uint8_t velocity); | |||||
| CARLA_EXPORT void prepare_for_save(unsigned short plugin_id); | CARLA_EXPORT void prepare_for_save(unsigned short plugin_id); | ||||
| CARLA_EXPORT quint32 get_buffer_size(); | |||||
| CARLA_EXPORT double get_sample_rate(); | |||||
| CARLA_EXPORT uint32_t get_buffer_size(); | |||||
| CARLA_EXPORT double get_sample_rate(); | |||||
| CARLA_EXPORT const char* get_last_error(); | CARLA_EXPORT const char* get_last_error(); | ||||
| CARLA_EXPORT const char* get_host_osc_url(); | CARLA_EXPORT const char* get_host_osc_url(); | ||||
| @@ -1286,9 +1286,8 @@ public: | |||||
| * | * | ||||
| * \note This function must be always called from the main thread. | * \note This function must be always called from the main thread. | ||||
| */ | */ | ||||
| virtual void setGuiData(const int data, const GuiDataHandle handle) | |||||
| virtual void setGuiData(const GuiDataHandle handle) | |||||
| { | { | ||||
| Q_UNUSED(data); | |||||
| Q_UNUSED(handle); | Q_UNUSED(handle); | ||||
| } | } | ||||
| @@ -1315,13 +1314,13 @@ public: | |||||
| if (m_hints & PLUGIN_USES_SINGLE_THREAD) | if (m_hints & PLUGIN_USES_SINGLE_THREAD) | ||||
| { | { | ||||
| // Process postponed events | // Process postponed events | ||||
| //postEventsRun(); | |||||
| postEventsRun(); | |||||
| // Update parameter outputs | // Update parameter outputs | ||||
| for (uint32_t i=0; i < param.count; i++) | for (uint32_t i=0; i < param.count; i++) | ||||
| { | { | ||||
| //if (param.data[i].type == PARAMETER_OUTPUT) | |||||
| // uiParameterChange(i, getParameterValue(i)); | |||||
| if (param.data[i].type == PARAMETER_OUTPUT) | |||||
| uiParameterChange(i, getParameterValue(i)); | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -385,12 +385,12 @@ const char* getBinaryBidgePath(const BinaryType type) | |||||
| // ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
| void* getPointer(const quintptr addr) | |||||
| void* getPointer(const uintptr_t addr) | |||||
| { | { | ||||
| Q_ASSERT(addr != 0); | Q_ASSERT(addr != 0); | ||||
| //qDebug("CarlaBackend::getPointer(" P_UINTPTR ")", addr); | |||||
| qDebug("CarlaBackend::getPointer(" P_UINTPTR ")", addr); | |||||
| quintptr* const ptr = (quintptr*)addr; | |||||
| uintptr_t* const ptr = (uintptr_t*)addr; | |||||
| return (void*)ptr; | return (void*)ptr; | ||||
| } | } | ||||
| @@ -43,7 +43,7 @@ CustomDataType getCustomDataStringType(const char* const stype); | |||||
| const char* getCustomDataTypeString(const CustomDataType type); | const char* getCustomDataTypeString(const CustomDataType type); | ||||
| const char* getBinaryBidgePath(const BinaryType type); | const char* getBinaryBidgePath(const BinaryType type); | ||||
| void* getPointer(const quintptr addr); | |||||
| void* getPointer(const uintptr_t addr); | |||||
| PluginCategory getPluginCategoryFromName(const char* const name); | PluginCategory getPluginCategoryFromName(const char* const name); | ||||
| const char* getLastError(); | const char* getLastError(); | ||||
| @@ -876,7 +876,7 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Set gui stuff | // Set gui stuff | ||||
| void setGuiData(const int, const GuiDataHandle handle) | |||||
| void setGuiData(const GuiDataHandle handle) | |||||
| { | { | ||||
| switch(gui.type) | switch(gui.type) | ||||
| { | { | ||||
| @@ -20,6 +20,9 @@ | |||||
| #ifndef __WINE__ | #ifndef __WINE__ | ||||
| #include <QtGui/QDialog> | #include <QtGui/QDialog> | ||||
| #ifdef Q_WS_X11 | |||||
| #include <QtGui/QX11Info> | |||||
| #endif | |||||
| #endif | #endif | ||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -329,23 +332,27 @@ public: | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Set gui stuff | // Set gui stuff | ||||
| void setGuiData(const int data, const GuiDataHandle handle) | |||||
| void setGuiData(const GuiDataHandle handle) | |||||
| { | { | ||||
| qDebug("VstPlugin::setGuiData(%i, %p)", data, handle); | |||||
| qDebug("VstPlugin::setGuiData(%p)", handle); | |||||
| Q_ASSERT(handle); | Q_ASSERT(handle); | ||||
| if (gui.type == GUI_EXTERNAL_OSC) | if (gui.type == GUI_EXTERNAL_OSC) | ||||
| return; | return; | ||||
| int32_t value = 0; | |||||
| #ifdef Q_WS_X11 | |||||
| value = (int64_t)QX11Info::display(); | |||||
| #endif | |||||
| #ifdef __WINE__ | #ifdef __WINE__ | ||||
| if (effect->dispatcher(effect, effEditOpen, 0, data, handle, 0.0f) == 1) | |||||
| if (effect->dispatcher(effect, effEditOpen, 0, value, handle, 0.0f) == 1) | |||||
| #else | #else | ||||
| const QDialog* const dialog = handle; | const QDialog* const dialog = handle; | ||||
| if (effect->dispatcher(effect, effEditOpen, 0, data, (void*)dialog->winId(), 0.0f) == 1) | |||||
| if (effect->dispatcher(effect, effEditOpen, 0, value, (void*)dialog->winId(), 0.0f) == 1) | |||||
| #endif | #endif | ||||
| { | { | ||||
| ERect* vstRect = nullptr; | ERect* vstRect = nullptr; | ||||
| effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f); | effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f); | ||||
| if (vstRect) | if (vstRect) | ||||
| @@ -355,7 +362,7 @@ public: | |||||
| if (width <= 0 || height <= 0) | if (width <= 0 || height <= 0) | ||||
| { | { | ||||
| qCritical("VstPlugin::setGuiData(%i, %p) - failed to get proper window size", data, handle); | |||||
| qCritical("VstPlugin::setGuiData(%p) - failed to get proper window size", handle); | |||||
| return; | return; | ||||
| } | } | ||||
| @@ -363,7 +370,7 @@ public: | |||||
| gui.height = height; | gui.height = height; | ||||
| } | } | ||||
| else | else | ||||
| qCritical("VstPlugin::setGuiData(%i, %p) - failed to get plugin window size", data, handle); | |||||
| qCritical("VstPlugin::setGuiData(%p) - failed to get plugin window size", handle); | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| @@ -1398,7 +1405,7 @@ public: | |||||
| postponeEvent(PluginPostEventParameterChange, index, 0, value); | postponeEvent(PluginPostEventParameterChange, index, 0, value); | ||||
| } | } | ||||
| else | else | ||||
| setParameterValue(index, value, true, true, true); | |||||
| setParameterValue(index, value, true, true, true); // FIXME - dont send to GUI? | |||||
| } | } | ||||
| intptr_t handleAudioMasterGetCurrentProcessLevel() | intptr_t handleAudioMasterGetCurrentProcessLevel() | ||||
| @@ -1673,11 +1680,10 @@ public: | |||||
| #else | #else | ||||
| if (effect && effect->resvd1) | if (effect && effect->resvd1) | ||||
| { | { | ||||
| //self = (VstPlugin*)getPointer(effect->resvd1); | |||||
| //self = (VstPlugin*)effect->resvd1; | |||||
| self = (VstPlugin*)effect->resvd1; | |||||
| #endif | #endif | ||||
| //if (self->unique1 != self->unique2) | |||||
| // self = nullptr; | |||||
| if (self->unique1 != self->unique2) | |||||
| self = nullptr; | |||||
| } | } | ||||
| intptr_t ret = 0; | intptr_t ret = 0; | ||||
| @@ -1849,11 +1855,11 @@ public: | |||||
| // Deprecated in VST SDK 2.4 | // Deprecated in VST SDK 2.4 | ||||
| break; | break; | ||||
| #ifdef VESTIGE_HEADER | |||||
| case audioMasterGetSpeakerArrangement: | |||||
| #else | |||||
| //#ifdef VESTIGE_HEADER | |||||
| // case audioMasterGetSpeakerArrangement: | |||||
| //#else | |||||
| case audioMasterGetOutputSpeakerArrangement: | case audioMasterGetOutputSpeakerArrangement: | ||||
| #endif | |||||
| //#endif | |||||
| // Deprecated in VST SDK 2.4 | // Deprecated in VST SDK 2.4 | ||||
| // TODO | // TODO | ||||
| break; | break; | ||||
| @@ -1861,7 +1867,7 @@ public: | |||||
| case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
| if (ptr) | if (ptr) | ||||
| strcpy((char*)ptr, "falkTX"); | |||||
| strcpy((char*)ptr, "Cadence"); | |||||
| break; | break; | ||||
| case audioMasterGetProductString: | case audioMasterGetProductString: | ||||
| @@ -8,7 +8,7 @@ CXX ?= g++ | |||||
| WINECXX ?= wineg++ | WINECXX ?= wineg++ | ||||
| STRIP ?= strip | STRIP ?= strip | ||||
| BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -fPIC -mtune=generic -msse -mfpmath=sse -Wall | |||||
| BASE_FLAGS = -O2 -ffast-math -fomit-frame-pointer -mtune=generic -msse -mfpmath=sse -Wall | |||||
| BUILD_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | BUILD_FLAGS = $(BASE_FLAGS) -std=c++0x $(CXXFLAGS) | ||||
| BUILD_FLAGS += -I. -I../carla-includes $(shell pkg-config --cflags liblo QtCore) | BUILD_FLAGS += -I. -I../carla-includes $(shell pkg-config --cflags liblo QtCore) | ||||
| @@ -210,6 +210,12 @@ public: | |||||
| m_osc.sendOscControl(index, value); | m_osc.sendOscControl(index, value); | ||||
| } | } | ||||
| void sendOscMidi(const uint8_t midiBuf[4]) | |||||
| { | |||||
| qDebug("CarlaClient::sendOscMidi(%p)", midiBuf); | |||||
| m_osc.sendOscMidi(midiBuf); | |||||
| } | |||||
| void sendOscUpdate() | void sendOscUpdate() | ||||
| { | { | ||||
| qDebug("CarlaClient::sendOscUpdate()"); | qDebug("CarlaClient::sendOscUpdate()"); | ||||
| @@ -75,33 +75,59 @@ public: | |||||
| void sendOscConfigure(const char* const key, const char* const value) | void sendOscConfigure(const char* const key, const char* const value) | ||||
| { | { | ||||
| osc_send_configure(&m_controlData, key, value); | |||||
| Q_ASSERT(m_controlData.target); | |||||
| if (m_controlData.target) | |||||
| osc_send_configure(&m_controlData, key, value); | |||||
| } | |||||
| void sendOscControl(const int32_t index, const float value) | |||||
| { | |||||
| Q_ASSERT(m_controlData.target); | |||||
| if (m_controlData.target) | |||||
| osc_send_control(&m_controlData, index, value); | |||||
| } | } | ||||
| void sendOscControl(int32_t index, float value) | |||||
| void sendOscMidi(const uint8_t midiBuf[4]) | |||||
| { | { | ||||
| osc_send_control(&m_controlData, index, value); | |||||
| Q_ASSERT(m_controlData.target); | |||||
| if (m_controlData.target) | |||||
| osc_send_midi(&m_controlData, midiBuf); | |||||
| } | } | ||||
| void sendOscUpdate() | void sendOscUpdate() | ||||
| { | { | ||||
| osc_send_update(&m_controlData, m_serverPath); | |||||
| Q_ASSERT(m_controlData.target); | |||||
| if (m_controlData.target) | |||||
| osc_send_update(&m_controlData, m_serverPath); | |||||
| } | } | ||||
| void sendOscExiting() | void sendOscExiting() | ||||
| { | { | ||||
| osc_send_exiting(&m_controlData); | |||||
| Q_ASSERT(m_controlData.target); | |||||
| if (m_controlData.target) | |||||
| osc_send_exiting(&m_controlData); | |||||
| } | } | ||||
| #ifdef BRIDGE_LV2 | #ifdef BRIDGE_LV2 | ||||
| void sendOscLv2TransferAtom(const char* const type, const char* const value) | void sendOscLv2TransferAtom(const char* const type, const char* const value) | ||||
| { | { | ||||
| osc_send_lv2_transfer_atom(&m_controlData, type, value); | |||||
| Q_ASSERT(m_controlData.target); | |||||
| if (m_controlData.target) | |||||
| osc_send_lv2_transfer_atom(&m_controlData, type, value); | |||||
| } | } | ||||
| void sendOscLv2TransferEvent(const char* const type, const char* const value) | void sendOscLv2TransferEvent(const char* const type, const char* const value) | ||||
| { | { | ||||
| osc_send_lv2_transfer_event(&m_controlData, type, value); | |||||
| Q_ASSERT(m_controlData.target); | |||||
| if (m_controlData.target) | |||||
| osc_send_lv2_transfer_event(&m_controlData, type, value); | |||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -57,11 +57,13 @@ public: | |||||
| gtk_init(&argc, &argv); | gtk_init(&argc, &argv); | ||||
| } | } | ||||
| void exec(CarlaClient* const client) | |||||
| void exec(CarlaClient* const client, const bool showGui) | |||||
| { | { | ||||
| qDebug("CarlaToolkitGtk2::exec(%p)", client); | qDebug("CarlaToolkitGtk2::exec(%p)", client); | ||||
| Q_ASSERT(client); | Q_ASSERT(client); | ||||
| m_client = client; | |||||
| window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | ||||
| gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | ||||
| @@ -88,12 +90,10 @@ public: | |||||
| g_timeout_add(50, gtk_ui_timeout, this); | g_timeout_add(50, gtk_ui_timeout, this); | ||||
| g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | ||||
| m_client = client; | |||||
| m_client->sendOscUpdate(); | m_client->sendOscUpdate(); | ||||
| #ifdef QTCREATOR_TEST | |||||
| show(); | |||||
| #endif | |||||
| if (showGui) | |||||
| show(); | |||||
| // Main loop | // Main loop | ||||
| gtk_main(); | gtk_main(); | ||||
| @@ -57,11 +57,13 @@ public: | |||||
| gtk_init(&argc, &argv); | gtk_init(&argc, &argv); | ||||
| } | } | ||||
| void exec(CarlaClient* const client) | |||||
| void exec(CarlaClient* const client, const bool showGui) | |||||
| { | { | ||||
| qDebug("CarlaToolkitGtk3::exec(%p)", client); | qDebug("CarlaToolkitGtk3::exec(%p)", client); | ||||
| Q_ASSERT(client); | Q_ASSERT(client); | ||||
| m_client = client; | |||||
| window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | ||||
| gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | ||||
| @@ -88,12 +90,10 @@ public: | |||||
| g_timeout_add(50, gtk_ui_timeout, this); | g_timeout_add(50, gtk_ui_timeout, this); | ||||
| g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | ||||
| m_client = client; | |||||
| m_client->sendOscUpdate(); | m_client->sendOscUpdate(); | ||||
| #ifdef QTCREATOR_TEST | |||||
| show(); | |||||
| #endif | |||||
| if (showGui) | |||||
| show(); | |||||
| // Main loop | // Main loop | ||||
| gtk_main(); | gtk_main(); | ||||
| @@ -26,36 +26,59 @@ | |||||
| CARLA_BRIDGE_START_NAMESPACE | CARLA_BRIDGE_START_NAMESPACE | ||||
| // ------------------------------------------------------------------------- | |||||
| static int _argc = 0; | |||||
| static char* _argv[] = { nullptr }; | |||||
| class MessageChecker : public QTimer | |||||
| class BridgeApplication : public QApplication | |||||
| { | { | ||||
| public: | public: | ||||
| MessageChecker(CarlaClient* const client_) | |||||
| : client(client_) | |||||
| BridgeApplication() | |||||
| : QApplication(_argc, _argv, true) | |||||
| { | { | ||||
| Q_ASSERT(client); | |||||
| msgTimer = 0; | |||||
| m_client = nullptr; | |||||
| } | |||||
| void exec(CarlaClient* const client) | |||||
| { | |||||
| m_client = client; | |||||
| startTimer(50); | |||||
| QApplication::exec(); | |||||
| } | } | ||||
| void timerEvent(QTimerEvent*) | |||||
| protected: | |||||
| void timerEvent(QTimerEvent* const event) | |||||
| { | { | ||||
| if (! client->runMessages()) | |||||
| stop(); | |||||
| if (event->timerId() == msgTimer) | |||||
| { | |||||
| if (m_client && ! m_client->runMessages()) | |||||
| killTimer(msgTimer); | |||||
| } | |||||
| QApplication::timerEvent(event); | |||||
| } | } | ||||
| private: | private: | ||||
| CarlaClient* const client; | |||||
| int msgTimer; | |||||
| CarlaClient* m_client; | |||||
| }; | }; | ||||
| // ------------------------------------------------------------------------- | |||||
| class CarlaToolkitQt4: public CarlaToolkit | class CarlaToolkitQt4: public CarlaToolkit | ||||
| { | { | ||||
| public: | public: | ||||
| CarlaToolkitQt4(const char* const title) | CarlaToolkitQt4(const char* const title) | ||||
| : CarlaToolkit(title), | : CarlaToolkit(title), | ||||
| #ifdef BRIDGE_LV2_X11 | |||||
| #if defined(BRIDGE_LV2_QT4) | |||||
| settings("Cadence", "Carla-Qt4UIs") | |||||
| #elif defined(BRIDGE_LV2_X11) || defined(BRIDGE_VST_X11) | |||||
| settings("Cadence", "Carla-X11UIs") | settings("Cadence", "Carla-X11UIs") | ||||
| #elif defined(BRIDGE_LV2_HWND) || defined(BRIDGE_VST_HWND) | |||||
| settings("Cadence", "Carla-HWNDUIs") | |||||
| #else | #else | ||||
| settings("Cadence", "Carla-Qt4UIs") | |||||
| settings("Cadence", "Carla-UIs") | |||||
| #endif | #endif | ||||
| { | { | ||||
| qDebug("CarlaToolkitQt4::CarlaToolkitQt4(%s)", title); | qDebug("CarlaToolkitQt4::CarlaToolkitQt4(%s)", title); | ||||
| @@ -67,6 +90,7 @@ public: | |||||
| ~CarlaToolkitQt4() | ~CarlaToolkitQt4() | ||||
| { | { | ||||
| qDebug("CarlaToolkitQt4::~CarlaToolkitQt4()"); | qDebug("CarlaToolkitQt4::~CarlaToolkitQt4()"); | ||||
| Q_ASSERT(! app); | |||||
| } | } | ||||
| void init() | void init() | ||||
| @@ -74,17 +98,17 @@ public: | |||||
| qDebug("CarlaToolkitQt4::init()"); | qDebug("CarlaToolkitQt4::init()"); | ||||
| Q_ASSERT(! app); | Q_ASSERT(! app); | ||||
| static int argc = 0; | |||||
| static char* argv[] = { nullptr }; | |||||
| app = new QApplication(argc, argv, true); | |||||
| app = new BridgeApplication; | |||||
| } | } | ||||
| void exec(CarlaClient* const client) | |||||
| void exec(CarlaClient* const client, const bool showGui) | |||||
| { | { | ||||
| qDebug("CarlaToolkitQt4::exec(%p)", client); | qDebug("CarlaToolkitQt4::exec(%p)", client); | ||||
| Q_ASSERT(app); | Q_ASSERT(app); | ||||
| Q_ASSERT(client); | Q_ASSERT(client); | ||||
| m_client = client; | |||||
| if (client->needsReparent()) | if (client->needsReparent()) | ||||
| { | { | ||||
| window = (QDialog*)client->getWidget(); | window = (QDialog*)client->getWidget(); | ||||
| @@ -93,7 +117,7 @@ public: | |||||
| else | else | ||||
| { | { | ||||
| // TODO - window->setCentralWidget(widget); or other simpler method | // TODO - window->setCentralWidget(widget); or other simpler method | ||||
| window = new QDialog(); | |||||
| window = new QDialog(nullptr); | |||||
| window->resize(10, 10); | window->resize(10, 10); | ||||
| window->setLayout(new QVBoxLayout(window)); | window->setLayout(new QVBoxLayout(window)); | ||||
| @@ -124,20 +148,15 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| MessageChecker messageChecker(client); | |||||
| messageChecker.start(50); | |||||
| QObject::connect(window, SIGNAL(finished(int)), app, SLOT(quit())); | |||||
| app->connect(window, SIGNAL(finished(int)), app, SLOT(quit())); | |||||
| m_client = client; | |||||
| m_client->sendOscUpdate(); | m_client->sendOscUpdate(); | ||||
| #ifdef QTCREATOR_TEST | |||||
| show(); | |||||
| #endif | |||||
| if (showGui) | |||||
| show(); | |||||
| // Main loop | // Main loop | ||||
| app->exec(); | |||||
| app->exec(client); | |||||
| } | } | ||||
| void quit() | void quit() | ||||
| @@ -170,6 +189,7 @@ public: | |||||
| app->quit(); | app->quit(); | ||||
| delete app; | delete app; | ||||
| app = nullptr; | |||||
| } | } | ||||
| } | } | ||||
| @@ -201,7 +221,7 @@ public: | |||||
| } | } | ||||
| private: | private: | ||||
| QApplication* app; | |||||
| BridgeApplication* app; | |||||
| QDialog* window; | QDialog* window; | ||||
| QSettings settings; | QSettings settings; | ||||
| }; | }; | ||||
| @@ -50,7 +50,7 @@ public: | |||||
| } | } | ||||
| virtual void init() = 0; | virtual void init() = 0; | ||||
| virtual void exec(CarlaClient* const client) = 0; | |||||
| virtual void exec(CarlaClient* const client, const bool showGui) = 0; | |||||
| virtual void quit() = 0; | virtual void quit() = 0; | ||||
| virtual void show() = 0; | virtual void show() = 0; | ||||
| @@ -32,6 +32,10 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| // fake values | |||||
| uint32_t bufferSize = 512; | |||||
| double sampleRate = 44100.0; | |||||
| // feature ids | // feature ids | ||||
| const uint32_t lv2_feature_id_event = 0; | const uint32_t lv2_feature_id_event = 0; | ||||
| const uint32_t lv2_feature_id_logs = 1; | const uint32_t lv2_feature_id_logs = 1; | ||||
| @@ -846,28 +850,36 @@ CARLA_BRIDGE_END_NAMESPACE | |||||
| int main(int argc, char* argv[]) | int main(int argc, char* argv[]) | ||||
| { | { | ||||
| using namespace CarlaBridge; | |||||
| if (argc != 5) | if (argc != 5) | ||||
| { | { | ||||
| qCritical("%s: bad arguments", argv[0]); | |||||
| qCritical("usage: %s <osc-url|\"null\"> <plugin-uri> <ui-uri> <ui-title>", argv[0]); | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| const char* osc_url = argv[1]; | |||||
| const char* plugin_uri = argv[2]; | |||||
| const char* ui_uri = argv[3]; | |||||
| const char* ui_title = argv[4]; | |||||
| const char* oscUrl = argv[1]; | |||||
| const char* pluginURI = argv[2]; | |||||
| const char* uiURI = argv[3]; | |||||
| const char* uiTitle = argv[4]; | |||||
| using namespace CarlaBridge; | |||||
| const bool useOsc = strcmp(oscUrl, "null"); | |||||
| // try to get sampleRate value | |||||
| const char* const sampleRateStr = getenv("CARLA_SAMPLE_RATE"); | |||||
| if (sampleRateStr) | |||||
| sampleRate = atof(sampleRateStr); | |||||
| // Init toolkit | // Init toolkit | ||||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(ui_title); | |||||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(uiTitle); | |||||
| toolkit->init(); | toolkit->init(); | ||||
| // Init LV2-UI | // Init LV2-UI | ||||
| CarlaLv2Client client(toolkit); | CarlaLv2Client client(toolkit); | ||||
| // Init OSC | // Init OSC | ||||
| if (! client.oscInit(osc_url)) | |||||
| if (useOsc && ! client.oscInit(oscUrl)) | |||||
| { | { | ||||
| toolkit->quit(); | toolkit->quit(); | ||||
| delete toolkit; | delete toolkit; | ||||
| @@ -877,9 +889,9 @@ int main(int argc, char* argv[]) | |||||
| // Load UI | // Load UI | ||||
| int ret; | int ret; | ||||
| if (client.init(plugin_uri, ui_uri)) | |||||
| if (client.init(pluginURI, uiURI)) | |||||
| { | { | ||||
| toolkit->exec(&client); | |||||
| toolkit->exec(&client, !useOsc); | |||||
| ret = 0; | ret = 0; | ||||
| } | } | ||||
| else | else | ||||
| @@ -889,8 +901,11 @@ int main(int argc, char* argv[]) | |||||
| } | } | ||||
| // Close OSC | // Close OSC | ||||
| client.sendOscExiting(); | |||||
| client.oscClose(); | |||||
| if (useOsc) | |||||
| { | |||||
| client.sendOscExiting(); | |||||
| client.oscClose(); | |||||
| } | |||||
| // Close LV2-UI | // Close LV2-UI | ||||
| client.close(); | client.close(); | ||||
| @@ -21,32 +21,32 @@ | |||||
| #include "carla_vst.h" | #include "carla_vst.h" | ||||
| #include "carla_midi.h" | #include "carla_midi.h" | ||||
| #include <QtCore/QTimerEvent> | |||||
| #include <QtGui/QDialog> | #include <QtGui/QDialog> | ||||
| #ifdef Q_WS_X11 | |||||
| #include <QtGui/QX11Info> | |||||
| #endif | |||||
| CARLA_BRIDGE_START_NAMESPACE | CARLA_BRIDGE_START_NAMESPACE | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| #define FAKE_SAMPLE_RATE 44100.0 | |||||
| #define FAKE_BUFFER_SIZE 512 | |||||
| // fake values | |||||
| uint32_t bufferSize = 512; | |||||
| double sampleRate = 44100.0; | |||||
| void* getPointer(const quintptr addr) | |||||
| { | |||||
| Q_ASSERT(addr != 0); | |||||
| qDebug("getPointer(" P_UINTPTR ")", addr); | |||||
| quintptr* const ptr = (quintptr*)addr; | |||||
| return (void*)ptr; | |||||
| } | |||||
| class CarlaVstClient : public CarlaClient | |||||
| class CarlaVstClient : public CarlaClient, QObject | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaVstClient(CarlaToolkit* const toolkit) | CarlaVstClient(CarlaToolkit* const toolkit) | ||||
| : CarlaClient(toolkit) | |||||
| : CarlaClient(toolkit), | |||||
| QObject(nullptr) | |||||
| { | { | ||||
| effect = nullptr; | effect = nullptr; | ||||
| widget = new QDialog; | |||||
| widget = new QDialog(nullptr); | |||||
| idleTimer = 0; | |||||
| // make client valid | // make client valid | ||||
| unique1 = unique2 = rand(); | unique1 = unique2 = rand(); | ||||
| @@ -67,37 +67,48 @@ public: | |||||
| // open DLL | // open DLL | ||||
| if (! libOpen(binary)) | if (! libOpen(binary)) | ||||
| { | |||||
| qWarning("%s", libError()); | |||||
| return false; | return false; | ||||
| } | |||||
| // ----------------------------------------------------------------- | // ----------------------------------------------------------------- | ||||
| // get DLL main entry | // get DLL main entry | ||||
| VST_Function vstfn = (VST_Function)libSymbol("VSTPluginMain"); | |||||
| VST_Function vstFn = (VST_Function)libSymbol("VSTPluginMain"); | |||||
| if (! vstfn) | |||||
| vstfn = (VST_Function)libSymbol("main"); | |||||
| if (! vstFn) | |||||
| vstFn = (VST_Function)libSymbol("main"); | |||||
| if (! vstfn) | |||||
| if (! vstFn) | |||||
| return false; | return false; | ||||
| // ----------------------------------------------------------------- | // ----------------------------------------------------------------- | ||||
| // initialize plugin | // initialize plugin | ||||
| effect = vstfn(VstHostCallback); | |||||
| effect = vstFn(hostCallback); | |||||
| if ((! effect) || effect->magic != kEffectMagic) | |||||
| if (! (effect && effect->magic == kEffectMagic)) | |||||
| return false; | return false; | ||||
| // ----------------------------------------------------------------- | // ----------------------------------------------------------------- | ||||
| // initialize VST stuff | // initialize VST stuff | ||||
| int32_t value = 0; | |||||
| #ifdef Q_WS_X11 | |||||
| value = (int64_t)QX11Info::display(); | |||||
| #endif | |||||
| effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); | effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f); | ||||
| #if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
| effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, FAKE_BUFFER_SIZE, nullptr, FAKE_SAMPLE_RATE); | |||||
| effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, bufferSize, nullptr, sampleRate); | |||||
| #endif | #endif | ||||
| effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, FAKE_SAMPLE_RATE); | |||||
| effect->dispatcher(effect, effSetBlockSize, 0, FAKE_BUFFER_SIZE, nullptr, 0.0f); | |||||
| effect->dispatcher(effect, effEditOpen, 0, 0, (void*)widget->winId(), 0.0f); | |||||
| effect->dispatcher(effect, effSetSampleRate, 0, 0, nullptr, sampleRate); | |||||
| effect->dispatcher(effect, effSetBlockSize, 0, bufferSize, nullptr, 0.0f); | |||||
| effect->dispatcher(effect, effSetProcessPrecision, 0, kVstProcessPrecision32, nullptr, 0.0f); | |||||
| if (effect->dispatcher(effect, effEditOpen, 0, value, (void*)widget->winId(), 0.0f) != 1) | |||||
| return false; | |||||
| #ifdef VESTIGE_HEADER | #ifdef VESTIGE_HEADER | ||||
| effect->ptr1 = this; | effect->ptr1 = this; | ||||
| @@ -109,17 +120,20 @@ public: | |||||
| // initialize gui stuff | // initialize gui stuff | ||||
| ERect* vstRect = nullptr; | ERect* vstRect = nullptr; | ||||
| effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f); | |||||
| if (effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f) && vstRect) | |||||
| if (vstRect) | |||||
| { | { | ||||
| int width = vstRect->right - vstRect->left; | int width = vstRect->right - vstRect->left; | ||||
| int height = vstRect->bottom - vstRect->top; | int height = vstRect->bottom - vstRect->top; | ||||
| widget->setFixedSize(width, height); | |||||
| //return true; | |||||
| if (width > 0 && height > 0) | |||||
| widget->setFixedSize(width, height); | |||||
| } | } | ||||
| idleTimer = startTimer(50); | |||||
| return true; | return true; | ||||
| //return false; | |||||
| } | } | ||||
| void close() | void close() | ||||
| @@ -178,8 +192,108 @@ public: | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| static intptr_t VstHostCallback(AEffect* effect, int32_t opcode, int32_t index, intptr_t value, void* ptr, float opt) | |||||
| void handleAudioMasterAutomate(const uint32_t index, const float value) | |||||
| { | |||||
| effect->setParameter(effect, index, value); | |||||
| sendOscControl(index, value); | |||||
| } | |||||
| intptr_t handleAudioMasterGetCurrentProcessLevel() | |||||
| { | |||||
| return kVstProcessLevelUser; | |||||
| } | |||||
| intptr_t handleAudioMasterProcessEvents(const VstEvents* const vstEvents) | |||||
| { | |||||
| for (int32_t i=0; i < vstEvents->numEvents; i++) | |||||
| { | |||||
| if (! vstEvents->events[i]) | |||||
| break; | |||||
| const VstMidiEvent* const vstMidiEvent = (const VstMidiEvent*)vstEvents->events[i]; | |||||
| if (vstMidiEvent->type != kVstMidiType) | |||||
| { | |||||
| uint8_t status = vstMidiEvent->midiData[0]; | |||||
| // Fix bad note-off | |||||
| if (MIDI_IS_STATUS_NOTE_ON(status) && vstMidiEvent->midiData[2] == 0) | |||||
| status -= 0x10; | |||||
| uint8_t midiBuf[4] = { 0, status, (uint8_t)vstMidiEvent->midiData[1], (uint8_t)vstMidiEvent->midiData[2] }; | |||||
| sendOscMidi(midiBuf); | |||||
| } | |||||
| } | |||||
| return 1; | |||||
| } | |||||
| intptr_t handleAdioMasterSizeWindow(int32_t width, int32_t height) | |||||
| { | |||||
| Q_ASSERT(widget); | |||||
| widget->setFixedSize(width, height); | |||||
| return 1; | |||||
| } | |||||
| void handleAudioMasterUpdateDisplay() | |||||
| { | |||||
| sendOscConfigure("reloadprograms", ""); | |||||
| } | |||||
| // --------------------------------------------------------------------- | |||||
| static intptr_t hostCanDo(const char* const feature) | |||||
| { | |||||
| qDebug("CarlaVstClient::hostCanDo(\"%s\")", feature); | |||||
| if (strcmp(feature, "supplyIdle") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "sendVstEvents") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "sendVstMidiEvent") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "sendVstMidiEventFlagIsRealtime") == 0) | |||||
| return -1; | |||||
| if (strcmp(feature, "sendVstTimeInfo") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "receiveVstEvents") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "receiveVstMidiEvent") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "receiveVstTimeInfo") == 0) | |||||
| return -1; | |||||
| if (strcmp(feature, "reportConnectionChanges") == 0) | |||||
| return -1; | |||||
| if (strcmp(feature, "acceptIOChanges") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "sizeWindow") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "offline") == 0) | |||||
| return -1; | |||||
| if (strcmp(feature, "openFileSelector") == 0) | |||||
| return -1; | |||||
| if (strcmp(feature, "closeFileSelector") == 0) | |||||
| return -1; | |||||
| if (strcmp(feature, "startStopProcess") == 0) | |||||
| return 1; | |||||
| if (strcmp(feature, "supportShell") == 0) | |||||
| return -1; | |||||
| if (strcmp(feature, "shellCategory") == 0) | |||||
| return -1; | |||||
| // unimplemented | |||||
| qWarning("CarlaVstClient::hostCanDo(\"%s\") - unknown feature", feature); | |||||
| return 0; | |||||
| } | |||||
| static intptr_t VSTCALLBACK hostCallback(AEffect* const effect, const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) | |||||
| { | { | ||||
| #if DEBUG | |||||
| qDebug("CarlaVstClient::hostCallback(%p, %s, %i, " P_INTPTR ", %p, %f", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt); | |||||
| #endif | |||||
| // Check if 'resvd1' points to this client | // Check if 'resvd1' points to this client | ||||
| CarlaVstClient* self = nullptr; | CarlaVstClient* self = nullptr; | ||||
| @@ -190,158 +304,140 @@ public: | |||||
| #else | #else | ||||
| if (effect && effect->resvd1) | if (effect && effect->resvd1) | ||||
| { | { | ||||
| self = (CarlaVstClient*)getPointer(effect->resvd1); | |||||
| self = (CarlaVstClient*)effect->resvd1; | |||||
| #endif | #endif | ||||
| if (self->unique1 != self->unique2) | if (self->unique1 != self->unique2) | ||||
| self = nullptr; | self = nullptr; | ||||
| } | } | ||||
| intptr_t ret = 0; | |||||
| switch (opcode) | switch (opcode) | ||||
| { | { | ||||
| case audioMasterAutomate: | case audioMasterAutomate: | ||||
| if (self) | if (self) | ||||
| self->sendOscControl(index, opt); | |||||
| self->handleAudioMasterAutomate(index, opt); | |||||
| break; | break; | ||||
| case audioMasterVersion: | case audioMasterVersion: | ||||
| return kVstVersion; | |||||
| ret = kVstVersion; | |||||
| break; | |||||
| case audioMasterCurrentId: | case audioMasterCurrentId: | ||||
| return 0; // TODO | |||||
| // TODO | |||||
| break; | |||||
| case audioMasterIdle: | case audioMasterIdle: | ||||
| if (effect) | |||||
| effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||||
| //if (effect) | |||||
| // effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||||
| break; | break; | ||||
| case audioMasterGetTime: | case audioMasterGetTime: | ||||
| static VstTimeInfo_R timeInfo; | static VstTimeInfo_R timeInfo; | ||||
| memset(&timeInfo, 0, sizeof(VstTimeInfo_R)); | memset(&timeInfo, 0, sizeof(VstTimeInfo_R)); | ||||
| timeInfo.sampleRate = FAKE_SAMPLE_RATE; | |||||
| return (intptr_t)&timeInfo; | |||||
| case audioMasterProcessEvents: | |||||
| #if 0 | |||||
| if (client && ptr) | |||||
| { | |||||
| const VstEvents* const events = (VstEvents*)ptr; | |||||
| timeInfo.sampleRate = sampleRate; | |||||
| for (int32_t i=0; i < events->numEvents; i++) | |||||
| { | |||||
| const VstMidiEvent* const midi_event = (VstMidiEvent*)events->events[i]; | |||||
| // Tempo | |||||
| timeInfo.tempo = 120.0; | |||||
| timeInfo.flags |= kVstTempoValid; | |||||
| uint8_t status = midi_event->midiData[0]; | |||||
| // Time Signature | |||||
| timeInfo.timeSigNumerator = 4; | |||||
| timeInfo.timeSigDenominator = 4; | |||||
| timeInfo.flags |= kVstTimeSigValid; | |||||
| // Fix bad note-off | |||||
| if (MIDI_IS_STATUS_NOTE_ON(status) && midi_event->midiData[2] == 0) | |||||
| status -= 0x10; | |||||
| ret = (intptr_t)&timeInfo; | |||||
| break; | |||||
| uint8_t midi_buf[4] = { 0, status, (uint8_t)midi_event->midiData[1], (uint8_t)midi_event->midiData[2] }; | |||||
| osc_send_midi(midi_buf); | |||||
| } | |||||
| } | |||||
| else | |||||
| qDebug("VstHostCallback:audioMasterProcessEvents - Some MIDI Out events were ignored"); | |||||
| #endif | |||||
| case audioMasterProcessEvents: | |||||
| if (self && ptr) | |||||
| ret = self->handleAudioMasterProcessEvents((const VstEvents*)ptr); | |||||
| break; | break; | ||||
| #if ! VST_FORCE_DEPRECATED | #if ! VST_FORCE_DEPRECATED | ||||
| case audioMasterTempoAt: | case audioMasterTempoAt: | ||||
| // Deprecated in VST SDK 2.4 | // Deprecated in VST SDK 2.4 | ||||
| return 120.0 * 10000; | |||||
| ret = 120 * 10000; | |||||
| break; | |||||
| #endif | #endif | ||||
| case audioMasterSizeWindow: | case audioMasterSizeWindow: | ||||
| if (self) | |||||
| self->quequeMessage(MESSAGE_RESIZE_GUI, index, value, 0.0); | |||||
| return 1; | |||||
| if (self && index > 0 && value > 0) | |||||
| ret = self->handleAdioMasterSizeWindow(index, value); | |||||
| break; | |||||
| case audioMasterGetSampleRate: | case audioMasterGetSampleRate: | ||||
| return FAKE_SAMPLE_RATE; | |||||
| ret = sampleRate; | |||||
| break; | |||||
| case audioMasterGetBlockSize: | case audioMasterGetBlockSize: | ||||
| return FAKE_BUFFER_SIZE; | |||||
| ret = bufferSize; | |||||
| break; | |||||
| case audioMasterGetCurrentProcessLevel: | |||||
| ret = kVstProcessLevelUser; | |||||
| break; | |||||
| case audioMasterGetAutomationState: | |||||
| ret = kVstAutomationReadWrite; | |||||
| break; | |||||
| case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
| strcpy((char*)ptr, "Cadence"); | |||||
| if (ptr) | |||||
| strcpy((char*)ptr, "Cadence"); | |||||
| break; | break; | ||||
| case audioMasterGetProductString: | case audioMasterGetProductString: | ||||
| strcpy((char*)ptr, "Carla-Bridge"); | |||||
| if (ptr) | |||||
| strcpy((char*)ptr, "Carla-Bridge"); | |||||
| break; | break; | ||||
| case audioMasterGetVendorVersion: | case audioMasterGetVendorVersion: | ||||
| return 0x05; // 0.5 | |||||
| case audioMasterVendorSpecific: | |||||
| ret = 0x050; // 0.5.0 | |||||
| break; | break; | ||||
| case audioMasterCanDo: | case audioMasterCanDo: | ||||
| #if DEBUG | |||||
| qDebug("VstHostCallback:audioMasterCanDo - %s", (char*)ptr); | |||||
| #endif | |||||
| if (strcmp((char*)ptr, "supplyIdle") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "sendVstEvents") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "sendVstMidiEvent") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "sendVstMidiEventFlagIsRealtime") == 0) | |||||
| return -1; | |||||
| if (strcmp((char*)ptr, "sendVstTimeInfo") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "receiveVstEvents") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "receiveVstMidiEvent") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "receiveVstTimeInfo") == 0) | |||||
| return -1; | |||||
| if (strcmp((char*)ptr, "reportConnectionChanges") == 0) | |||||
| return -1; | |||||
| if (strcmp((char*)ptr, "acceptIOChanges") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "sizeWindow") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "offline") == 0) | |||||
| return -1; | |||||
| if (strcmp((char*)ptr, "openFileSelector") == 0) | |||||
| return -1; | |||||
| if (strcmp((char*)ptr, "closeFileSelector") == 0) | |||||
| return -1; | |||||
| if (strcmp((char*)ptr, "startStopProcess") == 0) | |||||
| return 1; | |||||
| if (strcmp((char*)ptr, "supportShell") == 0) | |||||
| return -1; | |||||
| if (strcmp((char*)ptr, "shellCategory") == 0) | |||||
| return -1; | |||||
| // unimplemented | |||||
| qWarning("VstHostCallback:audioMasterCanDo - Got unknown feature request '%s'", (char*)ptr); | |||||
| return 0; | |||||
| if (ptr) | |||||
| ret = hostCanDo((const char*)ptr); | |||||
| break; | |||||
| case audioMasterGetLanguage: | case audioMasterGetLanguage: | ||||
| return kVstLangEnglish; | |||||
| ret = kVstLangEnglish; | |||||
| break; | |||||
| case audioMasterUpdateDisplay: | case audioMasterUpdateDisplay: | ||||
| if (self) | if (self) | ||||
| self->sendOscConfigure("reloadprograms", ""); | |||||
| self->handleAudioMasterUpdateDisplay(); | |||||
| break; | break; | ||||
| default: | default: | ||||
| #if DEBUG | |||||
| qDebug("VstHostCallback() - code: %s, index: %i, value: " P_INTPTR ", opt: %f", VstMasterOpcode2str(opcode), index, value, opt); | |||||
| #ifdef DEBUG | |||||
| qDebug("CarlaVstClient::hostCallback(%p, %s, %i, " P_INTPTR ", %p, %f", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt); | |||||
| #endif | #endif | ||||
| break; | break; | ||||
| } | } | ||||
| return 0; | |||||
| return ret; | |||||
| } | |||||
| protected: | |||||
| void timerEvent(QTimerEvent* const event) | |||||
| { | |||||
| if (event->timerId() == idleTimer && effect) | |||||
| { | |||||
| qDebug("timerEvent"); | |||||
| effect->dispatcher(effect, effIdle, 0, 0, nullptr, 0.0f); | |||||
| effect->dispatcher(effect, effEditIdle, 0, 0, nullptr, 0.0f); | |||||
| } | |||||
| QObject::timerEvent(event); | |||||
| } | } | ||||
| private: | private: | ||||
| int unique1; | int unique1; | ||||
| AEffect* effect; | AEffect* effect; | ||||
| QDialog* widget; | QDialog* widget; | ||||
| int idleTimer; | |||||
| int unique2; | int unique2; | ||||
| }; | }; | ||||
| @@ -349,27 +445,35 @@ CARLA_BRIDGE_END_NAMESPACE | |||||
| int main(int argc, char* argv[]) | int main(int argc, char* argv[]) | ||||
| { | { | ||||
| using namespace CarlaBridge; | |||||
| if (argc != 4) | if (argc != 4) | ||||
| { | { | ||||
| qCritical("%s: bad arguments", argv[0]); | |||||
| qCritical("usage: %s <osc-url|\"null\"> <binary> <ui-title>", argv[0]); | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| const char* osc_url = argv[1]; | |||||
| const char* binary = argv[2]; | |||||
| const char* ui_title = argv[3]; | |||||
| const char* oscUrl = argv[1]; | |||||
| const char* binary = argv[2]; | |||||
| const char* uiTitle = argv[3]; | |||||
| using namespace CarlaBridge; | |||||
| const bool useOsc = strcmp(oscUrl, "null"); | |||||
| // try to get sampleRate value | |||||
| const char* const sampleRateStr = getenv("CARLA_SAMPLE_RATE"); | |||||
| if (sampleRateStr) | |||||
| sampleRate = atof(sampleRateStr); | |||||
| // Init toolkit | // Init toolkit | ||||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(ui_title); | |||||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(uiTitle); | |||||
| toolkit->init(); | toolkit->init(); | ||||
| // Init VST-UI | // Init VST-UI | ||||
| CarlaVstClient client(toolkit); | CarlaVstClient client(toolkit); | ||||
| // Init OSC | // Init OSC | ||||
| if (! client.oscInit(osc_url)) | |||||
| if (useOsc && ! client.oscInit(oscUrl)) | |||||
| { | { | ||||
| toolkit->quit(); | toolkit->quit(); | ||||
| delete toolkit; | delete toolkit; | ||||
| @@ -381,7 +485,7 @@ int main(int argc, char* argv[]) | |||||
| if (client.init(binary, nullptr)) | if (client.init(binary, nullptr)) | ||||
| { | { | ||||
| toolkit->exec(&client); | |||||
| toolkit->exec(&client, !useOsc); | |||||
| ret = 0; | ret = 0; | ||||
| } | } | ||||
| else | else | ||||
| @@ -391,8 +495,11 @@ int main(int argc, char* argv[]) | |||||
| } | } | ||||
| // Close OSC | // Close OSC | ||||
| client.sendOscExiting(); | |||||
| client.oscClose(); | |||||
| if (useOsc) | |||||
| { | |||||
| client.sendOscExiting(); | |||||
| client.oscClose(); | |||||
| } | |||||
| // Close VST-UI | // Close VST-UI | ||||
| client.close(); | client.close(); | ||||
| @@ -168,6 +168,10 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode | |||||
| ret = kVstProcessLevelUser; | ret = kVstProcessLevelUser; | ||||
| break; | break; | ||||
| case audioMasterGetAutomationState: | |||||
| ret = kVstAutomationReadWrite; | |||||
| break; | |||||
| case audioMasterGetVendorString: | case audioMasterGetVendorString: | ||||
| if (ptr) | if (ptr) | ||||
| strcpy((char*)ptr, "Cadence"); | strcpy((char*)ptr, "Cadence"); | ||||
| @@ -105,7 +105,7 @@ static inline | |||||
| void osc_send_program(const CarlaOscData* const oscData, const int32_t bank, const int32_t program) | void osc_send_program(const CarlaOscData* const oscData, const int32_t bank, const int32_t program) | ||||
| { | { | ||||
| Q_ASSERT(oscData && oscData->path); | Q_ASSERT(oscData && oscData->path); | ||||
| Q_ASSERT(program >= 0); | |||||
| Q_ASSERT(program >= 0 && program < 128); | |||||
| Q_ASSERT(bank >= 0); | Q_ASSERT(bank >= 0); | ||||
| qDebug("osc_send_program(path:\"%s\", %i, %i)", oscData->path, bank, program); | qDebug("osc_send_program(path:\"%s\", %i, %i)", oscData->path, bank, program); | ||||
| @@ -155,7 +155,7 @@ static inline | |||||
| void osc_send_sample_rate(const CarlaOscData* const oscData, const float sampleRate) | void osc_send_sample_rate(const CarlaOscData* const oscData, const float sampleRate) | ||||
| { | { | ||||
| Q_ASSERT(oscData && oscData->path); | Q_ASSERT(oscData && oscData->path); | ||||
| Q_ASSERT(sampleRate >= 0.0f); | |||||
| Q_ASSERT(sampleRate > 0.0f); | |||||
| qDebug("osc_send_sample_rate(path:\"%s\", %f)", oscData->path, sampleRate); | qDebug("osc_send_sample_rate(path:\"%s\", %f)", oscData->path, sampleRate); | ||||
| if (oscData->target) | if (oscData->target) | ||||
| @@ -878,7 +878,7 @@ class Host(object): | |||||
| self.lib.set_chunk_data.argtypes = [c_ushort, c_char_p] | self.lib.set_chunk_data.argtypes = [c_ushort, c_char_p] | ||||
| self.lib.set_chunk_data.restype = None | self.lib.set_chunk_data.restype = None | ||||
| self.lib.set_gui_data.argtypes = [c_ushort, c_int, c_uintptr] | |||||
| self.lib.set_gui_data.argtypes = [c_ushort, c_uintptr] | |||||
| self.lib.set_gui_data.restype = None | self.lib.set_gui_data.restype = None | ||||
| self.lib.show_gui.argtypes = [c_ushort, c_bool] | self.lib.show_gui.argtypes = [c_ushort, c_bool] | ||||
| @@ -1055,8 +1055,8 @@ class Host(object): | |||||
| def set_chunk_data(self, plugin_id, chunk_data): | def set_chunk_data(self, plugin_id, chunk_data): | ||||
| self.lib.set_chunk_data(plugin_id, chunk_data.encode("utf-8")) | self.lib.set_chunk_data(plugin_id, chunk_data.encode("utf-8")) | ||||
| def set_gui_data(self, plugin_id, data, gui_addr): | |||||
| self.lib.set_gui_data(plugin_id, data, gui_addr) | |||||
| def set_gui_data(self, plugin_id, gui_addr): | |||||
| self.lib.set_gui_data(plugin_id, gui_addr) | |||||
| def show_gui(self, plugin_id, yesno): | def show_gui(self, plugin_id, yesno): | ||||
| self.lib.show_gui(plugin_id, yesno) | self.lib.show_gui(plugin_id, yesno) | ||||
| @@ -1270,8 +1270,7 @@ class PluginWidget(QFrame, ui_carla_plugin.Ui_PluginWidget): | |||||
| self.gui_dialog = PluginGUI(self, self.m_pluginInfo['name'], guiInfo['resizable']) | self.gui_dialog = PluginGUI(self, self.m_pluginInfo['name'], guiInfo['resizable']) | ||||
| self.gui_dialog.hide() | self.gui_dialog.hide() | ||||
| # TODO - display | |||||
| Carla.Host.set_gui_data(self.m_pluginId, 0, unwrapinstance(self.gui_dialog)) | |||||
| Carla.Host.set_gui_data(self.m_pluginId, unwrapinstance(self.gui_dialog)) | |||||
| elif guiType in (GUI_EXTERNAL_LV2, GUI_EXTERNAL_SUIL, GUI_EXTERNAL_OSC): | elif guiType in (GUI_EXTERNAL_LV2, GUI_EXTERNAL_SUIL, GUI_EXTERNAL_OSC): | ||||
| pass | pass | ||||