| @@ -93,7 +93,7 @@ const unsigned int PLUGIN_OPTION_SEND_ALL_SOUND_OFF = 0x100; //!< Send MIDI a | |||||
| const unsigned int PARAMETER_IS_BOOLEAN = 0x001; //!< Parameter values are boolean (always at minimum or maximum values). | const unsigned int PARAMETER_IS_BOOLEAN = 0x001; //!< Parameter values are boolean (always at minimum or maximum values). | ||||
| const unsigned int PARAMETER_IS_INTEGER = 0x002; //!< Parameter values are integer. | const unsigned int PARAMETER_IS_INTEGER = 0x002; //!< Parameter values are integer. | ||||
| const unsigned int PARAMETER_IS_LOGARITHMIC = 0x004; //!< Parameter values are logarithmic. | const unsigned int PARAMETER_IS_LOGARITHMIC = 0x004; //!< Parameter values are logarithmic. | ||||
| const unsigned int PARAMETER_IS_ENABLED = 0x008; //!< Parameter is enabled (can be viewed and changed). | |||||
| const unsigned int PARAMETER_IS_ENABLED = 0x008; //!< Parameter is enabled (can be viewed, changed and stored). | |||||
| const unsigned int PARAMETER_IS_AUTOMABLE = 0x010; //!< Parameter is automable (realtime safe). | const unsigned int PARAMETER_IS_AUTOMABLE = 0x010; //!< Parameter is automable (realtime safe). | ||||
| const unsigned int PARAMETER_IS_READ_ONLY = 0x020; //!< Parameter is read-only. | const unsigned int PARAMETER_IS_READ_ONLY = 0x020; //!< Parameter is read-only. | ||||
| const unsigned int PARAMETER_USES_SAMPLERATE = 0x040; //!< Parameter needs sample rate to work (value and ranges are multiplied by SR on usage, divided by SR on save). | const unsigned int PARAMETER_USES_SAMPLERATE = 0x040; //!< Parameter needs sample rate to work (value and ranges are multiplied by SR on usage, divided by SR on save). | ||||
| @@ -378,7 +378,7 @@ public: | |||||
| * | * | ||||
| * \see getParameterCount() | * \see getParameterCount() | ||||
| */ | */ | ||||
| void getParameterCountInfo(uint32_t* const ins, uint32_t* const outs, uint32_t* const total) const; | |||||
| void getParameterCountInfo(uint32_t& ins, uint32_t& outs, uint32_t& total) const; | |||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| // Set data (state) | // Set data (state) | ||||
| @@ -547,7 +547,6 @@ public: | |||||
| */ | */ | ||||
| void setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback); | void setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback); | ||||
| #ifndef BUILD_BRIDGE | |||||
| /*! | /*! | ||||
| * Set parameter's \a parameterId MIDI channel to \a channel.\n | * Set parameter's \a parameterId MIDI channel to \a channel.\n | ||||
| * \a channel must be between 0 and 15. | * \a channel must be between 0 and 15. | ||||
| @@ -559,7 +558,6 @@ public: | |||||
| * \a cc must be between 0 and 95 (0x5F), or -1 for invalid. | * \a cc must be between 0 and 95 (0x5F), or -1 for invalid. | ||||
| */ | */ | ||||
| void setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback); | void setParameterMidiCC(const uint32_t parameterId, int16_t cc, const bool sendOsc, const bool sendCallback); | ||||
| #endif | |||||
| /*! | /*! | ||||
| * Add a custom data set.\n | * Add a custom data set.\n | ||||
| @@ -1432,8 +1432,10 @@ void CarlaEngine::setOption(const OptionsType option, const int value, const cha | |||||
| { | { | ||||
| carla_debug("CarlaEngine::setOption(%s, %i, \"%s\")", OptionsType2Str(option), value, valueStr); | carla_debug("CarlaEngine::setOption(%s, %i, \"%s\")", OptionsType2Str(option), value, valueStr); | ||||
| #ifndef BUILD_BRIDGE | |||||
| if (option >= OPTION_PROCESS_MODE && option < OPTION_PATH_RESOURCES && isRunning()) | if (option >= OPTION_PROCESS_MODE && option < OPTION_PATH_RESOURCES && isRunning()) | ||||
| return carla_stderr("CarlaEngine::setOption(%s, %i, \"%s\") - Cannot set this option while engine is running!", OptionsType2Str(option), value, valueStr); | return carla_stderr("CarlaEngine::setOption(%s, %i, \"%s\") - Cannot set this option while engine is running!", OptionsType2Str(option), value, valueStr); | ||||
| #endif | |||||
| switch (option) | switch (option) | ||||
| { | { | ||||
| @@ -21,8 +21,8 @@ | |||||
| #include "CarlaEngine.hpp" | #include "CarlaEngine.hpp" | ||||
| #include "CarlaEngineOsc.hpp" | #include "CarlaEngineOsc.hpp" | ||||
| #include "CarlaEngineThread.hpp" | #include "CarlaEngineThread.hpp" | ||||
| #include "CarlaPlugin.hpp" | #include "CarlaPlugin.hpp" | ||||
| #include "CarlaMutex.hpp" | #include "CarlaMutex.hpp" | ||||
| #include "RtList.hpp" | #include "RtList.hpp" | ||||
| @@ -140,6 +140,8 @@ struct EnginePluginData { | |||||
| insPeak[0] = insPeak[1] = 0.0f; | insPeak[0] = insPeak[1] = 0.0f; | ||||
| outsPeak[0] = outsPeak[1] = 0.0f; | outsPeak[0] = outsPeak[1] = 0.0f; | ||||
| } | } | ||||
| CARLA_DECLARE_NON_COPY_STRUCT(EnginePluginData) | |||||
| }; | }; | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -22,8 +22,6 @@ | |||||
| #include "juce_core.h" | #include "juce_core.h" | ||||
| using juce::Thread; | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| #if 0 | #if 0 | ||||
| @@ -32,7 +30,7 @@ CARLA_BACKEND_START_NAMESPACE | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class CarlaEngineThread : public Thread | |||||
| class CarlaEngineThread : public juce::Thread | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaEngineThread(CarlaEngine* const engine); | CarlaEngineThread(CarlaEngine* const engine); | ||||
| @@ -1,153 +0,0 @@ | |||||
| /* | |||||
| * Carla Plugin | |||||
| * Copyright (C) 2011-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 General Public License as | |||||
| * published by the Free Software Foundation; either version 2 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||||
| */ | |||||
| #include "CarlaPluginGui.hpp" | |||||
| #if 0 | |||||
| #include <QtCore/QSettings> | |||||
| #ifdef Q_WS_X11 | |||||
| # include <QtGui/QX11EmbedContainer> | |||||
| #endif | |||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| #include "moc_CarlaPluginGui.cpp" | |||||
| // ------------------------------------------------------------------- | |||||
| // CarlaPluginGUI | |||||
| CarlaPluginGui::CarlaPluginGui(CarlaEngine* const engine, Callback* const callback, const Options& options, const QByteArray& lastGeometry) | |||||
| : QMainWindow(nullptr), | |||||
| kCallback(callback), | |||||
| fContainer(nullptr), | |||||
| fOptions(options) | |||||
| { | |||||
| CARLA_ASSERT(callback != nullptr); | |||||
| carla_debug("CarlaPluginGui::CarlaPluginGui(%p, %p)", engine, callback); | |||||
| setWindowIcon(QIcon::fromTheme("carla", QIcon(":/scalable/carla.svg"))); | |||||
| if (options.parented) | |||||
| { | |||||
| #ifdef Q_WS_X11 | |||||
| fContainer = new QX11EmbedContainer(this); | |||||
| #else | |||||
| fContainer = new QWidget(this); | |||||
| #endif | |||||
| setCentralWidget(fContainer); | |||||
| } | |||||
| #ifdef Q_OS_WIN | |||||
| if (! options.resizable) | |||||
| setWindowFlags(windowFlags()|Qt::MSWindowsFixedSizeDialogHint); | |||||
| #endif | |||||
| connect(this, SIGNAL(setSizeSafeSignal(int,int)), SLOT(setSizeSafeSlot(int,int))); | |||||
| { | |||||
| QSettings settings; | |||||
| if (settings.value("Engine/UIsAlwaysOnTop", true).toBool()) | |||||
| setWindowFlags(windowFlags()|Qt::WindowStaysOnTopHint); | |||||
| if (! lastGeometry.isNull()) | |||||
| restoreGeometry(lastGeometry); | |||||
| } | |||||
| } | |||||
| CarlaPluginGui::~CarlaPluginGui() | |||||
| { | |||||
| carla_debug("CarlaPluginGui::~CarlaPluginGui()"); | |||||
| if (fOptions.parented) | |||||
| { | |||||
| CARLA_ASSERT(fContainer != nullptr); | |||||
| if (fContainer != nullptr) | |||||
| { | |||||
| #ifdef Q_WS_X11 | |||||
| delete (QX11EmbedContainer*)fContainer; | |||||
| #else | |||||
| delete fContainer; | |||||
| #endif | |||||
| fContainer = nullptr; | |||||
| } | |||||
| } | |||||
| } | |||||
| void CarlaPluginGui::setSize(const int width, const int height) | |||||
| { | |||||
| CARLA_ASSERT_INT(width > 0, width); | |||||
| CARLA_ASSERT_INT(height > 0, height); | |||||
| carla_debug("CarlaPluginGui::setSize(%i, %i)", width, height); | |||||
| if (width <= 0) | |||||
| return; | |||||
| if (height <= 0) | |||||
| return; | |||||
| emit setSizeSafeSignal(width, height); | |||||
| } | |||||
| void* CarlaPluginGui::getContainerWinId() | |||||
| { | |||||
| CARLA_ASSERT(fContainer != nullptr); | |||||
| carla_debug("CarlaPluginGui::getContainerWinId()"); | |||||
| return (fContainer != nullptr) ? (void*)fContainer->winId() : nullptr; | |||||
| } | |||||
| void CarlaPluginGui::setWidget(QWidget* const widget) | |||||
| { | |||||
| CARLA_ASSERT(fContainer == nullptr); | |||||
| carla_debug("CarlaPluginGui::setWidget(%p)", widget); | |||||
| setCentralWidget(widget); | |||||
| widget->setParent(this); | |||||
| fContainer = widget; | |||||
| } | |||||
| void CarlaPluginGui::closeEvent(QCloseEvent* const event) | |||||
| { | |||||
| CARLA_ASSERT(event != nullptr); | |||||
| carla_debug("CarlaPluginGui::closeEvent(%p)", event); | |||||
| if (event == nullptr) | |||||
| return; | |||||
| if (event->spontaneous() && kCallback != nullptr) | |||||
| kCallback->guiClosedCallback(); | |||||
| QMainWindow::closeEvent(event); | |||||
| } | |||||
| void CarlaPluginGui::setSizeSafeSlot(int width, int height) | |||||
| { | |||||
| carla_debug("CarlaPluginGui::setSizeSafeSlot(%i, %i)", width, height); | |||||
| if (fOptions.resizable) | |||||
| resize(width, height); | |||||
| else | |||||
| setFixedSize(width, height); | |||||
| } | |||||
| // ------------------------------------------------------------------- | |||||
| CARLA_BACKEND_END_NAMESPACE | |||||
| #endif | |||||
| @@ -1,90 +0,0 @@ | |||||
| /* | |||||
| * Carla Plugin | |||||
| * Copyright (C) 2011-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 General Public License as | |||||
| * published by the Free Software Foundation; either version 2 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the GPL.txt file | |||||
| */ | |||||
| #ifndef CARLA_PLUGIN_GUI_HPP_INCLUDED | |||||
| #define CARLA_PLUGIN_GUI_HPP_INCLUDED | |||||
| #include "CarlaPluginInternal.hpp" | |||||
| #include "juce_gui_basics.h" | |||||
| #if 0 | |||||
| #include <QtGui/QCloseEvent> | |||||
| # if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |||||
| # include <QtWidgets/QMainWindow> | |||||
| #else | |||||
| # include <QtGui/QMainWindow> | |||||
| #endif | |||||
| CARLA_BACKEND_START_NAMESPACE | |||||
| #if 0 | |||||
| } // Fix editor indentation | |||||
| #endif | |||||
| class CarlaPluginGui : public QMainWindow | |||||
| { | |||||
| Q_OBJECT | |||||
| public: | |||||
| class Callback | |||||
| { | |||||
| public: | |||||
| virtual ~Callback() {} | |||||
| virtual void guiClosedCallback() = 0; | |||||
| }; | |||||
| struct Options { | |||||
| bool parented; | |||||
| bool resizable; | |||||
| }; | |||||
| CarlaPluginGui(CarlaEngine* const engine, Callback* const callback, const Options& options, const QByteArray& lastGeometry); | |||||
| ~CarlaPluginGui(); | |||||
| void setSize(const int width, const int height); | |||||
| // Parent UIs | |||||
| void* getContainerWinId(); | |||||
| // Qt UIs | |||||
| void setWidget(QWidget* widget); | |||||
| protected: | |||||
| void closeEvent(QCloseEvent* const event); | |||||
| private: | |||||
| Callback* const kCallback; | |||||
| QWidget* fContainer; | |||||
| const Options fOptions; | |||||
| signals: | |||||
| void setSizeSafeSignal(int, int); | |||||
| private slots: | |||||
| void setSizeSafeSlot(int width, int height); | |||||
| #ifndef MOC_PARSING | |||||
| CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaPluginGui) | |||||
| #endif | |||||
| }; | |||||
| CARLA_BACKEND_END_NAMESPACE | |||||
| #endif | |||||
| #endif // CARLA_PLUGIN_GUI_HPP_INCLUDED | |||||
| @@ -24,6 +24,7 @@ | |||||
| #include "CarlaBackendUtils.hpp" | #include "CarlaBackendUtils.hpp" | ||||
| #include "CarlaOscUtils.hpp" | #include "CarlaOscUtils.hpp" | ||||
| #include "CarlaStateUtils.hpp" | |||||
| #include "CarlaMutex.hpp" | #include "CarlaMutex.hpp" | ||||
| #include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
| #include "RtList.hpp" | #include "RtList.hpp" | ||||
| @@ -40,9 +41,9 @@ CARLA_BACKEND_START_NAMESPACE | |||||
| const unsigned short kPluginMaxMidiEvents = 512; | const unsigned short kPluginMaxMidiEvents = 512; | ||||
| const unsigned int PLUGIN_HINT_HAS_MIDI_IN = 0x1; | |||||
| const unsigned int PLUGIN_HINT_HAS_MIDI_OUT = 0x2; | |||||
| const unsigned int PLUGIN_HINT_CAN_RUN_RACK = 0x4; | |||||
| const unsigned int PLUGIN_EXTRA_HINT_HAS_MIDI_IN = 0x1; | |||||
| const unsigned int PLUGIN_EXTRA_HINT_HAS_MIDI_OUT = 0x2; | |||||
| const unsigned int PLUGIN_EXTRA_HINT_CAN_RUN_RACK = 0x4; | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -56,7 +57,7 @@ const unsigned int PLUGIN_HINT_CAN_RUN_RACK = 0x4; | |||||
| enum PluginPostRtEventType { | enum PluginPostRtEventType { | ||||
| kPluginPostRtEventNull, | kPluginPostRtEventNull, | ||||
| kPluginPostRtEventDebug, | kPluginPostRtEventDebug, | ||||
| kPluginPostRtEventParameterChange, // param, SP*, value (SP: if 1, don't report change to Callback and OSC) | |||||
| kPluginPostRtEventParameterChange, // param, SP (*), value (SP: if 1, don't report change to Callback and OSC) | |||||
| kPluginPostRtEventProgramChange, // index | kPluginPostRtEventProgramChange, // index | ||||
| kPluginPostRtEventMidiProgramChange, // index | kPluginPostRtEventMidiProgramChange, // index | ||||
| kPluginPostRtEventNoteOn, // channel, note, velo | kPluginPostRtEventNoteOn, // channel, note, velo | ||||
| @@ -86,7 +87,7 @@ struct PluginAudioPort { | |||||
| uint32_t rindex; | uint32_t rindex; | ||||
| CarlaEngineAudioPort* port; | CarlaEngineAudioPort* port; | ||||
| PluginAudioPort() | |||||
| PluginAudioPort() noexcept | |||||
| : rindex(0), | : rindex(0), | ||||
| port(nullptr) {} | port(nullptr) {} | ||||
| @@ -102,7 +103,7 @@ struct PluginAudioData { | |||||
| uint32_t count; | uint32_t count; | ||||
| PluginAudioPort* ports; | PluginAudioPort* ports; | ||||
| PluginAudioData() | |||||
| PluginAudioData() noexcept | |||||
| : count(0), | : count(0), | ||||
| ports(nullptr) {} | ports(nullptr) {} | ||||
| @@ -164,7 +165,7 @@ struct PluginCVPort { | |||||
| uint32_t param; | uint32_t param; | ||||
| CarlaEngineCVPort* port; | CarlaEngineCVPort* port; | ||||
| PluginCVPort() | |||||
| PluginCVPort() noexcept | |||||
| : rindex(0), | : rindex(0), | ||||
| param(0), | param(0), | ||||
| port(nullptr) {} | port(nullptr) {} | ||||
| @@ -181,7 +182,7 @@ struct PluginCVData { | |||||
| uint32_t count; | uint32_t count; | ||||
| PluginCVPort* ports; | PluginCVPort* ports; | ||||
| PluginCVData() | |||||
| PluginCVData() noexcept | |||||
| : count(0), | : count(0), | ||||
| ports(nullptr) {} | ports(nullptr) {} | ||||
| @@ -242,7 +243,7 @@ struct PluginEventData { | |||||
| CarlaEngineEventPort* portIn; | CarlaEngineEventPort* portIn; | ||||
| CarlaEngineEventPort* portOut; | CarlaEngineEventPort* portOut; | ||||
| PluginEventData() | |||||
| PluginEventData() noexcept | |||||
| : portIn(nullptr), | : portIn(nullptr), | ||||
| portOut(nullptr) {} | portOut(nullptr) {} | ||||
| @@ -286,7 +287,7 @@ struct PluginParameterData { | |||||
| ParameterData* data; | ParameterData* data; | ||||
| ParameterRanges* ranges; | ParameterRanges* ranges; | ||||
| PluginParameterData() | |||||
| PluginParameterData() noexcept | |||||
| : count(0), | : count(0), | ||||
| data(nullptr), | data(nullptr), | ||||
| ranges(nullptr) {} | ranges(nullptr) {} | ||||
| @@ -348,7 +349,7 @@ struct PluginProgramData { | |||||
| int32_t current; | int32_t current; | ||||
| ProgramName* names; | ProgramName* names; | ||||
| PluginProgramData() | |||||
| PluginProgramData() noexcept | |||||
| : count(0), | : count(0), | ||||
| current(-1), | current(-1), | ||||
| names(nullptr) {} | names(nullptr) {} | ||||
| @@ -408,7 +409,7 @@ struct PluginMidiProgramData { | |||||
| int32_t current; | int32_t current; | ||||
| MidiProgramData* data; | MidiProgramData* data; | ||||
| PluginMidiProgramData() | |||||
| PluginMidiProgramData() noexcept | |||||
| : count(0), | : count(0), | ||||
| current(-1), | current(-1), | ||||
| data(nullptr) {} | data(nullptr) {} | ||||
| @@ -467,11 +468,11 @@ struct PluginMidiProgramData { | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| struct ExternalMidiNote { | struct ExternalMidiNote { | ||||
| int8_t channel; // invalid == -1 | |||||
| int8_t channel; // invalid if -1 | |||||
| uint8_t note; | uint8_t note; | ||||
| uint8_t velo; // note-off if 0 | uint8_t velo; // note-off if 0 | ||||
| ExternalMidiNote() | |||||
| ExternalMidiNote() noexcept | |||||
| : channel(-1), | : channel(-1), | ||||
| note(0), | note(0), | ||||
| velo(0) {} | velo(0) {} | ||||
| @@ -479,13 +480,9 @@ struct ExternalMidiNote { | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class CarlaPluginGui; | |||||
| struct CarlaPluginProtectedData { | struct CarlaPluginProtectedData { | ||||
| CarlaEngine* const engine; | CarlaEngine* const engine; | ||||
| CarlaEngineClient* client; | CarlaEngineClient* client; | ||||
| CarlaPluginGui* gui; | |||||
| //QByteArray guiGeometry; | |||||
| bool active; | bool active; | ||||
| bool needsReset; | bool needsReset; | ||||
| @@ -510,6 +507,8 @@ struct CarlaPluginProtectedData { | |||||
| PluginMidiProgramData midiprog; | PluginMidiProgramData midiprog; | ||||
| NonRtList<CustomData> custom; | NonRtList<CustomData> custom; | ||||
| SaveState saveState; | |||||
| CarlaMutex masterMutex; // global master lock | CarlaMutex masterMutex; // global master lock | ||||
| CarlaMutex singleMutex; // small lock used only in processSingle() | CarlaMutex singleMutex; // small lock used only in processSingle() | ||||
| @@ -590,7 +589,7 @@ struct CarlaPluginProtectedData { | |||||
| float balanceRight; | float balanceRight; | ||||
| float panning; | float panning; | ||||
| PostProc() | |||||
| PostProc() noexcept | |||||
| : dryWet(1.0f), | : dryWet(1.0f), | ||||
| volume(1.0f), | volume(1.0f), | ||||
| balanceLeft(-1.0f), | balanceLeft(-1.0f), | ||||
| @@ -611,17 +610,13 @@ struct CarlaPluginProtectedData { | |||||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | #ifdef CARLA_PROPER_CPP11_SUPPORT | ||||
| OSC() = delete; | OSC() = delete; | ||||
| OSC(OSC&) = delete; | |||||
| OSC(const OSC&) = delete; | |||||
| CARLA_DECLARE_NON_COPY_STRUCT(OSC) | |||||
| #endif | #endif | ||||
| CARLA_LEAK_DETECTOR(OSC) | |||||
| } osc; | } osc; | ||||
| CarlaPluginProtectedData(CarlaEngine* const engine_, CarlaPlugin* const plugin) | |||||
| : engine(engine_), | |||||
| CarlaPluginProtectedData(CarlaEngine* const eng, CarlaPlugin* const plug) | |||||
| : engine(eng), | |||||
| client(nullptr), | client(nullptr), | ||||
| gui(nullptr), | |||||
| active(false), | active(false), | ||||
| needsReset(false), | needsReset(false), | ||||
| lib(nullptr), | lib(nullptr), | ||||
| @@ -630,7 +625,7 @@ struct CarlaPluginProtectedData { | |||||
| extraHints(0x0), | extraHints(0x0), | ||||
| latency(0), | latency(0), | ||||
| latencyBuffers(nullptr), | latencyBuffers(nullptr), | ||||
| osc(engine, plugin) {} | |||||
| osc(eng, plug) {} | |||||
| #ifdef CARLA_PROPER_CPP11_SUPPORT | #ifdef CARLA_PROPER_CPP11_SUPPORT | ||||
| CarlaPluginProtectedData() = delete; | CarlaPluginProtectedData() = delete; | ||||
| @@ -639,7 +634,6 @@ struct CarlaPluginProtectedData { | |||||
| ~CarlaPluginProtectedData() | ~CarlaPluginProtectedData() | ||||
| { | { | ||||
| CARLA_ASSERT(gui == nullptr); | |||||
| CARLA_ASSERT(client == nullptr); | CARLA_ASSERT(client == nullptr); | ||||
| CARLA_ASSERT(! active); | CARLA_ASSERT(! active); | ||||
| CARLA_ASSERT(lib == nullptr); | CARLA_ASSERT(lib == nullptr); | ||||
| @@ -655,6 +649,7 @@ struct CarlaPluginProtectedData { | |||||
| void cleanup() | void cleanup() | ||||
| { | { | ||||
| { | { | ||||
| // mutex MUST have been locked before | |||||
| const bool lockMaster(masterMutex.tryLock()); | const bool lockMaster(masterMutex.tryLock()); | ||||
| const bool lockSingle(singleMutex.tryLock()); | const bool lockSingle(singleMutex.tryLock()); | ||||
| CARLA_ASSERT(! lockMaster); | CARLA_ASSERT(! lockMaster); | ||||
| @@ -720,6 +715,8 @@ struct CarlaPluginProtectedData { | |||||
| { | { | ||||
| if (latencyBuffers != nullptr) | if (latencyBuffers != nullptr) | ||||
| { | { | ||||
| CARLA_ASSERT(audioIn.count > 0); | |||||
| for (uint32_t i=0; i < audioIn.count; ++i) | for (uint32_t i=0; i < audioIn.count; ++i) | ||||
| { | { | ||||
| CARLA_ASSERT(latencyBuffers[i] != nullptr); | CARLA_ASSERT(latencyBuffers[i] != nullptr); | ||||
| @@ -735,6 +732,10 @@ struct CarlaPluginProtectedData { | |||||
| latencyBuffers = nullptr; | latencyBuffers = nullptr; | ||||
| latency = 0; | latency = 0; | ||||
| } | } | ||||
| else | |||||
| { | |||||
| CARLA_ASSERT(latency == 0); | |||||
| } | |||||
| audioIn.clear(); | audioIn.clear(); | ||||
| audioOut.clear(); | audioOut.clear(); | ||||
| @@ -746,6 +747,8 @@ struct CarlaPluginProtectedData { | |||||
| { | { | ||||
| if (latencyBuffers != nullptr) | if (latencyBuffers != nullptr) | ||||
| { | { | ||||
| CARLA_ASSERT(audioIn.count > 0); | |||||
| for (uint32_t i=0; i < audioIn.count; ++i) | for (uint32_t i=0; i < audioIn.count; ++i) | ||||
| { | { | ||||
| CARLA_ASSERT(latencyBuffers[i] != nullptr); | CARLA_ASSERT(latencyBuffers[i] != nullptr); | ||||
| @@ -778,6 +781,8 @@ struct CarlaPluginProtectedData { | |||||
| void postponeRtEvent(const PluginPostRtEventType type, const int32_t value1, const int32_t value2, const float value3) | void postponeRtEvent(const PluginPostRtEventType type, const int32_t value1, const int32_t value2, const float value3) | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); | |||||
| PluginPostRtEvent event; | PluginPostRtEvent event; | ||||
| event.type = type; | event.type = type; | ||||
| event.value1 = value1; | event.value1 = value1; | ||||
| @@ -23,8 +23,6 @@ | |||||
| #include "juce_core.h" | #include "juce_core.h" | ||||
| using juce::Thread; | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| #if 0 | #if 0 | ||||
| @@ -33,7 +31,7 @@ CARLA_BACKEND_START_NAMESPACE | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| class CarlaPluginThread : public Thread | |||||
| class CarlaPluginThread : public juce::Thread | |||||
| { | { | ||||
| public: | public: | ||||
| enum Mode { | enum Mode { | ||||
| @@ -19,8 +19,7 @@ | |||||
| #ifdef WANT_DSSI | #ifdef WANT_DSSI | ||||
| #include "CarlaLadspaUtils.hpp" | |||||
| #include "dssi/dssi.h" | |||||
| #include "CarlaDssiUtils.hpp" | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| @@ -788,10 +787,10 @@ public: | |||||
| pData->extraHints = 0x0; | pData->extraHints = 0x0; | ||||
| if (mIns > 0) | if (mIns > 0) | ||||
| pData->extraHints |= PLUGIN_HINT_HAS_MIDI_IN; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_IN; | |||||
| if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0)) | if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0)) | ||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| // check latency | // check latency | ||||
| if (fHints & PLUGIN_CAN_DRYWET) | if (fHints & PLUGIN_CAN_DRYWET) | ||||
| @@ -1910,8 +1909,15 @@ public: | |||||
| if (guiFilename != nullptr) | if (guiFilename != nullptr) | ||||
| { | { | ||||
| fGuiFilename = guiFilename; | fGuiFilename = guiFilename; | ||||
| pData->osc.thread.setOscData(guiFilename, fDescriptor->Label); | |||||
| } | } | ||||
| else if (const char* const guiFilename2 = find_dssi_ui(filename, fDescriptor->Label)) | |||||
| { | |||||
| fGuiFilename = guiFilename2; | |||||
| delete[] guiFilename2; | |||||
| } | |||||
| if (fGuiFilename.isNotEmpty()) | |||||
| pData->osc.thread.setOscData((const char*)fGuiFilename, fDescriptor->Label); | |||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // load plugin settings | // load plugin settings | ||||
| @@ -880,8 +880,8 @@ public: | |||||
| // extra plugin hints | // extra plugin hints | ||||
| pData->extraHints = 0x0; | pData->extraHints = 0x0; | ||||
| pData->extraHints |= PLUGIN_HINT_HAS_MIDI_IN; | |||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_IN; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| bufferSizeChanged(pData->engine->getBufferSize()); | bufferSizeChanged(pData->engine->getBufferSize()); | ||||
| reloadPrograms(true); | reloadPrograms(true); | ||||
| @@ -760,7 +760,7 @@ public: | |||||
| pData->extraHints = 0x0; | pData->extraHints = 0x0; | ||||
| if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0)) | if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0)) | ||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| // check latency | // check latency | ||||
| if (fHints & PLUGIN_CAN_DRYWET) | if (fHints & PLUGIN_CAN_DRYWET) | ||||
| @@ -426,8 +426,8 @@ public: | |||||
| // extra plugin hints | // extra plugin hints | ||||
| pData->extraHints = 0x0; | pData->extraHints = 0x0; | ||||
| pData->extraHints |= PLUGIN_HINT_HAS_MIDI_IN; | |||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_IN; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| bufferSizeChanged(pData->engine->getBufferSize()); | bufferSizeChanged(pData->engine->getBufferSize()); | ||||
| reloadPrograms(true); | reloadPrograms(true); | ||||
| @@ -19,7 +19,6 @@ | |||||
| #ifdef WANT_LV2 | #ifdef WANT_LV2 | ||||
| #include "CarlaPluginGui.hpp" | |||||
| #include "CarlaLv2Utils.hpp" | #include "CarlaLv2Utils.hpp" | ||||
| #include "Lv2AtomQueue.hpp" | #include "Lv2AtomQueue.hpp" | ||||
| @@ -2149,17 +2148,17 @@ public: | |||||
| fHints |= PLUGIN_CAN_BALANCE; | fHints |= PLUGIN_CAN_BALANCE; | ||||
| // extra plugin hints | // extra plugin hints | ||||
| pData->extraHints &= ~PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints &= ~PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| if (fExt.state != nullptr || fExt.worker != nullptr) | if (fExt.state != nullptr || fExt.worker != nullptr) | ||||
| { | { | ||||
| if ((aIns == 0 || aIns == 2) && (aOuts == 0 || aOuts == 2) && evIns.count() <= 1 && evOuts.count() <= 1) | if ((aIns == 0 || aIns == 2) && (aOuts == 0 || aOuts == 2) && evIns.count() <= 1 && evOuts.count() <= 1) | ||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0) && evIns.count() <= 1 && evOuts.count() <= 1) | if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0) && evIns.count() <= 1 && evOuts.count() <= 1) | ||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| } | } | ||||
| bufferSizeChanged(pData->engine->getBufferSize()); | bufferSizeChanged(pData->engine->getBufferSize()); | ||||
| @@ -3912,7 +3911,6 @@ protected: | |||||
| int handleUiResize(const int width, const int height) | int handleUiResize(const int width, const int height) | ||||
| { | { | ||||
| CARLA_ASSERT(pData->gui != nullptr); | |||||
| CARLA_ASSERT(width > 0); | CARLA_ASSERT(width > 0); | ||||
| CARLA_ASSERT(height > 0); | CARLA_ASSERT(height > 0); | ||||
| @@ -1181,7 +1181,7 @@ public: | |||||
| pData->extraHints = 0x0; | pData->extraHints = 0x0; | ||||
| if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0) && mIns <= 1 && mOuts <= 1) | if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0) && mIns <= 1 && mOuts <= 1) | ||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| bufferSizeChanged(pData->engine->getBufferSize()); | bufferSizeChanged(pData->engine->getBufferSize()); | ||||
| reloadPrograms(true); | reloadPrograms(true); | ||||
| @@ -19,7 +19,6 @@ | |||||
| #ifdef WANT_VST | #ifdef WANT_VST | ||||
| #include "CarlaPluginGui.hpp" | |||||
| #include "CarlaVstUtils.hpp" | #include "CarlaVstUtils.hpp" | ||||
| //#ifdef Q_WS_X11 | //#ifdef Q_WS_X11 | ||||
| @@ -827,13 +826,13 @@ public: | |||||
| pData->extraHints = 0x0; | pData->extraHints = 0x0; | ||||
| if (mIns > 0) | if (mIns > 0) | ||||
| pData->extraHints |= PLUGIN_HINT_HAS_MIDI_IN; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_IN; | |||||
| if (mOuts > 0) | if (mOuts > 0) | ||||
| pData->extraHints |= PLUGIN_HINT_HAS_MIDI_OUT; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_HAS_MIDI_OUT; | |||||
| if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0)) | if (aIns <= 2 && aOuts <= 2 && (aIns == aOuts || aIns == 0 || aOuts == 0)) | ||||
| pData->extraHints |= PLUGIN_HINT_CAN_RUN_RACK; | |||||
| pData->extraHints |= PLUGIN_EXTRA_HINT_CAN_RUN_RACK; | |||||
| // dummy pre-start to get latency and wantEvents() on old plugins | // dummy pre-start to get latency and wantEvents() on old plugins | ||||
| { | { | ||||
| @@ -1970,7 +1969,7 @@ protected: | |||||
| break; | break; | ||||
| case audioMasterSizeWindow: | case audioMasterSizeWindow: | ||||
| if (pData->gui != nullptr) | |||||
| //if (pData->gui != nullptr) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT(fGui.isVisible); | CARLA_SAFE_ASSERT(fGui.isVisible); | ||||
| //if (fGui.isVisible) | //if (fGui.isVisible) | ||||
| @@ -375,6 +375,9 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||||
| if (gStandalone.engine->init(clientName)) | if (gStandalone.engine->init(clientName)) | ||||
| { | { | ||||
| if (gStandalone.callback != nullptr) | |||||
| gStandalone.engine->setCallback(gStandalone.callback, gStandalone.callbackPtr); | |||||
| gStandalone.lastError = "no error"; | gStandalone.lastError = "no error"; | ||||
| gStandalone.init(); | gStandalone.init(); | ||||
| return true; | return true; | ||||
| @@ -1034,7 +1037,7 @@ const CarlaPortCountInfo* carla_get_parameter_count_info(unsigned int pluginId) | |||||
| if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | ||||
| { | { | ||||
| plugin->getParameterCountInfo(&info.ins, &info.outs, &info.total); | |||||
| plugin->getParameterCountInfo(info.ins, info.outs, info.total); | |||||
| return &info; | return &info; | ||||
| } | } | ||||
| @@ -123,7 +123,7 @@ void CarlaBridgeClient::oscInit(const char* const url) | |||||
| fOsc.init(url); | fOsc.init(url); | ||||
| } | } | ||||
| bool CarlaBridgeClient::oscIdle() | |||||
| bool CarlaBridgeClient::oscIdle() const | |||||
| { | { | ||||
| fOsc.idle(); | fOsc.idle(); | ||||
| @@ -141,12 +141,12 @@ void CarlaBridgeClient::oscClose() | |||||
| fOsc.close(); | fOsc.close(); | ||||
| } | } | ||||
| bool CarlaBridgeClient::isOscControlRegistered() const | |||||
| bool CarlaBridgeClient::isOscControlRegistered() const noexcept | |||||
| { | { | ||||
| return fOsc.isControlRegistered(); | return fOsc.isControlRegistered(); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscUpdate() | |||||
| void CarlaBridgeClient::sendOscUpdate() const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscUpdate()"); | carla_debug("CarlaBridgeClient::sendOscUpdate()"); | ||||
| @@ -155,7 +155,7 @@ void CarlaBridgeClient::sendOscUpdate() | |||||
| } | } | ||||
| #ifdef BUILD_BRIDGE_PLUGIN | #ifdef BUILD_BRIDGE_PLUGIN | ||||
| void CarlaBridgeClient::sendOscBridgeUpdate() | |||||
| void CarlaBridgeClient::sendOscBridgeUpdate() const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscBridgeUpdate()"); | carla_debug("CarlaBridgeClient::sendOscBridgeUpdate()"); | ||||
| @@ -163,7 +163,7 @@ void CarlaBridgeClient::sendOscBridgeUpdate() | |||||
| osc_send_bridge_update(fOscData, fOscData.path); | osc_send_bridge_update(fOscData, fOscData.path); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscBridgeError(const char* const error) | |||||
| void CarlaBridgeClient::sendOscBridgeError(const char* const error) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscBridgeError(\"%s\")", error); | carla_debug("CarlaBridgeClient::sendOscBridgeError(\"%s\")", error); | ||||
| @@ -174,7 +174,7 @@ void CarlaBridgeClient::sendOscBridgeError(const char* const error) | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* const value) | |||||
| void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* const value) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | carla_debug("CarlaBridgeClient::sendOscConfigure(\"%s\", \"%s\")", key, value); | ||||
| @@ -182,7 +182,7 @@ void CarlaBridgeClient::sendOscConfigure(const char* const key, const char* cons | |||||
| osc_send_configure(fOscData, key, value); | osc_send_configure(fOscData, key, value); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) | |||||
| void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscControl(%i, %f)", index, value); | carla_debug("CarlaBridgeClient::sendOscControl(%i, %f)", index, value); | ||||
| @@ -190,7 +190,7 @@ void CarlaBridgeClient::sendOscControl(const int32_t index, const float value) | |||||
| osc_send_control(fOscData, index, value); | osc_send_control(fOscData, index, value); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscProgram(const int32_t index) | |||||
| void CarlaBridgeClient::sendOscProgram(const int32_t index) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscProgram(%i)", index); | carla_debug("CarlaBridgeClient::sendOscProgram(%i)", index); | ||||
| @@ -198,7 +198,7 @@ void CarlaBridgeClient::sendOscProgram(const int32_t index) | |||||
| osc_send_program(fOscData, index); | osc_send_program(fOscData, index); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) | |||||
| void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); | carla_debug("CarlaBridgeClient::sendOscMidiProgram(%i)", index); | ||||
| @@ -206,7 +206,7 @@ void CarlaBridgeClient::sendOscMidiProgram(const int32_t index) | |||||
| osc_send_midi_program(fOscData, index); | osc_send_midi_program(fOscData, index); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) | |||||
| void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscMidi(%p)", midiBuf); | carla_debug("CarlaBridgeClient::sendOscMidi(%p)", midiBuf); | ||||
| @@ -214,7 +214,7 @@ void CarlaBridgeClient::sendOscMidi(const uint8_t midiBuf[4]) | |||||
| osc_send_midi(fOscData, midiBuf); | osc_send_midi(fOscData, midiBuf); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscExiting() | |||||
| void CarlaBridgeClient::sendOscExiting() const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscExiting()"); | carla_debug("CarlaBridgeClient::sendOscExiting()"); | ||||
| @@ -223,7 +223,7 @@ void CarlaBridgeClient::sendOscExiting() | |||||
| } | } | ||||
| #ifdef BRIDGE_LV2 | #ifdef BRIDGE_LV2 | ||||
| void CarlaBridgeClient::sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf) | |||||
| void CarlaBridgeClient::sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\")", portIndex, atomBuf); | carla_debug("CarlaBridgeClient::sendOscLv2TransferAtom(%i, \"%s\")", portIndex, atomBuf); | ||||
| @@ -231,7 +231,7 @@ void CarlaBridgeClient::sendOscLv2AtomTransfer(const int32_t portIndex, const ch | |||||
| osc_send_lv2_atom_transfer(fOscData, portIndex, atomBuf); | osc_send_lv2_atom_transfer(fOscData, portIndex, atomBuf); | ||||
| } | } | ||||
| void CarlaBridgeClient::sendOscLv2UridMap(const uint32_t urid, const char* const uri) | |||||
| void CarlaBridgeClient::sendOscLv2UridMap(const uint32_t urid, const char* const uri) const | |||||
| { | { | ||||
| carla_debug("CarlaBridgeClient::sendOscLv2UridMap(%i, \"%s\")", urid, uri); | carla_debug("CarlaBridgeClient::sendOscLv2UridMap(%i, \"%s\")", urid, uri); | ||||
| @@ -70,43 +70,34 @@ public: | |||||
| void toolkitQuit(); | void toolkitQuit(); | ||||
| #endif | #endif | ||||
| #ifdef BUILD_BRIDGE_PLUGIN | |||||
| // --------------------------------------------------------------------- | |||||
| // plugin management | |||||
| virtual void saveNow() = 0; | |||||
| virtual void setCustomData(const char* const type, const char* const key, const char* const value) = 0; | |||||
| virtual void setChunkData(const char* const filePath) = 0; | |||||
| #endif | |||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| // osc stuff | // osc stuff | ||||
| void oscInit(const char* const url); | void oscInit(const char* const url); | ||||
| bool oscIdle(); | |||||
| bool oscIdle() const; | |||||
| void oscClose(); | void oscClose(); | ||||
| bool isOscControlRegistered() const; | |||||
| void sendOscUpdate(); | |||||
| bool isOscControlRegistered() const noexcept; | |||||
| void sendOscUpdate() const; | |||||
| #ifdef BUILD_BRIDGE_PLUGIN | #ifdef BUILD_BRIDGE_PLUGIN | ||||
| void sendOscBridgeUpdate(); | |||||
| void sendOscBridgeError(const char* const error); | |||||
| void sendOscBridgeUpdate() const; | |||||
| void sendOscBridgeError(const char* const error) const; | |||||
| #endif | #endif | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| protected: | protected: | ||||
| void sendOscConfigure(const char* const key, const char* const value); | |||||
| void sendOscControl(const int32_t index, const float value); | |||||
| void sendOscProgram(const int32_t index); | |||||
| void sendOscMidiProgram(const int32_t index); | |||||
| void sendOscMidi(const uint8_t midiBuf[4]); | |||||
| void sendOscExiting(); | |||||
| void sendOscConfigure(const char* const key, const char* const value) const; | |||||
| void sendOscControl(const int32_t index, const float value) const; | |||||
| void sendOscProgram(const int32_t index) const; | |||||
| void sendOscMidiProgram(const int32_t index) const; | |||||
| void sendOscMidi(const uint8_t midiBuf[4]) const; | |||||
| void sendOscExiting() const; | |||||
| #ifdef BRIDGE_LV2 | #ifdef BRIDGE_LV2 | ||||
| void sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf); | |||||
| void sendOscLv2UridMap(const uint32_t urid, const char* const uri); | |||||
| void sendOscLv2AtomTransfer(const int32_t portIndex, const char* const atomBuf) const; | |||||
| void sendOscLv2UridMap(const uint32_t urid, const char* const uri) const; | |||||
| #endif | #endif | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| @@ -84,7 +84,7 @@ void CarlaBridgeOsc::init(const char* const url) | |||||
| CARLA_ASSERT(fServerPath.isNotEmpty()); | CARLA_ASSERT(fServerPath.isNotEmpty()); | ||||
| } | } | ||||
| void CarlaBridgeOsc::idle() | |||||
| void CarlaBridgeOsc::idle() const | |||||
| { | { | ||||
| if (fServer == nullptr) | if (fServer == nullptr) | ||||
| return; | return; | ||||
| @@ -125,6 +125,7 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||||
| CARLA_SAFE_ASSERT_RETURN(fServerPath.isNotEmpty(), 1); | CARLA_SAFE_ASSERT_RETURN(fServerPath.isNotEmpty(), 1); | ||||
| CARLA_SAFE_ASSERT_RETURN(fServer != nullptr, 1); | CARLA_SAFE_ASSERT_RETURN(fServer != nullptr, 1); | ||||
| CARLA_SAFE_ASSERT_RETURN(path != nullptr, 1); | CARLA_SAFE_ASSERT_RETURN(path != nullptr, 1); | ||||
| CARLA_SAFE_ASSERT_RETURN(msg != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | carla_debug("CarlaBridgeOsc::handleMessage(\"%s\", %i, %p, \"%s\", %p)", path, argc, argv, types, msg); | ||||
| const size_t nameSize(fName.length()); | const size_t nameSize(fName.length()); | ||||
| @@ -146,22 +147,7 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| #ifdef BUILD_BRIDGE_UI | |||||
| // Common UI methods | |||||
| if (std::strcmp(method, "configure") == 0) | |||||
| return handleMsgConfigure(argc, argv, types); | |||||
| if (std::strcmp(method, "control") == 0) | |||||
| return handleMsgControl(argc, argv, types); | |||||
| if (std::strcmp(method, "program") == 0) | |||||
| return handleMsgProgram(argc, argv, types); | |||||
| if (std::strcmp(method, "midi-program") == 0) | |||||
| return handleMsgMidiProgram(argc, argv, types); | |||||
| if (std::strcmp(method, "midi") == 0) | |||||
| return handleMsgMidi(argc, argv, types); | |||||
| if (std::strcmp(method, "sample-rate") == 0) | |||||
| return 0; // unused | |||||
| #endif | |||||
| // Common methods | |||||
| if (std::strcmp(method, "show") == 0) | if (std::strcmp(method, "show") == 0) | ||||
| return handleMsgShow(); | return handleMsgShow(); | ||||
| if (std::strcmp(method, "hide") == 0) | if (std::strcmp(method, "hide") == 0) | ||||
| @@ -177,6 +163,22 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||||
| return handleMsgLv2UridMap(argc, argv, types); | return handleMsgLv2UridMap(argc, argv, types); | ||||
| #endif | #endif | ||||
| #ifdef BUILD_BRIDGE_UI | |||||
| // UI methods | |||||
| if (std::strcmp(method, "configure") == 0) | |||||
| return handleMsgConfigure(argc, argv, types); | |||||
| if (std::strcmp(method, "control") == 0) | |||||
| return handleMsgControl(argc, argv, types); | |||||
| if (std::strcmp(method, "program") == 0) | |||||
| return handleMsgProgram(argc, argv, types); | |||||
| if (std::strcmp(method, "midi-program") == 0) | |||||
| return handleMsgMidiProgram(argc, argv, types); | |||||
| if (std::strcmp(method, "midi") == 0) | |||||
| return handleMsgMidi(argc, argv, types); | |||||
| if (std::strcmp(method, "sample-rate") == 0) | |||||
| return 0; // unused | |||||
| #endif | |||||
| #ifdef BUILD_BRIDGE_PLUGIN | #ifdef BUILD_BRIDGE_PLUGIN | ||||
| // Plugin methods | // Plugin methods | ||||
| if (std::strcmp(method, "plugin_save_now") == 0) | if (std::strcmp(method, "plugin_save_now") == 0) | ||||
| @@ -196,6 +198,36 @@ int CarlaBridgeOsc::handleMessage(const char* const path, const int argc, const | |||||
| } | } | ||||
| #ifdef BUILD_BRIDGE_UI | #ifdef BUILD_BRIDGE_UI | ||||
| int CarlaBridgeOsc::handleMsgShow() | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgShow()"); | |||||
| fClient->toolkitShow(); | |||||
| return 0; | |||||
| } | |||||
| int CarlaBridgeOsc::handleMsgHide() | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgHide()"); | |||||
| fClient->toolkitHide(); | |||||
| return 0; | |||||
| } | |||||
| int CarlaBridgeOsc::handleMsgQuit() | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgQuit()"); | |||||
| fClient->toolkitQuit(); | |||||
| return 0; | |||||
| } | |||||
| int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaBridgeOsc::handleMsgConfigure(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
| { | { | ||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ss"); | ||||
| @@ -292,36 +324,6 @@ int CarlaBridgeOsc::handleMsgMidi(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaBridgeOsc::handleMsgShow() | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgShow()"); | |||||
| fClient->toolkitShow(); | |||||
| return 0; | |||||
| } | |||||
| int CarlaBridgeOsc::handleMsgHide() | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgHide()"); | |||||
| fClient->toolkitHide(); | |||||
| return 0; | |||||
| } | |||||
| int CarlaBridgeOsc::handleMsgQuit() | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgQuit()"); | |||||
| fClient->toolkitQuit(); | |||||
| return 0; | |||||
| } | |||||
| #endif // BUILD_BRIDGE_UI | #endif // BUILD_BRIDGE_UI | ||||
| CARLA_BRIDGE_END_NAMESPACE | CARLA_BRIDGE_END_NAMESPACE | ||||
| @@ -60,22 +60,22 @@ public: | |||||
| ~CarlaBridgeOsc(); | ~CarlaBridgeOsc(); | ||||
| void init(const char* const url); | void init(const char* const url); | ||||
| void idle(); | |||||
| void idle() const; | |||||
| void close(); | void close(); | ||||
| // ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
| bool isControlRegistered() const | |||||
| bool isControlRegistered() const noexcept | |||||
| { | { | ||||
| return (fControlData.target != nullptr); | return (fControlData.target != nullptr); | ||||
| } | } | ||||
| const CarlaOscData& getControlData() const | |||||
| const CarlaOscData& getControlData() const noexcept | |||||
| { | { | ||||
| return fControlData; | return fControlData; | ||||
| } | } | ||||
| const char* getServerPath() const | |||||
| const char* getServerPath() const noexcept | |||||
| { | { | ||||
| return (const char*)fServerPath; | return (const char*)fServerPath; | ||||
| } | } | ||||
| @@ -16,36 +16,26 @@ | |||||
| */ | */ | ||||
| #include "CarlaBridgeClient.hpp" | #include "CarlaBridgeClient.hpp" | ||||
| #include "CarlaBridgeToolkit.hpp" | |||||
| #include "CarlaBackendUtils.hpp" | |||||
| #include "CarlaBridgeUtils.hpp" | |||||
| #include "CarlaHost.hpp" | |||||
| #include "CarlaEngine.hpp" | #include "CarlaEngine.hpp" | ||||
| #include "CarlaPlugin.hpp" | #include "CarlaPlugin.hpp" | ||||
| #include "CarlaHost.hpp" | |||||
| //#include <QtCore/QDir> | |||||
| //#include <QtCore/QFile> | |||||
| //#include <QtCore/QTextStream> | |||||
| #include "CarlaBackendUtils.hpp" | |||||
| #include "CarlaBridgeUtils.hpp" | |||||
| //#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |||||
| //# include <QtWidgets/QApplication> | |||||
| //#else | |||||
| //# include <QtGui/QApplication> | |||||
| //#endif | |||||
| #include "juce_core.h" | |||||
| #ifdef CARLA_OS_UNIX | #ifdef CARLA_OS_UNIX | ||||
| # include <signal.h> | # include <signal.h> | ||||
| #endif | #endif | ||||
| #include "juce_core.h" | |||||
| using juce::File; | using juce::File; | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| static bool gCloseNow = false; | |||||
| static bool gSaveNow = false; | |||||
| static volatile bool gCloseNow = false; | |||||
| static volatile bool gSaveNow = false; | |||||
| #ifdef CARLA_OS_WIN | #ifdef CARLA_OS_WIN | ||||
| BOOL WINAPI closeSignalHandler(DWORD dwCtrlType) | BOOL WINAPI closeSignalHandler(DWORD dwCtrlType) | ||||
| @@ -59,11 +49,11 @@ BOOL WINAPI closeSignalHandler(DWORD dwCtrlType) | |||||
| return FALSE; | return FALSE; | ||||
| } | } | ||||
| #else | #else | ||||
| void closeSignalHandler(int) | |||||
| static void closeSignalHandler(int) | |||||
| { | { | ||||
| gCloseNow = true; | gCloseNow = true; | ||||
| } | } | ||||
| void saveSignalHandler(int) | |||||
| static void saveSignalHandler(int) | |||||
| { | { | ||||
| gSaveNow = true; | gSaveNow = true; | ||||
| } | } | ||||
| @@ -99,9 +89,6 @@ void initSignalHandler() | |||||
| } | } | ||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| // Helpers | |||||
| extern CarlaBackend::CarlaEngine* carla_get_standalone_engine(); | |||||
| CARLA_BRIDGE_START_NAMESPACE | CARLA_BRIDGE_START_NAMESPACE | ||||
| @@ -111,41 +98,38 @@ CARLA_BRIDGE_START_NAMESPACE | |||||
| // ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
| class CarlaPluginClient : public CarlaBridgeClient/*, | |||||
| public QObject*/ | |||||
| class CarlaPluginClient : public CarlaBridgeClient | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaPluginClient(const bool useBridge, const char* const driverName, const char* audioBaseName, const char* controlBaseName) | CarlaPluginClient(const bool useBridge, const char* const driverName, const char* audioBaseName, const char* controlBaseName) | ||||
| : CarlaBridgeClient(nullptr), | : CarlaBridgeClient(nullptr), | ||||
| // QObject(nullptr), | |||||
| fEngine(nullptr), | fEngine(nullptr), | ||||
| fPlugin(nullptr), | |||||
| fTimerId(0) | |||||
| fPlugin(nullptr) | |||||
| { | { | ||||
| CARLA_ASSERT(driverName != nullptr); | CARLA_ASSERT(driverName != nullptr); | ||||
| carla_debug("CarlaPluginClient::CarlaPluginClient(%s, \"%s\", %s, %s)", bool2str(useBridge), driverName, audioBaseName, controlBaseName); | carla_debug("CarlaPluginClient::CarlaPluginClient(%s, \"%s\", %s, %s)", bool2str(useBridge), driverName, audioBaseName, controlBaseName); | ||||
| if (useBridge) | |||||
| carla_engine_init_bridge(audioBaseName, controlBaseName, driverName); | |||||
| else | |||||
| carla_engine_init("JACK", driverName); | |||||
| carla_set_engine_callback(callback, this); | carla_set_engine_callback(callback, this); | ||||
| File curDir(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory()); | File curDir(File::getSpecialLocation(File::currentApplicationFile).getParentDirectory()); | ||||
| if (curDir.getChildFile("resources").exists()) | if (curDir.getChildFile("resources").exists()) | ||||
| carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("resources").getFullPathName().toRawUTF8()); | carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("resources").getFullPathName().toRawUTF8()); | ||||
| else if (curDir.getChildFile("../../modules/carla_native/resources").exists()) | |||||
| carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../../modules/carla_native/resources").getFullPathName().toRawUTF8()); | |||||
| else | else | ||||
| carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../modules/carla_native/resources").getFullPathName().toRawUTF8()); | carla_set_engine_option(CarlaBackend::OPTION_PATH_RESOURCES, 0, curDir.getChildFile("../modules/carla_native/resources").getFullPathName().toRawUTF8()); | ||||
| if (useBridge) | |||||
| carla_engine_init_bridge(audioBaseName, controlBaseName, driverName); | |||||
| else | |||||
| carla_engine_init("JACK", driverName); | |||||
| } | } | ||||
| ~CarlaPluginClient() | |||||
| ~CarlaPluginClient() override | |||||
| { | { | ||||
| CARLA_ASSERT(fTimerId == 0); | |||||
| carla_debug("CarlaPluginClient::~CarlaPluginClient()"); | carla_debug("CarlaPluginClient::~CarlaPluginClient()"); | ||||
| carla_set_engine_about_to_close(); | |||||
| carla_engine_close(); | carla_engine_close(); | ||||
| } | } | ||||
| @@ -159,8 +143,6 @@ public: | |||||
| void ready(const bool doSaveLoad) | void ready(const bool doSaveLoad) | ||||
| { | { | ||||
| CARLA_ASSERT(fTimerId == 0); | |||||
| fEngine = carla_get_standalone_engine(); | fEngine = carla_get_standalone_engine(); | ||||
| fPlugin = fEngine->getPlugin(0); | fPlugin = fEngine->getPlugin(0); | ||||
| @@ -169,44 +151,37 @@ public: | |||||
| fProjFileName = fPlugin->getName(); | fProjFileName = fPlugin->getName(); | ||||
| fProjFileName += ".carxs"; | fProjFileName += ".carxs"; | ||||
| fPlugin->loadStateFromFile(fProjFileName); | |||||
| } | |||||
| if (! File::isAbsolutePath((const char*)fProjFileName)) | |||||
| fProjFileName = File::getCurrentWorkingDirectory().getChildFile((const char*)fProjFileName).getFullPathName().toRawUTF8(); | |||||
| //fTimerId = startTimer(50); | |||||
| if (! fPlugin->loadStateFromFile(fProjFileName)) | |||||
| carla_stderr("Plugin preset load failed, error was:\n%s", fEngine->getLastError()); | |||||
| } | |||||
| } | } | ||||
| void idle() | void idle() | ||||
| { | { | ||||
| if (fEngine != nullptr) | |||||
| fEngine->idle(); | |||||
| CARLA_SAFE_ASSERT_RETURN(fEngine != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| fEngine->idle(); | |||||
| CarlaBridgeClient::oscIdle(); | CarlaBridgeClient::oscIdle(); | ||||
| if (gSaveNow) | if (gSaveNow) | ||||
| { | { | ||||
| gSaveNow = false; | gSaveNow = false; | ||||
| CARLA_ASSERT(fPlugin != nullptr); | |||||
| if (fPlugin != nullptr && fProjFileName.isNotEmpty()) | |||||
| fPlugin->saveStateToFile(fProjFileName); | |||||
| if (fProjFileName.isNotEmpty()) | |||||
| { | |||||
| if (! fPlugin->saveStateToFile(fProjFileName)) | |||||
| carla_stderr("Plugin preset save failed, error was:\n%s", fEngine->getLastError()); | |||||
| } | |||||
| } | } | ||||
| if (gCloseNow) | if (gCloseNow) | ||||
| { | { | ||||
| gCloseNow = false; | |||||
| if (fTimerId != 0) | |||||
| { | |||||
| //killTimer(fTimerId); | |||||
| fTimerId = 0; | |||||
| } | |||||
| // if (QApplication* const app = qApp) | |||||
| // { | |||||
| // if (! app->closingDown()) | |||||
| // app->quit(); | |||||
| // } | |||||
| //gCloseNow = false; | |||||
| // close something? | |||||
| } | } | ||||
| } | } | ||||
| @@ -215,7 +190,7 @@ public: | |||||
| while (! gCloseNow) | while (! gCloseNow) | ||||
| { | { | ||||
| idle(); | idle(); | ||||
| carla_msleep(50); | |||||
| carla_msleep(30); | |||||
| } | } | ||||
| } | } | ||||
| @@ -224,12 +199,9 @@ public: | |||||
| void saveNow() | void saveNow() | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fEngine != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| carla_debug("CarlaPluginClient::saveNow()"); | carla_debug("CarlaPluginClient::saveNow()"); | ||||
| CARLA_ASSERT(fEngine != nullptr); | |||||
| CARLA_ASSERT(fPlugin != nullptr); | |||||
| if (fPlugin == nullptr || fEngine == nullptr) | |||||
| return; | |||||
| fPlugin->prepareForSave(); | fPlugin->prepareForSave(); | ||||
| @@ -272,22 +244,34 @@ public: | |||||
| fEngine->oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); | fEngine->oscSend_bridge_configure(CARLA_BRIDGE_MSG_SAVED, ""); | ||||
| } | } | ||||
| void setParameterMidiChannel(const int32_t index, const int32_t channel) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| carla_debug("CarlaPluginClient::setParameterMidiChannel(%i, %i)", index, channel); | |||||
| fPlugin->setParameterMidiChannel(index, channel, false, false); | |||||
| } | |||||
| void setParameterMidiCC(const int32_t index, const int32_t cc) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| carla_debug("CarlaPluginClient::setParameterMidiCC(%i, %i)", index, cc); | |||||
| fPlugin->setParameterMidiCC(index, cc, false, false); | |||||
| } | |||||
| void setCustomData(const char* const type, const char* const key, const char* const value) | void setCustomData(const char* const type, const char* const key, const char* const value) | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| carla_debug("CarlaPluginClient::setCustomData(\"%s\", \"%s\", \"%s\")", type, key, value); | carla_debug("CarlaPluginClient::setCustomData(\"%s\", \"%s\", \"%s\")", type, key, value); | ||||
| CARLA_ASSERT(fPlugin != nullptr); | |||||
| if (fPlugin != nullptr) | |||||
| fPlugin->setCustomData(type, key, value, true); | |||||
| fPlugin->setCustomData(type, key, value, true); | |||||
| } | } | ||||
| void setChunkData(const char* const filePath) | void setChunkData(const char* const filePath) | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fPlugin != nullptr,); | |||||
| carla_debug("CarlaPluginClient::setChunkData(\"%s\")", filePath); | carla_debug("CarlaPluginClient::setChunkData(\"%s\")", filePath); | ||||
| CARLA_ASSERT(fPlugin != nullptr); | |||||
| if (fPlugin == nullptr) | |||||
| return; | |||||
| #if 0 | #if 0 | ||||
| QString chunkFilePath(filePath); | QString chunkFilePath(filePath); | ||||
| @@ -315,16 +299,6 @@ public: | |||||
| } | } | ||||
| // --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
| // processing | |||||
| void setParameter(const int32_t rindex, const float value) | |||||
| { | |||||
| carla_debug("CarlaPluginClient::setParameter(%i, %f)", rindex, value); | |||||
| CARLA_ASSERT(fPlugin != nullptr); | |||||
| if (fPlugin != nullptr) | |||||
| fPlugin->setParameterValueByRealIndex(rindex, value, true, true, false); | |||||
| } | |||||
| protected: | protected: | ||||
| void handleCallback(const CarlaBackend::CallbackType action, const int value1, const int value2, const float value3, const char* const valueStr) | void handleCallback(const CarlaBackend::CallbackType action, const int value1, const int value2, const float value3, const char* const valueStr) | ||||
| @@ -367,22 +341,14 @@ private: | |||||
| CarlaBackend::CarlaPlugin* fPlugin; | CarlaBackend::CarlaPlugin* fPlugin; | ||||
| CarlaString fProjFileName; | CarlaString fProjFileName; | ||||
| int fTimerId; | |||||
| // void timerEvent(QTimerEvent* const event) | |||||
| // { | |||||
| // if (event->timerId() == fTimerId) | |||||
| // idle(); | |||||
| // QObject::timerEvent(event); | |||||
| // } | |||||
| static void callback(void* ptr, CarlaBackend::CallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) | static void callback(void* ptr, CarlaBackend::CallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) | ||||
| { | { | ||||
| return ((CarlaPluginClient*)ptr)->handleCallback(action, value1, value2, value3, valueStr); | |||||
| carla_debug("CarlaPluginClient::callback(%p, %i:%s, %i, %i, %i, %f, \"%s\")", ptr, action, CarlaBackend::CallbackType2Str(action), pluginId, value1, value2, value3, valueStr); | |||||
| CARLA_SAFE_ASSERT_RETURN(ptr != nullptr,); | |||||
| CARLA_SAFE_ASSERT_RETURN(pluginId == 0,); | |||||
| // unused | |||||
| (void)pluginId; | |||||
| return ((CarlaPluginClient*)ptr)->handleCallback(action, value1, value2, value3, valueStr); | |||||
| } | } | ||||
| }; | }; | ||||
| @@ -416,7 +382,7 @@ int CarlaBridgeOsc::handleMsgQuit() | |||||
| int CarlaBridgeOsc::handleMsgPluginSaveNow() | int CarlaBridgeOsc::handleMsgPluginSaveNow() | ||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(fClient == nullptr, 1); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); | carla_debug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); | ||||
| CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | ||||
| @@ -427,22 +393,30 @@ int CarlaBridgeOsc::handleMsgPluginSaveNow() | |||||
| int CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
| { | { | ||||
| //CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "s"); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient == nullptr, 1); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel()"); | carla_debug("CarlaBridgeOsc::handleMsgPluginSetParameterMidiChannel()"); | ||||
| // TODO | |||||
| const int32_t index = argv[0]->i; | |||||
| const int32_t channel = argv[1]->i; | |||||
| CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | |||||
| plugClient->setParameterMidiChannel(index, channel); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| int CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
| { | { | ||||
| //CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "s"); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient == nullptr, 1); | |||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(2, "ii"); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC()"); | carla_debug("CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC()"); | ||||
| // TODO | |||||
| const int32_t index = argv[0]->i; | |||||
| const int32_t cc = argv[1]->i; | |||||
| CarlaPluginClient* const plugClient((CarlaPluginClient*)fClient); | |||||
| plugClient->setParameterMidiCC(index, cc); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -450,8 +424,8 @@ int CarlaBridgeOsc::handleMsgPluginSetParameterMidiCC(CARLA_BRIDGE_OSC_HANDLE_AR | |||||
| int CarlaBridgeOsc::handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaBridgeOsc::handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
| { | { | ||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "s"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(1, "s"); | ||||
| CARLA_SAFE_ASSERT_RETURN(fClient == nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgPluginSetChunk()"); | |||||
| const char* const chunkFile = (const char*)&argv[0]->s; | const char* const chunkFile = (const char*)&argv[0]->s; | ||||
| @@ -464,8 +438,8 @@ int CarlaBridgeOsc::handleMsgPluginSetChunk(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| int CarlaBridgeOsc::handleMsgPluginSetCustomData(CARLA_BRIDGE_OSC_HANDLE_ARGS) | int CarlaBridgeOsc::handleMsgPluginSetCustomData(CARLA_BRIDGE_OSC_HANDLE_ARGS) | ||||
| { | { | ||||
| CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(3, "sss"); | CARLA_BRIDGE_OSC_CHECK_OSC_TYPES(3, "sss"); | ||||
| CARLA_SAFE_ASSERT_RETURN(fClient == nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgPluginSaveNow()"); | |||||
| CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 1); | |||||
| carla_debug("CarlaBridgeOsc::handleMsgPluginSetCustomData()"); | |||||
| const char* const type = (const char*)&argv[0]->s; | const char* const type = (const char*)&argv[0]->s; | ||||
| const char* const key = (const char*)&argv[1]->s; | const char* const key = (const char*)&argv[1]->s; | ||||
| @@ -481,9 +455,14 @@ int CarlaBridgeOsc::handleMsgPluginSetCustomData(CARLA_BRIDGE_OSC_HANDLE_ARGS) | |||||
| CARLA_BRIDGE_END_NAMESPACE | CARLA_BRIDGE_END_NAMESPACE | ||||
| // ------------------------------------------------------------------------- | |||||
| int main(int argc, char* argv[]) | int main(int argc, char* argv[]) | ||||
| { | { | ||||
| CARLA_BRIDGE_USE_NAMESPACE | |||||
| CARLA_BRIDGE_USE_NAMESPACE; | |||||
| // --------------------------------------------------------------------- | |||||
| // Check argument count | |||||
| if (argc != 6 && argc != 7) | if (argc != 6 && argc != 7) | ||||
| { | { | ||||
| @@ -491,12 +470,18 @@ int main(int argc, char* argv[]) | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| // --------------------------------------------------------------------- | |||||
| // Get args | |||||
| const char* const oscUrl = argv[1]; | const char* const oscUrl = argv[1]; | ||||
| const char* const stype = argv[2]; | const char* const stype = argv[2]; | ||||
| const char* const filename = argv[3]; | const char* const filename = argv[3]; | ||||
| const char* name = argv[4]; | const char* name = argv[4]; | ||||
| const char* label = argv[5]; | const char* label = argv[5]; | ||||
| // --------------------------------------------------------------------- | |||||
| // Setup args | |||||
| const bool useBridge = (argc == 7); | const bool useBridge = (argc == 7); | ||||
| const bool useOsc = std::strcmp(oscUrl, "null"); | const bool useOsc = std::strcmp(oscUrl, "null"); | ||||
| @@ -506,15 +491,25 @@ int main(int argc, char* argv[]) | |||||
| if (std::strlen(label) == 0) | if (std::strlen(label) == 0) | ||||
| label = nullptr; | label = nullptr; | ||||
| char bridgeBaseAudioName[6+1] = { 0 }; | |||||
| char bridgeBaseControlName[6+1] = { 0 }; | |||||
| char bridgeBaseAudioName[6+1]; | |||||
| char bridgeBaseControlName[6+1]; | |||||
| if (useBridge) | if (useBridge) | ||||
| { | { | ||||
| std::strncpy(bridgeBaseAudioName, argv[6], 6); | |||||
| std::strncpy(bridgeBaseAudioName, argv[6], 6); | |||||
| std::strncpy(bridgeBaseControlName, argv[6]+6, 6); | std::strncpy(bridgeBaseControlName, argv[6]+6, 6); | ||||
| bridgeBaseAudioName[6] = '\0'; | |||||
| bridgeBaseControlName[6] = '\0'; | |||||
| } | |||||
| else | |||||
| { | |||||
| bridgeBaseAudioName[0] = '\0'; | |||||
| bridgeBaseControlName[0] = '\0'; | |||||
| } | } | ||||
| // --------------------------------------------------------------------- | |||||
| // Check plugin type | |||||
| CarlaBackend::PluginType itype(CarlaBackend::getPluginTypeFromString(stype)); | CarlaBackend::PluginType itype(CarlaBackend::getPluginTypeFromString(stype)); | ||||
| if (itype == CarlaBackend::PLUGIN_NONE) | if (itype == CarlaBackend::PLUGIN_NONE) | ||||
| @@ -523,34 +518,53 @@ int main(int argc, char* argv[]) | |||||
| return 1; | return 1; | ||||
| } | } | ||||
| //QApplication app(argc, argv, true); | |||||
| //app.setQuitOnLastWindowClosed(false); | |||||
| // --------------------------------------------------------------------- | |||||
| // Set client name | |||||
| CarlaString clientName((name != nullptr) ? name : label); | CarlaString clientName((name != nullptr) ? name : label); | ||||
| if (clientName.isEmpty()) | if (clientName.isEmpty()) | ||||
| { | { | ||||
| //QFileInfo fileinfo(filename); | |||||
| //clientName = fileinfo.baseName().toUtf8().constData(); | |||||
| File file(filename); | |||||
| clientName = file.getFileNameWithoutExtension().toRawUTF8(); | |||||
| } | } | ||||
| if (itype >= CarlaBackend::PLUGIN_GIG && itype <= CarlaBackend::PLUGIN_SFZ && label == nullptr) | |||||
| label = clientName; | |||||
| // --------------------------------------------------------------------- | |||||
| // Set extraStuff | |||||
| const void* extraStuff = nullptr; | |||||
| if (itype == CarlaBackend::PLUGIN_GIG || itype == CarlaBackend::PLUGIN_SF2 || itype == CarlaBackend::PLUGIN_SFZ) | |||||
| { | |||||
| if (label == nullptr) | |||||
| label = clientName; | |||||
| if (std::strstr(label, " (16 outs)") == 0) | |||||
| extraStuff = (const void*)label; // dummy non-null pointer | |||||
| } | |||||
| // --------------------------------------------------------------------- | |||||
| // Init plugin client | |||||
| // Init Plugin client | |||||
| CarlaPluginClient client(useBridge, (const char*)clientName, bridgeBaseAudioName, bridgeBaseControlName); | CarlaPluginClient client(useBridge, (const char*)clientName, bridgeBaseAudioName, bridgeBaseControlName); | ||||
| // --------------------------------------------------------------------- | |||||
| // Init OSC | // Init OSC | ||||
| if (useOsc) | if (useOsc) | ||||
| client.oscInit(oscUrl); | client.oscInit(oscUrl); | ||||
| // --------------------------------------------------------------------- | |||||
| // Listen for ctrl+c or sigint/sigterm events | // Listen for ctrl+c or sigint/sigterm events | ||||
| initSignalHandler(); | initSignalHandler(); | ||||
| // --------------------------------------------------------------------- | |||||
| // Init plugin | // Init plugin | ||||
| int ret; | int ret; | ||||
| if (carla_add_plugin(CarlaBackend::BINARY_NATIVE, itype, filename, name, label, nullptr)) | |||||
| if (carla_add_plugin(CarlaBackend::BINARY_NATIVE, itype, filename, name, label, extraStuff)) | |||||
| { | { | ||||
| if (useOsc) | if (useOsc) | ||||
| { | { | ||||
| @@ -569,14 +583,15 @@ int main(int argc, char* argv[]) | |||||
| } | } | ||||
| client.ready(!useOsc); | client.ready(!useOsc); | ||||
| //ret = app.exec(); | |||||
| client.exec(); | |||||
| carla_remove_plugin(0); | carla_remove_plugin(0); | ||||
| ret = 0; | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| const char* const lastError = carla_get_last_error(); | |||||
| const char* const lastError(carla_get_last_error()); | |||||
| carla_stderr("Plugin failed to load, error was:\n%s", lastError); | carla_stderr("Plugin failed to load, error was:\n%s", lastError); | ||||
| if (useOsc) | if (useOsc) | ||||
| @@ -585,7 +600,9 @@ int main(int argc, char* argv[]) | |||||
| ret = 1; | ret = 1; | ||||
| } | } | ||||
| // --------------------------------------------------------------------- | |||||
| // Close OSC | // Close OSC | ||||
| if (useOsc) | if (useOsc) | ||||
| client.oscClose(); | client.oscClose(); | ||||
| @@ -29,7 +29,7 @@ DEFINES += WANT_OPENGL | |||||
| DEFINES += WANT_AUDIOFILE | DEFINES += WANT_AUDIOFILE | ||||
| DEFINES += WANT_MIDIFILE | DEFINES += WANT_MIDIFILE | ||||
| DEFINES += WANT_ZYNADDSUBFX | DEFINES += WANT_ZYNADDSUBFX | ||||
| # DEFINES += WANT_ZYNADDSUBFX_UI | |||||
| DEFINES += WANT_ZYNADDSUBFX_UI | |||||
| # Engine | # Engine | ||||
| PKGCONFIG = liblo | PKGCONFIG = liblo | ||||
| @@ -51,8 +51,7 @@ PKGCONFIG += smf | |||||
| PKGCONFIG += gl | PKGCONFIG += gl | ||||
| # ZynAddSubFX | # ZynAddSubFX | ||||
| PKGCONFIG += fftw3 mxml zlib | |||||
| # ntk ntk_images | |||||
| PKGCONFIG += fftw3 mxml zlib ntk ntk_images | |||||
| # ----------------------------------------------------------- | # ----------------------------------------------------------- | ||||
| @@ -82,7 +81,6 @@ SOURCES += \ | |||||
| # Plugin | # Plugin | ||||
| SOURCES += \ | SOURCES += \ | ||||
| ../../backend/plugin/CarlaPlugin.cpp \ | ../../backend/plugin/CarlaPlugin.cpp \ | ||||
| ../../backend/plugin/CarlaPluginGui.cpp \ | |||||
| ../../backend/plugin/CarlaPluginThread.cpp \ | ../../backend/plugin/CarlaPluginThread.cpp \ | ||||
| ../../backend/plugin/BridgePlugin.cpp \ | ../../backend/plugin/BridgePlugin.cpp \ | ||||
| ../../backend/plugin/NativePlugin.cpp \ | ../../backend/plugin/NativePlugin.cpp \ | ||||
| @@ -102,58 +100,29 @@ SOURCES += \ | |||||
| # common | # common | ||||
| HEADERS += \ | HEADERS += \ | ||||
| ../../backend/CarlaBackend.hpp \ | |||||
| ../../backend/CarlaEngine.hpp \ | |||||
| ../../backend/CarlaPlugin.hpp \ | |||||
| ../../backend/CarlaHost.hpp | |||||
| ../../backend/*.hpp | |||||
| # engine | # engine | ||||
| HEADERS += \ | HEADERS += \ | ||||
| ../../backend/engine/CarlaEngineInternal.hpp \ | |||||
| ../../backend/engine/CarlaEngineOsc.hpp \ | |||||
| ../../backend/engine/CarlaEngineThread.hpp | |||||
| ../../backend/engine/*.hpp | |||||
| # plugin | # plugin | ||||
| HEADERS += \ | HEADERS += \ | ||||
| ../../backend/plugin/CarlaPluginInternal.hpp \ | |||||
| ../../backend/plugin/CarlaPluginGui.hpp \ | |||||
| ../../backend/plugin/CarlaPluginThread.hpp | |||||
| ../../backend/plugin/*.hpp | |||||
| # includes | # includes | ||||
| HEADERS += \ | HEADERS += \ | ||||
| ../../includes/CarlaDefines.hpp \ | |||||
| ../../includes/CarlaMIDI.h | |||||
| ../../includes/*.h \ | |||||
| ../../includes/*.hpp | |||||
| # modules | # modules | ||||
| HEADERS += \ | HEADERS += \ | ||||
| ../../modules/CarlaNative.h \ | |||||
| ../../modules/CarlaNative.hpp \ | |||||
| ../../modules/juce_audio_basics.h \ | |||||
| ../../modules/juce_core.h \ | |||||
| ../../modules/ladspa_rdf.hpp \ | |||||
| ../../modules/lv2_rdf.hpp | |||||
| ../../modules/*.h \ | |||||
| ../../modules/*.hpp | |||||
| # utils | # utils | ||||
| HEADERS += \ | HEADERS += \ | ||||
| ../../utils/CarlaUtils.hpp \ | |||||
| ../../utils/CarlaBackendUtils.hpp \ | |||||
| ../../utils/CarlaBridgeUtils.hpp \ | |||||
| ../../utils/CarlaDssiUtils.hpp \ | |||||
| ../../utils/CarlaJuceUtils.hpp \ | |||||
| ../../utils/CarlaLadspaUtils.hpp \ | |||||
| ../../utils/CarlaLibUtils.hpp \ | |||||
| ../../utils/CarlaLogThread.hpp \ | |||||
| ../../utils/CarlaLv2Utils.hpp \ | |||||
| ../../utils/CarlaOscUtils.hpp \ | |||||
| ../../utils/CarlaPipeUtils.hpp \ | |||||
| ../../utils/CarlaShmUtils.hpp \ | |||||
| ../../utils/CarlaStateUtils.hpp \ | |||||
| ../../utils/CarlaVstUtils.hpp \ | |||||
| ../../utils/CarlaMutex.hpp \ | |||||
| ../../utils/CarlaRingBuffer.hpp \ | |||||
| ../../utils/CarlaString.hpp \ | |||||
| ../../utils/Lv2AtomQueue.hpp \ | |||||
| ../../utils/RtList.hpp | |||||
| ../../utils/*.hpp | |||||
| INCLUDEPATH = .. \ | INCLUDEPATH = .. \ | ||||
| ../../backend \ | ../../backend \ | ||||
| @@ -169,6 +138,8 @@ LIBS = -ldl -lpthread -lrt | |||||
| LIBS += ../../modules/carla_native.a | LIBS += ../../modules/carla_native.a | ||||
| LIBS += ../../modules/juce_audio_basics.a | LIBS += ../../modules/juce_audio_basics.a | ||||
| LIBS += ../../modules/juce_core.a | LIBS += ../../modules/juce_core.a | ||||
| LIBS += ../../modules/juce_data_structures.a | |||||
| LIBS += ../../modules/juce_events.a | |||||
| LIBS += ../../modules/rtmempool.a | LIBS += ../../modules/rtmempool.a | ||||
| LIBS += ../../modules/dgl.a | LIBS += ../../modules/dgl.a | ||||
| @@ -29,6 +29,30 @@ juce_audio_basics_%: | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| juce_audio_devices: | |||||
| $(MAKE) -C juce_audio_devices | |||||
| juce_audio_devices_%: | |||||
| $(MAKE) -C juce_audio_devices $* | |||||
| # -------------------------------------------------------------- | |||||
| juce_audio_formats: | |||||
| $(MAKE) -C juce_audio_formats | |||||
| juce_audio_formats_%: | |||||
| $(MAKE) -C juce_audio_formats $* | |||||
| # -------------------------------------------------------------- | |||||
| juce_audio_processors: | |||||
| $(MAKE) -C juce_audio_processors | |||||
| juce_audio_processors_%: | |||||
| $(MAKE) -C juce_audio_processors $* | |||||
| # -------------------------------------------------------------- | |||||
| juce_core: | juce_core: | ||||
| $(MAKE) -C juce_core | $(MAKE) -C juce_core | ||||
| @@ -37,6 +61,38 @@ juce_core_%: | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| juce_data_structures: | |||||
| $(MAKE) -C juce_data_structures | |||||
| juce_data_structures_%: | |||||
| $(MAKE) -C juce_data_structures $* | |||||
| # -------------------------------------------------------------- | |||||
| juce_events: | |||||
| $(MAKE) -C juce_events | |||||
| juce_events_%: | |||||
| $(MAKE) -C juce_events $* | |||||
| # -------------------------------------------------------------- | |||||
| juce_graphics: | |||||
| $(MAKE) -C juce_graphics | |||||
| juce_graphics_%: | |||||
| $(MAKE) -C juce_graphics $* | |||||
| # -------------------------------------------------------------- | |||||
| juce_gui_basics: | |||||
| $(MAKE) -C juce_gui_basics | |||||
| juce_gui_basics_%: | |||||
| $(MAKE) -C juce_gui_basics $* | |||||
| # -------------------------------------------------------------- | |||||
| lilv: | lilv: | ||||
| $(MAKE) -C lilv | $(MAKE) -C lilv | ||||
| @@ -81,7 +137,14 @@ clean: | |||||
| $(MAKE) clean -C distrho/dgl | $(MAKE) clean -C distrho/dgl | ||||
| $(MAKE) clean -C jackbridge | $(MAKE) clean -C jackbridge | ||||
| $(MAKE) clean -C juce_audio_basics | $(MAKE) clean -C juce_audio_basics | ||||
| $(MAKE) clean -C juce_audio_devices | |||||
| $(MAKE) clean -C juce_audio_formats | |||||
| $(MAKE) clean -C juce_audio_processors | |||||
| $(MAKE) clean -C juce_core | $(MAKE) clean -C juce_core | ||||
| $(MAKE) clean -C juce_data_structures | |||||
| $(MAKE) clean -C juce_events | |||||
| $(MAKE) clean -C juce_graphics | |||||
| $(MAKE) clean -C juce_gui_basics | |||||
| $(MAKE) clean -C lilv | $(MAKE) clean -C lilv | ||||
| $(MAKE) clean -C rtmempool | $(MAKE) clean -C rtmempool | ||||
| $(MAKE) clean -C theme | $(MAKE) clean -C theme | ||||
| @@ -89,4 +152,6 @@ clean: | |||||
| # -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
| .PHONY: carla_native dgl juce_audio_basics juce_core lilv rtmempool theme | |||||
| .PHONY: carla_native dgl juce_audio_basics juce_audio_devices juce_audio_formats juce_audio_processors juce_core juce_data_structures juce_events juce_graphics juce_gui_basics lilv rtmempool theme | |||||
| # -------------------------------------------------------------- | |||||
| @@ -118,10 +118,10 @@ class ExternalUI(object): | |||||
| except IOError: | except IOError: | ||||
| return False | return False | ||||
| if msg == "": | |||||
| if not msg: | |||||
| return True | return True | ||||
| if msg == "control": | |||||
| elif msg == "control": | |||||
| index = int(self.fPipeRecv.readline()) | index = int(self.fPipeRecv.readline()) | ||||
| value = float(self.fPipeRecv.readline()) | value = float(self.fPipeRecv.readline()) | ||||
| self.d_parameterChanged(index, value) | self.d_parameterChanged(index, value) | ||||
| @@ -23,6 +23,8 @@ | |||||
| #include "juce_core.h" | #include "juce_core.h" | ||||
| using namespace juce; | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static inline | static inline | ||||
| @@ -30,11 +32,10 @@ const char* find_dssi_ui(const char* const filename, const char* const label) | |||||
| { | { | ||||
| CARLA_SAFE_ASSERT_RETURN(filename != nullptr, nullptr); | CARLA_SAFE_ASSERT_RETURN(filename != nullptr, nullptr); | ||||
| CARLA_SAFE_ASSERT_RETURN(label != nullptr, nullptr); | CARLA_SAFE_ASSERT_RETURN(label != nullptr, nullptr); | ||||
| using namespace juce; | |||||
| carla_debug("find_dssi_ui(\"%s\", \"%s\")", filename, label); | |||||
| File pluginFile(filename); | File pluginFile(filename); | ||||
| File pluginDir(pluginFile.getParentDirectory()); | |||||
| File pluginDir(pluginFile.getParentDirectory().getFullPathName() + File::separatorString + pluginFile.getFileNameWithoutExtension()); | |||||
| Array<File> results; | Array<File> results; | ||||
| @@ -46,7 +47,7 @@ const char* find_dssi_ui(const char* const filename, const char* const label) | |||||
| for (int i=0, count=results.size(); i < count; ++i) | for (int i=0, count=results.size(); i < count; ++i) | ||||
| { | { | ||||
| const File& file(results[i]); | const File& file(results[i]); | ||||
| guiFiles.add(file.getFullPathName()); | |||||
| guiFiles.add(file.getFileName()); | |||||
| } | } | ||||
| String pluginDirName(pluginDir.getFullPathName()); | String pluginDirName(pluginDir.getFullPathName()); | ||||
| @@ -0,0 +1,120 @@ | |||||
| /* | |||||
| * Carla library counter | |||||
| * Copyright (C) 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 General Public License as | |||||
| * published by the Free Software Foundation; either version 2 of | |||||
| * the License, or any later version. | |||||
| * | |||||
| * 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 General Public License for more details. | |||||
| * | |||||
| * For a full copy of the GNU General Public License see the doc/GPL.txt file. | |||||
| */ | |||||
| #ifndef CARLA_LIB_COUNTER_HPP_INCLUDED | |||||
| #define CARLA_LIB_COUNTER_HPP_INCLUDED | |||||
| #include "CarlaLibUtils.hpp" | |||||
| #include "CarlaMutex.hpp" | |||||
| #include "RtList.hpp" | |||||
| // ----------------------------------------------------------------------- | |||||
| class LibCounter | |||||
| { | |||||
| public: | |||||
| LibCounter() {} | |||||
| ~LibCounter() | |||||
| { | |||||
| CARLA_ASSERT(libs.isEmpty()); | |||||
| } | |||||
| void* open(const char* const filename) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(filename != nullptr, nullptr); | |||||
| const CarlaMutex::ScopedLocker sl(mutex); | |||||
| for (NonRtList<Lib>::Itenerator it = libs.begin(); it.valid(); it.next()) | |||||
| { | |||||
| Lib& lib(*it); | |||||
| CARLA_ASSERT(lib.count > 0); | |||||
| CARLA_SAFE_ASSERT_CONTINUE(lib.filename != nullptr); | |||||
| if (std::strcmp(lib.filename, filename) == 0) | |||||
| { | |||||
| ++lib.count; | |||||
| return lib.lib; | |||||
| } | |||||
| } | |||||
| void* const libPtr(lib_open(filename)); | |||||
| if (libPtr == nullptr) | |||||
| return nullptr; | |||||
| Lib lib; | |||||
| lib.lib = libPtr; | |||||
| lib.filename = carla_strdup(filename); | |||||
| lib.count = 1; | |||||
| libs.append(lib); | |||||
| return libPtr; | |||||
| } | |||||
| bool close(void* const libPtr) | |||||
| { | |||||
| CARLA_SAFE_ASSERT_RETURN(libPtr != nullptr, false); | |||||
| const CarlaMutex::ScopedLocker sl(mutex); | |||||
| for (NonRtList<Lib>::Itenerator it = libs.begin(); it.valid(); it.next()) | |||||
| { | |||||
| Lib& lib(*it); | |||||
| CARLA_ASSERT(lib.count > 0); | |||||
| CARLA_SAFE_ASSERT_CONTINUE(lib.lib != nullptr); | |||||
| if (lib.lib != libPtr) | |||||
| continue; | |||||
| if (--lib.count == 0) | |||||
| { | |||||
| if (lib.filename != nullptr) | |||||
| { | |||||
| delete[] lib.filename; | |||||
| lib.filename = nullptr; | |||||
| } | |||||
| lib_close(lib.lib); | |||||
| lib.lib = nullptr; | |||||
| libs.remove(it); | |||||
| } | |||||
| return true; | |||||
| } | |||||
| CARLA_ASSERT(false); // invalid pointer | |||||
| return false; | |||||
| } | |||||
| private: | |||||
| struct Lib { | |||||
| void* lib; | |||||
| const char* filename; | |||||
| int count; | |||||
| }; | |||||
| CarlaMutex mutex; | |||||
| NonRtList<Lib> libs; | |||||
| }; | |||||
| // ----------------------------------------------------------------------- | |||||
| #endif // CARLA_LIB_COUNTER_HPP_INCLUDED | |||||
| @@ -26,12 +26,11 @@ | |||||
| #include <fcntl.h> | #include <fcntl.h> | ||||
| using CarlaBackend::CallbackFunc; | using CarlaBackend::CallbackFunc; | ||||
| using juce::Thread; | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| // Log thread | // Log thread | ||||
| class CarlaLogThread : public Thread | |||||
| class CarlaLogThread : public juce::Thread | |||||
| { | { | ||||
| public: | public: | ||||
| CarlaLogThread() | CarlaLogThread() | ||||
| @@ -24,9 +24,6 @@ | |||||
| #include "juce_core.h" | #include "juce_core.h" | ||||
| using juce::String; | |||||
| using juce::XmlElement; | |||||
| CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| @@ -217,9 +214,9 @@ struct SaveState { | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static inline | static inline | ||||
| String xmlSafeString(const String& string, const bool toXml) | |||||
| juce::String xmlSafeString(const juce::String& string, const bool toXml) | |||||
| { | { | ||||
| String newString(string); | |||||
| juce::String newString(string); | |||||
| if (toXml) | if (toXml) | ||||
| return newString.replace("&","&").replace("<","<").replace(">",">").replace("'","'").replace("\"","""); | return newString.replace("&","&").replace("<","<").replace(">",">").replace("'","'").replace("\"","""); | ||||
| @@ -228,7 +225,7 @@ String xmlSafeString(const String& string, const bool toXml) | |||||
| } | } | ||||
| static inline | static inline | ||||
| const char* xmlSafeStringCharDup(const String& string, const bool toXml) | |||||
| const char* xmlSafeStringCharDup(const juce::String& string, const bool toXml) | |||||
| { | { | ||||
| return carla_strdup(xmlSafeString(string, toXml).toRawUTF8()); | return carla_strdup(xmlSafeString(string, toXml).toRawUTF8()); | ||||
| } | } | ||||
| @@ -236,9 +233,11 @@ const char* xmlSafeStringCharDup(const String& string, const bool toXml) | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static inline | static inline | ||||
| void fillSaveStateFromXmlElement(SaveState& saveState, const XmlElement& xmlElement) | |||||
| void fillSaveStateFromXmlElement(SaveState& saveState, const juce::XmlElement* const xmlElement) | |||||
| { | { | ||||
| for (XmlElement* elem = xmlElement.getFirstChildElement(); elem != nullptr; elem = elem->getNextElement()) | |||||
| using namespace juce; | |||||
| for (XmlElement* elem = xmlElement->getFirstChildElement(); elem != nullptr; elem = elem->getNextElement()) | |||||
| { | { | ||||
| // --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
| // Info | // Info | ||||
| @@ -422,8 +421,10 @@ void fillSaveStateFromXmlElement(SaveState& saveState, const XmlElement& xmlElem | |||||
| // ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
| static inline | static inline | ||||
| void fillXmlStringFromSaveState(String& content, const SaveState& saveState) | |||||
| void fillXmlStringFromSaveState(juce::String& content, const SaveState& saveState) | |||||
| { | { | ||||
| using namespace juce; | |||||
| { | { | ||||
| String info(" <Info>\n"); | String info(" <Info>\n"); | ||||