diff --git a/c++/carla-backend/Makefile b/c++/carla-backend/Makefile index 8ed6b93..6c31094 100644 --- a/c++/carla-backend/Makefile +++ b/c++/carla-backend/Makefile @@ -56,15 +56,15 @@ endif OBJS = \ carla_backend_standalone.o \ -# OBJS += ../carla-engine/carla_engine.a -# OBJS += ../carla-plugin/carla_plugin.a -# OBJS += ../carla-native/carla_native.a -# -# # others -# ifeq ($(CARLA_PLUGIN_SUPPORT),true) -# OBJS += ../carla-lilv/carla_lilv.a -# OBJS += ../carla-rtmempool/carla_rtmempool.a -# endif +OBJS += ../carla-engine/carla_engine.a +OBJS += ../carla-plugin/carla_plugin.a +OBJS += ../carla-native/carla_native.a + +# others +ifeq ($(CARLA_PLUGIN_SUPPORT),true) +OBJS += ../carla-lilv/carla_lilv.a +OBJS += ../carla-rtmempool/carla_rtmempool.a +endif # -------------------------------------------------------------- diff --git a/c++/carla-engine/carla_engine.cpp b/c++/carla-engine/carla_engine.cpp index 8c55fa0..1421682 100644 --- a/c++/carla-engine/carla_engine.cpp +++ b/c++/carla-engine/carla_engine.cpp @@ -498,7 +498,7 @@ int CarlaEngine::maxPortNameSize() return STR_MAX; } -unsigned short CarlaEngine::maxPluginNumber() +unsigned short CarlaEngine::maxPluginNumber() const { return m_maxPluginNumber; } @@ -1248,7 +1248,11 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize) // ------------------------------------------------------------------------------------------------------------------- // Carla Engine OSC stuff +#ifdef BUILD_BRIDGE +void CarlaEngine::osc_send_peaks(CarlaPlugin* const plugin) +#else void CarlaEngine::osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id) +#endif { // Peak values if (plugin->audioInCount() > 0) diff --git a/c++/carla-engine/carla_engine.hpp b/c++/carla-engine/carla_engine.hpp index 148f2fc..c9881ad 100644 --- a/c++/carla-engine/carla_engine.hpp +++ b/c++/carla-engine/carla_engine.hpp @@ -520,12 +520,6 @@ private: class CarlaEngine { public: - /*! - * The contructor.\n - * \note This only initializes engine data, it doesn't initialize the engine itself. - */ - CarlaEngine(); - /*! * The decontructor. * The engine must have been closed before this happens. @@ -549,49 +543,121 @@ public: /*! * Get the name of the engine driver at \a index. */ - static const char* getDriverName(unsigned int index); + static const char* getDriverName(unsigned int index); /*! - * Create a new engine, using driver \a driverName. + * Create a new engine, using driver \a driverName.\n + * Returned variable must be deleted when no longer needed. */ static CarlaEngine* newDriverByName(const char* const driverName); // ------------------------------------------------------------------- // Maximum values + /*! + * Maximum client name size. + */ virtual int maxClientNameSize(); + + /*! + * Maximum port name size. + */ virtual int maxPortNameSize(); - unsigned short maxPluginNumber(); + + /*! + * Maximum number of loadable plugins. + * \note This function returns 0 if no engine is not started. + */ + unsigned short maxPluginNumber() const; // ------------------------------------------------------------------- // Virtual, per-engine type calls + /*! + * Initialize engine, using \a clientName. + */ virtual bool init(const char* const clientName); + + /*! + * Close engine. + */ virtual bool close(); - virtual bool isOffline() const = 0; + + /*! + * Check if engine is running. + */ virtual bool isRunning() const = 0; + /*! + * Check if engine is running offline (aka freewheel mode). + */ + virtual bool isOffline() const = 0; + + /*! + * Get engine type. + */ virtual CarlaEngineType type() const = 0; + + /*! + * Add new engine client. + * \note This must only be called within a plugin class. + */ virtual CarlaEngineClient* addClient(CarlaPlugin* const plugin) = 0; // ------------------------------------------------------------------- // Plugin management - short getNewPluginId() const; + /*! + * Get next available plugin id.\n + * Returns -1 if no more plugins can be loaded. + */ + short getNewPluginId() const; + + /*! + * Get plugin with id \a id. + */ CarlaPlugin* getPlugin(const unsigned short id) const; + + /*! + * Get plugin with id \a id, faster unchecked version. + */ CarlaPlugin* getPluginUnchecked(const unsigned short id) const; - const char* getUniquePluginName(const char* const name); + /*! + * Get a unique plugin name within the engine.\n + * Returned variable must be free'd when no longer needed. + */ + const char* getUniquePluginName(const char* const name); + + /*! + * Add new plugin.\n + * Returns the id of the plugin, or -1 if the operation failed. + */ short addPlugin(const BinaryType btype, const PluginType ptype, const char* const filename, const char* const name, const char* const label, void* const extra = nullptr); + + /*! + * Add new plugin, using native binary type.\n + * Returns the id of the plugin, or -1 if the operation failed. + */ short addPlugin(const PluginType ptype, const char* const filename, const char* const name, const char* const label, void* const extra = nullptr); - bool removePlugin(const unsigned short id); - void removeAllPlugins(); - void idlePluginGuis(); -#ifndef BUILD_BRIDGE - void processRack(float* inBuf[2], float* outBuf[2], const uint32_t frames); -#endif + + /*! + * Remove plugin with id \a id. + */ + bool removePlugin(const unsigned short id); + + /*! + * Remove all plugins. + */ + void removeAllPlugins(); + + /*! + * Idle all plugins GUIs. + */ + void idlePluginGuis(); // bridge, internal use only + // TODO - find a better way for this void __bridgePluginRegister(const unsigned short id, CarlaPlugin* const plugin) { m_carlaPlugins[id] = plugin; @@ -600,11 +666,30 @@ public: // ------------------------------------------------------------------- // Information (base) + /*! + * Get engine name. + */ const char* getName() const; - double getSampleRate() const; + + /*! + * Get current sample rate. + */ + double getSampleRate() const; + + /*! + * Get current buffer size. + */ uint32_t getBufferSize() const; + + /*! + * Get current Time information. + */ const CarlaEngineTimeInfo* getTimeInfo() const; + /*! + * Tell the engine it's about to close.\n + * This is used to prevent the engine thread from reactivating. + */ void aboutToClose(); // ------------------------------------------------------------------- @@ -624,78 +709,127 @@ public: // ------------------------------------------------------------------- // Error handling + /*! + * Get last error. + */ const char* getLastError() const; + + /*! + * Set last error. + */ void setLastError(const char* const error); #ifndef BUILD_BRIDGE // ------------------------------------------------------------------- // Options - void setOption(const OptionsType option, const int value, const char* const valueStr); - + /*! + * Get the engine options (read-only). + */ const CarlaEngineOptions& getOptions() const { return options; } - ProcessMode processMode() const - { - return options.processMode; - } - - bool processHighPrecision() const - { - return options.processHighPrecision; - } - - uint maxParameters() const - { - return options.maxParameters; - } - - bool forceStereo() const - { - return options.forceStereo; - } - - bool useDssiVstChunks() const - { - return options.useDssiVstChunks; - } - - bool preferUiBridges() const - { - return options.preferUiBridges; - } + /*! + * Set the engine option \a option. + */ + void setOption(const OptionsType option, const int value, const char* const valueStr); - uint oscUiTimeout() const - { - return options.oscUiTimeout; - } +// ProcessMode processMode() const +// { +// return options.processMode; +// } + +// bool processHighPrecision() const +// { +// return options.processHighPrecision; +// } + +// uint maxParameters() const +// { +// return options.maxParameters; +// } + +// bool forceStereo() const +// { +// return options.forceStereo; +// } + +// bool useDssiVstChunks() const +// { +// return options.useDssiVstChunks; +// } + +// bool preferUiBridges() const +// { +// return options.preferUiBridges; +// } + +// uint oscUiTimeout() const +// { +// return options.oscUiTimeout; +// } #endif // ------------------------------------------------------------------- // Mutex locks + /*! + * Lock processing. + */ void processLock(); + + /*! + * Unlock processing. + */ void processUnlock(); + + /*! + * Lock MIDI. + */ void midiLock(); + + /*! + * Unlock MIDI. + */ void midiUnlock(); // ------------------------------------------------------------------- // OSC Stuff + /*! + * Check if OSC controller is registered. + */ bool isOscControlRegisted() const; #ifndef BUILD_BRIDGE + /*! + * Idle OSC. + */ bool idleOsc(); + + /*! + * Get OSC TCP server path. + */ const char* getOscServerPathTCP() const; + + /*! + * Get OSC UDP server path. + */ const char* getOscServerPathUDP() const; #else + /*! + * Set OSC bridge data. + */ void setOscBridgeData(const CarlaOscData* const oscData); #endif +#ifdef BUILD_BRIDGE + void osc_send_peaks(CarlaPlugin* const plugin); +#else void osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id); +#endif #ifdef BUILD_BRIDGE void osc_send_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total); @@ -796,6 +930,19 @@ public: // ------------------------------------- protected: + /*! + * The contructor, protected.\n + * \note This only initializes engine data, it doesn't initialize the engine itself. + */ + CarlaEngine(); + +#ifndef BUILD_BRIDGE + /*! + * Proccess audio buffer in rack mode, protected. + */ + void processRack(float* inBuf[2], float* outBuf[2], const uint32_t frames); +#endif + #ifndef BUILD_BRIDGE CarlaEngineOptions options; #endif @@ -809,16 +956,15 @@ protected: private: CarlaEngineThread m_thread; - #ifndef BUILD_BRIDGE CarlaEngineOsc m_osc; #endif + const CarlaOscData* m_oscData; CallbackFunc m_callback; void* m_callbackPtr; - - CarlaString m_lastError; + CarlaString m_lastError; QMutex m_procLock; QMutex m_midiLock; diff --git a/c++/carla-engine/carla_engine_osc.hpp b/c++/carla-engine/carla_engine_osc.hpp index ccefd3c..ec5f9ce 100644 --- a/c++/carla-engine/carla_engine_osc.hpp +++ b/c++/carla-engine/carla_engine_osc.hpp @@ -18,6 +18,10 @@ #ifndef CARLA_ENGINE_OSC_HPP #define CARLA_ENGINE_OSC_HPP +#ifdef BUILD_BRIDGE +# error Bad use of file! This should never be used in bridge builds +#endif + #include "carla_backend.hpp" #include "carla_osc_utils.hpp" @@ -77,12 +81,12 @@ public: const char* getServerPathTCP() const { - return m_serverPathTCP; + return (const char*)m_serverPathTCP; } const char* getServerPathUDP() const { - return m_serverPathUDP; + return (const char*)m_serverPathUDP; } // ------------------------------------------------------------------- diff --git a/c++/carla-engine/carla_engine_thread.cpp b/c++/carla-engine/carla_engine_thread.cpp index 7a9928a..d0eb70e 100644 --- a/c++/carla-engine/carla_engine_thread.cpp +++ b/c++/carla-engine/carla_engine_thread.cpp @@ -129,7 +129,13 @@ void CarlaEngineThread::run() // Update OSC control client peaks if (oscControlRegisted) + { +#ifdef BUILD_BRIDGE + engine->osc_send_peaks(plugin); +#else engine->osc_send_peaks(plugin, id); +#endif + } } } diff --git a/c++/carla-engine/jack.cpp b/c++/carla-engine/jack.cpp index 87e8869..1780721 100644 --- a/c++/carla-engine/jack.cpp +++ b/c++/carla-engine/jack.cpp @@ -616,11 +616,6 @@ public: return false; } - bool isOffline() const - { - return m_freewheel; - } - bool isRunning() const { #ifdef BUILD_BRIDGE @@ -630,6 +625,11 @@ public: #endif } + bool isOffline() const + { + return m_freewheel; + } + CarlaEngineType type() const { return CarlaEngineTypeJack; diff --git a/c++/carla-engine/plugin.cpp b/c++/carla-engine/plugin.cpp index a7325ff..112082b 100644 --- a/c++/carla-engine/plugin.cpp +++ b/c++/carla-engine/plugin.cpp @@ -149,14 +149,14 @@ public: return true; } - bool isOffline() const + bool isRunning() const { - return false; + return true; } - bool isRunning() const + bool isOffline() const { - return true; + return false; } CarlaEngineType type() const diff --git a/c++/carla-engine/rtaudio.cpp b/c++/carla-engine/rtaudio.cpp index 840e728..fb31e41 100644 --- a/c++/carla-engine/rtaudio.cpp +++ b/c++/carla-engine/rtaudio.cpp @@ -233,14 +233,14 @@ public: return true; } - bool isOffline() const + bool isRunning() const { - return false; + return audio.isStreamRunning(); } - bool isRunning() const + bool isOffline() const { - return audio.isStreamRunning(); + return false; } CarlaEngineType type() const diff --git a/c++/carla-plugin/carla_bridge.cpp b/c++/carla-plugin/carla_bridge.cpp index c0ed4e7..1e535ae 100644 --- a/c++/carla-plugin/carla_bridge.cpp +++ b/c++/carla-plugin/carla_bridge.cpp @@ -313,7 +313,8 @@ public: } // create new if needed - param.count = (pTotal < (int32_t)x_engine->maxParameters()) ? pTotal : 0; + const int32_t maxParams = x_engine->getOptions().maxParameters; + param.count = (pTotal < maxParams) ? pTotal : 0; if (param.count > 0) { @@ -580,7 +581,7 @@ public: } else if (strcmp(key, CARLA_BRIDGE_MSG_HIDE_GUI) == 0) { - x_engine->callback(CALLBACK_SHOW_GUI, m_id, 0, 0, 0.0); + x_engine->callback(CALLBACK_SHOW_GUI, m_id, 0, 0, 0.0, nullptr); } else if (strcmp(key, CARLA_BRIDGE_MSG_SAVED) == 0) { @@ -649,15 +650,15 @@ public: { CARLA_BRIDGE_CHECK_OSC_TYPES(3, "sss"); - const char* const stype = (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 value = (const char*)&argv[2]->s; - CARLA_ASSERT(stype); + CARLA_ASSERT(type); CARLA_ASSERT(key); CARLA_ASSERT(value); - setCustomData(getCustomDataStringType(stype), key, value, false); + setCustomData(type, key, value, false); break; } @@ -751,9 +752,9 @@ public: CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); } - void setCustomData(const CustomDataType type, const char* const key, const char* const value, const bool sendGui) + void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) { - CARLA_ASSERT(type != CUSTOM_DATA_INVALID); + CARLA_ASSERT(type); CARLA_ASSERT(key); CARLA_ASSERT(value); @@ -761,7 +762,7 @@ public: { // TODO - if type is chunk|binary, store it in a file and send path instead QString cData; - cData = getCustomDataTypeString(type); + cData = type; cData += "·"; cData += key; cData += "·"; diff --git a/c++/carla-plugin/carla_plugin.cpp b/c++/carla-plugin/carla_plugin.cpp index 454162e..d209e08 100644 --- a/c++/carla-plugin/carla_plugin.cpp +++ b/c++/carla-plugin/carla_plugin.cpp @@ -57,14 +57,17 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned short id) // options m_ctrlInChannel = 0; m_fixedBufferSize = true; - -#ifdef BUILD_BRIDGE m_processHighPrecision = false; -#else - m_processHighPrecision = x_engine->processHighPrecision(); - if (engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) - m_ctrlInChannel = m_id; +#ifndef BUILD_BRIDGE + { + const CarlaEngineOptions& options(x_engine->getOptions()); + + m_processHighPrecision = options.processHighPrecision; + + if (options.processMode == PROCESS_MODE_CONTINUOUS_RACK) + m_ctrlInChannel = m_id; + } #endif // latency @@ -433,7 +436,7 @@ void CarlaPlugin::setId(const unsigned short id) { m_id = id; - if (x_engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK) m_ctrlInChannel = id; } #endif @@ -948,10 +951,11 @@ void CarlaPlugin::registerToOscControl() // Plugin Parameters #ifdef BUILD_BRIDGE - uint32_t maxParameters = MAX_PARAMETERS; + const uint32_t maxParameters = MAX_PARAMETERS; #else - uint32_t maxParameters = x_engine->maxParameters(); + const uint32_t maxParameters = x_engine->getOptions().maxParameters; #endif + if (param.count > 0 && param.count < maxParameters) { char bufName[STR_MAX], bufUnit[STR_MAX]; @@ -1097,8 +1101,10 @@ bool CarlaPlugin::waitForOscGuiShow() { qWarning("CarlaPlugin::waitForOscGuiShow()"); + const uint oscUiTimeout = x_engine->getOptions().oscUiTimeout; + // wait for UI 'update' call - for (uint i=0; i < x_engine->oscUiTimeout(); i++) + for (uint i=0; i < oscUiTimeout; i++) { if (osc.data.target) { @@ -1110,7 +1116,7 @@ bool CarlaPlugin::waitForOscGuiShow() carla_msleep(100); } - qWarning("CarlaPlugin::waitForOscGuiShow() - Timeout while waiting for UI to respond (waited %i msecs)", x_engine->oscUiTimeout()); + qWarning("CarlaPlugin::waitForOscGuiShow() - Timeout while waiting for UI to respond (waited %u msecs)", oscUiTimeout); return false; } #endif diff --git a/c++/carla-plugin/carla_plugin.pro b/c++/carla-plugin/carla_plugin.pro index 94be1b4..22bfd50 100644 --- a/c++/carla-plugin/carla_plugin.pro +++ b/c++/carla-plugin/carla_plugin.pro @@ -9,10 +9,17 @@ CONFIG += link_pkgconfig qt warn_on DEFINES = DEBUG DEFINES += QTCREATOR_TEST +# Plugins DEFINES += WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST + +# Samplers +DEFINES += WANT_FLUIDSYNTH WANT_LINUXSAMPLER + +# ZynAddSubFX DEFINES += WANT_ZYNADDSUBFX + +# Misc DEFINES += WANT_SUIL -DEFINES += WANT_FLUIDSYNTH WANT_LINUXSAMPLER PKGCONFIG = liblo suil-0 fluidsynth linuxsampler diff --git a/c++/carla-plugin/carla_plugin_thread.cpp b/c++/carla-plugin/carla_plugin_thread.cpp index 9d9068a..af93cdc 100644 --- a/c++/carla-plugin/carla_plugin_thread.cpp +++ b/c++/carla-plugin/carla_plugin_thread.cpp @@ -122,13 +122,13 @@ void CarlaPluginThread::run() if (m_process->exitCode() == 0) { // Hide - engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0); + engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0, nullptr); qWarning("CarlaPluginThread::run() - GUI closed"); } else { // Kill - engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), -1, 0, 0.0); + engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), -1, 0, 0.0, nullptr); qWarning("CarlaPluginThread::run() - GUI crashed"); break; } @@ -136,7 +136,7 @@ void CarlaPluginThread::run() else { qDebug("CarlaPluginThread::run() - GUI timeout"); - engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0); + engine->callback(CarlaBackend::CALLBACK_SHOW_GUI, plugin->id(), 0, 0, 0.0, nullptr); } break; @@ -151,7 +151,7 @@ void CarlaPluginThread::run() "Saving now will lose its current settings.\n" "Please remove this plugin, and not rely on it from this point.").arg(plugin->name()); engine->setLastError(errorString.toUtf8().constData()); - engine->callback(CarlaBackend::CALLBACK_ERROR, plugin->id(), 0, 0, 0.0); + engine->callback(CarlaBackend::CALLBACK_ERROR, plugin->id(), 0, 0, 0.0, nullptr); } break; diff --git a/c++/carla-plugin/dssi.cpp b/c++/carla-plugin/dssi.cpp index 352cc93..e82407d 100644 --- a/c++/carla-plugin/dssi.cpp +++ b/c++/carla-plugin/dssi.cpp @@ -64,7 +64,7 @@ public: if (osc.thread) { // Wait a bit first, try safe quit, then force kill - if (osc.thread->isRunning() && ! osc.thread->wait(x_engine->oscUiTimeout() * 100)) + if (osc.thread->isRunning() && ! osc.thread->wait(x_engine->getOptions().oscUiTimeout * 100)) { qWarning("Failed to properly stop DSSI GUI thread"); osc.thread->terminate(); @@ -340,6 +340,10 @@ public: qDebug("DssiPlugin::reload() - start"); CARLA_ASSERT(descriptor && ldescriptor); +#ifndef BUILD_BRIDGE + const ProcessMode processMode(x_engine->getOptions().processMode); +#endif + // Safely disable plugin for reload const ScopedDisabler m(this); @@ -377,7 +381,7 @@ public: } #ifndef BUILD_BRIDGE - if (x_engine->forceStereo() && (aIns == 1 || aOuts == 1) && ! h2) + if (x_engine->getOptions().forceStereo && (aIns == 1 || aOuts == 1) && ! h2) { h2 = ldescriptor->instantiate(ldescriptor, sampleRate); @@ -433,7 +437,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -632,7 +636,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -649,7 +653,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -666,7 +670,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -689,7 +693,7 @@ public: m_hints |= PLUGIN_IS_SYNTH; #ifndef BUILD_BRIDGE - if (x_engine->useDssiVstChunks() && QString(m_filename).endsWith("dssi-vst.so", Qt::CaseInsensitive)) + if (x_engine->getOptions().useDssiVstChunks && QString(m_filename).endsWith("dssi-vst.so", Qt::CaseInsensitive)) { if (descriptor->get_custom_data && descriptor->set_custom_data) m_hints |= PLUGIN_USES_CHUNKS; @@ -881,7 +885,7 @@ public: // Input VU #ifndef BUILD_BRIDGE - if (aIn.count > 0 && x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (aIn.count > 0 && x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #else if (aIn.count > 0) #endif @@ -890,19 +894,19 @@ public: { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); } } else if (aIn.count > 1) { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); - if (abs(inBuffer[1][k]) > aInsPeak[1]) - aInsPeak[1] = abs(inBuffer[1][k]); + if (std::abs(inBuffer[1][k]) > aInsPeak[1]) + aInsPeak[1] = std::abs(inBuffer[1][k]); } } } @@ -1372,13 +1376,13 @@ public: // Output VU #ifndef BUILD_BRIDGE - if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #endif { for (k=0; i < 2 && k < frames; k++) { - if (abs(outBuffer[i][k]) > aOutsPeak[i]) - aOutsPeak[i] = abs(outBuffer[i][k]); + if (std::abs(outBuffer[i][k]) > aOutsPeak[i]) + aOutsPeak[i] = std::abs(outBuffer[i][k]); } } } @@ -1648,7 +1652,7 @@ CarlaPlugin* CarlaPlugin::newDSSI(const initializer& init, const void* const ext plugin->reload(); # ifndef BUILD_BRIDGE - if (init.engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) + if (init.engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK) { if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO)) { diff --git a/c++/carla-plugin/fluidsynth.cpp b/c++/carla-plugin/fluidsynth.cpp index 4bf914b..4cc8467 100644 --- a/c++/carla-plugin/fluidsynth.cpp +++ b/c++/carla-plugin/fluidsynth.cpp @@ -392,6 +392,8 @@ public: qDebug("FluidSynthPlugin::reload() - start"); CARLA_ASSERT(f_synth); + const ProcessMode processMode(x_engine->getOptions().processMode); + // Safely disable plugin for reload const ScopedDisabler m(this); @@ -423,7 +425,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -439,7 +441,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -458,7 +460,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -476,7 +478,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -491,7 +493,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -839,7 +841,7 @@ public: } else { - x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0); + x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0, nullptr); } } @@ -1197,12 +1199,12 @@ public: fluid_synth_set_gain(f_synth, x_volume); // Output VU - if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) { for (k=0; i < 2 && k < frames; k++) { - if (abs(outBuffer[i][k]) > aOutsPeak[i]) - aOutsPeak[i] = abs(outBuffer[i][k]); + if (std::abs(outBuffer[i][k]) > aOutsPeak[i]) + aOutsPeak[i] = std::abs(outBuffer[i][k]); } } } diff --git a/c++/carla-plugin/ladspa.cpp b/c++/carla-plugin/ladspa.cpp index feb27ad..33f8908 100644 --- a/c++/carla-plugin/ladspa.cpp +++ b/c++/carla-plugin/ladspa.cpp @@ -338,6 +338,10 @@ public: qDebug("LadspaPlugin::reload() - start"); CARLA_ASSERT(descriptor); +#ifndef BUILD_BRIDGE + const ProcessMode processMode(x_engine->getOptions().processMode); +#endif + // Safely disable plugin for reload const ScopedDisabler m(this); @@ -375,7 +379,7 @@ public: } #ifndef BUILD_BRIDGE - if (x_engine->forceStereo() && (aIns == 1 || aOuts == 1) && ! h2) + if (x_engine->getOptions().forceStereo && (aIns == 1 || aOuts == 1) && ! h2) { h2 = descriptor->instantiate(descriptor, sampleRate); @@ -429,7 +433,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -623,7 +627,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -640,7 +644,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -745,7 +749,7 @@ public: // Input VU #ifndef BUILD_BRIDGE - if (aIn.count > 0 && x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (aIn.count > 0 && x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #else if (aIn.count > 0) #endif @@ -754,19 +758,19 @@ public: { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); } } else if (aIn.count > 1) { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); - if (abs(inBuffer[1][k]) > aInsPeak[1]) - aInsPeak[1] = abs(inBuffer[1][k]); + if (std::abs(inBuffer[1][k]) > aInsPeak[1]) + aInsPeak[1] = std::abs(inBuffer[1][k]); } } } @@ -1042,7 +1046,7 @@ public: // Output VU #ifndef BUILD_BRIDGE - if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #endif { for (k=0; i < 2 && k < frames; k++) @@ -1247,7 +1251,7 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const initializer& init, const void* const e plugin->reload(); # ifndef BUILD_BRIDGE - if (init.engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) + if (init.engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK) { if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO)) { diff --git a/c++/carla-plugin/linuxsampler.cpp b/c++/carla-plugin/linuxsampler.cpp index f31a5b4..c3d15cb 100644 --- a/c++/carla-plugin/linuxsampler.cpp +++ b/c++/carla-plugin/linuxsampler.cpp @@ -264,6 +264,8 @@ public: qDebug("LinuxSamplerPlugin::reload() - start"); CARLA_ASSERT(instrument); + const ProcessMode processMode(x_engine->getOptions().processMode); + // Safely disable plugin for reload const ScopedDisabler m(this); @@ -291,7 +293,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -307,7 +309,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -326,7 +328,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -344,7 +346,7 @@ public: { portName.clear(); - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -428,7 +430,7 @@ public: } else { - x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0); + x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0, nullptr); } } @@ -796,12 +798,12 @@ public: } // Output VU - if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) { for (k=0; i < 2 && k < frames; k++) { - if (abs(outBuffer[i][k]) > aOutsPeak[i]) - aOutsPeak[i] = abs(outBuffer[i][k]); + if (std::abs(outBuffer[i][k]) > aOutsPeak[i]) + aOutsPeak[i] = std::abs(outBuffer[i][k]); } } } diff --git a/c++/carla-plugin/lv2.cpp b/c++/carla-plugin/lv2.cpp index d8140ca..c084f2d 100644 --- a/c++/carla-plugin/lv2.cpp +++ b/c++/carla-plugin/lv2.cpp @@ -345,7 +345,7 @@ public: if (osc.thread) { // Wait a bit first, try safe quit, then force kill - if (osc.thread->isRunning() && ! osc.thread->wait(x_engine->oscUiTimeout() * 100)) + if (osc.thread->isRunning() && ! osc.thread->wait(x_engine->getOptions().oscUiTimeout * 100)) { qWarning("Failed to properly stop LV2 OSC GUI thread"); osc.thread->terminate(); @@ -433,7 +433,7 @@ public: delete (LV2_Worker_Schedule*)features[lv2_feature_id_worker]->data; #ifndef BUILD_BRIDGE - if (! x_engine->processHighPrecision()) + if (! x_engine->getOptions().processHighPrecision) #endif { features[lv2_feature_id_bufsize_fixed] = nullptr; @@ -1113,6 +1113,10 @@ public: qDebug("Lv2Plugin::reload() - start"); CARLA_ASSERT(descriptor && rdf_descriptor); +#ifndef BUILD_BRIDGE + const ProcessMode processMode(x_engine->getOptions().processMode); +#endif + // Safely disable plugin for reload const ScopedDisabler m(this); @@ -1196,7 +1200,7 @@ public: } #ifndef BUILD_BRIDGE - if (x_engine->forceStereo() && (aIns == 1 || aOuts == 1) && ! (h2 || ext.state || ext.worker)) + if (x_engine->getOptions().forceStereo && (aIns == 1 || aOuts == 1) && ! (h2 || ext.state || ext.worker)) { h2 = descriptor->instantiate(descriptor, sampleRate, rdf_descriptor->Bundle, features); @@ -1316,7 +1320,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -1699,7 +1703,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -1716,7 +1720,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -1991,7 +1995,7 @@ public: // Input VU #ifndef BUILD_BRIDGE - if (aIn.count > 0 && x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (aIn.count > 0 && x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #else if (aIn.count > 0) #endif @@ -2000,19 +2004,19 @@ public: { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); } } else if (aIn.count > 1) { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); - if (abs(inBuffer[1][k]) > aInsPeak[1]) - aInsPeak[1] = abs(inBuffer[1][k]); + if (std::abs(inBuffer[1][k]) > aInsPeak[1]) + aInsPeak[1] = std::abs(inBuffer[1][k]); } } } @@ -2669,13 +2673,13 @@ public: // Output VU #ifndef BUILD_BRIDGE - if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #endif { for (k=0; i < 2 && k < frames; k++) { - if (abs(outBuffer[i][k]) > aOutsPeak[i]) - aOutsPeak[i] = abs(outBuffer[i][k]); + if (std::abs(outBuffer[i][k]) > aOutsPeak[i]) + aOutsPeak[i] = std::abs(outBuffer[i][k]); } } } @@ -3966,7 +3970,7 @@ public: features[lv2_feature_id_bufsize_bounded]->data = nullptr; #ifndef BUILD_BRIDGE - if (x_engine->processHighPrecision()) + if (x_engine->getOptions().processHighPrecision) { features[lv2_feature_id_bufsize_fixed] = new LV2_Feature; features[lv2_feature_id_bufsize_fixed]->URI = LV2_BUF_SIZE__fixedBlockLength; @@ -4193,13 +4197,17 @@ public: int eQt4, eCocoa, eHWND, eX11, eGtk2, eGtk3, iCocoa, iHWND, iX11, iQt4, iExt, iSuil, iFinal; eQt4 = eCocoa = eHWND = eX11 = eGtk2 = eGtk3 = iQt4 = iCocoa = iHWND = iX11 = iExt = iSuil = iFinal = -1; +#ifndef BUILD_BRIDGE + const bool preferUiBridges = x_engine->getOptions().preferUiBridges; +#endif + for (uint32_t i=0; i < rdf_descriptor->UICount; i++) { switch (rdf_descriptor->UIs[i].Type) { case LV2_UI_QT4: #ifndef BUILD_BRIDGE - if (isUiBridgeable(i) && x_engine->preferUiBridges()) + if (isUiBridgeable(i) && preferUiBridges) eQt4 = i; #endif iQt4 = i; @@ -4207,7 +4215,7 @@ public: case LV2_UI_COCOA: #ifndef BUILD_BRIDGE - if (isUiBridgeable(i) && x_engine->preferUiBridges()) + if (isUiBridgeable(i) && preferUiBridges) eCocoa = i; #endif iCocoa = i; @@ -4215,7 +4223,7 @@ public: case LV2_UI_WINDOWS: #ifndef BUILD_BRIDGE - if (isUiBridgeable(i) && x_engine->preferUiBridges()) + if (isUiBridgeable(i) && preferUiBridges) eHWND = i; #endif iHWND = i; @@ -4223,7 +4231,7 @@ public: case LV2_UI_X11: #ifndef BUILD_BRIDGE - if (isUiBridgeable(i) && x_engine->preferUiBridges()) + if (isUiBridgeable(i) && preferUiBridges) eX11 = i; #endif iX11 = i; @@ -4234,7 +4242,7 @@ public: if (false) #else # ifdef WANT_SUIL - if (isUiBridgeable(i) && x_engine->preferUiBridges()) + if (isUiBridgeable(i) && preferUiBridges) # else if (isUiBridgeable(i)) # endif @@ -4668,7 +4676,7 @@ CarlaPlugin* CarlaPlugin::newLV2(const initializer& init) plugin->reload(); # ifndef BUILD_BRIDGE - if (init.engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) + if (init.engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK) { if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO)) { diff --git a/c++/carla-plugin/native.cpp b/c++/carla-plugin/native.cpp index d813a07..d51f76f 100644 --- a/c++/carla-plugin/native.cpp +++ b/c++/carla-plugin/native.cpp @@ -315,22 +315,22 @@ public: CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); } - void setCustomData(const CustomDataType type, const char* const key, const char* const value, const bool sendGui) + void setCustomData(const char* const type, const char* const key, const char* const value, const bool sendGui) { CARLA_ASSERT(descriptor); CARLA_ASSERT(handle); - CARLA_ASSERT(type == CUSTOM_DATA_STRING); + CARLA_ASSERT(type); CARLA_ASSERT(key); CARLA_ASSERT(value); - if (type != CUSTOM_DATA_STRING) - return qCritical("NativePlugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is not string", CustomDataType2Str(type), key, value, bool2str(sendGui)); + if (! type) + return qCritical("NativePlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is not string", type, key, value, bool2str(sendGui)); if (! key) - return qCritical("NativePlugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2Str(type), key, value, bool2str(sendGui)); + return qCritical("NativePlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - key is null", type, key, value, bool2str(sendGui)); if (! value) - return qCritical("Nativelugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2Str(type), key, value, bool2str(sendGui)); + return qCritical("Nativelugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - value is null", type, key, value, bool2str(sendGui)); if (descriptor && handle) { @@ -408,6 +408,8 @@ public: qDebug("NativePlugin::reload() - start"); CARLA_ASSERT(descriptor); + const ProcessMode processMode(x_engine->getOptions().processMode); + // Safely disable plugin for reload const ScopedDisabler m(this); @@ -434,7 +436,7 @@ public: bool forcedStereoIn, forcedStereoOut; forcedStereoIn = forcedStereoOut = false; - if (x_engine->forceStereo() && (aIns == 1 || aOuts == 1) && mIns <= 1 && mOuts <= 1 && ! h2) + if (x_engine->getOptions().forceStereo && (aIns == 1 || aOuts == 1) && mIns <= 1 && mOuts <= 1 && ! h2) { h2 = descriptor->instantiate(descriptor, &host); @@ -489,7 +491,7 @@ public: // Audio Ins for (j=0; j < descriptor->audioIns; j++) { - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) sprintf(portName, "%s:input_%02i", m_name, j+1); else sprintf(portName, "input_%02i", j+1); @@ -508,7 +510,7 @@ public: // Audio Outs for (j=0; j < descriptor->audioOuts; j++) { - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) sprintf(portName, "%s:output_%02i", m_name, j+1); else sprintf(portName, "output_%02i", j+1); @@ -529,7 +531,7 @@ public: // MIDI Input for (j=0; j < mIns; j++) { - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) sprintf(portName, "%s:midi-in_%02i", m_name, j+1); else sprintf(portName, "midi-in_%02i", j+1); @@ -541,7 +543,7 @@ public: // MIDI Output for (j=0; j < mOuts; j++) { - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) sprintf(portName, "%s:midi-out_%02i", m_name, j+1); else sprintf(portName, "midi-out_%02i", j+1); @@ -660,7 +662,7 @@ public: if (needsCtrlIn) { - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { strcpy(portName, m_name); strcat(portName, ":control-in"); @@ -673,7 +675,7 @@ public: if (needsCtrlOut) { - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { strcpy(portName, m_name); strcat(portName, ":control-out"); @@ -771,7 +773,7 @@ public: } else { - x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0); + x_engine->callback(CALLBACK_RELOAD_PROGRAMS, m_id, 0, 0, 0.0, nullptr); // Check if current program is invalid bool programChanged = false; @@ -825,25 +827,25 @@ public: // -------------------------------------------------------------------------------------------------------- // Input VU - if (aIn.count > 0 && x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (aIn.count > 0 && x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) { if (aIn.count == 1) { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); } } else if (aIn.count > 1) { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); - if (abs(inBuffer[1][k]) > aInsPeak[1]) - aInsPeak[1] = abs(inBuffer[1][k]); + if (std::abs(inBuffer[1][k]) > aInsPeak[1]) + aInsPeak[1] = std::abs(inBuffer[1][k]); } } } @@ -1270,12 +1272,12 @@ public: } // Output VU - if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) { for (k=0; i < 2 && k < frames; k++) { - if (abs(outBuffer[i][k]) > aOutsPeak[i]) - aOutsPeak[i] = abs(outBuffer[i][k]); + if (std::abs(outBuffer[i][k]) > aOutsPeak[i]) + aOutsPeak[i] = std::abs(outBuffer[i][k]); } } } @@ -1547,12 +1549,13 @@ public: carla_register_native_plugin_bypass(); carla_register_native_plugin_midiSplit(); + + carla_register_native_plugin_3BandEQ(); + carla_register_native_plugin_3BandSplitter(); + #ifdef WANT_ZYNADDSUBFX carla_register_native_plugin_zynaddsubfx(); #endif - - //carla_register_native_plugin_3BandEQ(); - //carla_register_native_plugin_3BandSplitter(); } // ------------------------------------------------------------------- @@ -1662,7 +1665,7 @@ CarlaPlugin* CarlaPlugin::newNative(const initializer& init) plugin->reload(); - if (init.engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) + if (init.engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK) { if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO)) { diff --git a/c++/carla-plugin/vst.cpp b/c++/carla-plugin/vst.cpp index f65468d..0f95f47 100644 --- a/c++/carla-plugin/vst.cpp +++ b/c++/carla-plugin/vst.cpp @@ -98,7 +98,7 @@ public: if (osc.thread) { // Wait a bit first, try safe quit, then force kill - if (osc.thread->isRunning() && ! osc.thread->wait(x_engine->oscUiTimeout() * 100)) + if (osc.thread->isRunning() && ! osc.thread->wait(x_engine->getOptions().oscUiTimeout * 100)) { qWarning("Failed to properly stop VST OSC GUI thread"); osc.thread->terminate(); @@ -473,6 +473,10 @@ public: qDebug("VstPlugin::reload() - start"); CARLA_ASSERT(effect); +#ifndef BUILD_BRIDGE + const ProcessMode processMode(x_engine->getOptions().processMode); +#endif + // Safely disable plugin for reload const ScopedDisabler m(this); @@ -527,7 +531,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -547,7 +551,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -681,7 +685,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -698,7 +702,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -715,7 +719,7 @@ public: portName.clear(); #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT) + if (processMode == PROCESS_MODE_SINGLE_CLIENT) { portName = m_name; portName += ":"; @@ -914,7 +918,7 @@ public: // Input VU #ifndef BUILD_BRIDGE - if (aIn.count > 0 && x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (aIn.count > 0 && x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #else if (aIn.count > 0) #endif @@ -923,19 +927,19 @@ public: { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); } } else if (aIn.count > 1) { for (k=0; k < frames; k++) { - if (abs(inBuffer[0][k]) > aInsPeak[0]) - aInsPeak[0] = abs(inBuffer[0][k]); + if (std::abs(inBuffer[0][k]) > aInsPeak[0]) + aInsPeak[0] = std::abs(inBuffer[0][k]); - if (abs(inBuffer[1][k]) > aInsPeak[1]) - aInsPeak[1] = abs(inBuffer[1][k]); + if (std::abs(inBuffer[1][k]) > aInsPeak[1]) + aInsPeak[1] = std::abs(inBuffer[1][k]); } } } @@ -1368,13 +1372,13 @@ public: // Output VU #ifndef BUILD_BRIDGE - if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK) #endif { for (k=0; i < 2 && k < frames; k++) { - if (abs(outBuffer[i][k]) > aOutsPeak[i]) - aOutsPeak[i] = abs(outBuffer[i][k]); + if (std::abs(outBuffer[i][k]) > aOutsPeak[i]) + aOutsPeak[i] = std::abs(outBuffer[i][k]); } } } @@ -1624,7 +1628,7 @@ public: return 1; #ifndef BUILD_BRIDGE - if (x_engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) + if (x_engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK) { qCritical("VstPlugin::handleAudioMasterIOChanged() - plugin asked IO change, but it's not supported in rack mode"); return 0; @@ -2425,7 +2429,7 @@ CarlaPlugin* CarlaPlugin::newVST(const initializer& init) plugin->reload(); # ifndef BUILD_BRIDGE - if (init.engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK) + if (init.engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK) { if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO)) {