| @@ -330,7 +330,7 @@ const PortCountInfo* get_parameter_count_info(unsigned short plugin_id) | |||
| 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); | |||
| @@ -388,7 +388,7 @@ const ParameterInfo* get_parameter_info(unsigned short plugin_id, quint32 parame | |||
| 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); | |||
| @@ -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); | |||
| @@ -474,7 +474,7 @@ const CarlaBackend::ParameterData* get_parameter_data(unsigned short plugin_id, | |||
| 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); | |||
| @@ -495,7 +495,7 @@ const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_ | |||
| 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); | |||
| @@ -516,7 +516,7 @@ const CarlaBackend::midi_program_t* get_midi_program_data(unsigned short plugin_ | |||
| 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); | |||
| @@ -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); | |||
| @@ -664,7 +664,7 @@ const char* get_parameter_text(unsigned short plugin_id, quint32 parameter_id) | |||
| 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); | |||
| @@ -703,7 +703,7 @@ const char* get_program_name(unsigned short plugin_id, quint32 program_id) | |||
| 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); | |||
| @@ -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); | |||
| @@ -789,7 +789,7 @@ qint32 get_current_program_index(unsigned short plugin_id) | |||
| 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); | |||
| @@ -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); | |||
| @@ -823,7 +823,7 @@ double get_default_parameter_value(unsigned short plugin_id, quint32 parameter_i | |||
| 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); | |||
| @@ -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); | |||
| @@ -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); | |||
| } | |||
| 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); | |||
| @@ -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); | |||
| } | |||
| 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); | |||
| @@ -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); | |||
| } | |||
| 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); | |||
| @@ -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); | |||
| } | |||
| 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); | |||
| @@ -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); | |||
| } | |||
| 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); | |||
| if (plugin) | |||
| { | |||
| #ifdef __WINE__ | |||
| plugin->setGuiData(data, (HWND)gui_addr); | |||
| plugin->setGuiData((HWND)gui_addr); | |||
| #else | |||
| plugin->setGuiData(data, (QDialog*)CarlaBackend::getPointer(gui_addr)); | |||
| plugin->setGuiData((QDialog*)CarlaBackend::getPointer(gui_addr)); | |||
| #endif | |||
| 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); | |||
| @@ -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()"); | |||
| @@ -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, "", ""); | |||
| 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); | |||
| show_gui(id, false); | |||
| @@ -1519,7 +1519,7 @@ int main(int argc, char* argv[]) | |||
| //const GuiInfo* const guiInfo = get_gui_info(id); | |||
| //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(); | |||
| //} | |||
| @@ -18,6 +18,8 @@ | |||
| #ifndef CARLA_BACKEND_STANDALONE_H | |||
| #define CARLA_BACKEND_STANDALONE_H | |||
| #include <cstdint> | |||
| #include "carla_backend.h" | |||
| /*! | |||
| @@ -52,9 +54,9 @@ struct PluginInfo { | |||
| }; | |||
| struct PortCountInfo { | |||
| quint32 ins; | |||
| quint32 outs; | |||
| quint32 total; | |||
| uint32_t ins; | |||
| uint32_t outs; | |||
| uint32_t total; | |||
| PortCountInfo() | |||
| : ins(0), | |||
| @@ -66,7 +68,7 @@ struct ParameterInfo { | |||
| const char* name; | |||
| const char* symbol; | |||
| const char* unit; | |||
| quint32 scalePointCount; | |||
| uint32_t scalePointCount; | |||
| ParameterInfo() | |||
| : name(nullptr), | |||
| @@ -94,44 +96,44 @@ struct GuiInfo { | |||
| }; | |||
| 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_close(); | |||
| 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 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 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_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 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 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 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_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_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_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 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 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_host_osc_url(); | |||
| @@ -1286,9 +1286,8 @@ public: | |||
| * | |||
| * \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); | |||
| } | |||
| @@ -1315,13 +1314,13 @@ public: | |||
| if (m_hints & PLUGIN_USES_SINGLE_THREAD) | |||
| { | |||
| // Process postponed events | |||
| //postEventsRun(); | |||
| postEventsRun(); | |||
| // Update parameter outputs | |||
| 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); | |||
| //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; | |||
| } | |||
| @@ -43,7 +43,7 @@ CustomDataType getCustomDataStringType(const char* const stype); | |||
| const char* getCustomDataTypeString(const CustomDataType type); | |||
| const char* getBinaryBidgePath(const BinaryType type); | |||
| void* getPointer(const quintptr addr); | |||
| void* getPointer(const uintptr_t addr); | |||
| PluginCategory getPluginCategoryFromName(const char* const name); | |||
| const char* getLastError(); | |||
| @@ -876,7 +876,7 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // Set gui stuff | |||
| void setGuiData(const int, const GuiDataHandle handle) | |||
| void setGuiData(const GuiDataHandle handle) | |||
| { | |||
| switch(gui.type) | |||
| { | |||
| @@ -20,6 +20,9 @@ | |||
| #ifndef __WINE__ | |||
| #include <QtGui/QDialog> | |||
| #ifdef Q_WS_X11 | |||
| #include <QtGui/QX11Info> | |||
| #endif | |||
| #endif | |||
| CARLA_BACKEND_START_NAMESPACE | |||
| @@ -329,23 +332,27 @@ public: | |||
| // ------------------------------------------------------------------- | |||
| // 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); | |||
| if (gui.type == GUI_EXTERNAL_OSC) | |||
| return; | |||
| int32_t value = 0; | |||
| #ifdef Q_WS_X11 | |||
| value = (int64_t)QX11Info::display(); | |||
| #endif | |||
| #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 | |||
| 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 | |||
| { | |||
| ERect* vstRect = nullptr; | |||
| effect->dispatcher(effect, effEditGetRect, 0, 0, &vstRect, 0.0f); | |||
| if (vstRect) | |||
| @@ -355,7 +362,7 @@ public: | |||
| 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; | |||
| } | |||
| @@ -363,7 +370,7 @@ public: | |||
| gui.height = height; | |||
| } | |||
| 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 | |||
| { | |||
| @@ -1398,7 +1405,7 @@ public: | |||
| postponeEvent(PluginPostEventParameterChange, index, 0, value); | |||
| } | |||
| else | |||
| setParameterValue(index, value, true, true, true); | |||
| setParameterValue(index, value, true, true, true); // FIXME - dont send to GUI? | |||
| } | |||
| intptr_t handleAudioMasterGetCurrentProcessLevel() | |||
| @@ -1673,11 +1680,10 @@ public: | |||
| #else | |||
| if (effect && effect->resvd1) | |||
| { | |||
| //self = (VstPlugin*)getPointer(effect->resvd1); | |||
| //self = (VstPlugin*)effect->resvd1; | |||
| self = (VstPlugin*)effect->resvd1; | |||
| #endif | |||
| //if (self->unique1 != self->unique2) | |||
| // self = nullptr; | |||
| if (self->unique1 != self->unique2) | |||
| self = nullptr; | |||
| } | |||
| intptr_t ret = 0; | |||
| @@ -1849,11 +1855,11 @@ public: | |||
| // Deprecated in VST SDK 2.4 | |||
| break; | |||
| #ifdef VESTIGE_HEADER | |||
| case audioMasterGetSpeakerArrangement: | |||
| #else | |||
| //#ifdef VESTIGE_HEADER | |||
| // case audioMasterGetSpeakerArrangement: | |||
| //#else | |||
| case audioMasterGetOutputSpeakerArrangement: | |||
| #endif | |||
| //#endif | |||
| // Deprecated in VST SDK 2.4 | |||
| // TODO | |||
| break; | |||
| @@ -1861,7 +1867,7 @@ public: | |||
| case audioMasterGetVendorString: | |||
| if (ptr) | |||
| strcpy((char*)ptr, "falkTX"); | |||
| strcpy((char*)ptr, "Cadence"); | |||
| break; | |||
| case audioMasterGetProductString: | |||
| @@ -8,7 +8,7 @@ CXX ?= g++ | |||
| WINECXX ?= wineg++ | |||
| 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 += -I. -I../carla-includes $(shell pkg-config --cflags liblo QtCore) | |||
| @@ -210,6 +210,12 @@ public: | |||
| m_osc.sendOscControl(index, value); | |||
| } | |||
| void sendOscMidi(const uint8_t midiBuf[4]) | |||
| { | |||
| qDebug("CarlaClient::sendOscMidi(%p)", midiBuf); | |||
| m_osc.sendOscMidi(midiBuf); | |||
| } | |||
| void sendOscUpdate() | |||
| { | |||
| qDebug("CarlaClient::sendOscUpdate()"); | |||
| @@ -75,33 +75,59 @@ public: | |||
| 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() | |||
| { | |||
| 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() | |||
| { | |||
| osc_send_exiting(&m_controlData); | |||
| Q_ASSERT(m_controlData.target); | |||
| if (m_controlData.target) | |||
| osc_send_exiting(&m_controlData); | |||
| } | |||
| #ifdef BRIDGE_LV2 | |||
| 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) | |||
| { | |||
| 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 | |||
| @@ -57,11 +57,13 @@ public: | |||
| gtk_init(&argc, &argv); | |||
| } | |||
| void exec(CarlaClient* const client) | |||
| void exec(CarlaClient* const client, const bool showGui) | |||
| { | |||
| qDebug("CarlaToolkitGtk2::exec(%p)", client); | |||
| Q_ASSERT(client); | |||
| m_client = client; | |||
| window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |||
| gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | |||
| @@ -88,12 +90,10 @@ public: | |||
| g_timeout_add(50, gtk_ui_timeout, this); | |||
| g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | |||
| m_client = client; | |||
| m_client->sendOscUpdate(); | |||
| #ifdef QTCREATOR_TEST | |||
| show(); | |||
| #endif | |||
| if (showGui) | |||
| show(); | |||
| // Main loop | |||
| gtk_main(); | |||
| @@ -57,11 +57,13 @@ public: | |||
| gtk_init(&argc, &argv); | |||
| } | |||
| void exec(CarlaClient* const client) | |||
| void exec(CarlaClient* const client, const bool showGui) | |||
| { | |||
| qDebug("CarlaToolkitGtk3::exec(%p)", client); | |||
| Q_ASSERT(client); | |||
| m_client = client; | |||
| window = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |||
| gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)client->getWidget()); | |||
| @@ -88,12 +90,10 @@ public: | |||
| g_timeout_add(50, gtk_ui_timeout, this); | |||
| g_signal_connect(window, "destroy", G_CALLBACK(gtk_ui_destroy), this); | |||
| m_client = client; | |||
| m_client->sendOscUpdate(); | |||
| #ifdef QTCREATOR_TEST | |||
| show(); | |||
| #endif | |||
| if (showGui) | |||
| show(); | |||
| // Main loop | |||
| gtk_main(); | |||
| @@ -26,36 +26,59 @@ | |||
| CARLA_BRIDGE_START_NAMESPACE | |||
| // ------------------------------------------------------------------------- | |||
| static int _argc = 0; | |||
| static char* _argv[] = { nullptr }; | |||
| class MessageChecker : public QTimer | |||
| class BridgeApplication : public QApplication | |||
| { | |||
| 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: | |||
| CarlaClient* const client; | |||
| int msgTimer; | |||
| CarlaClient* m_client; | |||
| }; | |||
| // ------------------------------------------------------------------------- | |||
| class CarlaToolkitQt4: public CarlaToolkit | |||
| { | |||
| public: | |||
| CarlaToolkitQt4(const char* const 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") | |||
| #elif defined(BRIDGE_LV2_HWND) || defined(BRIDGE_VST_HWND) | |||
| settings("Cadence", "Carla-HWNDUIs") | |||
| #else | |||
| settings("Cadence", "Carla-Qt4UIs") | |||
| settings("Cadence", "Carla-UIs") | |||
| #endif | |||
| { | |||
| qDebug("CarlaToolkitQt4::CarlaToolkitQt4(%s)", title); | |||
| @@ -67,6 +90,7 @@ public: | |||
| ~CarlaToolkitQt4() | |||
| { | |||
| qDebug("CarlaToolkitQt4::~CarlaToolkitQt4()"); | |||
| Q_ASSERT(! app); | |||
| } | |||
| void init() | |||
| @@ -74,17 +98,17 @@ public: | |||
| qDebug("CarlaToolkitQt4::init()"); | |||
| 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); | |||
| Q_ASSERT(app); | |||
| Q_ASSERT(client); | |||
| m_client = client; | |||
| if (client->needsReparent()) | |||
| { | |||
| window = (QDialog*)client->getWidget(); | |||
| @@ -93,7 +117,7 @@ public: | |||
| else | |||
| { | |||
| // TODO - window->setCentralWidget(widget); or other simpler method | |||
| window = new QDialog(); | |||
| window = new QDialog(nullptr); | |||
| window->resize(10, 10); | |||
| 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(); | |||
| #ifdef QTCREATOR_TEST | |||
| show(); | |||
| #endif | |||
| if (showGui) | |||
| show(); | |||
| // Main loop | |||
| app->exec(); | |||
| app->exec(client); | |||
| } | |||
| void quit() | |||
| @@ -170,6 +189,7 @@ public: | |||
| app->quit(); | |||
| delete app; | |||
| app = nullptr; | |||
| } | |||
| } | |||
| @@ -201,7 +221,7 @@ public: | |||
| } | |||
| private: | |||
| QApplication* app; | |||
| BridgeApplication* app; | |||
| QDialog* window; | |||
| QSettings settings; | |||
| }; | |||
| @@ -50,7 +50,7 @@ public: | |||
| } | |||
| 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 show() = 0; | |||
| @@ -32,6 +32,10 @@ CARLA_BRIDGE_START_NAMESPACE | |||
| // ------------------------------------------------------------------------- | |||
| // fake values | |||
| uint32_t bufferSize = 512; | |||
| double sampleRate = 44100.0; | |||
| // feature ids | |||
| const uint32_t lv2_feature_id_event = 0; | |||
| const uint32_t lv2_feature_id_logs = 1; | |||
| @@ -846,28 +850,36 @@ CARLA_BRIDGE_END_NAMESPACE | |||
| int main(int argc, char* argv[]) | |||
| { | |||
| using namespace CarlaBridge; | |||
| 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; | |||
| } | |||
| 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 | |||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(ui_title); | |||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(uiTitle); | |||
| toolkit->init(); | |||
| // Init LV2-UI | |||
| CarlaLv2Client client(toolkit); | |||
| // Init OSC | |||
| if (! client.oscInit(osc_url)) | |||
| if (useOsc && ! client.oscInit(oscUrl)) | |||
| { | |||
| toolkit->quit(); | |||
| delete toolkit; | |||
| @@ -877,9 +889,9 @@ int main(int argc, char* argv[]) | |||
| // Load UI | |||
| int ret; | |||
| if (client.init(plugin_uri, ui_uri)) | |||
| if (client.init(pluginURI, uiURI)) | |||
| { | |||
| toolkit->exec(&client); | |||
| toolkit->exec(&client, !useOsc); | |||
| ret = 0; | |||
| } | |||
| else | |||
| @@ -889,8 +901,11 @@ int main(int argc, char* argv[]) | |||
| } | |||
| // Close OSC | |||
| client.sendOscExiting(); | |||
| client.oscClose(); | |||
| if (useOsc) | |||
| { | |||
| client.sendOscExiting(); | |||
| client.oscClose(); | |||
| } | |||
| // Close LV2-UI | |||
| client.close(); | |||
| @@ -21,32 +21,32 @@ | |||
| #include "carla_vst.h" | |||
| #include "carla_midi.h" | |||
| #include <QtCore/QTimerEvent> | |||
| #include <QtGui/QDialog> | |||
| #ifdef Q_WS_X11 | |||
| #include <QtGui/QX11Info> | |||
| #endif | |||
| 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: | |||
| CarlaVstClient(CarlaToolkit* const toolkit) | |||
| : CarlaClient(toolkit) | |||
| : CarlaClient(toolkit), | |||
| QObject(nullptr) | |||
| { | |||
| effect = nullptr; | |||
| widget = new QDialog; | |||
| widget = new QDialog(nullptr); | |||
| idleTimer = 0; | |||
| // make client valid | |||
| unique1 = unique2 = rand(); | |||
| @@ -67,37 +67,48 @@ public: | |||
| // open DLL | |||
| if (! libOpen(binary)) | |||
| { | |||
| qWarning("%s", libError()); | |||
| return false; | |||
| } | |||
| // ----------------------------------------------------------------- | |||
| // 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; | |||
| // ----------------------------------------------------------------- | |||
| // initialize plugin | |||
| effect = vstfn(VstHostCallback); | |||
| effect = vstFn(hostCallback); | |||
| if ((! effect) || effect->magic != kEffectMagic) | |||
| if (! (effect && effect->magic == kEffectMagic)) | |||
| return false; | |||
| // ----------------------------------------------------------------- | |||
| // 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); | |||
| #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 | |||
| 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 | |||
| effect->ptr1 = this; | |||
| @@ -109,17 +120,20 @@ public: | |||
| // initialize gui stuff | |||
| 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 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 false; | |||
| } | |||
| 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 | |||
| CarlaVstClient* self = nullptr; | |||
| @@ -190,158 +304,140 @@ public: | |||
| #else | |||
| if (effect && effect->resvd1) | |||
| { | |||
| self = (CarlaVstClient*)getPointer(effect->resvd1); | |||
| self = (CarlaVstClient*)effect->resvd1; | |||
| #endif | |||
| if (self->unique1 != self->unique2) | |||
| self = nullptr; | |||
| } | |||
| intptr_t ret = 0; | |||
| switch (opcode) | |||
| { | |||
| case audioMasterAutomate: | |||
| if (self) | |||
| self->sendOscControl(index, opt); | |||
| self->handleAudioMasterAutomate(index, opt); | |||
| break; | |||
| case audioMasterVersion: | |||
| return kVstVersion; | |||
| ret = kVstVersion; | |||
| break; | |||
| case audioMasterCurrentId: | |||
| return 0; // TODO | |||
| // TODO | |||
| break; | |||
| 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; | |||
| case audioMasterGetTime: | |||
| static VstTimeInfo_R timeInfo; | |||
| 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; | |||
| #if ! VST_FORCE_DEPRECATED | |||
| case audioMasterTempoAt: | |||
| // Deprecated in VST SDK 2.4 | |||
| return 120.0 * 10000; | |||
| ret = 120 * 10000; | |||
| break; | |||
| #endif | |||
| 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: | |||
| return FAKE_SAMPLE_RATE; | |||
| ret = sampleRate; | |||
| break; | |||
| case audioMasterGetBlockSize: | |||
| return FAKE_BUFFER_SIZE; | |||
| ret = bufferSize; | |||
| break; | |||
| case audioMasterGetCurrentProcessLevel: | |||
| ret = kVstProcessLevelUser; | |||
| break; | |||
| case audioMasterGetAutomationState: | |||
| ret = kVstAutomationReadWrite; | |||
| break; | |||
| case audioMasterGetVendorString: | |||
| strcpy((char*)ptr, "Cadence"); | |||
| if (ptr) | |||
| strcpy((char*)ptr, "Cadence"); | |||
| break; | |||
| case audioMasterGetProductString: | |||
| strcpy((char*)ptr, "Carla-Bridge"); | |||
| if (ptr) | |||
| strcpy((char*)ptr, "Carla-Bridge"); | |||
| break; | |||
| case audioMasterGetVendorVersion: | |||
| return 0x05; // 0.5 | |||
| case audioMasterVendorSpecific: | |||
| ret = 0x050; // 0.5.0 | |||
| break; | |||
| 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: | |||
| return kVstLangEnglish; | |||
| ret = kVstLangEnglish; | |||
| break; | |||
| case audioMasterUpdateDisplay: | |||
| if (self) | |||
| self->sendOscConfigure("reloadprograms", ""); | |||
| self->handleAudioMasterUpdateDisplay(); | |||
| break; | |||
| 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 | |||
| 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: | |||
| int unique1; | |||
| AEffect* effect; | |||
| QDialog* widget; | |||
| int idleTimer; | |||
| int unique2; | |||
| }; | |||
| @@ -349,27 +445,35 @@ CARLA_BRIDGE_END_NAMESPACE | |||
| int main(int argc, char* argv[]) | |||
| { | |||
| using namespace CarlaBridge; | |||
| if (argc != 4) | |||
| { | |||
| qCritical("%s: bad arguments", argv[0]); | |||
| qCritical("usage: %s <osc-url|\"null\"> <binary> <ui-title>", argv[0]); | |||
| 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 | |||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(ui_title); | |||
| CarlaToolkit* const toolkit = CarlaToolkit::createNew(uiTitle); | |||
| toolkit->init(); | |||
| // Init VST-UI | |||
| CarlaVstClient client(toolkit); | |||
| // Init OSC | |||
| if (! client.oscInit(osc_url)) | |||
| if (useOsc && ! client.oscInit(oscUrl)) | |||
| { | |||
| toolkit->quit(); | |||
| delete toolkit; | |||
| @@ -381,7 +485,7 @@ int main(int argc, char* argv[]) | |||
| if (client.init(binary, nullptr)) | |||
| { | |||
| toolkit->exec(&client); | |||
| toolkit->exec(&client, !useOsc); | |||
| ret = 0; | |||
| } | |||
| else | |||
| @@ -391,8 +495,11 @@ int main(int argc, char* argv[]) | |||
| } | |||
| // Close OSC | |||
| client.sendOscExiting(); | |||
| client.oscClose(); | |||
| if (useOsc) | |||
| { | |||
| client.sendOscExiting(); | |||
| client.oscClose(); | |||
| } | |||
| // Close VST-UI | |||
| client.close(); | |||
| @@ -168,6 +168,10 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode | |||
| ret = kVstProcessLevelUser; | |||
| break; | |||
| case audioMasterGetAutomationState: | |||
| ret = kVstAutomationReadWrite; | |||
| break; | |||
| case audioMasterGetVendorString: | |||
| if (ptr) | |||
| 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) | |||
| { | |||
| Q_ASSERT(oscData && oscData->path); | |||
| Q_ASSERT(program >= 0); | |||
| Q_ASSERT(program >= 0 && program < 128); | |||
| Q_ASSERT(bank >= 0); | |||
| 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) | |||
| { | |||
| 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); | |||
| 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.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.show_gui.argtypes = [c_ushort, c_bool] | |||
| @@ -1055,8 +1055,8 @@ class Host(object): | |||
| def set_chunk_data(self, plugin_id, chunk_data): | |||
| 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): | |||
| 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.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): | |||
| pass | |||