diff --git a/c++/carla-backend/carla_backend.doxygen b/c++/carla-backend/carla_backend.doxygen index b462d29..0094ab2 100644 --- a/c++/carla-backend/carla_backend.doxygen +++ b/c++/carla-backend/carla_backend.doxygen @@ -241,7 +241,7 @@ EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = -PREDEFINED = CARLA_ENGINE_JACK CARLA_ENGINE_RTAUDIO WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST WANT_FLUIDSYNTH WANT_LINUXSAMPLER +PREDEFINED = DOXYGEN CARLA_ENGINE_JACK CARLA_ENGINE_RTAUDIO WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST WANT_FLUIDSYNTH WANT_LINUXSAMPLER EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- diff --git a/c++/carla-backend/carla_backend.h b/c++/carla-backend/carla_backend.h index 909ae9d..3d93713 100644 --- a/c++/carla-backend/carla_backend.h +++ b/c++/carla-backend/carla_backend.h @@ -55,7 +55,7 @@ const unsigned int PLUGIN_IS_BRIDGE = 0x001; //!< Plugin is a bridge (i const unsigned int PLUGIN_IS_SYNTH = 0x002; //!< Plugin is a synthesizer (produces sound). const unsigned int PLUGIN_HAS_GUI = 0x004; //!< Plugin has its own custom GUI. const unsigned int PLUGIN_USES_CHUNKS = 0x008; //!< Plugin uses chunks to save internal data.\see CarlaPlugin::chunkData() -const unsigned int PLUGIN_USES_SINGLE_THREAD = 0x010; //!< Plugin has its own custom GUI. +const unsigned int PLUGIN_USES_SINGLE_THREAD = 0x010; //!< Plugin needs a single thread for both DSP processing and UI events. const unsigned int PLUGIN_CAN_DRYWET = 0x020; //!< Plugin can make use of Dry/Wet controls. const unsigned int PLUGIN_CAN_VOLUME = 0x040; //!< Plugin can make use of Volume controls. const unsigned int PLUGIN_CAN_BALANCE = 0x080; //!< Plugin can make use of Left & Right Balance controls. @@ -83,6 +83,7 @@ const unsigned int PARAMETER_USES_CUSTOM_TEXT = 0x80; //!< Parameter uses custom * @defgroup BridgeMessages Bridge Messages * * Various bridge related messages, used as configure(, value). + * \note This is for internal use only. * @{ */ const char* const CARLA_BRIDGE_MSG_HIDE_GUI = "CarlaBridgeHideGUI"; //!< Plugin -> Host call, tells host GUI is now hidden @@ -110,7 +111,7 @@ enum BinaryType { */ enum PluginType { PLUGIN_NONE = 0, //!< Null plugin type. - PLUGIN_INTERNAL = 1, //!< Internal plugin. + PLUGIN_INTERNAL = 1, //!< Internal plugin.\see NativePlugin PLUGIN_LADSPA = 2, //!< LADSPA plugin.\see LadspaPlugin PLUGIN_DSSI = 3, //!< DSSI plugin.\see DssiPlugin PLUGIN_LV2 = 4, //!< LV2 plugin.\see Lv2Plugin @@ -120,6 +121,10 @@ enum PluginType { PLUGIN_SFZ = 8 //!< SFZ sound kit, implemented via LinuxSampler.\see LinuxSamplerPlugin }; +/*! + * Plugin category, describing the funtionality of a plugin.\n + * When a plugin fails to tell his own category, one is atributted to it based on its name. + */ enum PluginCategory { PLUGIN_CATEGORY_NONE = 0, //!< Null plugin category. PLUGIN_CATEGORY_SYNTH = 1, //!< A synthesizer or generator. @@ -132,52 +137,67 @@ enum PluginCategory { PLUGIN_CATEGORY_OTHER = 8 //!< Misc plugin (used to check if the plugin has a category). }; +/*! + * Plugin parameter type. + */ enum ParameterType { - PARAMETER_UNKNOWN = 0, - PARAMETER_INPUT = 1, - PARAMETER_OUTPUT = 2, - PARAMETER_LATENCY = 3, - PARAMETER_SAMPLE_RATE = 4, - PARAMETER_LV2_FREEWHEEL = 5, - PARAMETER_LV2_TIME = 6 + PARAMETER_UNKNOWN = 0, //!< Null parameter type. + PARAMETER_INPUT = 1, //!< Input parameter. + PARAMETER_OUTPUT = 2, //!< Ouput parameter. + PARAMETER_LATENCY = 3, //!< Special latency parameter, used in LADSPA, DSSI and LV2 plugins. + PARAMETER_SAMPLE_RATE = 4, //!< Special sample-rate parameter, used in LADSPA, DSSI and LV2 plugins. + PARAMETER_LV2_FREEWHEEL = 5, //!< Special LV2 Plugin parameter used to report freewheel (offline) mode. + PARAMETER_LV2_TIME = 6 //!< Special LV2 Plugin parameter used to report time information. }; +/*! + * Internal parameter indexes.\n + * These are special parameters used internally, plugins do not know about their existence. + */ enum InternalParametersIndex { - PARAMETER_NULL = -1, - PARAMETER_ACTIVE = -2, - PARAMETER_DRYWET = -3, - PARAMETER_VOLUME = -4, - PARAMETER_BALANCE_LEFT = -5, - PARAMETER_BALANCE_RIGHT = -6 + PARAMETER_NULL = -1, //!< Null parameter. + PARAMETER_ACTIVE = -2, //!< Active parameter, can only be 'true' or 'false'; default is 'false'. + PARAMETER_DRYWET = -3, //!< Dry/Wet parameter, range 0.0...1.0; default is 1.0. + PARAMETER_VOLUME = -4, //!< Volume parameter, range 0.0...1.27; default is 1.0. + PARAMETER_BALANCE_LEFT = -5, //!< Balance-Left parameter, range -1.0...1.0; default is -1.0. + PARAMETER_BALANCE_RIGHT = -6 //!< Balance-Right parameter, range -1.0...1.0; default is 1.0. }; +/*! + * Custom Data types.\n + * The type defines how the value in CustomData is stored.\n + * Binary chunks are stored in base64 format. + */ enum CustomDataType { - CUSTOM_DATA_INVALID = 0, - CUSTOM_DATA_STRING = 1, - CUSTOM_DATA_PATH = 2, - CUSTOM_DATA_CHUNK = 3, - CUSTOM_DATA_BINARY = 4 + CUSTOM_DATA_INVALID = 0, //!< Null/Invalid data. + CUSTOM_DATA_STRING = 1, //!< String + CUSTOM_DATA_PATH = 2, //!< Path (same as string, but used for filenames). + CUSTOM_DATA_CHUNK = 3, //!< Binary chunk (known type). + CUSTOM_DATA_BINARY = 4 //!< Binary chunk, used to store any unknown type. }; +/*! + * Plugin custom GUI type. + * \see OPTION_PREFER_UI_BRIDGES + */ enum GuiType { - GUI_NONE = 0, - GUI_INTERNAL_QT4 = 1, - GUI_INTERNAL_COCOA = 2, - GUI_INTERNAL_HWND = 3, - GUI_INTERNAL_X11 = 4, - GUI_EXTERNAL_LV2 = 5, - GUI_EXTERNAL_SUIL = 6, - GUI_EXTERNAL_OSC = 7 + GUI_NONE = 0, //!< Null type, plugin has no custom GUI. + GUI_INTERNAL_QT4 = 1, //!< Qt4 type, handled internally. + GUI_INTERNAL_COCOA = 2, //!< Reparented MacOS native type, handled internally. + GUI_INTERNAL_HWND = 3, //!< Reparented Windows native type, handled internally. + GUI_INTERNAL_X11 = 4, //!< Reparented X11 native type, handled internally. + GUI_EXTERNAL_LV2 = 5, //!< External LV2-UI type, handled internally. + GUI_EXTERNAL_SUIL = 6, //!< SUIL type, currently used only for lv2 gtk2 direct-access UIs.\note This type will be removed in the future! + GUI_EXTERNAL_OSC = 7 //!< External, osc-bridge controlled, UI. }; /*! - * Options used in the setOption() call.\n - * These options must be set before calling CarlaEngine::init() or after CarlaEngine::close(). + * Options used in the set_option() call.\n + * These options must be set before calling engine_init() or after engine_close(). */ enum OptionsType { /*! * Try to set the current process name.\n - * * \note Not available on all platforms. */ OPTION_PROCESS_NAME = 0, @@ -185,7 +205,6 @@ enum OptionsType { /*! * Set the engine processing mode.\n * Default is PROCESS_MODE_MULTIPLE_CLIENTS. - * * \see ProcessModeType */ OPTION_PROCESS_MODE = 1, @@ -205,12 +224,12 @@ enum OptionsType { OPTION_MAX_PARAMETERS = 3, /*! - * Prefered buffer size. + * Prefered buffer size, currently unused. */ OPTION_PREFERRED_BUFFER_SIZE = 4, /*! - * Prefered sample rate. + * Prefered sample rate, currently unused. */ OPTION_PREFERRED_SAMPLE_RATE = 5, @@ -222,7 +241,7 @@ enum OptionsType { /*! * Use (unofficial) dssi-vst chunks feature.\n - * Default is no. + * Default is no.\n * EXPERIMENTAL! */ OPTION_USE_DSSI_VST_CHUNKS = 7, @@ -345,7 +364,7 @@ enum OptionsType { /*! * Opcodes sent from the engine callback, as defined by CallbackFunc. * - * \see CarlaEngine::setCallback() + * \see set_callback_function() */ enum CallbackType { /*! @@ -459,12 +478,12 @@ enum CallbackType { CALLBACK_NSM_ANNOUNCE = 15, /*! - * Non-Session-Manager Open message. + * Non-Session-Manager Open message #1. */ CALLBACK_NSM_OPEN1 = 16, /*! - * Non-Session-Manager Open message. + * Non-Session-Manager Open message #2. */ CALLBACK_NSM_OPEN2 = 17, @@ -480,34 +499,23 @@ enum CallbackType { }; /*! - * Engine process mode, changed using setOption(). + * Engine process mode, changed using set_option(). * * \see OPTION_PROCESS_MODE */ enum ProcessModeType { - PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic audio input/outputs as needed by plugins) - PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 client per plugin) + PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins) + PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin) PROCESS_MODE_CONTINUOUS_RACK = 2 //!< Single client, "rack" mode. Processes plugins in order of id, with forced stereo. }; /*! * Callback function the backend will call when something interesting happens. * - * \see CarlaEngine::setCallback() + * \see set_callback_function() */ typedef void (*CallbackFunc)(void* ptr, CallbackType action, unsigned short pluginId, int value1, int value2, double value3); -struct midi_program_t { - uint32_t bank; - uint32_t program; - const char* name; - - midi_program_t() - : bank(0), - program(0), - name(nullptr) {} -}; - struct ParameterData { ParameterType type; int32_t index; @@ -542,6 +550,17 @@ struct ParameterRanges { stepLarge(0.1) {} }; +struct MidiProgramData { + uint32_t bank; + uint32_t program; + const char* name; + + MidiProgramData() + : bank(0), + program(0), + name(nullptr) {} +}; + struct CustomData { CustomDataType type; const char* key; diff --git a/c++/carla-backend/carla_backend_standalone.cpp b/c++/carla-backend/carla_backend_standalone.cpp index a90b8ca..aee31d1 100644 --- a/c++/carla-backend/carla_backend_standalone.cpp +++ b/c++/carla-backend/carla_backend_standalone.cpp @@ -32,46 +32,48 @@ const char* get_extended_license_text() { qDebug("CarlaBackendStandalone::get_extended_license_text()"); - QString text("

This current Carla build is using the following features and 3rd-party code:

"); - text += ""; #ifdef WANT_LINUXSAMPLER - text += "

(*) Using LinuxSampler code in commercial hardware or software products is not allowed without prior written authorization by the authors.

"; + text += "

(*) Using LinuxSampler code in commercial hardware or software products is not allowed without prior written authorization by the authors.

"; #endif - if (! extendedLicenseText) extendedLicenseText = strdup(text.toUtf8().constData()); + } return extendedLicenseText; } @@ -99,7 +101,8 @@ const char* get_engine_driver_name(unsigned int index) #ifdef CARLA_ENGINE_JACK if (index == 0) return "JACK"; - index -= 1; + else + index -= 1; #endif #ifdef CARLA_ENGINE_RTAUDIO @@ -586,11 +589,11 @@ const CarlaBackend::ParameterRanges* get_parameter_ranges(unsigned short plugin_ return &ranges; } -const CarlaBackend::midi_program_t* get_midi_program_data(unsigned short plugin_id, uint32_t midi_program_id) +const CarlaBackend::MidiProgramData* 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); - static CarlaBackend::midi_program_t data; + static CarlaBackend::MidiProgramData data; CarlaBackend::CarlaPlugin* const plugin = carlaEngine->getPlugin(plugin_id); @@ -1254,11 +1257,11 @@ void set_callback_function(CarlaBackend::CallbackFunc func) carlaEngine->setCallback(func, nullptr); } -void set_option(CarlaBackend::OptionsType option, int value, const char* valueStr) +void set_option(CarlaBackend::OptionsType option, int value, const char* value_str) { - qDebug("CarlaBackendStandalone::set_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2str(option), value, valueStr); + qDebug("CarlaBackendStandalone::set_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2str(option), value, value_str); - CarlaBackend::setOption(option, value, valueStr); + CarlaBackend::setOption(option, value, value_str); } // ------------------------------------------------------------------------------------------------------------------- @@ -1340,7 +1343,7 @@ protected: int nsm_open_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg) { - qDebug("CarlaNSM::nsm_open_handler(%s, %i, %p, %s, %p)", path, argc, argv, types, msg); + qDebug("CarlaNSM::nsm_open_handler(\"%s\", \"%s\", %p, %i, %p)", path, types, argv, argc, msg); if (! carlaFunc) return 1; @@ -1365,7 +1368,7 @@ protected: int nsm_save_handler(const char* const path, const char* const types, lo_arg** const argv, const int argc, const lo_message msg) { - qDebug("CarlaNSM::nsm_save_handler(%s, %i, %p, %s, %p)", path, argc, argv, types, msg); + qDebug("CarlaNSM::nsm_save_handler(\"%s\", \"%s\", %p, %i, %p)", path, types, argv, argc, msg); if (! carlaFunc) return 1; diff --git a/c++/carla-backend/carla_backend_standalone.h b/c++/carla-backend/carla_backend_standalone.h index bb82596..904ffad 100644 --- a/c++/carla-backend/carla_backend_standalone.h +++ b/c++/carla-backend/carla_backend_standalone.h @@ -25,7 +25,7 @@ /*! * @defgroup CarlaBackendStandalone Carla Backend Standalone * - * The Carla Backend Standalone + * The Carla Backend Standalone API * * @{ */ @@ -120,7 +120,7 @@ CARLA_EXPORT const GuiInfo* get_gui_info(unsigned short plugin_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::MidiProgramData* 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); @@ -172,7 +172,7 @@ CARLA_EXPORT const char* get_last_error(); CARLA_EXPORT const char* get_host_osc_url(); CARLA_EXPORT void set_callback_function(CarlaBackend::CallbackFunc func); -CARLA_EXPORT void set_option(CarlaBackend::OptionsType option, int value, const char* valueStr); +CARLA_EXPORT void set_option(CarlaBackend::OptionsType option, int value, const char* value_str); CARLA_EXPORT void nsm_announce(const char* url, int pid); CARLA_EXPORT void nsm_reply_open(); diff --git a/c++/carla-backend/carla_bridge.cpp b/c++/carla-backend/carla_bridge.cpp index 8961b91..2c92e31 100644 --- a/c++/carla-backend/carla_bridge.cpp +++ b/c++/carla-backend/carla_bridge.cpp @@ -391,7 +391,7 @@ public: midiprog.count = count; if (midiprog.count > 0) - midiprog.data = new midi_program_t [midiprog.count]; + midiprog.data = new MidiProgramData[midiprog.count]; else midiprog.data = nullptr; diff --git a/c++/carla-backend/carla_engine.cpp b/c++/carla-backend/carla_engine.cpp index 106b5fa..a73298b 100644 --- a/c++/carla-backend/carla_engine.cpp +++ b/c++/carla-backend/carla_engine.cpp @@ -508,6 +508,7 @@ void CarlaEngine::callback(const CallbackType action, const unsigned short plugi void CarlaEngine::setCallback(const CallbackFunc func, void* const ptr) { qDebug("CarlaEngine::setCallback(%p, %p)", func, ptr); + CARLA_ASSERT(func); m_callback = func; m_callbackPtr = ptr; diff --git a/c++/carla-backend/carla_engine.h b/c++/carla-backend/carla_engine.h index 6f7558c..1e28cab 100644 --- a/c++/carla-backend/carla_engine.h +++ b/c++/carla-backend/carla_engine.h @@ -346,9 +346,9 @@ public: * \param engine The engine to lock * \param lock Wherever to lock the engine or not, true by default */ - ScopedLocker(CarlaEngine* const engine, bool lock = true) : - m_engine(engine), - m_lock(lock) + ScopedLocker(CarlaEngine* const engine, bool lock = true) + : m_engine(engine), + m_lock(lock) { if (m_lock) m_engine->processLock(); diff --git a/c++/carla-backend/carla_native.cpp b/c++/carla-backend/carla_native.cpp index 93fd6c4..c196466 100644 --- a/c++/carla-backend/carla_native.cpp +++ b/c++/carla-backend/carla_native.cpp @@ -779,7 +779,7 @@ public: midiprog.count = descriptor->midiProgramCount; if (midiprog.count > 0) - midiprog.data = new midi_program_t[midiprog.count]; + midiprog.data = new MidiProgramData[midiprog.count]; // Update data for (i=0; i < midiprog.count; i++) diff --git a/c++/carla-backend/carla_osc.cpp b/c++/carla-backend/carla_osc.cpp index 9e7f10e..e68bc58 100644 --- a/c++/carla-backend/carla_osc.cpp +++ b/c++/carla-backend/carla_osc.cpp @@ -25,8 +25,8 @@ void osc_error_handler(const int num, const char* const msg, const char* const p qCritical("osc_error_handler(%i, %s, %s)", num, msg, path); } -CarlaOsc::CarlaOsc(CarlaEngine* const engine_) : - engine(engine_) +CarlaOsc::CarlaOsc(CarlaEngine* const engine_) + : engine(engine_) { CARLA_ASSERT(engine); qDebug("CarlaOsc::CarlaOsc(%p)", engine_); diff --git a/c++/carla-backend/carla_plugin.h b/c++/carla-backend/carla_plugin.h index df1e4c5..e2e13ed 100644 --- a/c++/carla-backend/carla_plugin.h +++ b/c++/carla-backend/carla_plugin.h @@ -143,7 +143,7 @@ struct PluginProgramData { struct PluginMidiProgramData { uint32_t count; int32_t current; - midi_program_t* data; + MidiProgramData* data; PluginMidiProgramData() : count(0), @@ -178,10 +178,10 @@ struct ExternalMidiNote { }; // fallback data -static ParameterData paramDataNull; -static ParameterRanges paramRangesNull; -static midi_program_t midiProgramNull; -static CustomData customDataNull; +static ParameterData paramDataNull; +static ParameterRanges paramRangesNull; +static MidiProgramData midiProgramDataNull; +static CustomData customDataNull; /*! * \class CarlaPlugin @@ -535,14 +535,14 @@ public: * * \see getMidiProgramName() */ - const midi_program_t* midiProgramData(const uint32_t index) const + const MidiProgramData* midiProgramData(const uint32_t index) const { CARLA_ASSERT(index < midiprog.count); if (index < midiprog.count) return &midiprog.data[index]; - return &midiProgramNull; + return &midiProgramDataNull; } /*! @@ -2156,9 +2156,9 @@ public: * \param plugin The plugin to disable * \param disable Wherever to disable the plugin or not, true by default */ - ScopedDisabler(CarlaPlugin* const plugin, const bool disable = true) : - m_plugin(plugin), - m_disable(disable) + ScopedDisabler(CarlaPlugin* const plugin, const bool disable = true) + : m_plugin(plugin), + m_disable(disable) { if (m_disable) { diff --git a/c++/carla-backend/carla_threads.cpp b/c++/carla-backend/carla_threads.cpp index f6ddd0e..3715ebf 100644 --- a/c++/carla-backend/carla_threads.cpp +++ b/c++/carla-backend/carla_threads.cpp @@ -175,11 +175,11 @@ const char* PluginThreadMode2str(const CarlaPluginThread::PluginThreadMode mode) return nullptr; } -CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine_, CarlaBackend::CarlaPlugin* const plugin_, const PluginThreadMode mode_, QObject* const parent) : - QThread(parent), - engine(engine_), - plugin(plugin_), - mode(mode_) +CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine_, CarlaBackend::CarlaPlugin* const plugin_, const PluginThreadMode mode_, QObject* const parent) + : QThread(parent), + engine(engine_), + plugin(plugin_), + mode(mode_) { qDebug("CarlaPluginThread::CarlaPluginThread(plugin:\"%s\", engine:\"%s\", %s)", plugin->name(), engine->getName(), PluginThreadMode2str(mode)); diff --git a/c++/carla-backend/dssi.cpp b/c++/carla-backend/dssi.cpp index a194272..c122b15 100644 --- a/c++/carla-backend/dssi.cpp +++ b/c++/carla-backend/dssi.cpp @@ -731,7 +731,7 @@ public: } if (midiprog.count > 0) - midiprog.data = new midi_program_t[midiprog.count]; + midiprog.data = new MidiProgramData[midiprog.count]; // Update data for (i=0; i < midiprog.count; i++) diff --git a/c++/carla-backend/fluidsynth.cpp b/c++/carla-backend/fluidsynth.cpp index 7100a82..84f3d8e 100644 --- a/c++/carla-backend/fluidsynth.cpp +++ b/c++/carla-backend/fluidsynth.cpp @@ -762,7 +762,7 @@ public: CARLA_ASSERT(midiprog.count > 0); if (midiprog.count > 0) - midiprog.data = new midi_program_t[midiprog.count]; + midiprog.data = new MidiProgramData[midiprog.count]; // Update data uint32_t i = 0; diff --git a/c++/carla-backend/linuxsampler.cpp b/c++/carla-backend/linuxsampler.cpp index 28f35ab..9a653b9 100644 --- a/c++/carla-backend/linuxsampler.cpp +++ b/c++/carla-backend/linuxsampler.cpp @@ -247,7 +247,7 @@ public: CARLA_ASSERT(midiprog.count > 0); if (midiprog.count > 0) - midiprog.data = new midi_program_t [midiprog.count]; + midiprog.data = new MidiProgramData[midiprog.count]; // Update data for (i=0; i < midiprog.count; i++) diff --git a/c++/carla-backend/lv2.cpp b/c++/carla-backend/lv2.cpp index 1ae224f..af7ebb2 100644 --- a/c++/carla-backend/lv2.cpp +++ b/c++/carla-backend/lv2.cpp @@ -1758,7 +1758,7 @@ public: } if (midiprog.count > 0) - midiprog.data = new midi_program_t[midiprog.count]; + midiprog.data = new MidiProgramData[midiprog.count]; // Update data for (i=0; i < midiprog.count; i++) diff --git a/c++/carla-backend/plugins/midi-split.cpp b/c++/carla-backend/plugins/midi-split.cpp index 4d17959..04f695d 100644 --- a/c++/carla-backend/plugins/midi-split.cpp +++ b/c++/carla-backend/plugins/midi-split.cpp @@ -22,7 +22,8 @@ class MidiSplitPlugin : public PluginDescriptorClass { public: - MidiSplitPlugin(const PluginDescriptorClass* master) : PluginDescriptorClass(master) + MidiSplitPlugin(const PluginDescriptorClass* master) + : PluginDescriptorClass(master) { if (! master) return; diff --git a/c++/carla-backend/qtcreator/carla-backend.pro b/c++/carla-backend/qtcreator/carla-backend.pro index 5d665e8..e778f22 100644 --- a/c++/carla-backend/qtcreator/carla-backend.pro +++ b/c++/carla-backend/qtcreator/carla-backend.pro @@ -10,7 +10,7 @@ PKGCONFIG += fluidsynth linuxsampler PKGCONFIG += suil-0 TARGET = carla_backend -TEMPLATE = lib # app +TEMPLATE = app VERSION = 0.5.0 SOURCES = \ @@ -69,7 +69,7 @@ LIBS = -ldl \ ../../carla-rtmempool/carla_rtmempool.a DEFINES = QTCREATOR_TEST -DEFINES += DEBUG # NDEBUG +DEFINES += DEBUG NDEBUG DEFINES += CARLA_ENGINE_JACK DEFINES += CARLA_ENGINE_RTAUDIO HAVE_GETTIMEOFDAY __LINUX_ALSA__ __LINUX_ALSASEQ__ __LINUX_PULSE__ __RTAUDIO_DEBUG__ __RTMIDI_DEBUG__ DEFINES += CARLA_ENGINE_LV2 diff --git a/c++/carla-backend/vst.cpp b/c++/carla-backend/vst.cpp index 94d7fc9..1437dfb 100644 --- a/c++/carla-backend/vst.cpp +++ b/c++/carla-backend/vst.cpp @@ -1694,7 +1694,7 @@ public: { #ifdef DEBUG if (opcode != audioMasterGetTime) - qDebug("VstPlugin::hostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt); + qDebug("VstPlugin::hostCallback(%p, %02i:%s, %i, " P_INTPTR ", %p, %f)", effect, opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt); #endif #if 0 @@ -2097,7 +2097,7 @@ public: default: #ifdef DEBUG - qDebug("VstPlugin::hostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt); + qDebug("VstPlugin::hostCallback(%p, %02i:%s, %i, " P_INTPTR ", %p, %f)", effect, opcode, vstMasterOpcode2str(opcode), index, value, ptr, opt); #endif break; } diff --git a/c++/carla-bridge/carla_bridge.doxygen b/c++/carla-bridge/carla_bridge.doxygen index c76d521..8529257 100644 --- a/c++/carla-bridge/carla_bridge.doxygen +++ b/c++/carla-bridge/carla_bridge.doxygen @@ -241,7 +241,7 @@ EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = -PREDEFINED = BUILD_BRIDGE BUILD_BRIDGE_PLUGIN BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_VST LV2_GTK2 BRIDGE_LV2_GTK3 BRIDGE_LV2_QT4 BRIDGE_LV2_X11 BRIDGE_VST_HWND BRIDGE_VST_X11 +PREDEFINED = DOXYGEN BUILD_BRIDGE BUILD_BRIDGE_PLUGIN BUILD_BRIDGE_UI BRIDGE_LV2 BRIDGE_VST LV2_GTK2 BRIDGE_LV2_GTK3 BRIDGE_LV2_QT4 BRIDGE_LV2_X11 BRIDGE_VST_HWND BRIDGE_VST_X11 EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- diff --git a/c++/carla-includes/carla_includes.h b/c++/carla-includes/carla_includes.h index 20c99d2..e429938 100644 --- a/c++/carla-includes/carla_includes.h +++ b/c++/carla-includes/carla_includes.h @@ -103,7 +103,7 @@ #endif #ifdef NDEBUG -# define CARLA_ASSERT(cond) ((!(cond)) ? carla_assert(#cond,__FILE__,__LINE__) : pass()) +# define CARLA_ASSERT(cond) ((!(cond)) ? carla_assert(#cond, __FILE__, __LINE__) : pass()) #else # define CARLA_ASSERT Q_ASSERT #endif @@ -131,9 +131,9 @@ void carla_assert(const char* const assertion, const char* const file, const int } static inline -const char* bool2str(const bool yesno) +const char* bool2str(const bool yesNo) { - return yesno ? "true" : "false"; + return yesNo ? "true" : "false"; } static inline diff --git a/c++/carla-includes/carla_linuxsampler.h b/c++/carla-includes/carla_linuxsampler.h index 999acf4..985a95d 100644 --- a/c++/carla-includes/carla_linuxsampler.h +++ b/c++/carla-includes/carla_linuxsampler.h @@ -50,10 +50,10 @@ static const float VOLUME_MIN = 0.0f; // -inf dB class AudioOutputDevicePlugin : public AudioOutputDevice { public: - AudioOutputDevicePlugin(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin) : - AudioOutputDevice(std::map()), - m_engine(engine), - m_plugin(plugin) + AudioOutputDevicePlugin(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin) + : AudioOutputDevice(std::map()), + m_engine(engine), + m_plugin(plugin) { } @@ -108,8 +108,8 @@ private: class MidiInputDevicePlugin : public MidiInputDevice { public: - MidiInputDevicePlugin(Sampler* const sampler) : - MidiInputDevice(std::map(), sampler) + MidiInputDevicePlugin(Sampler* const sampler) + : MidiInputDevice(std::map(), sampler) { } @@ -147,8 +147,8 @@ public: class MidiInputPortPlugin : public MidiInputPort { protected: - MidiInputPortPlugin(MidiInputDevicePlugin* const device, const int portNumber) : - MidiInputPort(device, portNumber) + MidiInputPortPlugin(MidiInputDevicePlugin* const device, const int portNumber) + : MidiInputPort(device, portNumber) { } friend class MidiInputDevicePlugin; diff --git a/c++/carla-includes/carla_lv2.h b/c++/carla-includes/carla_lv2.h index 3f9a743..f8a2d51 100644 --- a/c++/carla-includes/carla_lv2.h +++ b/c++/carla-includes/carla_lv2.h @@ -95,112 +95,113 @@ struct LV2_Atom_Worker { class Lv2WorldClass : public Lilv::World { public: - Lv2WorldClass() : Lilv::World(), - port (new_uri(LV2_CORE__port)), - symbol (new_uri(LV2_CORE__symbol)), - designation (new_uri(LV2_CORE__designation)), - freewheeling (new_uri(LV2_CORE__freeWheeling)), - reportsLatency (new_uri(LV2_CORE__reportsLatency)), - - class_allpass (new_uri(LV2_CORE__AllpassPlugin)), - class_amplifier (new_uri(LV2_CORE__AmplifierPlugin)), - class_analyzer (new_uri(LV2_CORE__AnalyserPlugin)), - class_bandpass (new_uri(LV2_CORE__BandpassPlugin)), - class_chorus (new_uri(LV2_CORE__ChorusPlugin)), - class_comb (new_uri(LV2_CORE__CombPlugin)), - class_compressor (new_uri(LV2_CORE__CompressorPlugin)), - class_constant (new_uri(LV2_CORE__ConstantPlugin)), - class_converter (new_uri(LV2_CORE__ConverterPlugin)), - class_delay (new_uri(LV2_CORE__DelayPlugin)), - class_distortion (new_uri(LV2_CORE__DistortionPlugin)), - class_dynamics (new_uri(LV2_CORE__DynamicsPlugin)), - class_eq (new_uri(LV2_CORE__EQPlugin)), - class_expander (new_uri(LV2_CORE__ExpanderPlugin)), - class_filter (new_uri(LV2_CORE__FilterPlugin)), - class_flanger (new_uri(LV2_CORE__FlangerPlugin)), - class_function (new_uri(LV2_CORE__FunctionPlugin)), - class_gate (new_uri(LV2_CORE__GatePlugin)), - class_generator (new_uri(LV2_CORE__GeneratorPlugin)), - class_highpass (new_uri(LV2_CORE__HighpassPlugin)), - class_instrument (new_uri(LV2_CORE__InstrumentPlugin)), - class_limiter (new_uri(LV2_CORE__LimiterPlugin)), - class_lowpass (new_uri(LV2_CORE__LowpassPlugin)), - class_mixer (new_uri(LV2_CORE__MixerPlugin)), - class_modulator (new_uri(LV2_CORE__ModulatorPlugin)), - class_multi_eq (new_uri(LV2_CORE__MultiEQPlugin)), - class_oscillator (new_uri(LV2_CORE__OscillatorPlugin)), - class_para_eq (new_uri(LV2_CORE__ParaEQPlugin)), - class_phaser (new_uri(LV2_CORE__PhaserPlugin)), - class_pitch (new_uri(LV2_CORE__PitchPlugin)), - class_reverb (new_uri(LV2_CORE__ReverbPlugin)), - class_simulator (new_uri(LV2_CORE__SimulatorPlugin)), - class_spatial (new_uri(LV2_CORE__SpatialPlugin)), - class_spectral (new_uri(LV2_CORE__SpectralPlugin)), - class_utility (new_uri(LV2_CORE__UtilityPlugin)), - class_waveshaper (new_uri(LV2_CORE__WaveshaperPlugin)), - - port_input (new_uri(LV2_CORE__InputPort)), - port_output (new_uri(LV2_CORE__OutputPort)), - port_control (new_uri(LV2_CORE__ControlPort)), - port_audio (new_uri(LV2_CORE__AudioPort)), - port_cv (new_uri(LV2_CORE__CVPort)), - port_atom (new_uri(LV2_ATOM__AtomPort)), - port_event (new_uri(LV2_EVENT__EventPort)), - port_midi_ll (new_uri(LV2_MIDI_LL__MidiPort)), - - pprop_optional (new_uri(LV2_CORE__connectionOptional)), - pprop_enumeration (new_uri(LV2_CORE__enumeration)), - pprop_integer (new_uri(LV2_CORE__integer)), - pprop_sample_rate (new_uri(LV2_CORE__sampleRate)), - pprop_toggled (new_uri(LV2_CORE__toggled)), - pprop_artifacts (new_uri(LV2_PORT_PROPS__causesArtifacts)), - pprop_continuous_cv (new_uri(LV2_PORT_PROPS__continuousCV)), - pprop_discrete_cv (new_uri(LV2_PORT_PROPS__discreteCV)), - pprop_expensive (new_uri(LV2_PORT_PROPS__expensive)), - pprop_strict_bounds (new_uri(LV2_PORT_PROPS__hasStrictBounds)), - pprop_logarithmic (new_uri(LV2_PORT_PROPS__logarithmic)), - pprop_not_automatic (new_uri(LV2_PORT_PROPS__notAutomatic)), - pprop_not_on_gui (new_uri(LV2_PORT_PROPS__notOnGUI)), - pprop_trigger (new_uri(LV2_PORT_PROPS__trigger)), - - unit_unit (new_uri(LV2_UNITS__unit)), - unit_name (new_uri(LV2_UNITS__name)), - unit_render (new_uri(LV2_UNITS__render)), - unit_symbol (new_uri(LV2_UNITS__symbol)), - - ui_gtk2 (new_uri(LV2_UI__GtkUI)), - ui_gtk3 (new_uri(LV2_UI__Gtk3UI)), - ui_qt4 (new_uri(LV2_UI__Qt4UI)), - ui_cocoa (new_uri(LV2_UI__CocoaUI)), - ui_windows (new_uri(LV2_UI__WindowsUI)), - ui_x11 (new_uri(LV2_UI__X11UI)), - ui_external (new_uri(LV2_EXTERNAL_UI__Widget)), - ui_external_old (new_uri(LV2_EXTERNAL_UI_DEPRECATED_URI)), - - preset_preset (new_uri(LV2_PRESETS__Preset)), - preset_value (new_uri(LV2_PRESETS__value)), - - state_state (new_uri(LV2_STATE__state)), - - value_default (new_uri(LV2_CORE__default)), - value_minimum (new_uri(LV2_CORE__minimum)), - value_maximum (new_uri(LV2_CORE__maximum)), - - atom_sequence (new_uri(LV2_ATOM__Sequence)), - atom_buffer_type (new_uri(LV2_ATOM__bufferType)), - atom_supports (new_uri(LV2_ATOM__supports)), - - midi_event (new_uri(LV2_MIDI__MidiEvent)), - patch_message (new_uri(LV2_PATCH__Message)), - - mm_default_control (new_uri(NS_llmm "defaultMidiController")), - mm_control_type (new_uri(NS_llmm "controllerType")), - mm_control_number (new_uri(NS_llmm "controllerNumber")), - - dct_replaces (new_uri(NS_dct "replaces")), - doap_license (new_uri(NS_doap "license")), - rdf_type (new_uri(NS_rdf "type")), - rdfs_label (new_uri(NS_rdfs "label")) + Lv2WorldClass() + : Lilv::World(), + port (new_uri(LV2_CORE__port)), + symbol (new_uri(LV2_CORE__symbol)), + designation (new_uri(LV2_CORE__designation)), + freewheeling (new_uri(LV2_CORE__freeWheeling)), + reportsLatency (new_uri(LV2_CORE__reportsLatency)), + + class_allpass (new_uri(LV2_CORE__AllpassPlugin)), + class_amplifier (new_uri(LV2_CORE__AmplifierPlugin)), + class_analyzer (new_uri(LV2_CORE__AnalyserPlugin)), + class_bandpass (new_uri(LV2_CORE__BandpassPlugin)), + class_chorus (new_uri(LV2_CORE__ChorusPlugin)), + class_comb (new_uri(LV2_CORE__CombPlugin)), + class_compressor (new_uri(LV2_CORE__CompressorPlugin)), + class_constant (new_uri(LV2_CORE__ConstantPlugin)), + class_converter (new_uri(LV2_CORE__ConverterPlugin)), + class_delay (new_uri(LV2_CORE__DelayPlugin)), + class_distortion (new_uri(LV2_CORE__DistortionPlugin)), + class_dynamics (new_uri(LV2_CORE__DynamicsPlugin)), + class_eq (new_uri(LV2_CORE__EQPlugin)), + class_expander (new_uri(LV2_CORE__ExpanderPlugin)), + class_filter (new_uri(LV2_CORE__FilterPlugin)), + class_flanger (new_uri(LV2_CORE__FlangerPlugin)), + class_function (new_uri(LV2_CORE__FunctionPlugin)), + class_gate (new_uri(LV2_CORE__GatePlugin)), + class_generator (new_uri(LV2_CORE__GeneratorPlugin)), + class_highpass (new_uri(LV2_CORE__HighpassPlugin)), + class_instrument (new_uri(LV2_CORE__InstrumentPlugin)), + class_limiter (new_uri(LV2_CORE__LimiterPlugin)), + class_lowpass (new_uri(LV2_CORE__LowpassPlugin)), + class_mixer (new_uri(LV2_CORE__MixerPlugin)), + class_modulator (new_uri(LV2_CORE__ModulatorPlugin)), + class_multi_eq (new_uri(LV2_CORE__MultiEQPlugin)), + class_oscillator (new_uri(LV2_CORE__OscillatorPlugin)), + class_para_eq (new_uri(LV2_CORE__ParaEQPlugin)), + class_phaser (new_uri(LV2_CORE__PhaserPlugin)), + class_pitch (new_uri(LV2_CORE__PitchPlugin)), + class_reverb (new_uri(LV2_CORE__ReverbPlugin)), + class_simulator (new_uri(LV2_CORE__SimulatorPlugin)), + class_spatial (new_uri(LV2_CORE__SpatialPlugin)), + class_spectral (new_uri(LV2_CORE__SpectralPlugin)), + class_utility (new_uri(LV2_CORE__UtilityPlugin)), + class_waveshaper (new_uri(LV2_CORE__WaveshaperPlugin)), + + port_input (new_uri(LV2_CORE__InputPort)), + port_output (new_uri(LV2_CORE__OutputPort)), + port_control (new_uri(LV2_CORE__ControlPort)), + port_audio (new_uri(LV2_CORE__AudioPort)), + port_cv (new_uri(LV2_CORE__CVPort)), + port_atom (new_uri(LV2_ATOM__AtomPort)), + port_event (new_uri(LV2_EVENT__EventPort)), + port_midi_ll (new_uri(LV2_MIDI_LL__MidiPort)), + + pprop_optional (new_uri(LV2_CORE__connectionOptional)), + pprop_enumeration (new_uri(LV2_CORE__enumeration)), + pprop_integer (new_uri(LV2_CORE__integer)), + pprop_sample_rate (new_uri(LV2_CORE__sampleRate)), + pprop_toggled (new_uri(LV2_CORE__toggled)), + pprop_artifacts (new_uri(LV2_PORT_PROPS__causesArtifacts)), + pprop_continuous_cv (new_uri(LV2_PORT_PROPS__continuousCV)), + pprop_discrete_cv (new_uri(LV2_PORT_PROPS__discreteCV)), + pprop_expensive (new_uri(LV2_PORT_PROPS__expensive)), + pprop_strict_bounds (new_uri(LV2_PORT_PROPS__hasStrictBounds)), + pprop_logarithmic (new_uri(LV2_PORT_PROPS__logarithmic)), + pprop_not_automatic (new_uri(LV2_PORT_PROPS__notAutomatic)), + pprop_not_on_gui (new_uri(LV2_PORT_PROPS__notOnGUI)), + pprop_trigger (new_uri(LV2_PORT_PROPS__trigger)), + + unit_unit (new_uri(LV2_UNITS__unit)), + unit_name (new_uri(LV2_UNITS__name)), + unit_render (new_uri(LV2_UNITS__render)), + unit_symbol (new_uri(LV2_UNITS__symbol)), + + ui_gtk2 (new_uri(LV2_UI__GtkUI)), + ui_gtk3 (new_uri(LV2_UI__Gtk3UI)), + ui_qt4 (new_uri(LV2_UI__Qt4UI)), + ui_cocoa (new_uri(LV2_UI__CocoaUI)), + ui_windows (new_uri(LV2_UI__WindowsUI)), + ui_x11 (new_uri(LV2_UI__X11UI)), + ui_external (new_uri(LV2_EXTERNAL_UI__Widget)), + ui_external_old (new_uri(LV2_EXTERNAL_UI_DEPRECATED_URI)), + + preset_preset (new_uri(LV2_PRESETS__Preset)), + preset_value (new_uri(LV2_PRESETS__value)), + + state_state (new_uri(LV2_STATE__state)), + + value_default (new_uri(LV2_CORE__default)), + value_minimum (new_uri(LV2_CORE__minimum)), + value_maximum (new_uri(LV2_CORE__maximum)), + + atom_sequence (new_uri(LV2_ATOM__Sequence)), + atom_buffer_type (new_uri(LV2_ATOM__bufferType)), + atom_supports (new_uri(LV2_ATOM__supports)), + + midi_event (new_uri(LV2_MIDI__MidiEvent)), + patch_message (new_uri(LV2_PATCH__Message)), + + mm_default_control (new_uri(NS_llmm "defaultMidiController")), + mm_control_type (new_uri(NS_llmm "controllerType")), + mm_control_number (new_uri(NS_llmm "controllerNumber")), + + dct_replaces (new_uri(NS_dct "replaces")), + doap_license (new_uri(NS_doap "license")), + rdf_type (new_uri(NS_rdf "type")), + rdfs_label (new_uri(NS_rdfs "label")) { needInit = true; } diff --git a/src/carla_backend.py b/src/carla_backend.py index 5238605..2f909e6 100644 --- a/src/carla_backend.py +++ b/src/carla_backend.py @@ -665,13 +665,6 @@ if is64bit: else: c_uintptr = c_uint32 -class midi_program_t(Structure): - _fields_ = [ - ("bank", c_uint32), - ("program", c_uint32), - ("label", c_char_p) - ] - class ParameterData(Structure): _fields_ = [ ("type", c_enum), @@ -692,6 +685,13 @@ class ParameterRanges(Structure): ("stepLarge", c_double) ] +class MidiProgramData(Structure): + _fields_ = [ + ("bank", c_uint32), + ("program", c_uint32), + ("label", c_char_p) + ] + class CustomData(Structure): _fields_ = [ ("type", c_enum), @@ -820,7 +820,7 @@ class Host(object): self.lib.get_parameter_ranges.restype = POINTER(ParameterRanges) self.lib.get_midi_program_data.argtypes = [c_ushort, c_uint32] - self.lib.get_midi_program_data.restype = POINTER(midi_program_t) + self.lib.get_midi_program_data.restype = POINTER(MidiProgramData) self.lib.get_custom_data.argtypes = [c_ushort, c_uint32] self.lib.get_custom_data.restype = POINTER(CustomData) diff --git a/src/carla_control.py b/src/carla_control.py index 18cf626..e05e791 100755 --- a/src/carla_control.py +++ b/src/carla_control.py @@ -33,7 +33,7 @@ lo_targetName = "" Carla.isControl = True # Python Object dicts compatible to carla-backend struct ctypes -midi_program_t = { +MidiProgramData = { 'bank': 0, 'program': 0, 'label': None @@ -195,7 +195,7 @@ class Host(object): # add placeholders for x in range(count): - self.pluginInfo[index].midiProgramDataS.append(midi_program_t) + self.pluginInfo[index].midiProgramDataS.append(MidiProgramData) def _set_parameterInfoS(self, index, paramIndex, data): if paramIndex < self.pluginInfo[index].parameterCountInfo['total']: @@ -819,7 +819,7 @@ class CarlaControlW(QMainWindow, ui_carla_control.Ui_CarlaControlW): @pyqtSlot(int, int, int, int, str) def slot_handleSetMidiProgramData(self, pluginId, index, bank, program, name): - data = deepcopy(midi_program_t) + data = deepcopy(MidiProgramData) data['bank'] = bank data['program'] = program data['label'] = name