| @@ -29,7 +29,7 @@ STRIP ?= strip | |||
| # -------------------------------------------------------------- | |||
| BASE_FLAGS = -Wall -Wextra -fPIC -pipe | |||
| BASE_FLAGS = -Wall -Wextra -fPIC -DPIC -pipe | |||
| BASE_OPTS = -O2 -ffast-math -mtune=generic -msse -mfpmath=sse | |||
| ifeq ($(RASPPI),true) | |||
| @@ -260,31 +260,32 @@ enum OptionsType { | |||
| */ | |||
| OPTION_PREFER_UI_BRIDGES = 5, | |||
| /*! | |||
| * Make plugin UIs always-on-top.\n | |||
| * Default is yes. | |||
| */ | |||
| OPTION_UIS_ALWAYS_ON_TOP = 6, | |||
| #ifdef WANT_DSSI | |||
| /*! | |||
| * Use (unofficial) dssi-vst chunks feature.\n | |||
| * Default is no. | |||
| * \see PLUGIN_OPTION_USE_CHUNKS | |||
| */ | |||
| OPTION_USE_DSSI_VST_CHUNKS = 6, | |||
| OPTION_USE_DSSI_VST_CHUNKS = 7, | |||
| #endif | |||
| /*! | |||
| * Maximum number of parameters allowed.\n | |||
| * Default is MAX_DEFAULT_PARAMETERS. | |||
| */ | |||
| OPTION_MAX_PARAMETERS = 7, | |||
| OPTION_MAX_PARAMETERS = 8, | |||
| /*! | |||
| * Timeout value in ms for how much to wait for UI-Bridges to respond.\n | |||
| * Default is 4000 (4 secs). | |||
| */ | |||
| OPTION_UI_BRIDGES_TIMEOUT = 8, | |||
| /*! | |||
| * JACK auto-connect to hardware ports. | |||
| */ | |||
| OPTION_JACK_AUTOCONNECT = 9, | |||
| OPTION_UI_BRIDGES_TIMEOUT = 9, | |||
| #ifdef WANT_RTAUDIO | |||
| /*! | |||
| @@ -734,23 +735,22 @@ struct ParameterRanges { | |||
| float getFixedValue(const float& value) const noexcept | |||
| { | |||
| if (value < min) | |||
| if (value <= min) | |||
| return min; | |||
| else if (value > max) | |||
| if (value >= max) | |||
| return max; | |||
| return value; | |||
| } | |||
| float getNormalizedValue(const float& value) const noexcept | |||
| { | |||
| float newValue = (value - min) / (max - min); | |||
| if (newValue < 0.0f) | |||
| newValue = 0.0f; | |||
| else if (newValue > 1.0f) | |||
| newValue = 1.0f; | |||
| const float normValue((value - min) / (max - min)); | |||
| return newValue; | |||
| if (normValue <= 0.0f) | |||
| return 0.0f; | |||
| if (normValue >= 1.0f) | |||
| return 1.0f; | |||
| return normValue; | |||
| } | |||
| float getUnnormalizedValue(const float& value) const noexcept | |||
| @@ -200,12 +200,10 @@ struct EngineEvent { | |||
| EngineMidiEvent midi; | |||
| }; | |||
| #ifndef DOXYGEN | |||
| EngineEvent() noexcept | |||
| { | |||
| clear(); | |||
| } | |||
| #endif | |||
| void clear() noexcept | |||
| { | |||
| @@ -231,12 +229,10 @@ struct EngineOptions { | |||
| #endif | |||
| unsigned int maxParameters; | |||
| unsigned int oscUiTimeout; | |||
| bool jackAutoConnect; | |||
| unsigned int uiBridgesTimeout; | |||
| #ifdef WANT_RTAUDIO | |||
| unsigned int rtaudioNumberPeriods; | |||
| unsigned int rtaudioNumPeriods; | |||
| unsigned int rtaudioBufferSize; | |||
| unsigned int rtaudioSampleRate; | |||
| CarlaString rtaudioDevice; | |||
| @@ -266,32 +262,29 @@ struct EngineOptions { | |||
| CarlaString bridge_vstX11; | |||
| #endif | |||
| #ifndef DOXYGEN | |||
| EngineOptions() noexcept | |||
| # if defined(CARLA_OS_LINUX) | |||
| EngineOptions() | |||
| #if defined(CARLA_OS_LINUX) | |||
| : processMode(PROCESS_MODE_MULTIPLE_CLIENTS), | |||
| transportMode(TRANSPORT_MODE_JACK), | |||
| # else | |||
| #else | |||
| : processMode(PROCESS_MODE_CONTINUOUS_RACK), | |||
| transportMode(TRANSPORT_MODE_INTERNAL), | |||
| # endif | |||
| #endif | |||
| forceStereo(false), | |||
| preferPluginBridges(false), | |||
| preferUiBridges(true), | |||
| uisAlwaysOnTop(true), | |||
| # ifdef WANT_DSSI | |||
| #ifdef WANT_DSSI | |||
| useDssiVstChunks(false), | |||
| # endif | |||
| #endif | |||
| maxParameters(MAX_DEFAULT_PARAMETERS), | |||
| oscUiTimeout(4000), | |||
| jackAutoConnect(false), | |||
| # ifdef WANT_RTAUDIO | |||
| rtaudioNumberPeriods(0), | |||
| uiBridgesTimeout(4000), | |||
| #ifdef WANT_RTAUDIO | |||
| rtaudioNumPeriods(2), | |||
| rtaudioBufferSize(512), | |||
| rtaudioSampleRate(44100), | |||
| # endif | |||
| resourceDir() {} | |||
| #endif | |||
| resourceDir() {} | |||
| }; | |||
| /*! | |||
| @@ -309,7 +302,6 @@ struct EngineTimeInfoBBT { | |||
| double ticksPerBeat; | |||
| double beatsPerMinute; | |||
| #ifndef DOXYGEN | |||
| EngineTimeInfoBBT() noexcept | |||
| : bar(0), | |||
| beat(0), | |||
| @@ -319,7 +311,6 @@ struct EngineTimeInfoBBT { | |||
| beatType(0.0f), | |||
| ticksPerBeat(0.0), | |||
| beatsPerMinute(0.0) {} | |||
| #endif | |||
| }; | |||
| /*! | |||
| @@ -334,12 +325,10 @@ struct EngineTimeInfo { | |||
| uint32_t valid; | |||
| EngineTimeInfoBBT bbt; | |||
| #ifndef DOXYGEN | |||
| EngineTimeInfo() noexcept | |||
| { | |||
| clear(); | |||
| } | |||
| #endif | |||
| void clear() noexcept | |||
| { | |||
| @@ -349,7 +338,6 @@ struct EngineTimeInfo { | |||
| valid = 0x0; | |||
| } | |||
| #ifndef DOXYGEN | |||
| // quick operator, doesn't check all values | |||
| bool operator==(const EngineTimeInfo& timeInfo) const noexcept | |||
| { | |||
| @@ -366,7 +354,6 @@ struct EngineTimeInfo { | |||
| { | |||
| return !operator==(timeInfo); | |||
| } | |||
| #endif | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| @@ -1192,6 +1179,7 @@ private: | |||
| // ------------------------------------------------------------------- | |||
| // Bridge/Controller OSC stuff | |||
| public: | |||
| #ifdef BUILD_BRIDGE | |||
| void oscSend_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total); | |||
| void oscSend_bridge_midi_count(const int32_t ins, const int32_t outs, const int32_t total); | |||
| @@ -1213,7 +1201,6 @@ private: | |||
| void oscSend_bridge_set_chunk_data(const char* const chunkFile); | |||
| void oscSend_bridge_set_peaks(); | |||
| #else | |||
| public: | |||
| void oscSend_control_add_plugin_start(const int32_t pluginId, const char* const pluginName); | |||
| void oscSend_control_add_plugin_end(const int32_t pluginId); | |||
| void oscSend_control_remove_plugin(const int32_t pluginId); | |||
| @@ -30,7 +30,6 @@ extern "C" { | |||
| * @defgroup CarlaNativeAPI Carla Native API | |||
| * | |||
| * The Carla Native API | |||
| * | |||
| * @{ | |||
| */ | |||
| @@ -56,11 +55,10 @@ typedef enum { | |||
| PLUGIN_IS_RTSAFE = 1 << 0, | |||
| PLUGIN_IS_SYNTH = 1 << 1, | |||
| PLUGIN_HAS_GUI = 1 << 2, | |||
| PLUGIN_USES_GUI_AS_FILE = 1 << 3, | |||
| PLUGIN_USES_PANNING = 1 << 4, // uses stereo balance if unset (default) | |||
| PLUGIN_USES_SINGLE_THREAD = 1 << 5, | |||
| PLUGIN_USES_STATE = 1 << 6, | |||
| PLUGIN_USES_STATIC_BUFFERS = 1 << 7 | |||
| PLUGIN_USES_PANNING = 1 << 3, // uses stereo balance if unset (default) | |||
| PLUGIN_USES_SINGLE_THREAD = 1 << 4, | |||
| PLUGIN_USES_STATE = 1 << 5, | |||
| PLUGIN_USES_STATIC_BUFFERS = 1 << 6 | |||
| } PluginHints; | |||
| typedef enum { | |||
| @@ -52,134 +52,102 @@ protected: | |||
| return pHost; | |||
| } | |||
| const char* getResourceDir() const noexcept | |||
| const char* getResourceDir() const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->resourceDir; | |||
| return nullptr; | |||
| return pHost->resourceDir; | |||
| } | |||
| const char* getUiName() const noexcept | |||
| const char* getUiName() const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->uiName; | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||
| return nullptr; | |||
| return pHost->uiName; | |||
| } | |||
| uint32_t getBufferSize() const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->get_buffer_size(pHost->handle); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, 0); | |||
| return 0; | |||
| return pHost->get_buffer_size(pHost->handle); | |||
| } | |||
| double getSampleRate() const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->get_sample_rate(pHost->handle); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, 0.0); | |||
| return 0.0; | |||
| return pHost->get_sample_rate(pHost->handle); | |||
| } | |||
| bool isOffline() const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->is_offline(pHost->handle); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, false); | |||
| return false; | |||
| return pHost->is_offline(pHost->handle); | |||
| } | |||
| const TimeInfo* getTimeInfo() const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->get_time_info(pHost->handle); | |||
| return nullptr; | |||
| return pHost->get_time_info(pHost->handle); | |||
| } | |||
| void writeMidiEvent(const MidiEvent* const event) const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||
| if (pHost != nullptr) | |||
| pHost->write_midi_event(pHost->handle, event); | |||
| pHost->write_midi_event(pHost->handle, event); | |||
| } | |||
| void uiParameterChanged(const uint32_t index, const float value) const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||
| if (pHost != nullptr) | |||
| pHost->ui_parameter_changed(pHost->handle, index, value); | |||
| pHost->ui_parameter_changed(pHost->handle, index, value); | |||
| } | |||
| void uiMidiProgramChanged(const uint8_t channel, const uint32_t bank, const uint32_t program) const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||
| if (pHost != nullptr) | |||
| pHost->ui_midi_program_changed(pHost->handle, channel, bank, program); | |||
| pHost->ui_midi_program_changed(pHost->handle, channel, bank, program); | |||
| } | |||
| void uiCustomDataChanged(const char* const key, const char* const value) const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||
| if (pHost != nullptr) | |||
| pHost->ui_custom_data_changed(pHost->handle, key, value); | |||
| pHost->ui_custom_data_changed(pHost->handle, key, value); | |||
| } | |||
| void uiClosed() const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr,); | |||
| if (pHost != nullptr) | |||
| pHost->ui_closed(pHost->handle); | |||
| pHost->ui_closed(pHost->handle); | |||
| } | |||
| const char* uiOpenFile(const bool isDir, const char* const title, const char* const filter) const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->ui_open_file(pHost->handle, isDir, title, filter); | |||
| return nullptr; | |||
| return pHost->ui_open_file(pHost->handle, isDir, title, filter); | |||
| } | |||
| const char* uiSaveFile(const bool isDir, const char* const title, const char* const filter) const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->ui_save_file(pHost->handle, isDir, title, filter); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, nullptr); | |||
| return nullptr; | |||
| return pHost->ui_save_file(pHost->handle, isDir, title, filter); | |||
| } | |||
| intptr_t hostDispatcher(const HostDispatcherOpcode opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) const | |||
| { | |||
| CARLA_ASSERT(pHost != nullptr); | |||
| if (pHost != nullptr) | |||
| return pHost->dispatcher(pHost->handle, opcode, index, value, ptr, opt); | |||
| CARLA_SAFE_ASSERT_RETURN(pHost != nullptr, 0); | |||
| return 0; | |||
| return pHost->dispatcher(pHost->handle, opcode, index, value, ptr, opt); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -192,29 +160,22 @@ protected: | |||
| virtual const Parameter* getParameterInfo(const uint32_t index) | |||
| { | |||
| CARLA_ASSERT(index < getParameterCount()); | |||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | |||
| return nullptr; | |||
| // unused | |||
| (void)index; | |||
| } | |||
| virtual float getParameterValue(const uint32_t index) | |||
| { | |||
| CARLA_ASSERT(index < getParameterCount()); | |||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), 0.0f); | |||
| return 0.0f; | |||
| // unused | |||
| (void)index; | |||
| } | |||
| virtual const char* getParameterText(const uint32_t index, const float value) | |||
| { | |||
| CARLA_ASSERT(index < getParameterCount()); | |||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(), nullptr); | |||
| return nullptr; | |||
| // unused | |||
| (void)index; | |||
| (void)value; | |||
| } | |||
| @@ -228,11 +189,8 @@ protected: | |||
| virtual const MidiProgram* getMidiProgramInfo(const uint32_t index) | |||
| { | |||
| CARLA_ASSERT(index < getMidiProgramCount()); | |||
| CARLA_SAFE_ASSERT_RETURN(index < getMidiProgramCount(), nullptr); | |||
| return nullptr; | |||
| // unused | |||
| (void)index; | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -240,34 +198,27 @@ protected: | |||
| virtual void setParameterValue(const uint32_t index, const float value) | |||
| { | |||
| CARLA_ASSERT(index < getParameterCount()); | |||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(),); | |||
| return; | |||
| // unused | |||
| (void)index; | |||
| (void)value; | |||
| } | |||
| virtual void setMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) | |||
| { | |||
| CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
| CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); | |||
| return; | |||
| // unused | |||
| (void)channel; | |||
| (void)bank; | |||
| (void)program; | |||
| } | |||
| virtual void setCustomData(const char* const key, const char* const value) | |||
| { | |||
| CARLA_ASSERT(key != nullptr); | |||
| CARLA_ASSERT(value != nullptr); | |||
| return; | |||
| // unused | |||
| (void)key; | |||
| (void)value; | |||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -300,34 +251,27 @@ protected: | |||
| virtual void uiSetParameterValue(const uint32_t index, const float value) | |||
| { | |||
| CARLA_ASSERT(index < getParameterCount()); | |||
| CARLA_SAFE_ASSERT_RETURN(index < getParameterCount(),); | |||
| return; | |||
| // unused | |||
| (void)index; | |||
| (void)value; | |||
| } | |||
| virtual void uiSetMidiProgram(const uint8_t channel, const uint32_t bank, const uint32_t program) | |||
| { | |||
| CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
| CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS,); | |||
| return; | |||
| // unused | |||
| (void)channel; | |||
| (void)bank; | |||
| (void)program; | |||
| } | |||
| virtual void uiSetCustomData(const char* const key, const char* const value) | |||
| { | |||
| CARLA_ASSERT(key != nullptr); | |||
| CARLA_ASSERT(value != nullptr); | |||
| return; | |||
| // unused | |||
| (void)key; | |||
| (void)value; | |||
| CARLA_SAFE_ASSERT_RETURN(key != nullptr,); | |||
| CARLA_SAFE_ASSERT_RETURN(value != nullptr,); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -340,11 +284,7 @@ protected: | |||
| virtual void setState(const char* const data) | |||
| { | |||
| CARLA_ASSERT(data != nullptr); | |||
| return; | |||
| // unused | |||
| (void)data; | |||
| CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | |||
| } | |||
| // ------------------------------------------------------------------- | |||
| @@ -405,42 +345,42 @@ public: | |||
| static void _set_parameter_value(PluginHandle handle, uint32_t index, float value) | |||
| { | |||
| return handlePtr->setParameterValue(index, value); | |||
| handlePtr->setParameterValue(index, value); | |||
| } | |||
| static void _set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | |||
| { | |||
| return handlePtr->setMidiProgram(channel, bank, program); | |||
| handlePtr->setMidiProgram(channel, bank, program); | |||
| } | |||
| static void _set_custom_data(PluginHandle handle, const char* key, const char* value) | |||
| { | |||
| return handlePtr->setCustomData(key, value); | |||
| handlePtr->setCustomData(key, value); | |||
| } | |||
| static void _ui_show(PluginHandle handle, bool show) | |||
| { | |||
| return handlePtr->uiShow(show); | |||
| handlePtr->uiShow(show); | |||
| } | |||
| static void _ui_idle(PluginHandle handle) | |||
| { | |||
| return handlePtr->uiIdle(); | |||
| handlePtr->uiIdle(); | |||
| } | |||
| static void _ui_set_parameter_value(PluginHandle handle, uint32_t index, float value) | |||
| { | |||
| return handlePtr->uiSetParameterValue(index, value); | |||
| handlePtr->uiSetParameterValue(index, value); | |||
| } | |||
| static void _ui_set_midi_program(PluginHandle handle, uint8_t channel, uint32_t bank, uint32_t program) | |||
| { | |||
| return handlePtr->uiSetMidiProgram(channel, bank, program); | |||
| handlePtr->uiSetMidiProgram(channel, bank, program); | |||
| } | |||
| static void _ui_set_custom_data(PluginHandle handle, const char* key, const char* value) | |||
| { | |||
| return handlePtr->uiSetCustomData(key, value); | |||
| handlePtr->uiSetCustomData(key, value); | |||
| } | |||
| static void _activate(PluginHandle handle) | |||
| @@ -455,7 +395,7 @@ public: | |||
| static void _process(PluginHandle handle, float** inBuffer, float** outBuffer, const uint32_t frames, uint32_t midiEventCount, const MidiEvent* midiEvents) | |||
| { | |||
| return handlePtr->process(inBuffer, outBuffer, frames, midiEventCount, midiEvents); | |||
| handlePtr->process(inBuffer, outBuffer, frames, midiEventCount, midiEvents); | |||
| } | |||
| static char* _get_state(PluginHandle handle) | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_ENGINE_INTERNAL_HPP__ | |||
| #define __CARLA_ENGINE_INTERNAL_HPP__ | |||
| #ifndef CARLA_ENGINE_INTERNAL_HPP_INCLUDED | |||
| #define CARLA_ENGINE_INTERNAL_HPP_INCLUDED | |||
| #include "CarlaEngine.hpp" | |||
| #include "CarlaEngineOsc.hpp" | |||
| @@ -351,4 +351,4 @@ struct CarlaEngineProtectedData { | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| #endif // __CARLA_ENGINE_INTERNAL_HPP__ | |||
| #endif // CARLA_ENGINE_INTERNAL_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_ENGINE_OSC_HPP__ | |||
| #define __CARLA_ENGINE_OSC_HPP__ | |||
| #ifndef CARLA_ENGINE_OSC_HPP_INCLUDED | |||
| #define CARLA_ENGINE_OSC_HPP_INCLUDED | |||
| #include "CarlaBackend.hpp" | |||
| #include "CarlaOscUtils.hpp" | |||
| @@ -170,4 +170,4 @@ private: | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| #endif // __CARLA_ENGINE_OSC_HPP__ | |||
| #endif // CARLA_ENGINE_OSC_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_ENGINE_THREAD_HPP__ | |||
| #define __CARLA_ENGINE_THREAD_HPP__ | |||
| #ifndef CARLA_ENGINE_THREAD_HPP_INCLUDED | |||
| #define CARLA_ENGINE_THREAD_HPP_INCLUDED | |||
| #include "CarlaBackend.hpp" | |||
| #include "CarlaMutex.hpp" | |||
| @@ -56,4 +56,4 @@ private: | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| #endif // __CARLA_ENGINE_THREAD_HPP__ | |||
| #endif // CARLA_ENGINE_THREAD_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_NAME "Carla" | |||
| @@ -35,4 +35,4 @@ | |||
| #define DISTRHO_UI_EXTERNAL | |||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #define __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #ifndef DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
| #define DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
| #include "DistrhoPlugin.hpp" | |||
| @@ -105,4 +105,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #endif // DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_NAME "3 Band EQ" | |||
| @@ -34,4 +34,4 @@ | |||
| #define DISTRHO_UI_OPENGL | |||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #define __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #ifndef DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
| #define DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
| #include "DistrhoUIOpenGL.hpp" | |||
| @@ -90,4 +90,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #endif // DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_3BANDSPLITTER_HPP__ | |||
| #define __DISTRHO_PLUGIN_3BANDSPLITTER_HPP__ | |||
| #ifndef DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED | |||
| #define DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED | |||
| #include "DistrhoPlugin.hpp" | |||
| @@ -105,4 +105,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_PLUGIN_3BANDSPLITTER_HPP__ | |||
| #endif // DISTRHO_PLUGIN_3BANDSPLITTER_HPP_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_NAME "3 Band Splitter" | |||
| @@ -34,4 +34,4 @@ | |||
| #define DISTRHO_UI_OPENGL | |||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_UI_3BANDSPLITTER_HPP__ | |||
| #define __DISTRHO_UI_3BANDSPLITTER_HPP__ | |||
| #ifndef DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED | |||
| #define DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED | |||
| #include "DistrhoUIOpenGL.hpp" | |||
| @@ -90,4 +90,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_UI_3BANDSPLITTER_HPP__ | |||
| #endif // DISTRHO_UI_3BANDSPLITTER_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __AUDIO_BASE_HPP__ | |||
| #define __AUDIO_BASE_HPP__ | |||
| #ifndef AUDIO_BASE_HPP_INCLUDED | |||
| #define AUDIO_BASE_HPP_INCLUDED | |||
| #include "CarlaMutex.hpp" | |||
| @@ -386,4 +386,4 @@ private: | |||
| CarlaMutex fMutex; | |||
| }; | |||
| #endif // __AUDIO_BASE_HPP__ | |||
| #endif // AUDIO_BASE_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __MIDI_BASE_HPP__ | |||
| #define __MIDI_BASE_HPP__ | |||
| #ifndef MIDI_BASE_HPP_INCLUDED | |||
| #define MIDI_BASE_HPP_INCLUDED | |||
| #include "CarlaMIDI.h" | |||
| #include "CarlaMutex.hpp" | |||
| @@ -236,4 +236,4 @@ private: | |||
| } | |||
| }; | |||
| #endif // __MIDI_BASE_HPP__ | |||
| #endif // MIDI_BASE_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_NAME "Nekobi" | |||
| @@ -35,4 +35,4 @@ | |||
| #define DISTRHO_UI_OPENGL | |||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -16,8 +16,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #define __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #ifndef DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
| #define DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
| #include "DistrhoPlugin.hpp" | |||
| @@ -112,4 +112,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #endif // DISTRHO_PLUGIN_3BANDEQ_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #define __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #ifndef DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
| #define DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
| #include "DistrhoUIOpenGL.hpp" | |||
| @@ -101,4 +101,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #endif // DISTRHO_UI_3BANDEQ_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_NAME "Notes" | |||
| @@ -35,4 +35,4 @@ | |||
| #define DISTRHO_UI_QT | |||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_NOTES_HPP__ | |||
| #define __DISTRHO_PLUGIN_NOTES_HPP__ | |||
| #ifndef DISTRHO_PLUGIN_NOTES_HPP_INCLUDED | |||
| #define DISTRHO_PLUGIN_NOTES_HPP_INCLUDED | |||
| #include "DistrhoPlugin.hpp" | |||
| @@ -83,4 +83,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_PLUGIN_NOTES_HPP__ | |||
| #endif // DISTRHO_PLUGIN_NOTES_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_UI_NOTES_HPP__ | |||
| #define __DISTRHO_UI_NOTES_HPP__ | |||
| #ifndef DISTRHO_UI_NOTES_HPP_INCLUDED | |||
| #define DISTRHO_UI_NOTES_HPP_INCLUDED | |||
| #include "DistrhoUIQt.hpp" | |||
| #include "paramspinbox.hpp" | |||
| @@ -104,8 +104,6 @@ private: | |||
| void saveCurrentTextState(); | |||
| }; | |||
| // ------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_UI_NOTES_HPP__ | |||
| #endif // DISTRHO_UI_NOTES_HPP_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_NAME "Ping Pong Pan" | |||
| @@ -34,4 +34,4 @@ | |||
| #define DISTRHO_UI_OPENGL | |||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_PINGPONGPAN_HPP__ | |||
| #define __DISTRHO_PLUGIN_PINGPONGPAN_HPP__ | |||
| #ifndef DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED | |||
| #define DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED | |||
| #include "DistrhoPlugin.hpp" | |||
| @@ -96,4 +96,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_PLUGIN_PINGPONGPAN_HPP__ | |||
| #endif // DISTRHO_PLUGIN_PINGPONGPAN_HPP_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_UI_PINGPONGPAN_HPP__ | |||
| #define __DISTRHO_UI_PINGPONGPAN_HPP__ | |||
| #ifndef DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED | |||
| #define DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED | |||
| #include "DistrhoUIOpenGL.hpp" | |||
| @@ -78,8 +78,6 @@ private: | |||
| ImageButton* fButtonAbout; | |||
| }; | |||
| // ------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_UI_PINGPONGPAN_HPP__ | |||
| #endif // DISTRHO_UI_PINGPONGPAN_HPP_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_INFO_H__ | |||
| #define __DISTRHO_PLUGIN_INFO_H__ | |||
| #ifndef DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| #define DISTRHO_PLUGIN_NAME "Stereo Enhancer" | |||
| @@ -34,4 +34,4 @@ | |||
| #define DISTRHO_UI_OPENGL | |||
| #endif // __DISTRHO_PLUGIN_INFO_H__ | |||
| #endif // DISTRHO_PLUGIN_INFO_H_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #define __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #ifndef DISTRHO_PLUGIN_STEREO_ENHANCER_HPP_INCLUDED | |||
| #define DISTRHO_PLUGIN_STEREO_ENHANCER_HPP_INCLUDED | |||
| #include "DistrhoPlugin.hpp" | |||
| @@ -103,4 +103,4 @@ private: | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_PLUGIN_3BANDEQ_HPP__ | |||
| #endif // DISTRHO_PLUGIN_STEREO_ENHANCER_HPP_INCLUDED | |||
| @@ -14,8 +14,8 @@ | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifndef __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #define __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #ifndef DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED | |||
| #define DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED | |||
| #include "DistrhoUIOpenGL.hpp" | |||
| @@ -78,8 +78,6 @@ private: | |||
| ImageButton* fButtonAbout; | |||
| }; | |||
| // ------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| #endif // __DISTRHO_UI_3BANDEQ_HPP__ | |||
| #endif // DISTRHO_UI_STEREO_ENHANCER_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_PLUGIN_GUI_HPP__ | |||
| #define __CARLA_PLUGIN_GUI_HPP__ | |||
| #ifndef CARLA_PLUGIN_GUI_HPP_INCLUDED | |||
| #define CARLA_PLUGIN_GUI_HPP_INCLUDED | |||
| #include "CarlaPluginInternal.hpp" | |||
| @@ -79,4 +79,4 @@ private slots: | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| #endif // __CARLA_PLUGIN_GUI_HPP__ | |||
| #endif // CARLA_PLUGIN_GUI_HPP_INCLUDED | |||
| @@ -12,11 +12,11 @@ | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU General Public License for more details. | |||
| * | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
| */ | |||
| #ifndef __CARLA_PLUGIN_INTERNAL_HPP__ | |||
| #define __CARLA_PLUGIN_INTERNAL_HPP__ | |||
| #ifndef CARLA_PLUGIN_INTERNAL_HPP_INCLUDED | |||
| #define CARLA_PLUGIN_INTERNAL_HPP_INCLUDED | |||
| #include "CarlaPlugin.hpp" | |||
| #include "CarlaPluginThread.hpp" | |||
| @@ -806,38 +806,8 @@ struct CarlaPluginProtectedData { | |||
| void saveSetting(const unsigned int option, const bool yesNo); | |||
| unsigned int loadSettings(const unsigned int options, const unsigned int availOptions); | |||
| // ------------------------------------------------------------------- | |||
| // Static helper functions | |||
| static CarlaEngine* getEngine(CarlaPlugin* const plugin) | |||
| { | |||
| return plugin->kData->engine; | |||
| } | |||
| static CarlaEngineClient* getEngineClient(CarlaPlugin* const plugin) | |||
| { | |||
| return plugin->kData->client; | |||
| } | |||
| static CarlaEngineAudioPort* getAudioInPort(CarlaPlugin* const plugin, const uint32_t index) | |||
| { | |||
| return plugin->kData->audioIn.ports[index].port; | |||
| } | |||
| static CarlaEngineAudioPort* getAudioOutPort(CarlaPlugin* const plugin, const uint32_t index) | |||
| { | |||
| return plugin->kData->audioOut.ports[index].port; | |||
| } | |||
| static bool canRunInRack(CarlaPlugin* const plugin) | |||
| { | |||
| return (plugin->kData->extraHints & PLUGIN_HINT_CAN_RUN_RACK); | |||
| } | |||
| }; | |||
| // ----------------------------------------------------------------------- | |||
| CARLA_BACKEND_END_NAMESPACE | |||
| #endif // __CARLA_PLUGIN_INTERNAL_HPP__ | |||
| #endif // CARLA_PLUGIN_INTERNAL_HPP_INCLUDED | |||
| @@ -12,7 +12,7 @@ | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU General Public License for more details. | |||
| * | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
| */ | |||
| #include "CarlaPluginThread.hpp" | |||
| @@ -45,12 +45,12 @@ const char* PluginThreadMode2str(const CarlaPluginThread::Mode mode) | |||
| } | |||
| CarlaPluginThread::CarlaPluginThread(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin, const Mode mode) | |||
| : kEngine(engine), | |||
| kPlugin(plugin), | |||
| : fEngine(engine), | |||
| fPlugin(plugin), | |||
| fMode(mode), | |||
| fProcess(nullptr) | |||
| { | |||
| carla_debug("CarlaPluginThread::CarlaPluginThread(plugin:\"%s\", engine:\"%s\", %s)", plugin->name(), engine->getName(), PluginThreadMode2str(mode)); | |||
| carla_debug("CarlaPluginThread::CarlaPluginThread(plugin:\"%s\", engine:\"%s\", %s)", plugin->getName(), engine->getName(), PluginThreadMode2str(mode)); | |||
| } | |||
| CarlaPluginThread::~CarlaPluginThread() | |||
| @@ -99,7 +99,7 @@ void CarlaPluginThread::run() | |||
| case PLUGIN_THREAD_LV2_GUI: | |||
| case PLUGIN_THREAD_VST_GUI: | |||
| fProcess->terminate(); | |||
| kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), -1, 0, 0.0f, nullptr); | |||
| fEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, fPlugin->getId(), -1, 0, 0.0f, nullptr); | |||
| return; | |||
| case PLUGIN_THREAD_BRIDGE: | |||
| @@ -107,7 +107,7 @@ void CarlaPluginThread::run() | |||
| } | |||
| } | |||
| QString name(kPlugin->name()); | |||
| QString name(fPlugin->getName()); | |||
| QStringList arguments; | |||
| if (name.isEmpty()) | |||
| @@ -119,29 +119,29 @@ void CarlaPluginThread::run() | |||
| break; | |||
| case PLUGIN_THREAD_DSSI_GUI: | |||
| /* osc-url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathUDP()).arg(kPlugin->id()); | |||
| /* filename */ arguments << kPlugin->filename(); | |||
| /* osc-url */ arguments << QString("%1/%2").arg(fEngine->getOscServerPathUDP()).arg(fPlugin->getId()); | |||
| /* filename */ arguments << fPlugin->getFilename(); | |||
| /* label */ arguments << (const char*)fLabel; | |||
| /* ui-title */ arguments << QString("%1 (GUI)").arg(kPlugin->name()); | |||
| /* ui-title */ arguments << QString("%1 (GUI)").arg(fPlugin->getName()); | |||
| break; | |||
| case PLUGIN_THREAD_LV2_GUI: | |||
| /* osc-url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathTCP()).arg(kPlugin->id()); | |||
| /* osc-url */ arguments << QString("%1/%2").arg(fEngine->getOscServerPathTCP()).arg(fPlugin->getId()); | |||
| /* URI */ arguments << (const char*)fLabel; | |||
| /* ui-URI */ arguments << (const char*)fExtra1; | |||
| /* ui-title */ arguments << QString("%1 (GUI)").arg(kPlugin->name()); | |||
| /* ui-title */ arguments << QString("%1 (GUI)").arg(fPlugin->getName()); | |||
| break; | |||
| case PLUGIN_THREAD_VST_GUI: | |||
| /* osc-url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathTCP()).arg(kPlugin->id()); | |||
| /* filename */ arguments << kPlugin->filename(); | |||
| /* ui-title */ arguments << QString("%1 (GUI)").arg(kPlugin->name()); | |||
| /* osc-url */ arguments << QString("%1/%2").arg(fEngine->getOscServerPathTCP()).arg(fPlugin->getId()); | |||
| /* filename */ arguments << fPlugin->getFilename(); | |||
| /* ui-title */ arguments << QString("%1 (GUI)").arg(fPlugin->getName()); | |||
| break; | |||
| case PLUGIN_THREAD_BRIDGE: | |||
| /* osc-url */ arguments << QString("%1/%2").arg(kEngine->getOscServerPathTCP()).arg(kPlugin->id()); | |||
| /* osc-url */ arguments << QString("%1/%2").arg(fEngine->getOscServerPathTCP()).arg(fPlugin->getId()); | |||
| /* stype */ arguments << (const char*)fExtra1; | |||
| /* filename */ arguments << kPlugin->filename(); | |||
| /* filename */ arguments << fPlugin->getFilename(); | |||
| /* name */ arguments << name; | |||
| /* label */ arguments << (const char*)fLabel; | |||
| /* SHM ids */ arguments << (const char*)fExtra2; | |||
| @@ -159,20 +159,20 @@ void CarlaPluginThread::run() | |||
| case PLUGIN_THREAD_DSSI_GUI: | |||
| case PLUGIN_THREAD_LV2_GUI: | |||
| case PLUGIN_THREAD_VST_GUI: | |||
| if (kPlugin->waitForOscGuiShow()) | |||
| if (fPlugin->waitForOscGuiShow()) | |||
| { | |||
| fProcess->waitForFinished(-1); | |||
| if (fProcess->exitCode() == 0) | |||
| { | |||
| // Hide | |||
| kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), 0, 0, 0.0f, nullptr); | |||
| fEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, fPlugin->getId(), 0, 0, 0.0f, nullptr); | |||
| carla_stdout("CarlaPluginThread::run() - GUI closed"); | |||
| } | |||
| else | |||
| { | |||
| // Kill | |||
| kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), -1, 0, 0.0f, nullptr); | |||
| fEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, fPlugin->getId(), -1, 0, 0.0f, nullptr); | |||
| carla_stderr("CarlaPluginThread::run() - GUI crashed while running"); | |||
| } | |||
| } | |||
| @@ -183,12 +183,12 @@ void CarlaPluginThread::run() | |||
| if (fProcess->exitCode() != 0 || fProcess->exitStatus() == QProcess::CrashExit) | |||
| { | |||
| kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), -1, 0, 0.0f, nullptr); | |||
| fEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, fPlugin->getId(), -1, 0, 0.0f, nullptr); | |||
| carla_stderr("CarlaPluginThread::run() - GUI crashed while opening"); | |||
| } | |||
| else | |||
| { | |||
| kEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, kPlugin->id(), 0, 0, 0.0f, nullptr); | |||
| fEngine->callback(CarlaBackend::CALLBACK_SHOW_GUI, fPlugin->getId(), 0, 0, 0.0f, nullptr); | |||
| carla_debug("CarlaPluginThread::run() - GUI timeout"); | |||
| } | |||
| } | |||
| @@ -201,10 +201,10 @@ void CarlaPluginThread::run() | |||
| { | |||
| carla_stderr("CarlaPluginThread::run() - bridge crashed"); | |||
| CarlaString errorString("Plugin '" + CarlaString(kPlugin->name()) + "' has crashed!\n" | |||
| CarlaString errorString("Plugin '" + CarlaString(fPlugin->getName()) + "' has crashed!\n" | |||
| "Saving now will lose its current settings.\n" | |||
| "Please remove this plugin, and not rely on it from this point."); | |||
| kEngine->callback(CarlaBackend::CALLBACK_ERROR, kPlugin->id(), 0, 0, 0.0f, (const char*)errorString); | |||
| fEngine->callback(CarlaBackend::CALLBACK_ERROR, fPlugin->getId(), 0, 0, 0.0f, (const char*)errorString); | |||
| } | |||
| break; | |||
| } | |||
| @@ -12,7 +12,7 @@ | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU General Public License for more details. | |||
| * | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||
| */ | |||
| #include "CarlaStandalone.hpp" | |||
| @@ -37,12 +37,14 @@ | |||
| # include <QtGui/QApplication> | |||
| #endif | |||
| using CarlaBackend::CarlaEngine; | |||
| using CarlaBackend::CarlaPlugin; | |||
| using CarlaBackend::CallbackFunc; | |||
| using CarlaBackend::EngineOptions; | |||
| using CarlaBackend::EngineTimeInfo; | |||
| using CarlaBackend::LogThread; | |||
| namespace CB = CarlaBackend; | |||
| using CB::CarlaEngine; | |||
| using CB::CarlaPlugin; | |||
| using CB::CallbackFunc; | |||
| using CB::EngineOptions; | |||
| using CB::EngineTimeInfo; | |||
| using CB::LogThread; | |||
| // ------------------------------------------------------------------------------------------------------------------- | |||
| // Single, standalone engine | |||
| @@ -103,7 +105,7 @@ struct CarlaBackendStandalone { | |||
| if (app != nullptr) | |||
| return; | |||
| // try again, app might be registered now | |||
| // try again, app might be registed now | |||
| app = qApp; | |||
| if (app != nullptr) | |||
| @@ -130,7 +132,7 @@ struct CarlaBackendStandalone { | |||
| app = nullptr; | |||
| } | |||
| CARLA_DECLARE_NON_COPY_STRUCT_WITH_LEAK_DETECTOR(CarlaBackendStandalone) | |||
| CARLA_DECLARE_NON_COPY_STRUCT(CarlaBackendStandalone) | |||
| } standalone; | |||
| @@ -296,9 +298,9 @@ unsigned int carla_get_internal_plugin_count() | |||
| #ifdef WANT_NATIVE | |||
| return static_cast<unsigned int>(CarlaPlugin::getNativePluginCount()); | |||
| #endif | |||
| #else | |||
| return 0; | |||
| #endif | |||
| } | |||
| const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int internalPluginId) | |||
| @@ -320,15 +322,13 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int interna | |||
| info.hints = 0x0; | |||
| if (nativePlugin->hints & PLUGIN_IS_RTSAFE) | |||
| info.hints |= CarlaBackend::PLUGIN_IS_RTSAFE; | |||
| info.hints |= CB::PLUGIN_IS_RTSAFE; | |||
| if (nativePlugin->hints & PLUGIN_IS_SYNTH) | |||
| info.hints |= CarlaBackend::PLUGIN_IS_SYNTH; | |||
| info.hints |= CB::PLUGIN_IS_SYNTH; | |||
| if (nativePlugin->hints & PLUGIN_HAS_GUI) | |||
| info.hints |= CarlaBackend::PLUGIN_HAS_GUI; | |||
| if (nativePlugin->hints & PLUGIN_USES_GUI_AS_FILE) | |||
| info.hints |= CarlaBackend::PLUGIN_HAS_GUI_AS_FILE; | |||
| info.hints |= CB::PLUGIN_HAS_GUI; | |||
| if (nativePlugin->hints & PLUGIN_USES_SINGLE_THREAD) | |||
| info.hints |= CarlaBackend::PLUGIN_HAS_SINGLE_THREAD; | |||
| info.hints |= CB::PLUGIN_HAS_SINGLE_THREAD; | |||
| info.audioIns = nativePlugin->audioIns; | |||
| info.audioOuts = nativePlugin->audioOuts; | |||
| @@ -355,17 +355,17 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int interna | |||
| bool carla_engine_init(const char* driverName, const char* clientName) | |||
| { | |||
| carla_debug("carla_engine_init(\"%s\", \"%s\")", driverName, clientName); | |||
| CARLA_ASSERT(standalone.engine == nullptr); | |||
| CARLA_ASSERT(driverName != nullptr); | |||
| CARLA_ASSERT(clientName != nullptr); | |||
| carla_debug("carla_engine_init(\"%s\", \"%s\")", driverName, clientName); | |||
| #ifndef NDEBUG | |||
| static bool showWarning = true; | |||
| if (showWarning && standalone.callback != nullptr) | |||
| { | |||
| standalone.callback(standalone.callbackPtr, CarlaBackend::CALLBACK_DEBUG, 0, 0, 0, 0.0f, "Debug builds don't use this, check the console instead"); | |||
| standalone.callback(standalone.callbackPtr, CB::CALLBACK_DEBUG, 0, 0, 0, 0.0f, "Debug builds don't use this, check the console instead"); | |||
| showWarning = false; | |||
| } | |||
| #endif | |||
| @@ -399,49 +399,47 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||
| standalone.engine->setCallback(standalone.callback, nullptr); | |||
| #ifndef BUILD_BRIDGE | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_MODE, static_cast<int>(standalone.options.processMode), nullptr); | |||
| # if 0 // disabled for now | |||
| standalone.engine->setOption(CarlaBackend::OPTION_TRANSPORT_MODE, static_cast<int>(standalone.options.transportMode), nullptr); | |||
| # endif | |||
| standalone.engine->setOption(CarlaBackend::OPTION_FORCE_STEREO, standalone.options.forceStereo ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES, standalone.options.preferPluginBridges ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PREFER_UI_BRIDGES, standalone.options.preferUiBridges ? 1 : 0, nullptr); | |||
| # ifdef WANT_DSSI | |||
| standalone.engine->setOption(CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS, standalone.options.useDssiVstChunks ? 1 : 0, nullptr); | |||
| # endif | |||
| standalone.engine->setOption(CarlaBackend::OPTION_MAX_PARAMETERS, static_cast<int>(standalone.options.maxParameters), nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_OSC_UI_TIMEOUT, static_cast<int>(standalone.options.oscUiTimeout), nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_JACK_AUTOCONNECT, standalone.options.jackAutoConnect ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_JACK_TIMEMASTER, standalone.options.jackTimeMaster ? 1 : 0, nullptr); | |||
| # ifdef WANT_RTAUDIO | |||
| standalone.engine->setOption(CarlaBackend::OPTION_RTAUDIO_BUFFER_SIZE, static_cast<int>(standalone.options.rtaudioBufferSize), nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_RTAUDIO_SAMPLE_RATE, static_cast<int>(standalone.options.rtaudioSampleRate), nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_RTAUDIO_DEVICE, 0, (const char*)standalone.options.rtaudioDevice); | |||
| # endif | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_RESOURCES, 0, (const char*)standalone.options.resourceDir); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_NATIVE, 0, (const char*)standalone.options.bridge_native); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX32, 0, (const char*)standalone.options.bridge_posix32); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_POSIX64, 0, (const char*)standalone.options.bridge_posix64); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN32, 0, (const char*)standalone.options.bridge_win32); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_WIN64, 0, (const char*)standalone.options.bridge_win64); | |||
| # ifdef WANT_LV2 | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2, 0, (const char*)standalone.options.bridge_lv2Gtk2); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3, 0, (const char*)standalone.options.bridge_lv2Gtk3); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4, 0, (const char*)standalone.options.bridge_lv2Qt4); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT5, 0, (const char*)standalone.options.bridge_lv2Qt5); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA, 0, (const char*)standalone.options.bridge_lv2Cocoa); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, (const char*)standalone.options.bridge_lv2Win); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11, 0, (const char*)standalone.options.bridge_lv2X11); | |||
| # endif | |||
| # ifdef WANT_VST | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA, 0, (const char*)standalone.options.bridge_vstCocoa); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND, 0, (const char*)standalone.options.bridge_vstHWND); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PATH_BRIDGE_VST_X11, 0, (const char*)standalone.options.bridge_vstX11); | |||
| # endif | |||
| standalone.engine->setOption(CB::OPTION_PROCESS_MODE, static_cast<int>(standalone.options.processMode), nullptr); | |||
| standalone.engine->setOption(CB::OPTION_TRANSPORT_MODE, static_cast<int>(standalone.options.transportMode), nullptr); | |||
| #endif | |||
| standalone.engine->setOption(CB::OPTION_FORCE_STEREO, standalone.options.forceStereo ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_PREFER_PLUGIN_BRIDGES, standalone.options.preferPluginBridges ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_PREFER_UI_BRIDGES, standalone.options.preferUiBridges ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_UIS_ALWAYS_ON_TOP, standalone.options.uisAlwaysOnTop ? 1 : 0, nullptr); | |||
| #ifdef WANT_DSSI | |||
| standalone.engine->setOption(CB::OPTION_USE_DSSI_VST_CHUNKS, standalone.options.useDssiVstChunks ? 1 : 0, nullptr); | |||
| #endif | |||
| standalone.engine->setOption(CB::OPTION_MAX_PARAMETERS, static_cast<int>(standalone.options.maxParameters), nullptr); | |||
| standalone.engine->setOption(CB::OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(standalone.options.uiBridgesTimeout), nullptr); | |||
| #ifdef WANT_RTAUDIO | |||
| standalone.engine->setOption(CB::OPTION_RTAUDIO_NUMBER_PERIODS, static_cast<int>(standalone.options.rtaudioNumPeriods), nullptr); | |||
| standalone.engine->setOption(CB::OPTION_RTAUDIO_BUFFER_SIZE, static_cast<int>(standalone.options.rtaudioBufferSize), nullptr); | |||
| standalone.engine->setOption(CB::OPTION_RTAUDIO_SAMPLE_RATE, static_cast<int>(standalone.options.rtaudioSampleRate), nullptr); | |||
| standalone.engine->setOption(CB::OPTION_RTAUDIO_DEVICE, 0, (const char*)standalone.options.rtaudioDevice); | |||
| #endif | |||
| standalone.engine->setOption(CB::OPTION_PATH_RESOURCES, 0, (const char*)standalone.options.resourceDir); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_NATIVE, 0, (const char*)standalone.options.bridge_native); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_POSIX32, 0, (const char*)standalone.options.bridge_posix32); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_POSIX64, 0, (const char*)standalone.options.bridge_posix64); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_WIN32, 0, (const char*)standalone.options.bridge_win32); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_WIN64, 0, (const char*)standalone.options.bridge_win64); | |||
| #ifdef WANT_LV2 | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_GTK2, 0, (const char*)standalone.options.bridge_lv2Gtk2); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_GTK3, 0, (const char*)standalone.options.bridge_lv2Gtk3); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_QT4, 0, (const char*)standalone.options.bridge_lv2Qt4); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_QT5, 0, (const char*)standalone.options.bridge_lv2Qt5); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_COCOA, 0, (const char*)standalone.options.bridge_lv2Cocoa); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, (const char*)standalone.options.bridge_lv2Win); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_X11, 0, (const char*)standalone.options.bridge_lv2X11); | |||
| #endif | |||
| #ifdef WANT_VST | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_VST_COCOA, 0, (const char*)standalone.options.bridge_vstCocoa); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_VST_HWND, 0, (const char*)standalone.options.bridge_vstHWND); | |||
| standalone.engine->setOption(CB::OPTION_PATH_BRIDGE_VST_X11, 0, (const char*)standalone.options.bridge_vstX11); | |||
| #endif | |||
| if (standalone.procName.isNotEmpty()) | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_NAME, 0, (const char*)standalone.procName); | |||
| #endif | |||
| standalone.engine->setOption(CB::OPTION_PROCESS_NAME, 0, (const char*)standalone.procName); | |||
| if (standalone.engine->init(clientName)) | |||
| { | |||
| @@ -460,8 +458,8 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||
| bool carla_engine_close() | |||
| { | |||
| carla_debug("carla_engine_close()"); | |||
| CARLA_ASSERT(standalone.engine != nullptr); | |||
| carla_debug("carla_engine_close()"); | |||
| if (standalone.engine == nullptr) | |||
| { | |||
| @@ -504,8 +502,8 @@ bool carla_is_engine_running() | |||
| void carla_set_engine_about_to_close() | |||
| { | |||
| carla_debug("carla_set_engine_about_to_close()"); | |||
| CARLA_ASSERT(standalone.engine != nullptr); | |||
| carla_debug("carla_set_engine_about_to_close()"); | |||
| if (standalone.engine != nullptr) | |||
| standalone.engine->setAboutToClose(); | |||
| @@ -526,142 +524,140 @@ void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr) | |||
| void carla_set_engine_option(CarlaOptionsType option, int value, const char* valueStr) | |||
| { | |||
| carla_debug("carla_set_engine_option(%s, %i, \"%s\")", CarlaBackend::OptionsType2Str(option), value, valueStr); | |||
| carla_debug("carla_set_engine_option(%s, %i, \"%s\")", CB::OptionsType2Str(option), value, valueStr); | |||
| switch (option) | |||
| { | |||
| case CarlaBackend::OPTION_PROCESS_NAME: | |||
| case CB::OPTION_PROCESS_NAME: | |||
| standalone.procName = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PROCESS_MODE: | |||
| if (value < CarlaBackend::PROCESS_MODE_SINGLE_CLIENT || value > CarlaBackend::PROCESS_MODE_PATCHBAY) | |||
| case CB::OPTION_PROCESS_MODE: | |||
| if (value < CB::PROCESS_MODE_SINGLE_CLIENT || value > CB::PROCESS_MODE_PATCHBAY) | |||
| return carla_stderr2("carla_set_engine_option(OPTION_PROCESS_MODE, %i, \"%s\") - invalid value", value, valueStr); | |||
| standalone.options.processMode = static_cast<CarlaBackend::ProcessMode>(value); | |||
| standalone.options.processMode = static_cast<CB::ProcessMode>(value); | |||
| break; | |||
| case CarlaBackend::OPTION_TRANSPORT_MODE: | |||
| #if 0 // disabled for now | |||
| if (value < CarlaBackend::TRANSPORT_MODE_INTERNAL || value > CarlaBackend::TRANSPORT_MODE_JACK) | |||
| case CB::OPTION_TRANSPORT_MODE: | |||
| if (value < CB::TRANSPORT_MODE_INTERNAL || value > CB::TRANSPORT_MODE_JACK) | |||
| return carla_stderr2("carla_set_engine_option(OPTION_TRANSPORT_MODE, %i, \"%s\") - invalid value", value, valueStr); | |||
| standalone.options.transportMode = static_cast<CarlaBackend::TransportMode>(value); | |||
| #endif | |||
| standalone.options.transportMode = static_cast<CB::TransportMode>(value); | |||
| break; | |||
| case CarlaBackend::OPTION_FORCE_STEREO: | |||
| case CB::OPTION_FORCE_STEREO: | |||
| standalone.options.forceStereo = (value != 0); | |||
| break; | |||
| case CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES: | |||
| case CB::OPTION_PREFER_PLUGIN_BRIDGES: | |||
| standalone.options.preferPluginBridges = (value != 0); | |||
| break; | |||
| case CarlaBackend::OPTION_PREFER_UI_BRIDGES: | |||
| case CB::OPTION_PREFER_UI_BRIDGES: | |||
| standalone.options.preferUiBridges = (value != 0); | |||
| break; | |||
| #ifdef WANT_DSSI | |||
| case CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS: | |||
| case CB::OPTION_USE_DSSI_VST_CHUNKS: | |||
| standalone.options.useDssiVstChunks = (value != 0); | |||
| break; | |||
| #endif | |||
| case CarlaBackend::OPTION_MAX_PARAMETERS: | |||
| case CB::OPTION_MAX_PARAMETERS: | |||
| if (value <= 0) | |||
| return carla_stderr2("carla_set_engine_option(OPTION_MAX_PARAMETERS, %i, \"%s\") - invalid value", value, valueStr); | |||
| standalone.options.maxParameters = static_cast<unsigned int>(value); | |||
| break; | |||
| case CarlaBackend::OPTION_OSC_UI_TIMEOUT: | |||
| case CB::OPTION_OSC_UI_TIMEOUT: | |||
| if (value <= 0) | |||
| return carla_stderr2("carla_set_engine_option(OPTION_OSC_UI_TIMEOUT, %i, \"%s\") - invalid value", value, valueStr); | |||
| standalone.options.oscUiTimeout = static_cast<unsigned int>(value); | |||
| break; | |||
| case CarlaBackend::OPTION_JACK_AUTOCONNECT: | |||
| case CB::OPTION_JACK_AUTOCONNECT: | |||
| standalone.options.jackAutoConnect = (value != 0); | |||
| break; | |||
| case CarlaBackend::OPTION_JACK_TIMEMASTER: | |||
| case CB::OPTION_JACK_TIMEMASTER: | |||
| standalone.options.jackTimeMaster = (value != 0); | |||
| break; | |||
| #ifdef WANT_RTAUDIO | |||
| case CarlaBackend::OPTION_RTAUDIO_BUFFER_SIZE: | |||
| case CB::OPTION_RTAUDIO_BUFFER_SIZE: | |||
| if (value <= 0) | |||
| return carla_stderr2("carla_set_engine_option(OPTION_RTAUDIO_BUFFER_SIZE, %i, \"%s\") - invalid value", value, valueStr); | |||
| standalone.options.rtaudioBufferSize = static_cast<unsigned int>(value); | |||
| break; | |||
| case CarlaBackend::OPTION_RTAUDIO_SAMPLE_RATE: | |||
| case CB::OPTION_RTAUDIO_SAMPLE_RATE: | |||
| if (value <= 0) | |||
| return carla_stderr2("carla_set_engine_option(OPTION_RTAUDIO_SAMPLE_RATE, %i, \"%s\") - invalid value", value, valueStr); | |||
| standalone.options.rtaudioSampleRate = static_cast<unsigned int>(value); | |||
| break; | |||
| case CarlaBackend::OPTION_RTAUDIO_DEVICE: | |||
| case CB::OPTION_RTAUDIO_DEVICE: | |||
| standalone.options.rtaudioDevice = valueStr; | |||
| break; | |||
| #endif | |||
| case CarlaBackend::OPTION_PATH_RESOURCES: | |||
| case CB::OPTION_PATH_RESOURCES: | |||
| standalone.options.resourceDir = valueStr; | |||
| break; | |||
| #ifndef BUILD_BRIDGE | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_NATIVE: | |||
| case CB::OPTION_PATH_BRIDGE_NATIVE: | |||
| standalone.options.bridge_native = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_POSIX32: | |||
| case CB::OPTION_PATH_BRIDGE_POSIX32: | |||
| standalone.options.bridge_posix32 = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_POSIX64: | |||
| case CB::OPTION_PATH_BRIDGE_POSIX64: | |||
| standalone.options.bridge_posix64 = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_WIN32: | |||
| case CB::OPTION_PATH_BRIDGE_WIN32: | |||
| standalone.options.bridge_win32 = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_WIN64: | |||
| case CB::OPTION_PATH_BRIDGE_WIN64: | |||
| standalone.options.bridge_win64 = valueStr; | |||
| break; | |||
| #endif | |||
| #ifdef WANT_LV2 | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK2: | |||
| case CB::OPTION_PATH_BRIDGE_LV2_GTK2: | |||
| standalone.options.bridge_lv2Gtk2 = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_LV2_GTK3: | |||
| case CB::OPTION_PATH_BRIDGE_LV2_GTK3: | |||
| standalone.options.bridge_lv2Gtk3 = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT4: | |||
| case CB::OPTION_PATH_BRIDGE_LV2_QT4: | |||
| standalone.options.bridge_lv2Qt4 = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_LV2_QT5: | |||
| case CB::OPTION_PATH_BRIDGE_LV2_QT5: | |||
| standalone.options.bridge_lv2Qt5 = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_LV2_COCOA: | |||
| case CB::OPTION_PATH_BRIDGE_LV2_COCOA: | |||
| standalone.options.bridge_lv2Cocoa = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
| case CB::OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
| standalone.options.bridge_lv2Win = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_LV2_X11: | |||
| case CB::OPTION_PATH_BRIDGE_LV2_X11: | |||
| standalone.options.bridge_lv2X11 = valueStr; | |||
| break; | |||
| #endif | |||
| #ifdef WANT_VST | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_VST_COCOA: | |||
| case CB::OPTION_PATH_BRIDGE_VST_COCOA: | |||
| standalone.options.bridge_vstCocoa = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_VST_HWND: | |||
| case CB::OPTION_PATH_BRIDGE_VST_HWND: | |||
| standalone.options.bridge_vstHWND = valueStr; | |||
| break; | |||
| case CarlaBackend::OPTION_PATH_BRIDGE_VST_X11: | |||
| case CB::OPTION_PATH_BRIDGE_VST_X11: | |||
| standalone.options.bridge_vstX11 = valueStr; | |||
| break; | |||
| #endif | |||
| @@ -834,7 +830,7 @@ const CarlaTransportInfo* carla_get_transport_info() | |||
| bool carla_add_plugin(CarlaBinaryType btype, CarlaPluginType ptype, const char* filename, const char* const name, const char* label, const void* extraStuff) | |||
| { | |||
| carla_debug("carla_add_plugin(%s, %s, \"%s\", \"%s\", \"%s\", %p)", CarlaBackend::BinaryType2Str(btype), CarlaBackend::PluginType2Str(ptype), filename, name, label, extraStuff); | |||
| carla_debug("carla_add_plugin(%s, %s, \"%s\", \"%s\", \"%s\", %p)", CB::BinaryType2Str(btype), CB::PluginType2Str(ptype), filename, name, label, extraStuff); | |||
| CARLA_ASSERT(standalone.engine != nullptr); | |||
| if (standalone.engine != nullptr && standalone.engine->isRunning()) | |||
| @@ -961,8 +957,8 @@ const CarlaPluginInfo* carla_get_plugin_info(unsigned int pluginId) | |||
| static CarlaPluginInfo info; | |||
| // reset | |||
| info.type = CarlaBackend::PLUGIN_NONE; | |||
| info.category = CarlaBackend::PLUGIN_CATEGORY_NONE; | |||
| info.type = CB::PLUGIN_NONE; | |||
| info.category = CB::PLUGIN_CATEGORY_NONE; | |||
| info.hints = 0x0; | |||
| info.hints = 0x0; | |||
| info.binary = nullptr; | |||
| @@ -1324,7 +1320,7 @@ const char* carla_get_chunk_data(unsigned int pluginId) | |||
| if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId)) | |||
| { | |||
| if (plugin->options() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS) | |||
| if (plugin->options() & CB::PLUGIN_OPTION_USE_CHUNKS) | |||
| { | |||
| void* data = nullptr; | |||
| const int32_t dataSize = plugin->chunkData(&data); | |||
| @@ -1880,7 +1876,7 @@ void carla_set_chunk_data(unsigned int pluginId, const char* chunkData) | |||
| if (CarlaPlugin* const plugin = standalone.engine->getPlugin(pluginId)) | |||
| { | |||
| if (plugin->options() & CarlaBackend::PLUGIN_OPTION_USE_CHUNKS) | |||
| if (plugin->options() & CB::PLUGIN_OPTION_USE_CHUNKS) | |||
| return plugin->setChunkData(chunkData); | |||
| carla_stderr2("carla_set_chunk_data(%i, \"%s\") - plugin does not support chunks", pluginId, chunkData); | |||
| @@ -2099,7 +2095,7 @@ protected: | |||
| carla_msleep(100); | |||
| if (std::strcmp(method, "/nsm/server/announce") == 0 && standalone.callback != nullptr) | |||
| standalone.callback(standalone.callbackPtr, CarlaBackend::CALLBACK_NSM_ANNOUNCE, 0, 0, 0, 0.0f, smName); | |||
| standalone.callback(standalone.callbackPtr, CB::CALLBACK_NSM_ANNOUNCE, 0, 0, 0, 0.0f, smName); | |||
| return 0; | |||
| @@ -2132,7 +2128,7 @@ protected: | |||
| fIsOpened = false; | |||
| standalone.callback(nullptr, CarlaBackend::CALLBACK_NSM_OPEN, 0, 0, 0, 0.0f, data); | |||
| standalone.callback(nullptr, CB::CALLBACK_NSM_OPEN, 0, 0, 0, 0.0f, data); | |||
| // wait max 10 secs to open | |||
| for (int i=0; i < 100 && ! fIsOpened; ++i) | |||
| @@ -2167,7 +2163,7 @@ protected: | |||
| fIsSaved = false; | |||
| standalone.callback(nullptr, CarlaBackend::CALLBACK_NSM_SAVE, 0, 0, 0, 0.0f, nullptr); | |||
| standalone.callback(nullptr, CB::CALLBACK_NSM_SAVE, 0, 0, 0, 0.0f, nullptr); | |||
| // wait max 10 secs to save | |||
| for (int i=0; i < 100 && ! fIsSaved; ++i) | |||
| @@ -2272,18 +2268,18 @@ bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBase | |||
| if (standalone.callback != nullptr) | |||
| standalone.engine->setCallback(standalone.callback, nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PROCESS_MODE, CarlaBackend::PROCESS_MODE_BRIDGE, nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_TRANSPORT_MODE, CarlaBackend::TRANSPORT_MODE_BRIDGE, nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr); | |||
| standalone.engine->setOption(CarlaBackend::OPTION_PREFER_UI_BRIDGES, false, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_PROCESS_MODE, CB::PROCESS_MODE_BRIDGE, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_TRANSPORT_MODE, CB::TRANSPORT_MODE_BRIDGE, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_PREFER_UI_BRIDGES, false, nullptr); | |||
| // TODO - read from environment | |||
| #if 0 | |||
| standalone.engine->setOption(CarlaBackend::OPTION_FORCE_STEREO, standalone.options.forceStereo ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_FORCE_STEREO, standalone.options.forceStereo ? 1 : 0, nullptr); | |||
| # ifdef WANT_DSSI | |||
| standalone.engine->setOption(CarlaBackend::OPTION_USE_DSSI_VST_CHUNKS, standalone.options.useDssiVstChunks ? 1 : 0, nullptr); | |||
| standalone.engine->setOption(CB::OPTION_USE_DSSI_VST_CHUNKS, standalone.options.useDssiVstChunks ? 1 : 0, nullptr); | |||
| # endif | |||
| standalone.engine->setOption(CarlaBackend::OPTION_MAX_PARAMETERS, static_cast<int>(standalone.options.maxParameters), nullptr); | |||
| standalone.engine->setOption(CB::OPTION_MAX_PARAMETERS, static_cast<int>(standalone.options.maxParameters), nullptr); | |||
| #endif | |||
| if (standalone.engine->init(clientName)) | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_BRIDGE_HPP__ | |||
| #define __CARLA_BRIDGE_HPP__ | |||
| #ifndef CARLA_BRIDGE_HPP_INCLUDED | |||
| #define CARLA_BRIDGE_HPP_INCLUDED | |||
| #include "CarlaDefines.hpp" | |||
| @@ -32,4 +32,4 @@ class CarlaBridgeToolkit; | |||
| CARLA_BRIDGE_END_NAMESPACE | |||
| #endif // __CARLA_BRIDGE_HPP__ | |||
| #endif // CARLA_BRIDGE_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_BRIDGE_CLIENT_HPP__ | |||
| #define __CARLA_BRIDGE_CLIENT_HPP__ | |||
| #ifndef CARLA_BRIDGE_CLIENT_HPP_INCLUDED | |||
| #define CARLA_BRIDGE_CLIENT_HPP_INCLUDED | |||
| #include "CarlaBridgeOsc.hpp" | |||
| @@ -174,4 +174,4 @@ private: | |||
| CARLA_BRIDGE_END_NAMESPACE | |||
| #endif // __CARLA_BRIDGE_CLIENT_HPP__ | |||
| #endif // CARLA_BRIDGE_CLIENT_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_BRIDGE_OSC_HPP__ | |||
| #define __CARLA_BRIDGE_OSC_HPP__ | |||
| #ifndef CARLA_BRIDGE_OSC_HPP_INCLUDED | |||
| #define CARLA_BRIDGE_OSC_HPP_INCLUDED | |||
| #include "CarlaBridge.hpp" | |||
| #include "CarlaOscUtils.hpp" | |||
| @@ -138,4 +138,4 @@ private: | |||
| CARLA_BRIDGE_END_NAMESPACE | |||
| #endif // __CARLA_BRIDGE_OSC_HPP__ | |||
| #endif // CARLA_BRIDGE_OSC_HPP_INCLUDED | |||
| @@ -15,8 +15,8 @@ | |||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||
| */ | |||
| #ifndef __CARLA_BRIDGE_TOOLKIT_HPP__ | |||
| #define __CARLA_BRIDGE_TOOLKIT_HPP__ | |||
| #ifndef CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | |||
| #define CARLA_BRIDGE_TOOLKIT_HPP_INCLUDED | |||
| #include "CarlaBridge.hpp" | |||
| #include "CarlaJuceUtils.hpp" | |||
| @@ -203,10 +203,10 @@ OPTION_TRANSPORT_MODE = 2 | |||
| OPTION_FORCE_STEREO = 3 | |||
| OPTION_PREFER_PLUGIN_BRIDGES = 4 | |||
| OPTION_PREFER_UI_BRIDGES = 5 | |||
| OPTION_USE_DSSI_VST_CHUNKS = 6 | |||
| OPTION_MAX_PARAMETERS = 7 | |||
| OPTION_UI_BRIDGES_TIMEOUT = 8 | |||
| OPTION_JACK_AUTOCONNECT = 9 | |||
| OPTION_UIS_ALWAYS_ON_TOP = 6 | |||
| OPTION_USE_DSSI_VST_CHUNKS = 7 | |||
| OPTION_MAX_PARAMETERS = 8 | |||
| OPTION_UI_BRIDGES_TIMEOUT = 9 | |||
| OPTION_RTAUDIO_NUMBER_PERIODS = 10 | |||
| OPTION_RTAUDIO_BUFFER_SIZE = 11 | |||
| OPTION_RTAUDIO_SAMPLE_RATE = 12 | |||
| @@ -109,6 +109,16 @@ | |||
| # define BINARY_NATIVE BINARY_OTHER | |||
| #endif | |||
| // Define CARLA_DECLARE_NON_COPY_STRUCT | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| # define CARLA_DECLARE_NON_COPY_STRUCT(StructName) \ | |||
| StructName(StructName&) = delete; \ | |||
| StructName(const StructName&) = delete; \ | |||
| StructName& operator=(const StructName&) = delete; | |||
| #else | |||
| # define CARLA_DECLARE_NON_COPY_STRUCT(StructName) | |||
| #endif | |||
| // Define CARLA_SAFE_ASSERT* | |||
| #define CARLA_SAFE_ASSERT(cond) if (cond) pass(); else carla_assert (#cond, __FILE__, __LINE__); | |||
| #define CARLA_SAFE_ASSERT_INT(cond, value) if (cond) pass(); else carla_assert_int (#cond, __FILE__, __LINE__, value); | |||
| @@ -28,7 +28,7 @@ | |||
| #define MIDI_STATUS_POLYPHONIC_AFTERTOUCH 0xA0 // note (0-127), pressure (0-127) | |||
| #define MIDI_STATUS_CONTROL_CHANGE 0xB0 // see 'Control Change Messages List' | |||
| #define MIDI_STATUS_PROGRAM_CHANGE 0xC0 // program (0-127), none | |||
| #define MIDI_STATUS_AFTERTOUCH 0xD0 // pressure (0-127), none | |||
| #define MIDI_STATUS_CHANNEL_PRESSURE 0xD0 // pressure (0-127), none | |||
| #define MIDI_STATUS_PITCH_WHEEL_CONTROL 0xE0 // LSB (0-127), MSB (0-127) | |||
| #define MIDI_IS_STATUS_NOTE_OFF(status) (((status) & 0xF0) == MIDI_STATUS_NOTE_OFF) | |||
| @@ -1 +0,0 @@ | |||
| ../libs/distrho/dgl/ | |||
| @@ -18,7 +18,7 @@ | |||
| #ifndef LADSPA_RDF_HPP_INCLUDED | |||
| #define LADSPA_RDF_HPP_INCLUDED | |||
| #include "CarlaJuceUtils.hpp" | |||
| #include "CarlaDefines.hpp" | |||
| // Base Types | |||
| typedef float LADSPA_Data; | |||
| @@ -1 +1 @@ | |||
| ../libs/lilv/lilv-0.16.0/lilv | |||
| ../modules/lilv/lilv-0.16.0/lilv | |||
| @@ -18,7 +18,7 @@ | |||
| #ifndef LV2_RDF_HPP_INCLUDED | |||
| #define LV2_RDF_HPP_INCLUDED | |||
| #include "CarlaJuceUtils.hpp" | |||
| #include "CarlaDefines.hpp" | |||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | |||
| # include <cstdint> | |||
| @@ -1 +0,0 @@ | |||
| ../libs/rtmempool | |||
| @@ -1 +0,0 @@ | |||
| ../libs/lilv/serd-0.18.2/serd | |||
| @@ -1 +0,0 @@ | |||
| ../libs/lilv/sord-0.12.0/sord | |||
| @@ -1 +0,0 @@ | |||
| ../libs/lilv/sratom-0.4.2/sratom | |||
| @@ -1,72 +0,0 @@ | |||
| #!/usr/bin/make -f | |||
| # Makefile for carla libs # | |||
| # ----------------------- # | |||
| # Created by falkTX | |||
| # | |||
| all: | |||
| # -------------------------------------------------------------- | |||
| dgl: | |||
| $(MAKE) -C distrho/dgl | |||
| dgl_%: | |||
| $(MAKE) -C distrho/dgl $* | |||
| # -------------------------------------------------------------- | |||
| lilv: | |||
| $(MAKE) -C lilv | |||
| lilv_%: | |||
| $(MAKE) -C lilv $* | |||
| # -------------------------------------------------------------- | |||
| rtmempool: | |||
| $(MAKE) -C rtmempool | |||
| rtmempool_%: | |||
| $(MAKE) -C rtmempool $* | |||
| # -------------------------------------------------------------- | |||
| theme: | |||
| $(MAKE) -C ../theme | |||
| theme_%: | |||
| $(MAKE) -C ../theme $* | |||
| # -------------------------------------------------------------- | |||
| widgets: | |||
| $(MAKE) -C ../widgets | |||
| # -------------------------------------------------------------- | |||
| jackbridge-win32: | |||
| $(MAKE) -C jackbridge win32 | |||
| jackbridge-win64: | |||
| $(MAKE) -C jackbridge win64 | |||
| jackbridge-wine32: | |||
| $(MAKE) -C jackbridge wine32 | |||
| jackbridge-wine64: | |||
| $(MAKE) -C jackbridge wine64 | |||
| # -------------------------------------------------------------- | |||
| clean: | |||
| rm -f *.a *.def *.dll *.dylib *.so | |||
| $(MAKE) clean -C distrho/dgl | |||
| $(MAKE) clean -C lilv | |||
| $(MAKE) clean -C rtmempool | |||
| $(MAKE) clean -C ../theme | |||
| $(MAKE) clean -C ../widgets | |||
| # -------------------------------------------------------------- | |||
| .PHONY: lilv rtmempool | |||
| @@ -8,8 +8,8 @@ include ../../../Makefile.mk | |||
| # -------------------------------------------------------------- | |||
| BUILD_C_FLAGS += -fvisibility=hidden -fPIC | |||
| BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -I. | |||
| BUILD_C_FLAGS += -I. | |||
| BUILD_CXX_FLAGS += -I. | |||
| OBJS = \ | |||
| src/App.cpp.o \ | |||
| @@ -0,0 +1,365 @@ | |||
| /* | |||
| * DISTRHO Plugin Toolkit (DPT) | |||
| * Copyright (C) 2012-2013 Filipe Coelho <falktx@falktx.com> | |||
| * | |||
| * This program is free software; you can redistribute it and/or | |||
| * modify it under the terms of the GNU Lesser General Public | |||
| * License as published by the Free Software Foundation. | |||
| * | |||
| * This program is distributed in the hope that it will be useful, | |||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| * GNU Lesser General Public License for more details. | |||
| * | |||
| * For a full copy of the license see the LGPL.txt file | |||
| */ | |||
| #ifdef DISTRHO_PLUGIN_TARGET_JACK | |||
| #include "DistrhoDefines.h" | |||
| #if ! DISTRHO_PLUGIN_HAS_UI | |||
| # error Standalone JACK mode requires UI | |||
| #endif | |||
| #include "DistrhoPluginInternal.h" | |||
| #include "DistrhoUIInternal.h" | |||
| #include <jack/jack.h> | |||
| #include <jack/midiport.h> | |||
| #include <jack/transport.h> | |||
| #include <QtCore/QSettings> | |||
| #include <QtGui/QApplication> | |||
| #include <QtGui/QMainWindow> | |||
| #include <QtGui/QMessageBox> | |||
| // ------------------------------------------------- | |||
| START_NAMESPACE_DISTRHO | |||
| class PluginJack : public QMainWindow | |||
| { | |||
| public: | |||
| PluginJack(jack_client_t* client_) | |||
| : QMainWindow(nullptr), | |||
| widget(this), | |||
| settings("DISTRHO", DISTRHO_PLUGIN_NAME), | |||
| ui(this, widget.winId(), setParameterCallback, setStateCallback, nullptr, uiNoteCallback, uiResizeCallback), | |||
| client(client_) | |||
| { | |||
| setCentralWidget(&widget); | |||
| setFixedSize(ui.getWidth(), ui.getHeight()); | |||
| setWindowTitle(DISTRHO_PLUGIN_NAME); | |||
| if (DISTRHO_PLUGIN_NUM_INPUTS > 0) | |||
| { | |||
| portsIn = new jack_port_t* [DISTRHO_PLUGIN_NUM_INPUTS]; | |||
| for (int i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; i++) | |||
| portsIn[i] = jack_port_register(client, d_string("Audio Input ") + d_string(i+1), JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); | |||
| } | |||
| else | |||
| portsIn = nullptr; | |||
| if (DISTRHO_PLUGIN_NUM_OUTPUTS > 0) | |||
| { | |||
| portsOut = new jack_port_t* [DISTRHO_PLUGIN_NUM_OUTPUTS]; | |||
| for (int i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; i++) | |||
| portsOut[i] = jack_port_register(client, d_string("Audio Output ") + d_string(i+1), JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); | |||
| } | |||
| else | |||
| portsOut = nullptr; | |||
| #if DISTRHO_PLUGIN_IS_SYNTH | |||
| portMidi = jack_port_register(client, "Midi Input", JACK_DEFAULT_MIDI_TYPE, JackPortIsInput, 0); | |||
| #endif | |||
| jack_set_process_callback(client, jackProcessCallback, this); | |||
| uiTimer = startTimer(30); | |||
| // load settings | |||
| restoreGeometry(settings.value("Global/Geometry", QByteArray()).toByteArray()); | |||
| for (uint32_t i=0; i < plugin.parameterCount(); i++) | |||
| { | |||
| bool ok; | |||
| float value = settings.value(QString("Parameters/%1").arg(i)).toFloat(&ok); | |||
| if (ok) | |||
| { | |||
| plugin.setParameterValue(i, value); | |||
| ui.parameterChanged(i, value); | |||
| } | |||
| } | |||
| #if DISTRHO_PLUGIN_WANT_STATE | |||
| for (uint32_t i=0; i < plugin.stateCount(); i++) | |||
| { | |||
| const char* key = plugin.stateKey(i); | |||
| QString stringValue(settings.value(key).toString()); | |||
| if (! stringValue.isEmpty()) | |||
| ui.stateChanged(key, stringValue.toUtf8().constData()); | |||
| } | |||
| #endif | |||
| } | |||
| ~PluginJack() | |||
| { | |||
| // save settings | |||
| settings.setValue("Global/Geometry", saveGeometry()); | |||
| if (uiTimer) | |||
| killTimer(uiTimer); | |||
| if (portsIn) | |||
| delete[] portsIn; | |||
| if (portsOut) | |||
| delete[] portsOut; | |||
| } | |||
| // --------------------------------------------- | |||
| protected: | |||
| void setParameterValue(uint32_t index, float value) | |||
| { | |||
| plugin.setParameterValue(index, value); | |||
| settings.setValue(QString("Parameters/%1").arg(index), value); | |||
| } | |||
| #if DISTRHO_PLUGIN_WANT_STATE | |||
| void setState(const char* key, const char* value) | |||
| { | |||
| plugin.setState(key, value); | |||
| settings.setValue(key, value); | |||
| } | |||
| #endif | |||
| #if DISTRHO_PLUGIN_IS_SYNTH | |||
| void uiNote(bool onOff, uint8_t channel, uint8_t note, uint8_t velocity) | |||
| { | |||
| // TODO | |||
| } | |||
| #endif | |||
| void uiResize(unsigned int width, unsigned int height) | |||
| { | |||
| widget.setFixedSize(width, height); | |||
| setFixedSize(width, height); | |||
| } | |||
| int jackProcess(jack_nframes_t nframes) | |||
| { | |||
| if (nframes <= 1) | |||
| return 1; | |||
| // Check for updated bufferSize | |||
| if (nframes != d_lastBufferSize) | |||
| { | |||
| d_lastBufferSize = nframes; | |||
| plugin.setBufferSize(nframes, true); | |||
| } | |||
| const float* ins[DISTRHO_PLUGIN_NUM_INPUTS]; | |||
| float* outs[DISTRHO_PLUGIN_NUM_OUTPUTS]; | |||
| for (int i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; i++) | |||
| ins[i] = (float*)jack_port_get_buffer(portsIn[i], nframes); | |||
| for (int i=0; i < DISTRHO_PLUGIN_NUM_OUTPUTS; i++) | |||
| outs[i] = (float*)jack_port_get_buffer(portsOut[i], nframes); | |||
| #if DISTRHO_PLUGIN_IS_SYNTH | |||
| uint32_t midiEventCount = 0; | |||
| void* mIn = jack_port_get_buffer(portMidi, nframes); | |||
| // TODO | |||
| plugin.run(ins, outs, nframes, midiEventCount, midiEvents); | |||
| #else | |||
| plugin.run(ins, outs, nframes, 0, nullptr); | |||
| #endif | |||
| return 0; | |||
| } | |||
| // --------------------------------------------- | |||
| void closeEvent(QCloseEvent* event) | |||
| { | |||
| QMainWindow::closeEvent(event); | |||
| qApp->quit(); | |||
| } | |||
| void timerEvent(QTimerEvent* event) | |||
| { | |||
| if (event->timerId() == uiTimer) | |||
| ui.idle(); | |||
| QMainWindow::timerEvent(event); | |||
| } | |||
| // --------------------------------------------- | |||
| private: | |||
| // Qt4 stuff | |||
| int uiTimer; | |||
| QWidget widget; | |||
| QSettings settings; | |||
| PluginInternal plugin; | |||
| UIInternal ui; | |||
| jack_client_t* const client; | |||
| jack_port_t** portsIn; | |||
| jack_port_t** portsOut; | |||
| #if DISTRHO_PLUGIN_IS_SYNTH | |||
| jack_port_t* portMidi; | |||
| MidiEvent midiEvents[MAX_MIDI_EVENTS]; | |||
| #endif | |||
| // --------------------------------------------- | |||
| // Callbacks | |||
| static void setParameterCallback(void* ptr, uint32_t index, float value) | |||
| { | |||
| PluginJack* _this_ = (PluginJack*)ptr; | |||
| assert(_this_); | |||
| _this_->setParameterValue(index, value); | |||
| } | |||
| static void setStateCallback(void* ptr, const char* key, const char* value) | |||
| { | |||
| #if DISTRHO_PLUGIN_WANT_STATE | |||
| PluginJack* _this_ = (PluginJack*)ptr; | |||
| assert(_this_); | |||
| _this_->setState(key, value); | |||
| #else | |||
| Q_UNUSED(ptr); | |||
| Q_UNUSED(key); | |||
| Q_UNUSED(value); | |||
| #endif | |||
| } | |||
| static void uiNoteCallback(void* ptr, bool onOff, uint8_t channel, uint8_t note, uint8_t velocity) | |||
| { | |||
| #if DISTRHO_PLUGIN_IS_SYNTH | |||
| PluginJack* _this_ = (PluginJack*)ptr; | |||
| assert(_this_); | |||
| _this_->uiNote(onOff, channel, note, velocity); | |||
| #else | |||
| Q_UNUSED(ptr); | |||
| Q_UNUSED(onOff); | |||
| Q_UNUSED(channel); | |||
| Q_UNUSED(note); | |||
| Q_UNUSED(velocity); | |||
| #endif | |||
| } | |||
| static void uiResizeCallback(void* ptr, unsigned int width, unsigned int height) | |||
| { | |||
| PluginJack* _this_ = (PluginJack*)ptr; | |||
| assert(_this_); | |||
| _this_->uiResize(width, height); | |||
| } | |||
| static int jackProcessCallback(jack_nframes_t nframes, void* arg) | |||
| { | |||
| PluginJack* _this_ = (PluginJack*)arg; | |||
| assert(_this_); | |||
| return _this_->jackProcess(nframes); | |||
| } | |||
| }; | |||
| // ------------------------------------------------- | |||
| END_NAMESPACE_DISTRHO | |||
| // ------------------------------------------------- | |||
| std::string jack_status_get_error_string(const jack_status_t& status) | |||
| { | |||
| std::string errorString; | |||
| if (status & JackFailure) | |||
| errorString += "Overall operation failed;\n"; | |||
| if (status & JackInvalidOption) | |||
| errorString += "The operation contained an invalid or unsupported option;\n"; | |||
| if (status & JackNameNotUnique) | |||
| errorString += "The desired client name was not unique;\n"; | |||
| if (status & JackServerStarted) | |||
| errorString += "The JACK server was started as a result of this operation;\n"; | |||
| if (status & JackServerFailed) | |||
| errorString += "Unable to connect to the JACK server;\n"; | |||
| if (status & JackServerError) | |||
| errorString += "Communication error with the JACK server;\n"; | |||
| if (status & JackNoSuchClient) | |||
| errorString += "Requested client does not exist;\n"; | |||
| if (status & JackLoadFailure) | |||
| errorString += "Unable to load internal client;\n"; | |||
| if (status & JackInitFailure) | |||
| errorString += "Unable to initialize client;\n"; | |||
| if (status & JackShmFailure) | |||
| errorString += "Unable to access shared memory;\n"; | |||
| if (status & JackVersionError) | |||
| errorString += "Client's protocol version does not match;\n"; | |||
| if (status & JackBackendError) | |||
| errorString += "Backend Error;\n"; | |||
| if (status & JackClientZombie) | |||
| errorString += "Client is being shutdown against its will;\n"; | |||
| if (errorString.size() > 0) | |||
| errorString.replace(errorString.size()-2, 2, "."); | |||
| return errorString; | |||
| } | |||
| int main(int argc, char* argv[]) | |||
| { | |||
| USE_NAMESPACE_DISTRHO | |||
| QApplication app(argc, argv, true); | |||
| jack_status_t status; | |||
| jack_client_t* client = jack_client_open(DISTRHO_PLUGIN_NAME, JackNullOption, &status); | |||
| if (! client) | |||
| { | |||
| std::string errorString(jack_status_get_error_string(status)); | |||
| QMessageBox::critical(nullptr, app.translate(DISTRHO_PLUGIN_NAME, "Error"), | |||
| app.translate(DISTRHO_PLUGIN_NAME, | |||
| "Could not connect to JACK, possible reasons:\n" | |||
| "%1").arg(QString::fromStdString(errorString))); | |||
| return 1; | |||
| } | |||
| d_lastBufferSize = jack_get_buffer_size(client); | |||
| d_lastSampleRate = jack_get_sample_rate(client); | |||
| setLastUiSampleRate(d_lastSampleRate); | |||
| PluginJack plugin(client); | |||
| plugin.show(); | |||
| jack_activate(client); | |||
| int ret = app.exec(); | |||
| jack_deactivate(client); | |||
| jack_client_close(client); | |||
| return ret; | |||
| } | |||
| // ------------------------------------------------- | |||
| #endif // DISTRHO_PLUGIN_TARGET_JACK | |||