Browse Source

Carla: Continue rework, fix peaks

tags/v0.9.0
falkTX 12 years ago
parent
commit
721a95d7ac
19 changed files with 424 additions and 223 deletions
  1. +9
    -9
      c++/carla-backend/Makefile
  2. +5
    -1
      c++/carla-engine/carla_engine.cpp
  3. +203
    -57
      c++/carla-engine/carla_engine.hpp
  4. +6
    -2
      c++/carla-engine/carla_engine_osc.hpp
  5. +6
    -0
      c++/carla-engine/carla_engine_thread.cpp
  6. +5
    -5
      c++/carla-engine/jack.cpp
  7. +4
    -4
      c++/carla-engine/plugin.cpp
  8. +4
    -4
      c++/carla-engine/rtaudio.cpp
  9. +9
    -8
      c++/carla-plugin/carla_bridge.cpp
  10. +17
    -11
      c++/carla-plugin/carla_plugin.cpp
  11. +8
    -1
      c++/carla-plugin/carla_plugin.pro
  12. +4
    -4
      c++/carla-plugin/carla_plugin_thread.cpp
  13. +22
    -18
      c++/carla-plugin/dssi.cpp
  14. +11
    -9
      c++/carla-plugin/fluidsynth.cpp
  15. +17
    -13
      c++/carla-plugin/ladspa.cpp
  16. +10
    -8
      c++/carla-plugin/linuxsampler.cpp
  17. +31
    -23
      c++/carla-plugin/lv2.cpp
  18. +31
    -28
      c++/carla-plugin/native.cpp
  19. +22
    -18
      c++/carla-plugin/vst.cpp

+ 9
- 9
c++/carla-backend/Makefile View File

@@ -56,15 +56,15 @@ endif
OBJS = \ OBJS = \
carla_backend_standalone.o \ 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


# -------------------------------------------------------------- # --------------------------------------------------------------




+ 5
- 1
c++/carla-engine/carla_engine.cpp View File

@@ -498,7 +498,7 @@ int CarlaEngine::maxPortNameSize()
return STR_MAX; return STR_MAX;
} }


unsigned short CarlaEngine::maxPluginNumber()
unsigned short CarlaEngine::maxPluginNumber() const
{ {
return m_maxPluginNumber; return m_maxPluginNumber;
} }
@@ -1248,7 +1248,11 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize)
// ------------------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------------------
// Carla Engine OSC stuff // 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) void CarlaEngine::osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id)
#endif
{ {
// Peak values // Peak values
if (plugin->audioInCount() > 0) if (plugin->audioInCount() > 0)


+ 203
- 57
c++/carla-engine/carla_engine.hpp View File

@@ -520,12 +520,6 @@ private:
class CarlaEngine class CarlaEngine
{ {
public: public:
/*!
* The contructor.\n
* \note This only initializes engine data, it doesn't initialize the engine itself.
*/
CarlaEngine();

/*! /*!
* The decontructor. * The decontructor.
* The engine must have been closed before this happens. * The engine must have been closed before this happens.
@@ -549,49 +543,121 @@ public:
/*! /*!
* Get the name of the engine driver at \a index. * 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); static CarlaEngine* newDriverByName(const char* const driverName);


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Maximum values // Maximum values


/*!
* Maximum client name size.
*/
virtual int maxClientNameSize(); virtual int maxClientNameSize();

/*!
* Maximum port name size.
*/
virtual int maxPortNameSize(); 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 // Virtual, per-engine type calls


/*!
* Initialize engine, using \a clientName.
*/
virtual bool init(const char* const clientName); virtual bool init(const char* const clientName);

/*!
* Close engine.
*/
virtual bool close(); virtual bool close();
virtual bool isOffline() const = 0;

/*!
* Check if engine is running.
*/
virtual bool isRunning() const = 0; 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; 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; virtual CarlaEngineClient* addClient(CarlaPlugin* const plugin) = 0;


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Plugin management // 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; CarlaPlugin* getPlugin(const unsigned short id) const;

/*!
* Get plugin with id \a id, faster unchecked version.
*/
CarlaPlugin* getPluginUnchecked(const unsigned short id) const; 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); 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); 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 // bridge, internal use only
// TODO - find a better way for this
void __bridgePluginRegister(const unsigned short id, CarlaPlugin* const plugin) void __bridgePluginRegister(const unsigned short id, CarlaPlugin* const plugin)
{ {
m_carlaPlugins[id] = plugin; m_carlaPlugins[id] = plugin;
@@ -600,11 +666,30 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Information (base) // Information (base)


/*!
* Get engine name.
*/
const char* getName() const; const char* getName() const;
double getSampleRate() const;

/*!
* Get current sample rate.
*/
double getSampleRate() const;

/*!
* Get current buffer size.
*/
uint32_t getBufferSize() const; uint32_t getBufferSize() const;

/*!
* Get current Time information.
*/
const CarlaEngineTimeInfo* getTimeInfo() const; 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(); void aboutToClose();


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -624,78 +709,127 @@ public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Error handling // Error handling


/*!
* Get last error.
*/
const char* getLastError() const; const char* getLastError() const;

/*!
* Set last error.
*/
void setLastError(const char* const error); void setLastError(const char* const error);


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Options // Options


void setOption(const OptionsType option, const int value, const char* const valueStr);

/*!
* Get the engine options (read-only).
*/
const CarlaEngineOptions& getOptions() const const CarlaEngineOptions& getOptions() const
{ {
return options; 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 #endif


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// Mutex locks // Mutex locks


/*!
* Lock processing.
*/
void processLock(); void processLock();

/*!
* Unlock processing.
*/
void processUnlock(); void processUnlock();

/*!
* Lock MIDI.
*/
void midiLock(); void midiLock();

/*!
* Unlock MIDI.
*/
void midiUnlock(); void midiUnlock();


// ------------------------------------------------------------------- // -------------------------------------------------------------------
// OSC Stuff // OSC Stuff


/*!
* Check if OSC controller is registered.
*/
bool isOscControlRegisted() const; bool isOscControlRegisted() const;


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
/*!
* Idle OSC.
*/
bool idleOsc(); bool idleOsc();

/*!
* Get OSC TCP server path.
*/
const char* getOscServerPathTCP() const; const char* getOscServerPathTCP() const;

/*!
* Get OSC UDP server path.
*/
const char* getOscServerPathUDP() const; const char* getOscServerPathUDP() const;
#else #else
/*!
* Set OSC bridge data.
*/
void setOscBridgeData(const CarlaOscData* const oscData); void setOscBridgeData(const CarlaOscData* const oscData);
#endif #endif


#ifdef BUILD_BRIDGE
void osc_send_peaks(CarlaPlugin* const plugin);
#else
void osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id); void osc_send_peaks(CarlaPlugin* const plugin, const unsigned short& id);
#endif


#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
void osc_send_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total); void osc_send_bridge_audio_count(const int32_t ins, const int32_t outs, const int32_t total);
@@ -796,6 +930,19 @@ public:
// ------------------------------------- // -------------------------------------


protected: 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 #ifndef BUILD_BRIDGE
CarlaEngineOptions options; CarlaEngineOptions options;
#endif #endif
@@ -809,16 +956,15 @@ protected:


private: private:
CarlaEngineThread m_thread; CarlaEngineThread m_thread;

#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
CarlaEngineOsc m_osc; CarlaEngineOsc m_osc;
#endif #endif

const CarlaOscData* m_oscData; const CarlaOscData* m_oscData;


CallbackFunc m_callback; CallbackFunc m_callback;
void* m_callbackPtr; void* m_callbackPtr;

CarlaString m_lastError;
CarlaString m_lastError;


QMutex m_procLock; QMutex m_procLock;
QMutex m_midiLock; QMutex m_midiLock;


+ 6
- 2
c++/carla-engine/carla_engine_osc.hpp View File

@@ -18,6 +18,10 @@
#ifndef CARLA_ENGINE_OSC_HPP #ifndef CARLA_ENGINE_OSC_HPP
#define 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_backend.hpp"
#include "carla_osc_utils.hpp" #include "carla_osc_utils.hpp"


@@ -77,12 +81,12 @@ public:


const char* getServerPathTCP() const const char* getServerPathTCP() const
{ {
return m_serverPathTCP;
return (const char*)m_serverPathTCP;
} }


const char* getServerPathUDP() const const char* getServerPathUDP() const
{ {
return m_serverPathUDP;
return (const char*)m_serverPathUDP;
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------


+ 6
- 0
c++/carla-engine/carla_engine_thread.cpp View File

@@ -129,7 +129,13 @@ void CarlaEngineThread::run()
// Update OSC control client peaks // Update OSC control client peaks


if (oscControlRegisted) if (oscControlRegisted)
{
#ifdef BUILD_BRIDGE
engine->osc_send_peaks(plugin);
#else
engine->osc_send_peaks(plugin, id); engine->osc_send_peaks(plugin, id);
#endif
}
} }
} }




+ 5
- 5
c++/carla-engine/jack.cpp View File

@@ -616,11 +616,6 @@ public:
return false; return false;
} }


bool isOffline() const
{
return m_freewheel;
}

bool isRunning() const bool isRunning() const
{ {
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
@@ -630,6 +625,11 @@ public:
#endif #endif
} }


bool isOffline() const
{
return m_freewheel;
}

CarlaEngineType type() const CarlaEngineType type() const
{ {
return CarlaEngineTypeJack; return CarlaEngineTypeJack;


+ 4
- 4
c++/carla-engine/plugin.cpp View File

@@ -149,14 +149,14 @@ public:
return true; 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 CarlaEngineType type() const


+ 4
- 4
c++/carla-engine/rtaudio.cpp View File

@@ -233,14 +233,14 @@ public:
return true; 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 CarlaEngineType type() const


+ 9
- 8
c++/carla-plugin/carla_bridge.cpp View File

@@ -313,7 +313,8 @@ public:
} }


// create new if needed // 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) if (param.count > 0)
{ {
@@ -580,7 +581,7 @@ public:
} }
else if (strcmp(key, CARLA_BRIDGE_MSG_HIDE_GUI) == 0) 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) else if (strcmp(key, CARLA_BRIDGE_MSG_SAVED) == 0)
{ {
@@ -649,15 +650,15 @@ public:
{ {
CARLA_BRIDGE_CHECK_OSC_TYPES(3, "sss"); 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 key = (const char*)&argv[1]->s;
const char* const value = (const char*)&argv[2]->s; const char* const value = (const char*)&argv[2]->s;


CARLA_ASSERT(stype);
CARLA_ASSERT(type);
CARLA_ASSERT(key); CARLA_ASSERT(key);
CARLA_ASSERT(value); CARLA_ASSERT(value);


setCustomData(getCustomDataStringType(stype), key, value, false);
setCustomData(type, key, value, false);


break; break;
} }
@@ -751,9 +752,9 @@ public:
CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); 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(key);
CARLA_ASSERT(value); CARLA_ASSERT(value);


@@ -761,7 +762,7 @@ public:
{ {
// TODO - if type is chunk|binary, store it in a file and send path instead // TODO - if type is chunk|binary, store it in a file and send path instead
QString cData; QString cData;
cData = getCustomDataTypeString(type);
cData = type;
cData += "·"; cData += "·";
cData += key; cData += key;
cData += "·"; cData += "·";


+ 17
- 11
c++/carla-plugin/carla_plugin.cpp View File

@@ -57,14 +57,17 @@ CarlaPlugin::CarlaPlugin(CarlaEngine* const engine, const unsigned short id)
// options // options
m_ctrlInChannel = 0; m_ctrlInChannel = 0;
m_fixedBufferSize = true; m_fixedBufferSize = true;

#ifdef BUILD_BRIDGE
m_processHighPrecision = false; 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 #endif


// latency // latency
@@ -433,7 +436,7 @@ void CarlaPlugin::setId(const unsigned short id)
{ {
m_id = id; m_id = id;


if (x_engine->processMode() == PROCESS_MODE_CONTINUOUS_RACK)
if (x_engine->getOptions().processMode == PROCESS_MODE_CONTINUOUS_RACK)
m_ctrlInChannel = id; m_ctrlInChannel = id;
} }
#endif #endif
@@ -948,10 +951,11 @@ void CarlaPlugin::registerToOscControl()


// Plugin Parameters // Plugin Parameters
#ifdef BUILD_BRIDGE #ifdef BUILD_BRIDGE
uint32_t maxParameters = MAX_PARAMETERS;
const uint32_t maxParameters = MAX_PARAMETERS;
#else #else
uint32_t maxParameters = x_engine->maxParameters();
const uint32_t maxParameters = x_engine->getOptions().maxParameters;
#endif #endif

if (param.count > 0 && param.count < maxParameters) if (param.count > 0 && param.count < maxParameters)
{ {
char bufName[STR_MAX], bufUnit[STR_MAX]; char bufName[STR_MAX], bufUnit[STR_MAX];
@@ -1097,8 +1101,10 @@ bool CarlaPlugin::waitForOscGuiShow()
{ {
qWarning("CarlaPlugin::waitForOscGuiShow()"); qWarning("CarlaPlugin::waitForOscGuiShow()");


const uint oscUiTimeout = x_engine->getOptions().oscUiTimeout;

// wait for UI 'update' call // 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) if (osc.data.target)
{ {
@@ -1110,7 +1116,7 @@ bool CarlaPlugin::waitForOscGuiShow()
carla_msleep(100); 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; return false;
} }
#endif #endif


+ 8
- 1
c++/carla-plugin/carla_plugin.pro View File

@@ -9,10 +9,17 @@ CONFIG += link_pkgconfig qt warn_on
DEFINES = DEBUG DEFINES = DEBUG
DEFINES += QTCREATOR_TEST DEFINES += QTCREATOR_TEST


# Plugins
DEFINES += WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST DEFINES += WANT_LADSPA WANT_DSSI WANT_LV2 WANT_VST

# Samplers
DEFINES += WANT_FLUIDSYNTH WANT_LINUXSAMPLER

# ZynAddSubFX
DEFINES += WANT_ZYNADDSUBFX DEFINES += WANT_ZYNADDSUBFX

# Misc
DEFINES += WANT_SUIL DEFINES += WANT_SUIL
DEFINES += WANT_FLUIDSYNTH WANT_LINUXSAMPLER


PKGCONFIG = liblo suil-0 fluidsynth linuxsampler PKGCONFIG = liblo suil-0 fluidsynth linuxsampler




+ 4
- 4
c++/carla-plugin/carla_plugin_thread.cpp View File

@@ -122,13 +122,13 @@ void CarlaPluginThread::run()
if (m_process->exitCode() == 0) if (m_process->exitCode() == 0)
{ {
// Hide // 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"); qWarning("CarlaPluginThread::run() - GUI closed");
} }
else else
{ {
// Kill // 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"); qWarning("CarlaPluginThread::run() - GUI crashed");
break; break;
} }
@@ -136,7 +136,7 @@ void CarlaPluginThread::run()
else else
{ {
qDebug("CarlaPluginThread::run() - GUI timeout"); 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; break;


@@ -151,7 +151,7 @@ void CarlaPluginThread::run()
"Saving now will lose its current settings.\n" "Saving now will lose its current settings.\n"
"Please remove this plugin, and not rely on it from this point.").arg(plugin->name()); "Please remove this plugin, and not rely on it from this point.").arg(plugin->name());
engine->setLastError(errorString.toUtf8().constData()); 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; break;


+ 22
- 18
c++/carla-plugin/dssi.cpp View File

@@ -64,7 +64,7 @@ public:
if (osc.thread) if (osc.thread)
{ {
// Wait a bit first, try safe quit, then force kill // 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"); qWarning("Failed to properly stop DSSI GUI thread");
osc.thread->terminate(); osc.thread->terminate();
@@ -340,6 +340,10 @@ public:
qDebug("DssiPlugin::reload() - start"); qDebug("DssiPlugin::reload() - start");
CARLA_ASSERT(descriptor && ldescriptor); CARLA_ASSERT(descriptor && ldescriptor);


#ifndef BUILD_BRIDGE
const ProcessMode processMode(x_engine->getOptions().processMode);
#endif

// Safely disable plugin for reload // Safely disable plugin for reload
const ScopedDisabler m(this); const ScopedDisabler m(this);


@@ -377,7 +381,7 @@ public:
} }


#ifndef BUILD_BRIDGE #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); h2 = ldescriptor->instantiate(ldescriptor, sampleRate);


@@ -433,7 +437,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -632,7 +636,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -649,7 +653,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -666,7 +670,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -689,7 +693,7 @@ public:
m_hints |= PLUGIN_IS_SYNTH; m_hints |= PLUGIN_IS_SYNTH;


#ifndef BUILD_BRIDGE #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) if (descriptor->get_custom_data && descriptor->set_custom_data)
m_hints |= PLUGIN_USES_CHUNKS; m_hints |= PLUGIN_USES_CHUNKS;
@@ -881,7 +885,7 @@ public:
// Input VU // Input VU


#ifndef BUILD_BRIDGE #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 #else
if (aIn.count > 0) if (aIn.count > 0)
#endif #endif
@@ -890,19 +894,19 @@ public:
{ {
for (k=0; k < frames; k++) 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) else if (aIn.count > 1)
{ {
for (k=0; k < frames; k++) 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 // Output VU
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK)
#endif #endif
{ {
for (k=0; i < 2 && k < frames; k++) 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(); plugin->reload();


# ifndef BUILD_BRIDGE # 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)) if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{ {


+ 11
- 9
c++/carla-plugin/fluidsynth.cpp View File

@@ -392,6 +392,8 @@ public:
qDebug("FluidSynthPlugin::reload() - start"); qDebug("FluidSynthPlugin::reload() - start");
CARLA_ASSERT(f_synth); CARLA_ASSERT(f_synth);


const ProcessMode processMode(x_engine->getOptions().processMode);

// Safely disable plugin for reload // Safely disable plugin for reload
const ScopedDisabler m(this); const ScopedDisabler m(this);


@@ -423,7 +425,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -439,7 +441,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -458,7 +460,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -476,7 +478,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -491,7 +493,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -839,7 +841,7 @@ public:
} }
else 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); fluid_synth_set_gain(f_synth, x_volume);


// Output VU // 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++) 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]);
} }
} }
} }


+ 17
- 13
c++/carla-plugin/ladspa.cpp View File

@@ -338,6 +338,10 @@ public:
qDebug("LadspaPlugin::reload() - start"); qDebug("LadspaPlugin::reload() - start");
CARLA_ASSERT(descriptor); CARLA_ASSERT(descriptor);


#ifndef BUILD_BRIDGE
const ProcessMode processMode(x_engine->getOptions().processMode);
#endif

// Safely disable plugin for reload // Safely disable plugin for reload
const ScopedDisabler m(this); const ScopedDisabler m(this);


@@ -375,7 +379,7 @@ public:
} }


#ifndef BUILD_BRIDGE #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); h2 = descriptor->instantiate(descriptor, sampleRate);


@@ -429,7 +433,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -623,7 +627,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -640,7 +644,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -745,7 +749,7 @@ public:
// Input VU // Input VU


#ifndef BUILD_BRIDGE #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 #else
if (aIn.count > 0) if (aIn.count > 0)
#endif #endif
@@ -754,19 +758,19 @@ public:
{ {
for (k=0; k < frames; k++) 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) else if (aIn.count > 1)
{ {
for (k=0; k < frames; k++) 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 // Output VU
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK)
#endif #endif
{ {
for (k=0; i < 2 && k < frames; k++) for (k=0; i < 2 && k < frames; k++)
@@ -1247,7 +1251,7 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const initializer& init, const void* const e
plugin->reload(); plugin->reload();


# ifndef BUILD_BRIDGE # 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)) if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{ {


+ 10
- 8
c++/carla-plugin/linuxsampler.cpp View File

@@ -264,6 +264,8 @@ public:
qDebug("LinuxSamplerPlugin::reload() - start"); qDebug("LinuxSamplerPlugin::reload() - start");
CARLA_ASSERT(instrument); CARLA_ASSERT(instrument);


const ProcessMode processMode(x_engine->getOptions().processMode);

// Safely disable plugin for reload // Safely disable plugin for reload
const ScopedDisabler m(this); const ScopedDisabler m(this);


@@ -291,7 +293,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -307,7 +309,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -326,7 +328,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -344,7 +346,7 @@ public:
{ {
portName.clear(); portName.clear();


if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -428,7 +430,7 @@ public:
} }
else 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 // 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++) 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]);
} }
} }
} }


+ 31
- 23
c++/carla-plugin/lv2.cpp View File

@@ -345,7 +345,7 @@ public:
if (osc.thread) if (osc.thread)
{ {
// Wait a bit first, try safe quit, then force kill // 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"); qWarning("Failed to properly stop LV2 OSC GUI thread");
osc.thread->terminate(); osc.thread->terminate();
@@ -433,7 +433,7 @@ public:
delete (LV2_Worker_Schedule*)features[lv2_feature_id_worker]->data; delete (LV2_Worker_Schedule*)features[lv2_feature_id_worker]->data;


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (! x_engine->processHighPrecision())
if (! x_engine->getOptions().processHighPrecision)
#endif #endif
{ {
features[lv2_feature_id_bufsize_fixed] = nullptr; features[lv2_feature_id_bufsize_fixed] = nullptr;
@@ -1113,6 +1113,10 @@ public:
qDebug("Lv2Plugin::reload() - start"); qDebug("Lv2Plugin::reload() - start");
CARLA_ASSERT(descriptor && rdf_descriptor); CARLA_ASSERT(descriptor && rdf_descriptor);


#ifndef BUILD_BRIDGE
const ProcessMode processMode(x_engine->getOptions().processMode);
#endif

// Safely disable plugin for reload // Safely disable plugin for reload
const ScopedDisabler m(this); const ScopedDisabler m(this);


@@ -1196,7 +1200,7 @@ public:
} }


#ifndef BUILD_BRIDGE #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); h2 = descriptor->instantiate(descriptor, sampleRate, rdf_descriptor->Bundle, features);


@@ -1316,7 +1320,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -1699,7 +1703,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -1716,7 +1720,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -1991,7 +1995,7 @@ public:
// Input VU // Input VU


#ifndef BUILD_BRIDGE #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 #else
if (aIn.count > 0) if (aIn.count > 0)
#endif #endif
@@ -2000,19 +2004,19 @@ public:
{ {
for (k=0; k < frames; k++) 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) else if (aIn.count > 1)
{ {
for (k=0; k < frames; k++) 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 // Output VU
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK)
#endif #endif
{ {
for (k=0; i < 2 && k < frames; k++) 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; features[lv2_feature_id_bufsize_bounded]->data = nullptr;


#ifndef BUILD_BRIDGE #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] = new LV2_Feature;
features[lv2_feature_id_bufsize_fixed]->URI = LV2_BUF_SIZE__fixedBlockLength; 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; 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; 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++) for (uint32_t i=0; i < rdf_descriptor->UICount; i++)
{ {
switch (rdf_descriptor->UIs[i].Type) switch (rdf_descriptor->UIs[i].Type)
{ {
case LV2_UI_QT4: case LV2_UI_QT4:
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (isUiBridgeable(i) && x_engine->preferUiBridges())
if (isUiBridgeable(i) && preferUiBridges)
eQt4 = i; eQt4 = i;
#endif #endif
iQt4 = i; iQt4 = i;
@@ -4207,7 +4215,7 @@ public:


case LV2_UI_COCOA: case LV2_UI_COCOA:
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (isUiBridgeable(i) && x_engine->preferUiBridges())
if (isUiBridgeable(i) && preferUiBridges)
eCocoa = i; eCocoa = i;
#endif #endif
iCocoa = i; iCocoa = i;
@@ -4215,7 +4223,7 @@ public:


case LV2_UI_WINDOWS: case LV2_UI_WINDOWS:
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (isUiBridgeable(i) && x_engine->preferUiBridges())
if (isUiBridgeable(i) && preferUiBridges)
eHWND = i; eHWND = i;
#endif #endif
iHWND = i; iHWND = i;
@@ -4223,7 +4231,7 @@ public:


case LV2_UI_X11: case LV2_UI_X11:
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (isUiBridgeable(i) && x_engine->preferUiBridges())
if (isUiBridgeable(i) && preferUiBridges)
eX11 = i; eX11 = i;
#endif #endif
iX11 = i; iX11 = i;
@@ -4234,7 +4242,7 @@ public:
if (false) if (false)
#else #else
# ifdef WANT_SUIL # ifdef WANT_SUIL
if (isUiBridgeable(i) && x_engine->preferUiBridges())
if (isUiBridgeable(i) && preferUiBridges)
# else # else
if (isUiBridgeable(i)) if (isUiBridgeable(i))
# endif # endif
@@ -4668,7 +4676,7 @@ CarlaPlugin* CarlaPlugin::newLV2(const initializer& init)
plugin->reload(); plugin->reload();


# ifndef BUILD_BRIDGE # 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)) if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{ {


+ 31
- 28
c++/carla-plugin/native.cpp View File

@@ -315,22 +315,22 @@ public:
CarlaPlugin::setParameterValue(parameterId, value, sendGui, sendOsc, sendCallback); 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(descriptor);
CARLA_ASSERT(handle); CARLA_ASSERT(handle);
CARLA_ASSERT(type == CUSTOM_DATA_STRING);
CARLA_ASSERT(type);
CARLA_ASSERT(key); CARLA_ASSERT(key);
CARLA_ASSERT(value); 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) 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) 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) if (descriptor && handle)
{ {
@@ -408,6 +408,8 @@ public:
qDebug("NativePlugin::reload() - start"); qDebug("NativePlugin::reload() - start");
CARLA_ASSERT(descriptor); CARLA_ASSERT(descriptor);


const ProcessMode processMode(x_engine->getOptions().processMode);

// Safely disable plugin for reload // Safely disable plugin for reload
const ScopedDisabler m(this); const ScopedDisabler m(this);


@@ -434,7 +436,7 @@ public:
bool forcedStereoIn, forcedStereoOut; bool forcedStereoIn, forcedStereoOut;
forcedStereoIn = forcedStereoOut = false; 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); h2 = descriptor->instantiate(descriptor, &host);


@@ -489,7 +491,7 @@ public:
// Audio Ins // Audio Ins
for (j=0; j < descriptor->audioIns; j++) 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); sprintf(portName, "%s:input_%02i", m_name, j+1);
else else
sprintf(portName, "input_%02i", j+1); sprintf(portName, "input_%02i", j+1);
@@ -508,7 +510,7 @@ public:
// Audio Outs // Audio Outs
for (j=0; j < descriptor->audioOuts; j++) 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); sprintf(portName, "%s:output_%02i", m_name, j+1);
else else
sprintf(portName, "output_%02i", j+1); sprintf(portName, "output_%02i", j+1);
@@ -529,7 +531,7 @@ public:
// MIDI Input // MIDI Input
for (j=0; j < mIns; j++) 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); sprintf(portName, "%s:midi-in_%02i", m_name, j+1);
else else
sprintf(portName, "midi-in_%02i", j+1); sprintf(portName, "midi-in_%02i", j+1);
@@ -541,7 +543,7 @@ public:
// MIDI Output // MIDI Output
for (j=0; j < mOuts; j++) 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); sprintf(portName, "%s:midi-out_%02i", m_name, j+1);
else else
sprintf(portName, "midi-out_%02i", j+1); sprintf(portName, "midi-out_%02i", j+1);
@@ -660,7 +662,7 @@ public:


if (needsCtrlIn) if (needsCtrlIn)
{ {
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
strcpy(portName, m_name); strcpy(portName, m_name);
strcat(portName, ":control-in"); strcat(portName, ":control-in");
@@ -673,7 +675,7 @@ public:


if (needsCtrlOut) if (needsCtrlOut)
{ {
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
strcpy(portName, m_name); strcpy(portName, m_name);
strcat(portName, ":control-out"); strcat(portName, ":control-out");
@@ -771,7 +773,7 @@ public:
} }
else 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 // Check if current program is invalid
bool programChanged = false; bool programChanged = false;
@@ -825,25 +827,25 @@ public:
// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
// Input VU // 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) if (aIn.count == 1)
{ {
for (k=0; k < frames; k++) 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) else if (aIn.count > 1)
{ {
for (k=0; k < frames; k++) 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 // 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++) 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_bypass();
carla_register_native_plugin_midiSplit(); carla_register_native_plugin_midiSplit();

carla_register_native_plugin_3BandEQ();
carla_register_native_plugin_3BandSplitter();

#ifdef WANT_ZYNADDSUBFX #ifdef WANT_ZYNADDSUBFX
carla_register_native_plugin_zynaddsubfx(); carla_register_native_plugin_zynaddsubfx();
#endif #endif

//carla_register_native_plugin_3BandEQ();
//carla_register_native_plugin_3BandSplitter();
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------
@@ -1662,7 +1665,7 @@ CarlaPlugin* CarlaPlugin::newNative(const initializer& init)


plugin->reload(); 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)) if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{ {


+ 22
- 18
c++/carla-plugin/vst.cpp View File

@@ -98,7 +98,7 @@ public:
if (osc.thread) if (osc.thread)
{ {
// Wait a bit first, try safe quit, then force kill // 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"); qWarning("Failed to properly stop VST OSC GUI thread");
osc.thread->terminate(); osc.thread->terminate();
@@ -473,6 +473,10 @@ public:
qDebug("VstPlugin::reload() - start"); qDebug("VstPlugin::reload() - start");
CARLA_ASSERT(effect); CARLA_ASSERT(effect);


#ifndef BUILD_BRIDGE
const ProcessMode processMode(x_engine->getOptions().processMode);
#endif

// Safely disable plugin for reload // Safely disable plugin for reload
const ScopedDisabler m(this); const ScopedDisabler m(this);


@@ -527,7 +531,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -547,7 +551,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -681,7 +685,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -698,7 +702,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -715,7 +719,7 @@ public:
portName.clear(); portName.clear();


#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() == PROCESS_MODE_SINGLE_CLIENT)
if (processMode == PROCESS_MODE_SINGLE_CLIENT)
{ {
portName = m_name; portName = m_name;
portName += ":"; portName += ":";
@@ -914,7 +918,7 @@ public:
// Input VU // Input VU


#ifndef BUILD_BRIDGE #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 #else
if (aIn.count > 0) if (aIn.count > 0)
#endif #endif
@@ -923,19 +927,19 @@ public:
{ {
for (k=0; k < frames; k++) 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) else if (aIn.count > 1)
{ {
for (k=0; k < frames; k++) 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 // Output VU
#ifndef BUILD_BRIDGE #ifndef BUILD_BRIDGE
if (x_engine->processMode() != PROCESS_MODE_CONTINUOUS_RACK)
if (x_engine->getOptions().processMode != PROCESS_MODE_CONTINUOUS_RACK)
#endif #endif
{ {
for (k=0; i < 2 && k < frames; k++) 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; return 1;


#ifndef BUILD_BRIDGE #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"); qCritical("VstPlugin::handleAudioMasterIOChanged() - plugin asked IO change, but it's not supported in rack mode");
return 0; return 0;
@@ -2425,7 +2429,7 @@ CarlaPlugin* CarlaPlugin::newVST(const initializer& init)
plugin->reload(); plugin->reload();


# ifndef BUILD_BRIDGE # 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)) if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{ {


Loading…
Cancel
Save