@@ -215,7 +215,7 @@ enum ParameterType SIZE_INT { | |||
* Internal parameter indexes.\n | |||
* These are special parameters used internally, plugins do not know about their existence. | |||
*/ | |||
enum InternalParametersIndex SIZE_INT { | |||
enum InternalParameterIndex SIZE_INT { | |||
PARAMETER_NULL = -1, //!< Null parameter. | |||
PARAMETER_ACTIVE = -2, //!< Active parameter, can only be 'true' or 'false'; default is 'false'. | |||
PARAMETER_DRYWET = -3, //!< Dry/Wet parameter, range 0.0...1.0; default is 1.0. | |||
@@ -227,232 +227,11 @@ enum InternalParametersIndex SIZE_INT { | |||
PARAMETER_MAX = -9 //!< Max value, defined for convenience. | |||
}; | |||
/*! | |||
* Engine process mode. | |||
* \see ENGINE_OPTION_PROCESS_MODE | |||
*/ | |||
enum ProcessMode SIZE_INT { | |||
PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins). | |||
PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin). | |||
PROCESS_MODE_CONTINUOUS_RACK = 2, //!< Single client, 'rack' mode. Processes plugins in order of Id, with forced stereo. | |||
PROCESS_MODE_PATCHBAY = 3, //!< Single client, 'patchbay' mode. | |||
PROCESS_MODE_BRIDGE = 4 //!< Special mode, used in plugin-bridges only. | |||
}; | |||
/*! | |||
* All the available transport modes | |||
*/ | |||
enum TransportMode SIZE_INT { | |||
TRANSPORT_MODE_INTERNAL = 0, //!< Internal transport mode. | |||
TRANSPORT_MODE_JACK = 1, //!< Transport from JACK, only available if driver name is "JACK". | |||
TRANSPORT_MODE_PLUGIN = 2, //!< Transport from host, used when Carla is a plugin. | |||
TRANSPORT_MODE_BRIDGE = 3 //!< Special mode, used in plugin-bridges only. | |||
}; | |||
/*! | |||
* Options used in the CarlaEngine::setOption() calls.\n | |||
* All options except paths must be set before initiliazing or after closing the engine. | |||
*/ | |||
enum EngineOptionsType SIZE_INT { | |||
/*! | |||
* Set the current process name.\n | |||
* This is a convenience option, as Python lacks this functionality. | |||
*/ | |||
ENGINE_OPTION_PROCESS_NAME = 0, | |||
/*! | |||
* Set the engine processing mode.\n | |||
* Default is PROCESS_MODE_MULTIPLE_CLIENTS on Linux and PROCESS_MODE_CONTINUOUS_RACK for all other OSes. | |||
* \see ProcessMode | |||
*/ | |||
ENGINE_OPTION_PROCESS_MODE = 1, | |||
/*! | |||
* Set the engine transport mode.\n | |||
* Default is TRANSPORT_MODE_INTERNAL. | |||
* \see TransportMode | |||
*/ | |||
ENGINE_OPTION_TRANSPORT_MODE = 2, | |||
/*! | |||
* Force mono plugins as stereo, by running 2 instances at the same time. | |||
* \note Not supported by all plugins. | |||
* \see PLUGIN_OPTION_FORCE_STEREO | |||
*/ | |||
ENGINE_OPTION_FORCE_STEREO = 3, | |||
/*! | |||
* Use plugin bridges whenever possible.\n | |||
* Default is no, EXPERIMENTAL. | |||
*/ | |||
ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4, | |||
/*! | |||
* Use UI bridges whenever possible, otherwise UIs will be handled in the main thread.\n | |||
* Default is yes. | |||
*/ | |||
ENGINE_OPTION_PREFER_UI_BRIDGES = 5, | |||
/*! | |||
* Make plugin UIs always-on-top.\n | |||
* Default is yes. | |||
*/ | |||
ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6, | |||
/*! | |||
* Maximum number of parameters allowed.\n | |||
* Default is MAX_DEFAULT_PARAMETERS. | |||
*/ | |||
ENGINE_OPTION_MAX_PARAMETERS = 7, | |||
/*! | |||
* Timeout value in ms for how much to wait for UI-Bridges to respond.\n | |||
* Default is 4000 (4 secs). | |||
*/ | |||
ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8, | |||
/*! | |||
* Audio number of periods. | |||
*/ | |||
ENGINE_OPTION_AUDIO_NUM_PERIODS = 9, | |||
/*! | |||
* Audio buffer size. | |||
*/ | |||
ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10, | |||
/*! | |||
* Audio sample rate. | |||
*/ | |||
ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11, | |||
/*! | |||
* Audio device. | |||
*/ | |||
ENGINE_OPTION_AUDIO_DEVICE = 12, | |||
/*! | |||
* Set path to the resource files.\n | |||
* Default unset. | |||
* | |||
* \note Must be set for some internal plugins to work! | |||
*/ | |||
ENGINE_OPTION_PATH_RESOURCES = 13, | |||
#ifndef BUILD_BRIDGE | |||
/*! | |||
* Set path to the native plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_NATIVE = 14, | |||
/*! | |||
* Set path to the POSIX 32bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_POSIX32 = 15, | |||
/*! | |||
* Set path to the POSIX 64bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_POSIX64 = 16, | |||
/*! | |||
* Set path to the Windows 32bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_WIN32 = 17, | |||
/*! | |||
* Set path to the Windows 64bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_WIN64 = 18, | |||
#endif | |||
#ifdef WANT_LV2 | |||
/*! | |||
* Set path to the LV2 External UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL = 19, | |||
/*! | |||
* Set path to the LV2 Gtk2 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2 = 20, | |||
/*! | |||
* Set path to the LV2 Gtk3 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3 = 21, | |||
/*! | |||
* Set path to the LV2 Ntk UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_NTK = 22, | |||
/*! | |||
* Set path to the LV2 Qt4 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_QT4 = 23, | |||
/*! | |||
* Set path to the LV2 Qt5 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_QT5 = 24, | |||
/*! | |||
* Set path to the LV2 Cocoa UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA = 25, | |||
/*! | |||
* Set path to the LV2 Windows UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS = 26, | |||
/*! | |||
* Set path to the LV2 X11 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_X11 = 27, | |||
#endif | |||
#ifdef WANT_VST | |||
/*! | |||
* Set path to the VST Mac UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_VST_MAC = 28, | |||
/*! | |||
* Set path to the VST HWND UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_VST_HWND = 29, | |||
/*! | |||
* Set path to the VST X11 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_VST_X11 = 30 | |||
#endif | |||
}; | |||
/*! | |||
* Opcodes sent from the engine callback to the GUI, as defined by EngineCallbackFunc. | |||
* \see CarlaEngine::setCallback() | |||
*/ | |||
enum EngineCallbackType SIZE_INT { | |||
enum EngineCallbackOpcode SIZE_INT { | |||
/*! | |||
* Debug.\n | |||
* This opcode is undefined and used only for testing purposes. | |||
@@ -698,10 +477,231 @@ enum EngineCallbackType SIZE_INT { | |||
ENGINE_CALLBACK_QUIT = 38 | |||
}; | |||
/*! | |||
* Options used in the CarlaEngine::setOption() calls.\n | |||
* All options except paths must be set before initiliazing or after closing the engine. | |||
*/ | |||
enum EngineOption SIZE_INT { | |||
/*! | |||
* Set the current process name.\n | |||
* This is a convenience option, as Python lacks this functionality. | |||
*/ | |||
ENGINE_OPTION_PROCESS_NAME = 0, | |||
/*! | |||
* Set the engine processing mode.\n | |||
* Default is PROCESS_MODE_MULTIPLE_CLIENTS on Linux and PROCESS_MODE_CONTINUOUS_RACK for all other OSes. | |||
* \see ProcessMode | |||
*/ | |||
ENGINE_OPTION_PROCESS_MODE = 1, | |||
/*! | |||
* Set the engine transport mode.\n | |||
* Default is TRANSPORT_MODE_INTERNAL. | |||
* \see TransportMode | |||
*/ | |||
ENGINE_OPTION_TRANSPORT_MODE = 2, | |||
/*! | |||
* Force mono plugins as stereo, by running 2 instances at the same time. | |||
* \note Not supported by all plugins. | |||
* \see PLUGIN_OPTION_FORCE_STEREO | |||
*/ | |||
ENGINE_OPTION_FORCE_STEREO = 3, | |||
/*! | |||
* Use plugin bridges whenever possible.\n | |||
* Default is no, EXPERIMENTAL. | |||
*/ | |||
ENGINE_OPTION_PREFER_PLUGIN_BRIDGES = 4, | |||
/*! | |||
* Use UI bridges whenever possible, otherwise UIs will be handled in the main thread.\n | |||
* Default is yes. | |||
*/ | |||
ENGINE_OPTION_PREFER_UI_BRIDGES = 5, | |||
/*! | |||
* Make plugin UIs always-on-top.\n | |||
* Default is yes. | |||
*/ | |||
ENGINE_OPTION_UIS_ALWAYS_ON_TOP = 6, | |||
/*! | |||
* Maximum number of parameters allowed.\n | |||
* Default is MAX_DEFAULT_PARAMETERS. | |||
*/ | |||
ENGINE_OPTION_MAX_PARAMETERS = 7, | |||
/*! | |||
* Timeout value in ms for how much to wait for UI-Bridges to respond.\n | |||
* Default is 4000 (4 secs). | |||
*/ | |||
ENGINE_OPTION_UI_BRIDGES_TIMEOUT = 8, | |||
/*! | |||
* Audio number of periods. | |||
*/ | |||
ENGINE_OPTION_AUDIO_NUM_PERIODS = 9, | |||
/*! | |||
* Audio buffer size. | |||
*/ | |||
ENGINE_OPTION_AUDIO_BUFFER_SIZE = 10, | |||
/*! | |||
* Audio sample rate. | |||
*/ | |||
ENGINE_OPTION_AUDIO_SAMPLE_RATE = 11, | |||
/*! | |||
* Audio device. | |||
*/ | |||
ENGINE_OPTION_AUDIO_DEVICE = 12, | |||
/*! | |||
* Set path to the resource files.\n | |||
* Default unset. | |||
* | |||
* \note Must be set for some internal plugins to work! | |||
*/ | |||
ENGINE_OPTION_PATH_RESOURCES = 13, | |||
#ifndef BUILD_BRIDGE | |||
/*! | |||
* Set path to the native plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_NATIVE = 14, | |||
/*! | |||
* Set path to the POSIX 32bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_POSIX32 = 15, | |||
/*! | |||
* Set path to the POSIX 64bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_POSIX64 = 16, | |||
/*! | |||
* Set path to the Windows 32bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_WIN32 = 17, | |||
/*! | |||
* Set path to the Windows 64bit plugin bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_WIN64 = 18, | |||
#endif | |||
#ifdef WANT_LV2 | |||
/*! | |||
* Set path to the LV2 External UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL = 19, | |||
/*! | |||
* Set path to the LV2 Gtk2 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2 = 20, | |||
/*! | |||
* Set path to the LV2 Gtk3 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3 = 21, | |||
/*! | |||
* Set path to the LV2 Ntk UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_NTK = 22, | |||
/*! | |||
* Set path to the LV2 Qt4 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_QT4 = 23, | |||
/*! | |||
* Set path to the LV2 Qt5 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_QT5 = 24, | |||
/*! | |||
* Set path to the LV2 Cocoa UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA = 25, | |||
/*! | |||
* Set path to the LV2 Windows UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS = 26, | |||
/*! | |||
* Set path to the LV2 X11 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_LV2_X11 = 27, | |||
#endif | |||
#ifdef WANT_VST | |||
/*! | |||
* Set path to the VST Mac UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_VST_MAC = 28, | |||
/*! | |||
* Set path to the VST HWND UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_VST_HWND = 29, | |||
/*! | |||
* Set path to the VST X11 UI bridge executable.\n | |||
* Default unset. | |||
*/ | |||
ENGINE_OPTION_PATH_BRIDGE_VST_X11 = 30 | |||
#endif | |||
}; | |||
/*! | |||
* Engine process mode. | |||
* \see ENGINE_OPTION_PROCESS_MODE | |||
*/ | |||
enum EngineProcessMode SIZE_INT { | |||
ENGINE_PROCESS_MODE_SINGLE_CLIENT = 0, //!< Single client mode (dynamic input/outputs as needed by plugins). | |||
ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS = 1, //!< Multiple client mode (1 master client + 1 client per plugin). | |||
ENGINE_PROCESS_MODE_CONTINUOUS_RACK = 2, //!< Single client, 'rack' mode. Processes plugins in order of Id, with forced stereo. | |||
ENGINE_PROCESS_MODE_PATCHBAY = 3, //!< Single client, 'patchbay' mode. | |||
ENGINE_PROCESS_MODE_BRIDGE = 4 //!< Special mode, used in plugin-bridges only. | |||
}; | |||
/*! | |||
* All the available transport modes | |||
*/ | |||
enum EngineTransportMode SIZE_INT { | |||
ENGINE_TRANSPORT_MODE_INTERNAL = 0, //!< Internal transport mode. | |||
ENGINE_TRANSPORT_MODE_JACK = 1, //!< Transport from JACK, only available if driver name is "JACK". | |||
ENGINE_TRANSPORT_MODE_PLUGIN = 2, //!< Transport from host, used when Carla is a plugin. | |||
ENGINE_TRANSPORT_MODE_BRIDGE = 3 //!< Special mode, used in plugin-bridges only. | |||
}; | |||
/*! | |||
* Opcodes sent from the backend to the frontend, asking for file related tasks. | |||
*/ | |||
enum FileCallbackType SIZE_INT { | |||
enum FileCallbackOpcode SIZE_INT { | |||
/*! | |||
* Debug.\n | |||
* This opcode is undefined and used only for testing purposes. | |||
@@ -723,13 +723,13 @@ enum FileCallbackType SIZE_INT { | |||
* Engine callback function. | |||
* \see EngineCallbackType | |||
*/ | |||
typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackType action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr); | |||
typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr); | |||
/*! | |||
* File callback function. | |||
* \see FileCallbackType | |||
*/ | |||
typedef char* (*FileCallbackFunc)(void* ptr, FileCallbackType action, bool isDir, const char* title, const char* filter); | |||
typedef const char* (*FileCallbackFunc)(void* ptr, FileCallbackOpcode action, bool isDir, const char* title, const char* filter); | |||
/*! | |||
* Parameter data. | |||
@@ -232,8 +232,8 @@ struct EngineEvent { | |||
* Engine options. | |||
*/ | |||
struct EngineOptions { | |||
ProcessMode processMode; | |||
TransportMode transportMode; | |||
EngineProcessMode processMode; | |||
EngineTransportMode transportMode; | |||
bool forceStereo; | |||
bool preferPluginBridges; | |||
@@ -259,6 +259,7 @@ struct EngineOptions { | |||
CarlaString bridge_lv2Extrn; | |||
CarlaString bridge_lv2Gtk2; | |||
CarlaString bridge_lv2Gtk3; | |||
CarlaString bridge_lv2Ntk; | |||
CarlaString bridge_lv2Qt4; | |||
CarlaString bridge_lv2Qt5; | |||
CarlaString bridge_lv2Cocoa; | |||
@@ -273,11 +274,11 @@ struct EngineOptions { | |||
EngineOptions() | |||
#if defined(CARLA_OS_LINUX) | |||
: processMode(PROCESS_MODE_MULTIPLE_CLIENTS), | |||
transportMode(TRANSPORT_MODE_JACK), | |||
: processMode(ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS), | |||
transportMode(ENGINE_TRANSPORT_MODE_JACK), | |||
#else | |||
: processMode(PROCESS_MODE_CONTINUOUS_RACK), | |||
transportMode(TRANSPORT_MODE_INTERNAL), | |||
: processMode(ENGINE_PROCESS_MODE_CONTINUOUS_RACK), | |||
transportMode(ENGINE_TRANSPORT_MODE_INTERNAL), | |||
#endif | |||
forceStereo(false), | |||
preferPluginBridges(false), | |||
@@ -926,7 +927,7 @@ public: | |||
/*! | |||
* Get the engine proccess mode. | |||
*/ | |||
ProcessMode getProccessMode() const noexcept | |||
EngineProcessMode getProccessMode() const noexcept | |||
{ | |||
return fOptions.processMode; | |||
} | |||
@@ -960,12 +961,12 @@ public: | |||
/*! | |||
* TODO. | |||
*/ | |||
void callback(const CallbackType action, const unsigned int pluginId, const int value1, const int value2, const float value3, const char* const valueStr); | |||
void callback(const EngineCallbackOpcode action, const unsigned int pluginId, const int value1, const int value2, const float value3, const char* const valueStr); | |||
/*! | |||
* TODO. | |||
*/ | |||
void setCallback(const CallbackFunc func, void* const ptr); | |||
void setCallback(const EngineCallbackFunc func, void* const ptr); | |||
// ------------------------------------------------------------------- | |||
// Patchbay | |||
@@ -1031,7 +1032,7 @@ public: | |||
/*! | |||
* Set the engine option \a option. | |||
*/ | |||
void setOption(const OptionsType option, const int value, const char* const valueStr); | |||
void setOption(const EngineOption option, const int value, const char* const valueStr); | |||
// ------------------------------------------------------------------- | |||
// OSC Stuff | |||
@@ -40,16 +40,18 @@ | |||
* Basic typedefs to help make code cleaner. | |||
* @{ | |||
*/ | |||
typedef CarlaBackend::BinaryType CarlaBinaryType; | |||
typedef CarlaBackend::PluginType CarlaPluginType; | |||
typedef CarlaBackend::PluginCategory CarlaPluginCategory; | |||
typedef CarlaBackend::OptionsType CarlaOptionsType; | |||
typedef CarlaBackend::CallbackType CarlaCallbackType; | |||
typedef CarlaBackend::CallbackFunc CarlaCallbackFunc; | |||
typedef CarlaBackend::ParameterData CarlaParameterData; | |||
typedef CarlaBackend::ParameterRanges CarlaParameterRanges; | |||
typedef CarlaBackend::MidiProgramData CarlaMidiProgramData; | |||
typedef CarlaBackend::CustomData CarlaCustomData; | |||
typedef CarlaBackend::BinaryType CarlaBinaryType; | |||
typedef CarlaBackend::PluginType CarlaPluginType; | |||
typedef CarlaBackend::PluginCategory CarlaPluginCategory; | |||
typedef CarlaBackend::EngineCallbackFunc CarlaEngineCallbackFunc; | |||
typedef CarlaBackend::EngineCallbackOpcode CarlaEngineCallbackOpcode; | |||
typedef CarlaBackend::EngineOption CarlaEngineOption; | |||
typedef CarlaBackend::FileCallbackFunc CarlaFileCallbackFunc; | |||
typedef CarlaBackend::FileCallbackOpcode CarlaFileCallbackOpcode; | |||
typedef CarlaBackend::ParameterData CarlaParameterData; | |||
typedef CarlaBackend::ParameterRanges CarlaParameterRanges; | |||
typedef CarlaBackend::MidiProgramData CarlaMidiProgramData; | |||
typedef CarlaBackend::CustomData CarlaCustomData; | |||
/**@}*/ | |||
/*! | |||
@@ -344,14 +346,20 @@ CARLA_EXPORT void carla_set_engine_about_to_close(); | |||
* Set the engine callback function to \a func. | |||
* Use \a ptr to pass a custom pointer to the callback. | |||
*/ | |||
CARLA_EXPORT void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr); | |||
CARLA_EXPORT void carla_set_engine_callback(CarlaEngineCallbackFunc func, void* ptr); | |||
/*! | |||
* Set the engine option \a option.\n | |||
* With the exception of OPTION_PROCESS_NAME, OPTION_TRANSPORT_MODE and OPTION_PATH_*, | |||
* this function should not be called when the engine is running. | |||
*/ | |||
CARLA_EXPORT void carla_set_engine_option(CarlaOptionsType option, int value, const char* valueStr); | |||
CARLA_EXPORT void carla_set_engine_option(CarlaEngineOption option, int value, const char* valueStr); | |||
/*! | |||
* Set the file callback function to \a func. | |||
* Use \a ptr to pass a custom pointer to the callback. | |||
*/ | |||
CARLA_EXPORT void carla_set_file_callback(CarlaFileCallbackFunc func, void* ptr); | |||
/*! | |||
* Load \a filename of any type.\n | |||
@@ -30,9 +30,11 @@ | |||
#include "CarlaStateUtils.hpp" | |||
#include "CarlaMIDI.h" | |||
#ifdef USE_JUCE | |||
#include "juce_audio_basics.h" | |||
using juce::FloatVectorOperations; | |||
#endif | |||
CARLA_BACKEND_START_NAMESPACE | |||
@@ -41,8 +43,8 @@ CARLA_BACKEND_START_NAMESPACE | |||
#endif | |||
// Engine helper macro, sets lastError and returns false/NULL | |||
#define CARLA_SAFE_ASSERT_RETURN_ERR(cond, err) if (cond) pass(); else { carla_assert(#cond, __FILE__, __LINE__); setLastError(err); return false; } | |||
#define CARLA_SAFE_ASSERT_RETURN_ERRN(cond, err) if (cond) pass(); else { carla_assert(#cond, __FILE__, __LINE__); setLastError(err); return nullptr; } | |||
#define CARLA_SAFE_ASSERT_RETURN_ERR(cond, err) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); setLastError(err); return false; } | |||
#define CARLA_SAFE_ASSERT_RETURN_ERRN(cond, err) if (cond) pass(); else { carla_safe_assert(#cond, __FILE__, __LINE__); setLastError(err); return nullptr; } | |||
// ----------------------------------------------------------------------- | |||
// Fallback data | |||
@@ -102,7 +104,9 @@ void CarlaEngineCVPort::initBuffer() | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,); | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(fBuffer, fEngine.getBufferSize()); | |||
#endif | |||
} | |||
void CarlaEngineCVPort::writeBuffer(const uint32_t, const uint32_t) | |||
@@ -127,7 +131,7 @@ CarlaEngineEventPort::CarlaEngineEventPort(const CarlaEngine& engine, const bool | |||
{ | |||
carla_debug("CarlaEngineEventPort::CarlaEngineEventPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_PATCHBAY) | |||
fBuffer = new EngineEvent[kEngineMaxInternalEventCount]; | |||
} | |||
@@ -135,7 +139,7 @@ CarlaEngineEventPort::~CarlaEngineEventPort() | |||
{ | |||
carla_debug("CarlaEngineEventPort::~CarlaEngineEventPort()"); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_PATCHBAY) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,); | |||
@@ -146,9 +150,9 @@ CarlaEngineEventPort::~CarlaEngineEventPort() | |||
void CarlaEngineEventPort::initBuffer() | |||
{ | |||
if (fEngine.getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK || fEngine.getProccessMode() == PROCESS_MODE_BRIDGE) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_BRIDGE) | |||
fBuffer = fEngine.getInternalEventBuffer(fIsInput); | |||
else if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY && ! fIsInput) | |||
else if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_PATCHBAY && ! fIsInput) | |||
carla_zeroStruct<EngineEvent>(fBuffer, kEngineMaxInternalEventCount); | |||
} | |||
@@ -156,7 +160,7 @@ uint32_t CarlaEngineEventPort::getEventCount() const | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fIsInput, 0); | |||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, 0); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, 0); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != ENGINE_PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, 0); | |||
uint32_t i=0; | |||
@@ -173,7 +177,7 @@ const EngineEvent& CarlaEngineEventPort::getEvent(const uint32_t index) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fIsInput, kFallbackEngineEvent); | |||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, kFallbackEngineEvent); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, kFallbackEngineEvent); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != ENGINE_PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, kFallbackEngineEvent); | |||
CARLA_SAFE_ASSERT_RETURN(index < kEngineMaxInternalEventCount, kFallbackEngineEvent); | |||
return fBuffer[index]; | |||
@@ -188,7 +192,7 @@ bool CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(! fIsInput, false); | |||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, false); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, false); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != ENGINE_PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, false); | |||
CARLA_SAFE_ASSERT_RETURN(type != kEngineControlEventTypeNull, false); | |||
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS, false); | |||
CARLA_SAFE_ASSERT(value >= 0.0f && value <= 1.0f); | |||
@@ -226,7 +230,7 @@ bool CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t cha | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(! fIsInput, false); | |||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, false); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, false); | |||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != ENGINE_PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS, false); | |||
CARLA_SAFE_ASSERT_RETURN(channel < MAX_MIDI_CHANNELS, false); | |||
CARLA_SAFE_ASSERT_RETURN(data != nullptr, false); | |||
CARLA_SAFE_ASSERT_RETURN(size > 0 && size <= 4, false); | |||
@@ -494,22 +498,22 @@ bool CarlaEngine::init(const char* const clientName) | |||
switch (fOptions.processMode) | |||
{ | |||
case PROCESS_MODE_SINGLE_CLIENT: | |||
case PROCESS_MODE_MULTIPLE_CLIENTS: | |||
case ENGINE_PROCESS_MODE_SINGLE_CLIENT: | |||
case ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS: | |||
pData->maxPluginNumber = MAX_DEFAULT_PLUGINS; | |||
break; | |||
case PROCESS_MODE_CONTINUOUS_RACK: | |||
case ENGINE_PROCESS_MODE_CONTINUOUS_RACK: | |||
pData->maxPluginNumber = MAX_RACK_PLUGINS; | |||
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount]; | |||
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount]; | |||
break; | |||
case PROCESS_MODE_PATCHBAY: | |||
case ENGINE_PROCESS_MODE_PATCHBAY: | |||
pData->maxPluginNumber = MAX_PATCHBAY_PLUGINS; | |||
break; | |||
case PROCESS_MODE_BRIDGE: | |||
case ENGINE_PROCESS_MODE_BRIDGE: | |||
pData->maxPluginNumber = 1; | |||
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount]; | |||
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount]; | |||
@@ -533,9 +537,9 @@ bool CarlaEngine::init(const char* const clientName) | |||
#endif | |||
pData->nextAction.ready(); | |||
pData->thread.startThread(); | |||
pData->thread.start(); | |||
callback(CALLBACK_ENGINE_STARTED, 0, 0, 0, 0.0f, getCurrentDriverName()); | |||
callback(ENGINE_CALLBACK_ENGINE_STARTED, 0, 0, 0, 0.0f, getCurrentDriverName()); | |||
return true; | |||
} | |||
@@ -548,7 +552,7 @@ bool CarlaEngine::close() | |||
CARLA_SAFE_ASSERT_RETURN_ERR(pData->nextAction.opcode == kEnginePostActionNull, "Invalid engine internal data (err #9)"); | |||
carla_debug("CarlaEngine::close()"); | |||
pData->thread.stopThread(500); | |||
pData->thread.stop(500); | |||
pData->nextAction.ready(); | |||
#ifndef BUILD_BRIDGE | |||
@@ -582,7 +586,7 @@ bool CarlaEngine::close() | |||
fName.clear(); | |||
callback(CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0f, nullptr); | |||
return true; | |||
} | |||
@@ -779,12 +783,12 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, cons | |||
if (oldPlugin != nullptr) | |||
{ | |||
delete oldPlugin; | |||
callback(CALLBACK_RELOAD_ALL, id, 0, 0, 0.0f, plugin->getName()); | |||
callback(ENGINE_CALLBACK_RELOAD_ALL, id, 0, 0, 0.0f, plugin->getName()); | |||
} | |||
else | |||
{ | |||
++pData->curPluginCount; | |||
callback(CALLBACK_PLUGIN_ADDED, id, 0, 0, 0.0f, plugin->getName()); | |||
callback(ENGINE_CALLBACK_PLUGIN_ADDED, id, 0, 0, 0.0f, plugin->getName()); | |||
} | |||
return true; | |||
@@ -803,9 +807,9 @@ bool CarlaEngine::removePlugin(const unsigned int id) | |||
CARLA_SAFE_ASSERT_RETURN_ERR(plugin != nullptr, "Could not find plugin to remove"); | |||
CARLA_SAFE_ASSERT_RETURN_ERR(plugin->getId() == id, "Invalid engine internal data (err #17)"); | |||
pData->thread.stopThread(500); | |||
pData->thread.stop(500); | |||
const bool lockWait(isRunning() && fOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS); | |||
const bool lockWait(isRunning() && fOptions.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS); | |||
const CarlaEngineProtectedData::ScopedActionLock sal(pData, kEnginePostActionRemovePlugin, id, 0, lockWait); | |||
#ifndef BUILD_BRIDGE | |||
@@ -816,9 +820,9 @@ bool CarlaEngine::removePlugin(const unsigned int id) | |||
delete plugin; | |||
if (isRunning() && ! pData->aboutToClose) | |||
pData->thread.startThread(); | |||
pData->thread.start(); | |||
callback(CALLBACK_PLUGIN_REMOVED, id, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PLUGIN_REMOVED, id, 0, 0, 0.0f, nullptr); | |||
return true; | |||
} | |||
@@ -832,7 +836,7 @@ bool CarlaEngine::removeAllPlugins() | |||
if (pData->curPluginCount == 0) | |||
return true; | |||
pData->thread.stopThread(500); | |||
pData->thread.stop(500); | |||
const bool lockWait(isRunning()); | |||
const CarlaEngineProtectedData::ScopedActionLock sal(pData, kEnginePostActionZeroCount, 0, 0, lockWait); | |||
@@ -854,7 +858,7 @@ bool CarlaEngine::removeAllPlugins() | |||
} | |||
if (isRunning() && ! pData->aboutToClose) | |||
pData->thread.startThread(); | |||
pData->thread.start(); | |||
return true; | |||
} | |||
@@ -949,9 +953,9 @@ bool CarlaEngine::switchPlugins(const unsigned int idA, const unsigned int idB) | |||
CARLA_SAFE_ASSERT_RETURN_ERR(pluginA->getId() == idA, "Invalid engine internal data (err #36)"); | |||
CARLA_SAFE_ASSERT_RETURN_ERR(pluginB->getId() == idB, "Invalid engine internal data (err #37)"); | |||
pData->thread.stopThread(500); | |||
pData->thread.stop(500); | |||
const bool lockWait(isRunning() && fOptions.processMode != PROCESS_MODE_MULTIPLE_CLIENTS); | |||
const bool lockWait(isRunning() && fOptions.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS); | |||
const CarlaEngineProtectedData::ScopedActionLock sal(pData, kEnginePostActionSwitchPlugins, idA, idB, lockWait); | |||
#ifndef BUILD_BRIDGE // TODO | |||
@@ -960,7 +964,7 @@ bool CarlaEngine::switchPlugins(const unsigned int idA, const unsigned int idB) | |||
#endif | |||
if (isRunning() && ! pData->aboutToClose) | |||
pData->thread.startThread(); | |||
pData->thread.start(); | |||
return true; | |||
} | |||
@@ -1073,6 +1077,7 @@ bool CarlaEngine::loadFilename(const char* const filename) | |||
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #1)"); | |||
carla_debug("CarlaEngine::loadFilename(\"%s\")", filename); | |||
#ifdef USE_JUCE | |||
using namespace juce; | |||
File file(filename); | |||
@@ -1113,7 +1118,7 @@ bool CarlaEngine::loadFilename(const char* const filename) | |||
if (addPlugin(PLUGIN_INTERNAL, nullptr, baseName, "audiofile")) | |||
{ | |||
if (CarlaPlugin* const plugin = getPlugin(pData->curPluginCount-1)) | |||
plugin->setCustomData(CUSTOM_DATA_STRING, "file", filename, true); | |||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "file", filename, true); | |||
return true; | |||
} | |||
return false; | |||
@@ -1131,7 +1136,7 @@ bool CarlaEngine::loadFilename(const char* const filename) | |||
if (addPlugin(PLUGIN_INTERNAL, nullptr, baseName, "audiofile")) | |||
{ | |||
if (CarlaPlugin* const plugin = getPlugin(pData->curPluginCount-1)) | |||
plugin->setCustomData(CUSTOM_DATA_STRING, "file", filename, true); | |||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "file", filename, true); | |||
return true; | |||
} | |||
return false; | |||
@@ -1153,7 +1158,7 @@ bool CarlaEngine::loadFilename(const char* const filename) | |||
if (addPlugin(PLUGIN_INTERNAL, nullptr, baseName, "midifile")) | |||
{ | |||
if (CarlaPlugin* const plugin = getPlugin(pData->curPluginCount-1)) | |||
plugin->setCustomData(CUSTOM_DATA_STRING, "file", filename, true); | |||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "file", filename, true); | |||
return true; | |||
} | |||
return false; | |||
@@ -1172,7 +1177,7 @@ bool CarlaEngine::loadFilename(const char* const filename) | |||
if (addPlugin(PLUGIN_INTERNAL, nullptr, baseName, "zynaddsubfx")) | |||
{ | |||
if (CarlaPlugin* const plugin = getPlugin(pData->curPluginCount-1)) | |||
plugin->setCustomData(CUSTOM_DATA_STRING, (extension == "xmz") ? "CarlaAlternateFile1" : "CarlaAlternateFile2", filename, true); | |||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, (extension == "xmz") ? "CarlaAlternateFile1" : "CarlaAlternateFile2", filename, true); | |||
return true; | |||
} | |||
return false; | |||
@@ -1181,6 +1186,7 @@ bool CarlaEngine::loadFilename(const char* const filename) | |||
return false; | |||
#endif | |||
} | |||
#endif | |||
// ------------------------------------------------------------------- | |||
@@ -1207,6 +1213,7 @@ bool CarlaEngine::loadProject(const char* const filename) | |||
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #2)"); | |||
carla_debug("CarlaEngine::loadProject(\"%s\")", filename); | |||
#ifdef USE_JUCE | |||
using namespace juce; | |||
File file(filename); | |||
@@ -1267,6 +1274,7 @@ bool CarlaEngine::loadProject(const char* const filename) | |||
delete xmlCheck; | |||
return false; | |||
} | |||
#endif | |||
setLastError("Not a valid file"); | |||
return false; | |||
@@ -1277,6 +1285,7 @@ bool CarlaEngine::saveProject(const char* const filename) | |||
CARLA_SAFE_ASSERT_RETURN_ERR(filename != nullptr && filename[0] != '\0', "Invalid filename (err #3)"); | |||
carla_debug("CarlaEngine::saveProject(\"%s\")", filename); | |||
#ifdef USE_JUCE | |||
using namespace juce; | |||
File file(filename); | |||
@@ -1323,6 +1332,9 @@ bool CarlaEngine::saveProject(const char* const filename) | |||
out << "</CARLA-PROJECT>\n"; | |||
return file.replaceWithData(out.getData(), out.getDataSize()); | |||
#endif | |||
return false; | |||
} | |||
// ----------------------------------------------------------------------- | |||
@@ -1349,15 +1361,15 @@ float CarlaEngine::getOutputPeak(const unsigned int pluginId, const unsigned sho | |||
// ----------------------------------------------------------------------- | |||
// Callback | |||
void CarlaEngine::callback(const CallbackType action, const unsigned int pluginId, const int value1, const int value2, const float value3, const char* const valueStr) | |||
void CarlaEngine::callback(const EngineCallbackOpcode action, const unsigned int pluginId, const int value1, const int value2, const float value3, const char* const valueStr) | |||
{ | |||
carla_debug("CarlaEngine::callback(%s, %i, %i, %i, %f, \"%s\")", CallbackType2Str(action), pluginId, value1, value2, value3, valueStr); | |||
carla_debug("CarlaEngine::callback(%s, %i, %i, %i, %f, \"%s\")", EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | |||
if (pData->callback != nullptr) | |||
pData->callback(pData->callbackPtr, action, pluginId, value1, value2, value3, valueStr); | |||
} | |||
void CarlaEngine::setCallback(const CallbackFunc func, void* const ptr) | |||
void CarlaEngine::setCallback(const EngineCallbackFunc func, void* const ptr) | |||
{ | |||
CARLA_ASSERT(func != nullptr); | |||
carla_debug("CarlaEngine::setCallback(%p, %p)", func, ptr); | |||
@@ -1427,146 +1439,149 @@ void CarlaEngine::setAboutToClose() | |||
// ----------------------------------------------------------------------- | |||
// Global options | |||
void CarlaEngine::setOption(const OptionsType option, const int value, const char* const valueStr) | |||
void CarlaEngine::setOption(const EngineOption option, const int value, const char* const valueStr) | |||
{ | |||
carla_debug("CarlaEngine::setOption(%i:%s, %i, \"%s\")", option, OptionsType2Str(option), value, valueStr); | |||
carla_debug("CarlaEngine::setOption(%i:%s, %i, \"%s\")", option, EngineOption2Str(option), value, valueStr); | |||
#ifndef BUILD_BRIDGE | |||
if (option >= OPTION_PROCESS_MODE && option < OPTION_PATH_RESOURCES && isRunning()) | |||
return carla_stderr("CarlaEngine::setOption(%s, %i, \"%s\") - Cannot set this option while engine is running!", OptionsType2Str(option), value, valueStr); | |||
if (option >= ENGINE_OPTION_PROCESS_MODE && option < ENGINE_OPTION_PATH_RESOURCES && isRunning()) | |||
return carla_stderr("CarlaEngine::setOption(%s, %i, \"%s\") - Cannot set this option while engine is running!", EngineOption2Str(option), value, valueStr); | |||
#endif | |||
switch (option) | |||
{ | |||
case OPTION_PROCESS_NAME: | |||
case ENGINE_OPTION_PROCESS_NAME: | |||
break; | |||
case OPTION_PROCESS_MODE: | |||
if (value < PROCESS_MODE_SINGLE_CLIENT || value > PROCESS_MODE_PATCHBAY) | |||
return carla_stderr("CarlaEngine::setOption(OPTION_PROCESS_MODE, %i, \"%s\") - invalid value", value, valueStr); | |||
case ENGINE_OPTION_PROCESS_MODE: | |||
if (value < ENGINE_PROCESS_MODE_SINGLE_CLIENT || value > ENGINE_PROCESS_MODE_PATCHBAY) | |||
return carla_stderr("CarlaEngine::setOption(ENGINE_OPTION_PROCESS_MODE, %i, \"%s\") - invalid value", value, valueStr); | |||
fOptions.processMode = static_cast<ProcessMode>(value); | |||
fOptions.processMode = static_cast<EngineProcessMode>(value); | |||
break; | |||
case OPTION_TRANSPORT_MODE: | |||
if (value < TRANSPORT_MODE_INTERNAL || value > TRANSPORT_MODE_JACK) | |||
return carla_stderr2("carla_set_engine_option(OPTION_TRANSPORT_MODE, %i, \"%s\") - invalid value", value, valueStr); | |||
case ENGINE_OPTION_TRANSPORT_MODE: | |||
if (value < ENGINE_TRANSPORT_MODE_INTERNAL || value > ENGINE_TRANSPORT_MODE_JACK) | |||
return carla_stderr2("carla_set_engine_option(ENGINE_OPTION_TRANSPORT_MODE, %i, \"%s\") - invalid value", value, valueStr); | |||
fOptions.transportMode = static_cast<TransportMode>(value); | |||
fOptions.transportMode = static_cast<EngineTransportMode>(value); | |||
break; | |||
case OPTION_FORCE_STEREO: | |||
case ENGINE_OPTION_FORCE_STEREO: | |||
fOptions.forceStereo = (value != 0); | |||
break; | |||
case OPTION_PREFER_PLUGIN_BRIDGES: | |||
case ENGINE_OPTION_PREFER_PLUGIN_BRIDGES: | |||
fOptions.preferPluginBridges = (value != 0); | |||
break; | |||
case OPTION_PREFER_UI_BRIDGES: | |||
case ENGINE_OPTION_PREFER_UI_BRIDGES: | |||
fOptions.preferUiBridges = (value != 0); | |||
break; | |||
case OPTION_UIS_ALWAYS_ON_TOP: | |||
case ENGINE_OPTION_UIS_ALWAYS_ON_TOP: | |||
fOptions.uisAlwaysOnTop = (value != 0); | |||
break; | |||
case OPTION_MAX_PARAMETERS: | |||
case ENGINE_OPTION_MAX_PARAMETERS: | |||
if (value < 1) | |||
return carla_stderr2("carla_set_engine_option(OPTION_MAX_PARAMETERS, %i, \"%s\") - invalid value", value, valueStr); | |||
return carla_stderr2("carla_set_engine_option(ENGINE_OPTION_MAX_PARAMETERS, %i, \"%s\") - invalid value", value, valueStr); | |||
fOptions.maxParameters = static_cast<uint>(value); | |||
break; | |||
case OPTION_UI_BRIDGES_TIMEOUT: | |||
case ENGINE_OPTION_UI_BRIDGES_TIMEOUT: | |||
if (value < 1) | |||
return carla_stderr2("carla_set_engine_option(OPTION_UI_BRIDGES_TIMEOUT, %i, \"%s\") - invalid value", value, valueStr); | |||
return carla_stderr2("carla_set_engine_option(ENGINE_OPTION_UI_BRIDGES_TIMEOUT, %i, \"%s\") - invalid value", value, valueStr); | |||
fOptions.uiBridgesTimeout = static_cast<uint>(value); | |||
break; | |||
case OPTION_AUDIO_NUM_PERIODS: | |||
case ENGINE_OPTION_AUDIO_NUM_PERIODS: | |||
if (value < 2 || value > 3) | |||
return carla_stderr2("carla_set_engine_option(OPTION_AUDIO_NUM_PERIODS, %i, \"%s\") - invalid value", value, valueStr); | |||
return carla_stderr2("carla_set_engine_option(ENGINE_OPTION_AUDIO_NUM_PERIODS, %i, \"%s\") - invalid value", value, valueStr); | |||
fOptions.audioNumPeriods = static_cast<uint>(value); | |||
break; | |||
case OPTION_AUDIO_BUFFER_SIZE: | |||
case ENGINE_OPTION_AUDIO_BUFFER_SIZE: | |||
if (value < 8) | |||
return carla_stderr2("carla_set_engine_option(OPTION_AUDIO_BUFFER_SIZE, %i, \"%s\") - invalid value", value, valueStr); | |||
return carla_stderr2("carla_set_engine_option(ENGINE_OPTION_AUDIO_BUFFER_SIZE, %i, \"%s\") - invalid value", value, valueStr); | |||
fOptions.audioBufferSize = static_cast<uint>(value); | |||
break; | |||
case OPTION_AUDIO_SAMPLE_RATE: | |||
case ENGINE_OPTION_AUDIO_SAMPLE_RATE: | |||
if (value < 22050) | |||
return carla_stderr2("carla_set_engine_option(OPTION_AUDIO_SAMPLE_RATE, %i, \"%s\") - invalid value", value, valueStr); | |||
return carla_stderr2("carla_set_engine_option(ENGINE_OPTION_AUDIO_SAMPLE_RATE, %i, \"%s\") - invalid value", value, valueStr); | |||
fOptions.audioSampleRate = static_cast<uint>(value); | |||
break; | |||
case OPTION_AUDIO_DEVICE: | |||
case ENGINE_OPTION_AUDIO_DEVICE: | |||
fOptions.audioDevice = valueStr; | |||
break; | |||
case OPTION_PATH_RESOURCES: | |||
case ENGINE_OPTION_PATH_RESOURCES: | |||
fOptions.resourceDir = valueStr; | |||
break; | |||
#ifndef BUILD_BRIDGE | |||
case OPTION_PATH_BRIDGE_NATIVE: | |||
case ENGINE_OPTION_PATH_BRIDGE_NATIVE: | |||
fOptions.bridge_native = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_POSIX32: | |||
case ENGINE_OPTION_PATH_BRIDGE_POSIX32: | |||
fOptions.bridge_posix32 = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_POSIX64: | |||
case ENGINE_OPTION_PATH_BRIDGE_POSIX64: | |||
fOptions.bridge_posix64 = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_WIN32: | |||
case ENGINE_OPTION_PATH_BRIDGE_WIN32: | |||
fOptions.bridge_win32 = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_WIN64: | |||
case ENGINE_OPTION_PATH_BRIDGE_WIN64: | |||
fOptions.bridge_win64 = valueStr; | |||
break; | |||
#endif | |||
#ifdef WANT_LV2 | |||
case OPTION_PATH_BRIDGE_LV2_EXTERNAL: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL: | |||
fOptions.bridge_lv2Extrn = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_LV2_GTK2: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2: | |||
fOptions.bridge_lv2Gtk2 = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_LV2_GTK3: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3: | |||
fOptions.bridge_lv2Gtk3 = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_LV2_QT4: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_NTK: | |||
fOptions.bridge_lv2Ntk = valueStr; | |||
break; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_QT4: | |||
fOptions.bridge_lv2Qt4 = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_LV2_QT5: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_QT5: | |||
fOptions.bridge_lv2Qt5 = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_LV2_COCOA: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA: | |||
fOptions.bridge_lv2Cocoa = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
fOptions.bridge_lv2Win = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_LV2_X11: | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_X11: | |||
fOptions.bridge_lv2X11 = valueStr; | |||
break; | |||
#endif | |||
#ifdef WANT_VST | |||
case OPTION_PATH_BRIDGE_VST_MAC: | |||
case ENGINE_OPTION_PATH_BRIDGE_VST_MAC: | |||
fOptions.bridge_vstMac = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_VST_HWND: | |||
case ENGINE_OPTION_PATH_BRIDGE_VST_HWND: | |||
fOptions.bridge_vstHWND = valueStr; | |||
break; | |||
case OPTION_PATH_BRIDGE_VST_X11: | |||
case ENGINE_OPTION_PATH_BRIDGE_VST_X11: | |||
fOptions.bridge_vstX11 = valueStr; | |||
break; | |||
#endif | |||
@@ -1641,7 +1656,7 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize) | |||
plugin->bufferSizeChanged(newBufferSize); | |||
} | |||
callback(CALLBACK_BUFFER_SIZE_CHANGED, 0, newBufferSize, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_BUFFER_SIZE_CHANGED, 0, newBufferSize, 0, 0.0f, nullptr); | |||
} | |||
void CarlaEngine::sampleRateChanged(const double newSampleRate) | |||
@@ -1656,7 +1671,7 @@ void CarlaEngine::sampleRateChanged(const double newSampleRate) | |||
plugin->sampleRateChanged(newSampleRate); | |||
} | |||
callback(CALLBACK_SAMPLE_RATE_CHANGED, 0, 0, 0, newSampleRate, nullptr); | |||
callback(ENGINE_CALLBACK_SAMPLE_RATE_CHANGED, 0, 0, 0, newSampleRate, nullptr); | |||
} | |||
void CarlaEngine::offlineModeChanged(const bool isOffline) | |||
@@ -1679,7 +1694,7 @@ void CarlaEngine::runPendingRtEvents() | |||
if (pData->time.playing) | |||
pData->time.frame += fBufferSize; | |||
if (fOptions.transportMode == TRANSPORT_MODE_INTERNAL) | |||
if (fOptions.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL) | |||
{ | |||
fTimeInfo.playing = pData->time.playing; | |||
fTimeInfo.frame = pData->time.frame; | |||
@@ -1707,6 +1722,7 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 | |||
float inBuf1[frames]; | |||
float* inBuf[2] = { inBuf0, inBuf1 }; | |||
#ifdef USE_JUCE | |||
// initialize audio inputs | |||
FloatVectorOperations::copy(inBuf0, inBufReal[0], frames); | |||
FloatVectorOperations::copy(inBuf1, inBufReal[1], frames); | |||
@@ -1714,6 +1730,15 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 | |||
// initialize audio outputs (zero) | |||
FloatVectorOperations::clear(outBuf[0], frames); | |||
FloatVectorOperations::clear(outBuf[1], frames); | |||
#else | |||
// initialize audio inputs | |||
carla_copyFloat(inBuf0, inBufReal[0], frames); | |||
carla_copyFloat(inBuf1, inBufReal[1], frames); | |||
// initialize audio outputs (zero) | |||
carla_zeroFloat(outBuf[0], frames); | |||
carla_zeroFloat(outBuf[1], frames); | |||
#endif | |||
// initialize event outputs (zero) | |||
carla_zeroMem(pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); | |||
@@ -1733,6 +1758,7 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 | |||
if (processed) | |||
{ | |||
#ifdef USE_JUCE | |||
// initialize audio inputs (from previous outputs) | |||
FloatVectorOperations::copy(inBuf0, outBuf[0], frames); | |||
FloatVectorOperations::copy(inBuf1, outBuf[1], frames); | |||
@@ -1740,6 +1766,15 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 | |||
// initialize audio outputs (zero) | |||
FloatVectorOperations::clear(outBuf[0], frames); | |||
FloatVectorOperations::clear(outBuf[1], frames); | |||
#else | |||
// initialize audio inputs (from previous outputs) | |||
carla_copyFloat(inBuf0, outBuf[0], frames); | |||
carla_copyFloat(inBuf1, outBuf[1], frames); | |||
// initialize audio outputs (zero) | |||
carla_zeroFloat(outBuf[0], frames); | |||
carla_zeroFloat(outBuf[1], frames); | |||
#endif | |||
// if plugin has no midi out, add previous events | |||
if (oldMidiOutCount == 0 && pData->bufEvents.in[0].type != kEngineEventTypeNull) | |||
@@ -1771,15 +1806,22 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 | |||
// if plugin has no audio inputs, add input buffer | |||
if (oldAudioInCount == 0) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::add(outBuf[0], inBuf0, frames); | |||
FloatVectorOperations::add(outBuf[1], inBuf1, frames); | |||
#else | |||
carla_addFloat(outBuf[0], inBuf0, frames); | |||
carla_addFloat(outBuf[1], inBuf1, frames); | |||
#endif | |||
} | |||
// set peaks | |||
{ | |||
float tmpMin, tmpMax; | |||
EnginePluginData& pluginData(pData->plugins[i]); | |||
#ifdef USE_JUCE | |||
float tmpMin, tmpMax; | |||
FloatVectorOperations::findMinAndMax(inBuf0, frames, tmpMin, tmpMax); | |||
pluginData.insPeak[0] = carla_max<float>(std::abs(tmpMin), std::abs(tmpMax), 1.0f); | |||
@@ -1791,6 +1833,10 @@ void CarlaEngine::processRack(float* inBufReal[2], float* outBuf[2], const uint3 | |||
FloatVectorOperations::findMinAndMax(outBuf[1], frames, tmpMin, tmpMax); | |||
pluginData.outsPeak[1] = carla_max<float>(std::abs(tmpMin), std::abs(tmpMax), 1.0f); | |||
#else | |||
// TODO | |||
(void)pluginData; | |||
#endif | |||
} | |||
processed = true; | |||
@@ -1968,7 +2014,7 @@ void CarlaEngine::oscSend_control_set_parameter_value(const int32_t pluginId, co | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(pData->oscData != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(pluginId >= 0 && pluginId < static_cast<int32_t>(pData->maxPluginNumber),); | |||
carla_debug("CarlaEngine::oscSend_control_set_parameter_value(%i, %i:%s, %f)", pluginId, index, (index < 0) ? InternalParametersIndex2Str(static_cast<InternalParametersIndex>(index)) : "(none)", value); | |||
carla_debug("CarlaEngine::oscSend_control_set_parameter_value(%i, %i:%s, %f)", pluginId, index, (index < 0) ? InternalParameterIndex2Str(static_cast<InternalParameterIndex>(index)) : "(none)", value); | |||
if (pData->oscData->target != nullptr) | |||
{ | |||
@@ -150,9 +150,10 @@ struct CarlaEngineProtectedData { | |||
const CarlaOscData* oscData; | |||
CallbackFunc callback; | |||
void* callbackPtr; | |||
CarlaString lastError; | |||
EngineCallbackFunc callback; | |||
void* callbackPtr; | |||
CarlaString lastError; | |||
bool aboutToClose; // don't re-activate thread if true | |||
unsigned int curPluginCount; // number of plugins loaded (0...max) | |||
@@ -21,11 +21,15 @@ | |||
#include "jackbridge/JackBridge.hpp" | |||
#include "juce_audio_basics.h" | |||
#include <cmath> | |||
#define URI_CANVAS_ICON "http://kxstudio.sf.net/ns/canvas/icon" | |||
#ifdef USE_JUCE | |||
#include "juce_audio_basics.h" | |||
using juce::FloatVectorOperations; | |||
#endif | |||
CARLA_BACKEND_START_NAMESPACE | |||
@@ -51,7 +55,7 @@ public: | |||
{ | |||
carla_debug("CarlaEngineJackAudioPort::CarlaEngineJackAudioPort(name:\"%s\", %s, %p, %p)", engine.getName(), bool2str(isInput), client, port); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CARLA_ASSERT(client != nullptr && port != nullptr); | |||
} | |||
@@ -79,7 +83,13 @@ public: | |||
fBuffer = (float*)jackbridge_port_get_buffer(fPort, bufferSize); | |||
if (! fIsInput) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(fBuffer, bufferSize); | |||
#else | |||
carla_zeroFloat(fBuffer, bufferSize); | |||
#endif | |||
} | |||
} | |||
private: | |||
@@ -104,7 +114,7 @@ public: | |||
{ | |||
carla_debug("CarlaEngineJackCVPort::CarlaEngineJackCVPort(name:\"%s\", %s, %p, %p)", engine.getName(), bool2str(isInput), client, port); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CARLA_ASSERT(client != nullptr && port != nullptr); | |||
} | |||
@@ -132,11 +142,19 @@ public: | |||
if (fIsInput) | |||
{ | |||
float* const jackBuffer((float*)jackbridge_port_get_buffer(fPort, bufferSize)); | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::copy(fBuffer, jackBuffer, bufferSize); | |||
#else | |||
carla_copyFloat(fBuffer, jackBuffer, bufferSize); | |||
#endif | |||
} | |||
else | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(fBuffer, bufferSize); | |||
#else | |||
carla_zeroFloat(fBuffer, bufferSize); | |||
#endif | |||
} | |||
} | |||
@@ -145,7 +163,12 @@ public: | |||
CARLA_SAFE_ASSERT_RETURN(! fIsInput,); | |||
float* const jackBuffer((float*)jackbridge_port_get_buffer(fPort, fEngine.getBufferSize())); | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::copy(jackBuffer+timeOffset, fBuffer, frames); | |||
#else | |||
carla_copyFloat(jackBuffer+timeOffset, fBuffer, frames); | |||
#endif | |||
} | |||
private: | |||
@@ -171,7 +194,7 @@ public: | |||
{ | |||
carla_debug("CarlaEngineJackEventPort::CarlaEngineJackEventPort(name:\"%s\", %s, %p, %p)", engine.getName(), bool2str(isInput), client, port); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CARLA_ASSERT(client != nullptr && port != nullptr); | |||
} | |||
@@ -412,7 +435,7 @@ public: | |||
CarlaEngineJackClient(const CarlaEngine& engine, jack_client_t* const client) | |||
: CarlaEngineClient(engine), | |||
fClient(client), | |||
fUseClient(engine.getProccessMode() == PROCESS_MODE_SINGLE_CLIENT || engine.getProccessMode() == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
fUseClient(engine.getProccessMode() == ENGINE_PROCESS_MODE_SINGLE_CLIENT || engine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
carla_debug("CarlaEngineJackClient::CarlaEngineJackClient(name:\"%s\", %p)", engine.getName(), client); | |||
@@ -430,7 +453,7 @@ public: | |||
{ | |||
carla_debug("CarlaEngineClient::~CarlaEngineClient()"); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_MULTIPLE_CLIENTS && fClient != nullptr) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS && fClient != nullptr) | |||
jackbridge_client_close(fClient); | |||
} | |||
@@ -438,7 +461,7 @@ public: | |||
{ | |||
carla_debug("CarlaEngineJackClient::activate()"); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fClient != nullptr && ! fActive,); | |||
@@ -452,7 +475,7 @@ public: | |||
{ | |||
carla_debug("CarlaEngineJackClient::deactivate()"); | |||
if (fEngine.getProccessMode() == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fEngine.getProccessMode() == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fClient != nullptr && fActive,); | |||
@@ -560,13 +583,13 @@ public: | |||
carla_debug("CarlaEngineJack::CarlaEngineJack()"); | |||
#ifdef BUILD_BRIDGE | |||
fOptions.processMode = PROCESS_MODE_MULTIPLE_CLIENTS; | |||
fOptions.processMode = ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS; | |||
#else | |||
carla_fill<jack_port_t*>(fRackPorts, kRackPortCount, nullptr); | |||
#endif | |||
// FIXME: Always enable JACK transport for now | |||
fOptions.transportMode = TRANSPORT_MODE_JACK; | |||
fOptions.transportMode = ENGINE_TRANSPORT_MODE_JACK; | |||
carla_zeroStruct<jack_position_t>(fTransportPos); | |||
} | |||
@@ -589,7 +612,7 @@ public: | |||
unsigned int getMaxClientNameSize() const noexcept override | |||
{ | |||
if (fOptions.processMode == PROCESS_MODE_SINGLE_CLIENT || fOptions.processMode == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fOptions.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
unsigned int ret = 0; | |||
@@ -606,7 +629,7 @@ public: | |||
unsigned int getMaxPortNameSize() const noexcept override | |||
{ | |||
if (fOptions.processMode == PROCESS_MODE_SINGLE_CLIENT || fOptions.processMode == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT || fOptions.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
unsigned int ret = 0; | |||
@@ -669,7 +692,7 @@ public: | |||
jackbridge_set_port_connect_callback(fClient, carla_jack_port_connect_callback, this); | |||
jackbridge_set_port_rename_callback(fClient, carla_jack_port_rename_callback, this); | |||
if (fOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) | |||
{ | |||
fRackPorts[kRackPortAudioIn1] = jackbridge_port_register(fClient, "audio-in1", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); | |||
fRackPorts[kRackPortAudioIn2] = jackbridge_port_register(fClient, "audio-in2", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0); | |||
@@ -724,7 +747,7 @@ public: | |||
#else | |||
if (jackbridge_deactivate(fClient)) | |||
{ | |||
if (fOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) | |||
{ | |||
jackbridge_port_unregister(fClient, fRackPorts[kRackPortAudioIn1]); | |||
jackbridge_port_unregister(fClient, fRackPorts[kRackPortAudioIn2]); | |||
@@ -777,10 +800,10 @@ public: | |||
void* data; | |||
size_t dataSize; | |||
NonRtList<int> groupIconsCopy; | |||
List<int> groupIconsCopy; | |||
fGroupIconsChanged.spliceAppend(groupIconsCopy, true); | |||
for (NonRtList<int>::Itenerator it = groupIconsCopy.begin(); it.valid(); it.next()) | |||
for (List<int>::Itenerator it = groupIconsCopy.begin(); it.valid(); it.next()) | |||
{ | |||
const int& groupId(*it); | |||
const char* const groupName(getGroupName(groupId)); | |||
@@ -793,7 +816,7 @@ public: | |||
const char* const icon((const char*)data); | |||
CARLA_ASSERT(std::strlen(icon)+1 == dataSize); | |||
callback(CALLBACK_PATCHBAY_ICON_CHANGED, 0, groupId, 0, 0.0f, icon); | |||
callback(ENGINE_CALLBACK_PATCHBAY_ICON_CHANGED, 0, groupId, 0, 0.0f, icon); | |||
jackbridge_free(data); | |||
} | |||
@@ -849,11 +872,11 @@ public: | |||
jackbridge_set_process_callback(client, carla_jack_process_callback, this); | |||
jackbridge_on_shutdown(client, carla_jack_shutdown_callback, this); | |||
#else | |||
if (fOptions.processMode == PROCESS_MODE_SINGLE_CLIENT) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT) | |||
{ | |||
client = fClient; | |||
} | |||
else if (fOptions.processMode == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
else if (fOptions.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
client = jackbridge_client_open(plugin->getName(), JackNullOption, nullptr); | |||
@@ -893,13 +916,13 @@ public: | |||
CARLA_ASSERT(plugin->getId() == id); | |||
bool needsReinit = (fOptions.processMode == PROCESS_MODE_SINGLE_CLIENT); | |||
bool needsReinit = (fOptions.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT); | |||
const char* name = getUniquePluginName(newName); | |||
// TODO - use rename port if single-client | |||
// JACK client rename | |||
if (fOptions.processMode == PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
{ | |||
CarlaEngineJackClient* const client((CarlaEngineJackClient*)plugin->getEngineClient()); | |||
@@ -994,7 +1017,7 @@ public: | |||
return false; | |||
} | |||
for (NonRtList<ConnectionToId>::Itenerator it = fUsedConnections.begin(); it.valid(); it.next()) | |||
for (List<ConnectionToId>::Itenerator it = fUsedConnections.begin(); it.valid(); it.next()) | |||
{ | |||
const ConnectionToId& connectionToId(*it); | |||
@@ -1042,7 +1065,7 @@ public: | |||
void transportPlay() override | |||
{ | |||
if (fOptions.transportMode == TRANSPORT_MODE_INTERNAL) | |||
if (fOptions.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL) | |||
CarlaEngine::transportPlay(); | |||
else if (fClient != nullptr) | |||
jackbridge_transport_start(fClient); | |||
@@ -1050,7 +1073,7 @@ public: | |||
void transportPause() override | |||
{ | |||
if (fOptions.transportMode == TRANSPORT_MODE_INTERNAL) | |||
if (fOptions.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL) | |||
CarlaEngine::transportPause(); | |||
else if (fClient != nullptr) | |||
jackbridge_transport_stop(fClient); | |||
@@ -1058,7 +1081,7 @@ public: | |||
void transportRelocate(const uint32_t frame) override | |||
{ | |||
if (fOptions.transportMode == TRANSPORT_MODE_INTERNAL) | |||
if (fOptions.transportMode == ENGINE_TRANSPORT_MODE_INTERNAL) | |||
CarlaEngine::transportRelocate(frame); | |||
else if (fClient != nullptr) | |||
jackbridge_transport_locate(fClient, frame); | |||
@@ -1096,7 +1119,7 @@ protected: | |||
void saveTransportInfo() | |||
{ | |||
if (fOptions.transportMode != TRANSPORT_MODE_JACK) | |||
if (fOptions.transportMode != ENGINE_TRANSPORT_MODE_JACK) | |||
return; | |||
fTransportPos.unique_1 = fTransportPos.unique_2 + 1; // invalidate | |||
@@ -1140,7 +1163,7 @@ protected: | |||
{ | |||
#ifndef BUILD_BRIDGE | |||
// pass-through | |||
if (fOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) | |||
{ | |||
float* const audioIn1 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioIn1], nframes); | |||
float* const audioIn2 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioIn2], nframes); | |||
@@ -1148,8 +1171,11 @@ protected: | |||
float* const audioOut2 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioOut2], nframes); | |||
void* const eventOut = jackbridge_port_get_buffer(fRackPorts[kRackPortEventOut], nframes); | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::copy(audioOut1, audioIn1, nframes); | |||
FloatVectorOperations::copy(audioOut2, audioIn2, nframes); | |||
#else | |||
#endif | |||
jackbridge_midi_clear_buffer(eventOut); | |||
} | |||
#endif | |||
@@ -1169,7 +1195,7 @@ protected: | |||
return runPendingRtEvents(); | |||
#else | |||
if (fOptions.processMode == PROCESS_MODE_SINGLE_CLIENT) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_SINGLE_CLIENT) | |||
{ | |||
for (unsigned int i=0; i < pData->curPluginCount; ++i) | |||
{ | |||
@@ -1186,7 +1212,7 @@ protected: | |||
return runPendingRtEvents(); | |||
} | |||
if (fOptions.processMode == PROCESS_MODE_CONTINUOUS_RACK) | |||
if (fOptions.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK) | |||
{ | |||
// get buffers from jack | |||
float* const audioIn1 = (float*)jackbridge_port_get_buffer(fRackPorts[kRackPortAudioIn1], nframes); | |||
@@ -1387,7 +1413,7 @@ protected: | |||
void handleJackLatencyCallback(const jack_latency_callback_mode_t mode) | |||
{ | |||
if (fOptions.processMode != PROCESS_MODE_SINGLE_CLIENT) | |||
if (fOptions.processMode != ENGINE_PROCESS_MODE_SINGLE_CLIENT) | |||
return; | |||
for (unsigned int i=0; i < pData->curPluginCount; ++i) | |||
@@ -1426,7 +1452,7 @@ protected: | |||
GroupNameToId groupNameId(id, name); | |||
fUsedGroupNames.removeAll(groupNameId); | |||
callback(CALLBACK_PATCHBAY_CLIENT_REMOVED, 0, id, 0, 0.0f, name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED, 0, id, 0, 0.0f, name); | |||
} | |||
void handleJackPortRegistrationCallback(const jack_port_id_t port, const bool reg) | |||
@@ -1464,12 +1490,12 @@ protected: | |||
if (jackPortFlags & JackPortIsPhysical) | |||
{ | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, groupName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, groupName); | |||
// hardware | |||
} | |||
else | |||
{ | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, groupName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, groupName); | |||
fGroupIconsChanged.append(groupId); | |||
// "application" | |||
} | |||
@@ -1489,7 +1515,7 @@ protected: | |||
PortNameToId portNameToId(groupId, fLastPortId++, portName, fullPortName); | |||
fUsedPortNames.append(portNameToId); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, groupId, portNameToId.portId, canvasPortFlags, portName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, groupId, portNameToId.portId, canvasPortFlags, portName); | |||
} | |||
else | |||
{ | |||
@@ -1504,7 +1530,7 @@ protected: | |||
PortNameToId portNameId(groupId, portId, portName, fullPortName); | |||
fUsedPortNames.removeOne(portNameId); | |||
callback(CALLBACK_PATCHBAY_PORT_REMOVED, 0, groupId, portId, 0.0f, portName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, 0, groupId, portId, 0.0f, portName); | |||
} | |||
} | |||
@@ -1540,17 +1566,17 @@ protected: | |||
ConnectionToId connectionToId(fLastConnectionId++, portIdA, portIdB); | |||
fUsedConnections.append(connectionToId); | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, connectionToId.id, portIdA, portIdB, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, connectionToId.id, portIdA, portIdB, nullptr); | |||
} | |||
else | |||
{ | |||
for (NonRtList<ConnectionToId>::Itenerator it = fUsedConnections.begin(); it.valid(); it.next()) | |||
for (List<ConnectionToId>::Itenerator it = fUsedConnections.begin(); it.valid(); it.next()) | |||
{ | |||
const ConnectionToId& connectionToId(*it); | |||
if (connectionToId.portOut == portIdA && connectionToId.portIn == portIdB) | |||
{ | |||
callback(CALLBACK_PATCHBAY_CONNECTION_REMOVED, 0, connectionToId.id, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, 0, connectionToId.id, 0, 0.0f, nullptr); | |||
fUsedConnections.remove(it); | |||
break; | |||
} | |||
@@ -1560,14 +1586,14 @@ protected: | |||
void handleJackClientRenameCallback(const char* const oldName, const char* const newName) | |||
{ | |||
for (NonRtList<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
for (List<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
{ | |||
GroupNameToId& groupNameToId(*it); | |||
if (std::strcmp(groupNameToId.name, oldName) == 0) | |||
{ | |||
groupNameToId.rename(newName); | |||
callback(CALLBACK_PATCHBAY_CLIENT_RENAMED, 0, groupNameToId.id, 0, 0.0f, newName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED, 0, groupNameToId.id, 0, 0.0f, newName); | |||
break; | |||
} | |||
} | |||
@@ -1596,7 +1622,7 @@ protected: | |||
if (groupId == -1) | |||
return; | |||
for (NonRtList<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
for (List<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
{ | |||
PortNameToId& portNameId(*it); | |||
@@ -1604,7 +1630,7 @@ protected: | |||
{ | |||
CARLA_ASSERT(portNameId.groupId == groupId); | |||
portNameId.rename(portName, newName); | |||
callback(CALLBACK_PATCHBAY_PORT_RENAMED, 0, groupId, portNameId.portId, 0.0f, newName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED, 0, groupId, portNameId.portId, 0.0f, newName); | |||
break; | |||
} | |||
} | |||
@@ -1622,7 +1648,7 @@ protected: | |||
} | |||
fClient = nullptr; | |||
callback(CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -1764,10 +1790,10 @@ private: | |||
int fLastPortId; | |||
int fLastConnectionId; | |||
NonRtList<GroupNameToId> fUsedGroupNames; | |||
NonRtList<PortNameToId> fUsedPortNames; | |||
NonRtList<ConnectionToId> fUsedConnections; | |||
NonRtList<int> fGroupIconsChanged; | |||
List<GroupNameToId> fUsedGroupNames; | |||
List<PortNameToId> fUsedPortNames; | |||
List<ConnectionToId> fUsedConnections; | |||
List<int> fGroupIconsChanged; | |||
int getGroupId(const char* const name) | |||
{ | |||
@@ -1776,7 +1802,7 @@ private: | |||
if (name == nullptr) | |||
return -1; | |||
for (NonRtList<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
for (List<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
{ | |||
const GroupNameToId& groupNameId(*it); | |||
@@ -1796,7 +1822,7 @@ private: | |||
if (groupId < 0) | |||
return fallback; | |||
for (NonRtList<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
for (List<GroupNameToId>::Itenerator it = fUsedGroupNames.begin(); it.valid(); it.next()) | |||
{ | |||
const GroupNameToId& groupNameId(*it); | |||
@@ -1814,7 +1840,7 @@ private: | |||
if (fullName == nullptr) | |||
return -1; | |||
for (NonRtList<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
for (List<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
{ | |||
const PortNameToId& portNameId(*it); | |||
@@ -1827,7 +1853,7 @@ private: | |||
void getFullPortName(const int portId, char nameBuf[STR_MAX+1]) | |||
{ | |||
for (NonRtList<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
for (List<PortNameToId>::Itenerator it = fUsedPortNames.begin(); it.valid(); it.next()) | |||
{ | |||
const PortNameToId& portNameId(*it); | |||
@@ -1849,6 +1875,7 @@ private: | |||
CARLA_ASSERT(fLastConnectionId == 0); | |||
CARLA_ASSERT(ourName != nullptr); | |||
#ifdef USE_JUCE | |||
using namespace juce; | |||
// query initial jack ports | |||
@@ -1862,7 +1889,7 @@ private: | |||
GroupNameToId groupNameToId(fLastGroupId++, ourName); | |||
fUsedGroupNames.append(groupNameToId); | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupNameToId.id, 0, 0.0f, ourName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupNameToId.id, 0, 0.0f, ourName); | |||
// carla | |||
} | |||
@@ -1913,7 +1940,7 @@ private: | |||
// icon | |||
} | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, groupName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, groupId, 0, 0.0f, groupName); | |||
} | |||
bool portIsInput = (jackPortFlags & JackPortIsInput); | |||
@@ -1930,7 +1957,7 @@ private: | |||
PortNameToId portNameToId(groupId, fLastPortId++, portName, fullPortName); | |||
fUsedPortNames.append(portNameToId); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, groupId, portNameToId.portId, canvasPortFlags, portName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, groupId, portNameToId.portId, canvasPortFlags, portName); | |||
} | |||
#if 0 | |||
@@ -1969,7 +1996,7 @@ private: | |||
ConnectionToId connectionToId(fLastConnectionId++, thisPortId, targetPortId); | |||
fUsedConnections.append(connectionToId); | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, connectionToId.id, thisPortId, targetPortId, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, connectionToId.id, thisPortId, targetPortId, nullptr); | |||
} | |||
jackbridge_free(connections); | |||
@@ -1980,6 +2007,7 @@ private: | |||
jackbridge_free(ports); | |||
} | |||
#endif | |||
} | |||
#endif | |||
@@ -15,6 +15,10 @@ | |||
* For a full copy of the GNU General Public License see the GPL.txt file | |||
*/ | |||
#ifndef USE_JUCE | |||
# error This file should not be compiled if Juce is disabled | |||
#endif | |||
#include "CarlaEngineInternal.hpp" | |||
#include "CarlaBackendUtils.hpp" | |||
#include "CarlaMIDI.h" | |||
@@ -463,7 +463,7 @@ int CarlaEngineOsc::handleMsgConfigure(CARLA_ENGINE_OSC_HANDLE_ARGS2) | |||
const char* const key = (const char*)&argv[0]->s; | |||
const char* const value = (const char*)&argv[1]->s; | |||
plugin->setCustomData(CUSTOM_DATA_STRING, key, value, false); | |||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, key, value, false); | |||
return 0; | |||
} | |||
@@ -589,7 +589,7 @@ int CarlaEngineOsc::handleMsgExiting(CARLA_ENGINE_OSC_HANDLE_ARGS1) | |||
carla_debug("CarlaEngineOsc::handleMsgExiting()"); | |||
// TODO - check for non-UIs (dssi-vst) and set to -1 instead | |||
fEngine->callback(CALLBACK_SHOW_GUI, plugin->getId(), 0, 0, 0.0f, nullptr); | |||
fEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, plugin->getId(), 0, 0, 0.0f, nullptr); | |||
// TODO | |||
//plugin->freeOscData(); | |||
@@ -23,9 +23,11 @@ | |||
#include "rtaudio/RtAudio.h" | |||
#include "rtmidi/RtMidi.h" | |||
#ifdef USE_JUCE | |||
#include "juce_audio_basics.h" | |||
using juce::FloatVectorOperations; | |||
#endif | |||
CARLA_BACKEND_START_NAMESPACE | |||
@@ -113,8 +115,8 @@ public: | |||
// just to make sure | |||
fOptions.forceStereo = true; | |||
fOptions.processMode = PROCESS_MODE_CONTINUOUS_RACK; | |||
fOptions.transportMode = TRANSPORT_MODE_INTERNAL; | |||
fOptions.processMode = ENGINE_PROCESS_MODE_CONTINUOUS_RACK; | |||
fOptions.transportMode = ENGINE_TRANSPORT_MODE_INTERNAL; | |||
} | |||
~CarlaEngineRtAudio() override | |||
@@ -337,7 +339,7 @@ public: | |||
fConnectName.clear(); | |||
for (NonRtList<MidiPort>::Itenerator it = fMidiIns.begin(); it.valid(); it.next()) | |||
for (List<MidiPort>::Itenerator it = fMidiIns.begin(); it.valid(); it.next()) | |||
{ | |||
MidiPort& port(*it); | |||
RtMidiIn* const midiInPort((RtMidiIn*)port.rtmidi); | |||
@@ -346,7 +348,7 @@ public: | |||
delete midiInPort; | |||
} | |||
for (NonRtList<MidiPort>::Itenerator it = fMidiOuts.begin(); it.valid(); it.next()) | |||
for (List<MidiPort>::Itenerator it = fMidiOuts.begin(); it.valid(); it.next()) | |||
{ | |||
MidiPort& port(*it); | |||
RtMidiOut* const midiOutPort((RtMidiOut*)port.rtmidi); | |||
@@ -519,7 +521,7 @@ public: | |||
connectionToId.portOut = portA; | |||
connectionToId.portIn = portB; | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, portA, portB, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, portA, portB, nullptr); | |||
fUsedConnections.append(connectionToId); | |||
fLastConnectionId++; | |||
@@ -544,7 +546,7 @@ public: | |||
return false; | |||
} | |||
for (NonRtList<ConnectionToId>::Itenerator it=fUsedConnections.begin(); it.valid(); it.next()) | |||
for (List<ConnectionToId>::Itenerator it=fUsedConnections.begin(); it.valid(); it.next()) | |||
{ | |||
const ConnectionToId& connection(*it); | |||
@@ -557,7 +559,7 @@ public: | |||
{ | |||
const int portId(targetPort-PATCHBAY_GROUP_MIDI_OUT*1000); | |||
for (NonRtList<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||
for (List<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||
{ | |||
MidiPort& midiPort(*it); | |||
@@ -576,7 +578,7 @@ public: | |||
{ | |||
const int portId(targetPort-PATCHBAY_GROUP_MIDI_IN*1000); | |||
for (NonRtList<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||
for (List<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||
{ | |||
MidiPort& midiPort(*it); | |||
@@ -627,7 +629,7 @@ public: | |||
CARLA_ASSERT(false); | |||
} | |||
callback(CALLBACK_PATCHBAY_CONNECTION_REMOVED, 0, connection.id, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, 0, connection.id, 0, 0.0f, nullptr); | |||
fUsedConnections.remove(it); | |||
break; | |||
@@ -653,14 +655,14 @@ public: | |||
// Main | |||
{ | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_CARLA, 0, 0.0f, getName()); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_CARLA, 0, 0.0f, getName()); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_IN1, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_INPUT, "audio-in1"); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_IN2, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_INPUT, "audio-in2"); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_OUT1, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_OUTPUT, "audio-out1"); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_OUT2, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_OUTPUT, "audio-out2"); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_MIDI_IN, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_INPUT, "midi-in"); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_MIDI_OUT, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_OUTPUT, "midi-out"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_IN1, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_INPUT, "audio-in1"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_IN2, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_INPUT, "audio-in2"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_OUT1, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_OUTPUT, "audio-out1"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_AUDIO_OUT2, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_OUTPUT, "audio-out2"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_MIDI_IN, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_INPUT, "midi-in"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_CARLA, PATCHBAY_PORT_MIDI_OUT, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_OUTPUT, "midi-out"); | |||
} | |||
// Audio In | |||
@@ -670,12 +672,12 @@ public: | |||
else | |||
std::strncpy(strBuf, "Capture", STR_MAX); | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_AUDIO_IN, 0, 0.0f, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_AUDIO_IN, 0, 0.0f, strBuf); | |||
for (unsigned int i=0; i < fAudioCountIn; ++i) | |||
{ | |||
std::snprintf(strBuf, STR_MAX, "capture_%i", i+1); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_AUDIO_IN, PATCHBAY_GROUP_AUDIO_IN*1000 + i, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_OUTPUT, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_AUDIO_IN, PATCHBAY_GROUP_AUDIO_IN*1000 + i, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_OUTPUT, strBuf); | |||
} | |||
} | |||
@@ -686,18 +688,18 @@ public: | |||
else | |||
std::strncpy(strBuf, "Playback", STR_MAX); | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_AUDIO_OUT, 0, 0.0f, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_AUDIO_OUT, 0, 0.0f, strBuf); | |||
for (unsigned int i=0; i < fAudioCountOut; ++i) | |||
{ | |||
std::snprintf(strBuf, STR_MAX, "playback_%i", i+1); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_AUDIO_OUT, PATCHBAY_GROUP_AUDIO_OUT*1000 + i, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_INPUT, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_AUDIO_OUT, PATCHBAY_GROUP_AUDIO_OUT*1000 + i, PATCHBAY_PORT_IS_AUDIO|PATCHBAY_PORT_IS_INPUT, strBuf); | |||
} | |||
} | |||
// MIDI In | |||
{ | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_MIDI_IN, 0, 0.0f, "Readable MIDI ports"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_MIDI_IN, 0, 0.0f, "Readable MIDI ports"); | |||
for (unsigned int i=0, count=fDummyMidiIn.getPortCount(); i < count; ++i) | |||
{ | |||
@@ -706,14 +708,14 @@ public: | |||
std::strncpy(portNameToId.name, fDummyMidiIn.getPortName(i).c_str(), STR_MAX); | |||
fUsedMidiIns.append(portNameToId); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_MIDI_IN, portNameToId.portId, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_OUTPUT, portNameToId.name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_MIDI_IN, portNameToId.portId, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_OUTPUT, portNameToId.name); | |||
} | |||
} | |||
#if 0 // midi-out not implemented yet | |||
// MIDI Out | |||
{ | |||
callback(CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_MIDI_OUT, 0, 0.0f, "Writable MIDI ports"); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, 0, PATCHBAY_GROUP_MIDI_OUT, 0, 0.0f, "Writable MIDI ports"); | |||
for (unsigned int i=0, count=fDummyMidiOut.getPortCount(); i < count; ++i) | |||
{ | |||
@@ -722,7 +724,7 @@ public: | |||
std::strncpy(portNameToId.name, fDummyMidiOut.getPortName(i).c_str(), STR_MAX); | |||
fUsedMidiOuts.append(portNameToId); | |||
callback(CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_MIDI_OUT, portNameToId.portId, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_INPUT, portNameToId.name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, 0, PATCHBAY_GROUP_MIDI_OUT, portNameToId.portId, PATCHBAY_PORT_IS_MIDI|PATCHBAY_PORT_IS_INPUT, portNameToId.name); | |||
} | |||
} | |||
#endif | |||
@@ -730,7 +732,7 @@ public: | |||
// Connections | |||
fConnectAudioLock.lock(); | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountIn); | |||
@@ -740,13 +742,13 @@ public: | |||
connectionToId.portOut = PATCHBAY_GROUP_AUDIO_IN*1000 + port; | |||
connectionToId.portIn = PATCHBAY_PORT_AUDIO_IN1; | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
fUsedConnections.append(connectionToId); | |||
fLastConnectionId++; | |||
} | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountIn); | |||
@@ -756,13 +758,13 @@ public: | |||
connectionToId.portOut = PATCHBAY_GROUP_AUDIO_IN*1000 + port; | |||
connectionToId.portIn = PATCHBAY_PORT_AUDIO_IN2; | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
fUsedConnections.append(connectionToId); | |||
fLastConnectionId++; | |||
} | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountOut); | |||
@@ -772,13 +774,13 @@ public: | |||
connectionToId.portOut = PATCHBAY_PORT_AUDIO_OUT1; | |||
connectionToId.portIn = PATCHBAY_GROUP_AUDIO_OUT*1000 + port; | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
fUsedConnections.append(connectionToId); | |||
fLastConnectionId++; | |||
} | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountOut); | |||
@@ -788,7 +790,7 @@ public: | |||
connectionToId.portOut = PATCHBAY_PORT_AUDIO_OUT2; | |||
connectionToId.portIn = PATCHBAY_GROUP_AUDIO_OUT*1000 + port; | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
fUsedConnections.append(connectionToId); | |||
fLastConnectionId++; | |||
@@ -796,7 +798,7 @@ public: | |||
fConnectAudioLock.unlock(); | |||
for (NonRtList<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||
for (List<MidiPort>::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) | |||
{ | |||
const MidiPort& midiPort(*it); | |||
@@ -805,13 +807,13 @@ public: | |||
connectionToId.portOut = PATCHBAY_GROUP_MIDI_IN*1000 + midiPort.portId; | |||
connectionToId.portIn = PATCHBAY_PORT_MIDI_IN; | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
fUsedConnections.append(connectionToId); | |||
fLastConnectionId++; | |||
} | |||
for (NonRtList<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||
for (List<MidiPort>::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) | |||
{ | |||
const MidiPort& midiPort(*it); | |||
@@ -820,7 +822,7 @@ public: | |||
connectionToId.portOut = PATCHBAY_PORT_MIDI_OUT; | |||
connectionToId.portIn = PATCHBAY_GROUP_MIDI_OUT*1000 + midiPort.portId; | |||
callback(CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, 0, fLastConnectionId, connectionToId.portOut, connectionToId.portIn, nullptr); | |||
fUsedConnections.append(connectionToId); | |||
fLastConnectionId++; | |||
@@ -844,7 +846,11 @@ protected: | |||
if (pData->curPluginCount == 0 || fAudioCountOut == 0 || ! fAudioIsReady) | |||
{ | |||
if (fAudioCountOut > 0 && fAudioIsReady) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(outsPtr, nframes*fAudioCountOut); | |||
#endif | |||
} | |||
return runPendingRtEvents(); | |||
} | |||
@@ -863,15 +869,21 @@ protected: | |||
else | |||
{ | |||
for (unsigned int i=0; i < fAudioCountIn; ++i) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::copy(fAudioBufIn[i], insPtr+(nframes*i), nframes); | |||
#endif | |||
} | |||
} | |||
#ifdef USE_JUCE | |||
// initialize audio output | |||
for (unsigned int i=0; i < fAudioCountOut; ++i) | |||
FloatVectorOperations::clear(fAudioBufOut[i], nframes); | |||
FloatVectorOperations::clear(fAudioBufRackOut[0], nframes); | |||
FloatVectorOperations::clear(fAudioBufRackOut[1], nframes); | |||
#endif | |||
// initialize input events | |||
carla_zeroMem(pData->bufEvents.in, sizeof(EngineEvent)*kEngineMaxInternalEventCount); | |||
@@ -971,54 +983,78 @@ protected: | |||
// connect input buffers | |||
if (fConnectedAudioIns[0].count() == 0) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(fAudioBufRackIn[0], nframes); | |||
#endif | |||
} | |||
else | |||
{ | |||
bool first = true; | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountIn); | |||
if (first) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::copy(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||
#endif | |||
first = false; | |||
} | |||
else | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::add(fAudioBufRackIn[0], fAudioBufIn[port], nframes); | |||
#endif | |||
} | |||
} | |||
if (first) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(fAudioBufRackIn[0], nframes); | |||
#endif | |||
} | |||
} | |||
if (fConnectedAudioIns[1].count() == 0) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(fAudioBufRackIn[1], nframes); | |||
#endif | |||
} | |||
else | |||
{ | |||
bool first = true; | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountIn); | |||
if (first) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::copy(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||
#endif | |||
first = false; | |||
} | |||
else | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::add(fAudioBufRackIn[1], fAudioBufIn[port], nframes); | |||
#endif | |||
} | |||
} | |||
if (first) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::clear(fAudioBufRackIn[1], nframes); | |||
#endif | |||
} | |||
} | |||
// process | |||
@@ -1027,23 +1063,27 @@ protected: | |||
// connect output buffers | |||
if (fConnectedAudioOuts[0].count() != 0) | |||
{ | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountOut); | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::add(fAudioBufOut[port], fAudioBufRackOut[0], nframes); | |||
#endif | |||
} | |||
} | |||
if (fConnectedAudioOuts[1].count() != 0) | |||
{ | |||
for (NonRtList<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||
for (List<uint>::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) | |||
{ | |||
const uint& port(*it); | |||
CARLA_ASSERT(port < fAudioCountOut); | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::add(fAudioBufOut[port], fAudioBufRackOut[1], nframes); | |||
#endif | |||
} | |||
} | |||
@@ -1063,7 +1103,11 @@ protected: | |||
else | |||
{ | |||
for (unsigned int i=0; i < fAudioCountOut; ++i) | |||
{ | |||
#ifdef USE_JUCE | |||
FloatVectorOperations::copy(outsPtr+(nframes*i), fAudioBufOut[i], nframes); | |||
#endif | |||
} | |||
} | |||
// output events | |||
@@ -1248,8 +1292,8 @@ private: | |||
bool fAudioIsInterleaved; | |||
bool fAudioIsReady; | |||
NonRtList<uint> fConnectedAudioIns[2]; | |||
NonRtList<uint> fConnectedAudioOuts[2]; | |||
List<uint> fConnectedAudioIns[2]; | |||
List<uint> fConnectedAudioOuts[2]; | |||
CarlaMutex fConnectAudioLock; | |||
CarlaString fConnectName; | |||
@@ -1287,17 +1331,17 @@ private: | |||
}; | |||
int fLastConnectionId; | |||
NonRtList<PortNameToId> fUsedMidiIns; | |||
NonRtList<PortNameToId> fUsedMidiOuts; | |||
NonRtList<ConnectionToId> fUsedConnections; | |||
List<PortNameToId> fUsedMidiIns; | |||
List<PortNameToId> fUsedMidiOuts; | |||
List<ConnectionToId> fUsedConnections; | |||
struct MidiPort { | |||
RtMidi* rtmidi; | |||
int portId; | |||
}; | |||
NonRtList<MidiPort> fMidiIns; | |||
NonRtList<MidiPort> fMidiOuts; | |||
List<MidiPort> fMidiIns; | |||
List<MidiPort> fMidiOuts; | |||
struct RtMidiEvent { | |||
uint32_t time; | |||
@@ -1472,7 +1516,7 @@ const char** CarlaEngine::getRtAudioApiDeviceNames(const unsigned int index) | |||
if (devCount > 0) | |||
{ | |||
NonRtList<const char*> devNames; | |||
List<const char*> devNames; | |||
for (unsigned int i=0; i < devCount; ++i) | |||
{ | |||
@@ -25,13 +25,11 @@ CARLA_BACKEND_START_NAMESPACE | |||
// ----------------------------------------------------------------------- | |||
CarlaEngineThread::CarlaEngineThread(CarlaEngine* const engine) | |||
: Thread("CarlaEngineThread"), | |||
: CarlaThread("CarlaEngineThread"), | |||
fEngine(engine) | |||
{ | |||
CARLA_ASSERT(engine != nullptr); | |||
carla_debug("CarlaEngineThread::CarlaEngineThread(%p)", engine); | |||
setPriority(5); | |||
} | |||
CarlaEngineThread::~CarlaEngineThread() | |||
@@ -50,7 +48,7 @@ void CarlaEngineThread::run() | |||
bool oscRegisted, needsSingleThread; | |||
float value; | |||
while (fEngine->isRunning() && ! threadShouldExit()) | |||
while (fEngine->isRunning() && ! shouldExit()) | |||
{ | |||
#ifdef BUILD_BRIDGE | |||
oscRegisted = fEngine->isOscBridgeRegistered(); | |||
@@ -113,7 +111,7 @@ void CarlaEngineThread::run() | |||
} | |||
fEngine->idleOsc(); | |||
Thread::sleep(oscRegisted ? 30 : 50); | |||
carla_msleep(oscRegisted ? 30 : 50); | |||
} | |||
} | |||
@@ -19,8 +19,7 @@ | |||
#define CARLA_ENGINE_THREAD_HPP_INCLUDED | |||
#include "CarlaBackend.hpp" | |||
#include "juce_core.h" | |||
#include "CarlaThread.hpp" | |||
CARLA_BACKEND_START_NAMESPACE | |||
@@ -30,7 +29,7 @@ CARLA_BACKEND_START_NAMESPACE | |||
// ----------------------------------------------------------------------- | |||
class CarlaEngineThread : public juce::Thread | |||
class CarlaEngineThread : public CarlaThread | |||
{ | |||
public: | |||
CarlaEngineThread(CarlaEngine* const engine); | |||
@@ -42,7 +41,7 @@ protected: | |||
private: | |||
CarlaEngine* const fEngine; | |||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineThread) | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineThread) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
@@ -24,9 +24,11 @@ OBJSp = \ | |||
OBJS = $(OBJSp) \ | |||
CarlaEngineBridge.cpp.o \ | |||
CarlaEngineJack.cpp.o \ | |||
CarlaEngineJuce.cpp.o \ | |||
CarlaEngineRtAudio.cpp.o | |||
# OBJS += \ | |||
# CarlaEngineJuce.cpp.o | |||
HEADERS = \ | |||
../CarlaBackend.hpp ../CarlaEngine.hpp ../CarlaPlugin.hpp \ | |||
CarlaEngineInternal.hpp CarlaEngineOsc.hpp CarlaEngineThread.hpp | |||
@@ -42,6 +42,7 @@ using CB::CarlaPlugin; | |||
using CB::EngineCallbackFunc; | |||
using CB::EngineOptions; | |||
using CB::EngineTimeInfo; | |||
using CB::FileCallbackFunc; | |||
#ifdef USE_JUCE | |||
using namespace juce; | |||
@@ -139,10 +140,20 @@ struct CarlaBackendStandalone { | |||
CARLA_DECLARE_NON_COPY_STRUCT(CarlaBackendStandalone) | |||
}; | |||
struct CarlaBackendFileHandler { | |||
FileCallbackFunc callback; | |||
void* callbackPtr; | |||
CarlaBackendFileHandler() | |||
: callback(nullptr), | |||
callbackPtr(nullptr) {} | |||
}; | |||
//#ifdef WANT_LOGS | |||
//static CarlaLogThread gLogThread; | |||
//#endif | |||
static CarlaBackendStandalone gStandalone; | |||
static CarlaBackendStandalone gStandalone; | |||
static CarlaBackendFileHandler gFileHandler; | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
// API | |||
@@ -296,11 +307,14 @@ unsigned int carla_get_engine_driver_count() | |||
return CarlaEngine::getDriverCount(); | |||
} | |||
const char* carla_get_engine_driver_name(unsigned int index) | |||
const CarlaEngineDriverInfo* carla_get_engine_driver_info(unsigned int index) | |||
{ | |||
carla_debug("carla_get_engine_driver_name(%i)", index); | |||
carla_debug("carla_get_engine_driver_info(%i)", index); | |||
static CarlaEngineDriverInfo info; | |||
info.name = CarlaEngine::getDriverName(index); | |||
return CarlaEngine::getDriverName(index); | |||
return &info; | |||
} | |||
const char** carla_get_engine_driver_device_names(unsigned int index) | |||
@@ -407,41 +421,41 @@ bool carla_engine_init(const char* driverName, const char* clientName) | |||
gStandalone.engine->setCallback(gStandalone.callback, gStandalone.callbackPtr); | |||
#ifndef BUILD_BRIDGE | |||
gStandalone.engine->setOption(CB::OPTION_PROCESS_MODE, static_cast<int>(gStandalone.options.processMode), nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.options.transportMode), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, static_cast<int>(gStandalone.options.processMode), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, static_cast<int>(gStandalone.options.transportMode), nullptr); | |||
#endif | |||
gStandalone.engine->setOption(CB::OPTION_FORCE_STEREO, gStandalone.options.forceStereo ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_PREFER_PLUGIN_BRIDGES, gStandalone.options.preferPluginBridges ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_PREFER_UI_BRIDGES, gStandalone.options.preferUiBridges ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_UIS_ALWAYS_ON_TOP, gStandalone.options.uisAlwaysOnTop ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_MAX_PARAMETERS, static_cast<int>(gStandalone.options.maxParameters), nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(gStandalone.options.uiBridgesTimeout), nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_AUDIO_NUM_PERIODS, static_cast<int>(gStandalone.options.audioNumPeriods), nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_AUDIO_BUFFER_SIZE, static_cast<int>(gStandalone.options.audioBufferSize), nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(gStandalone.options.audioSampleRate), nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_AUDIO_DEVICE, 0, (const char*)gStandalone.options.audioDevice); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_RESOURCES, 0, (const char*)gStandalone.options.resourceDir); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, gStandalone.options.forceStereo ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, gStandalone.options.preferPluginBridges ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, gStandalone.options.preferUiBridges ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, gStandalone.options.uisAlwaysOnTop ? 1 : 0, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(gStandalone.options.maxParameters), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(gStandalone.options.uiBridgesTimeout), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_NUM_PERIODS, static_cast<int>(gStandalone.options.audioNumPeriods), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE, static_cast<int>(gStandalone.options.audioBufferSize), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE, static_cast<int>(gStandalone.options.audioSampleRate), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_AUDIO_DEVICE, 0, (const char*)gStandalone.options.audioDevice); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_RESOURCES, 0, (const char*)gStandalone.options.resourceDir); | |||
#ifndef BUILD_BRIDGE | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_NATIVE, 0, (const char*)gStandalone.options.bridge_native); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_POSIX32, 0, (const char*)gStandalone.options.bridge_posix32); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_POSIX64, 0, (const char*)gStandalone.options.bridge_posix64); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_WIN32, 0, (const char*)gStandalone.options.bridge_win32); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_WIN64, 0, (const char*)gStandalone.options.bridge_win64); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_NATIVE, 0, (const char*)gStandalone.options.bridge_native); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_POSIX32, 0, (const char*)gStandalone.options.bridge_posix32); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_POSIX64, 0, (const char*)gStandalone.options.bridge_posix64); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_WIN32, 0, (const char*)gStandalone.options.bridge_win32); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_WIN64, 0, (const char*)gStandalone.options.bridge_win64); | |||
#endif | |||
#ifdef WANT_LV2 | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_EXTERNAL, 0, (const char*)gStandalone.options.bridge_lv2Extrn); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_GTK2, 0, (const char*)gStandalone.options.bridge_lv2Gtk2); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_GTK3, 0, (const char*)gStandalone.options.bridge_lv2Gtk3); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_QT4, 0, (const char*)gStandalone.options.bridge_lv2Qt4); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_QT5, 0, (const char*)gStandalone.options.bridge_lv2Qt5); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_COCOA, 0, (const char*)gStandalone.options.bridge_lv2Cocoa); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, (const char*)gStandalone.options.bridge_lv2Win); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_LV2_X11, 0, (const char*)gStandalone.options.bridge_lv2X11); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL, 0, (const char*)gStandalone.options.bridge_lv2Extrn); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2, 0, (const char*)gStandalone.options.bridge_lv2Gtk2); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3, 0, (const char*)gStandalone.options.bridge_lv2Gtk3); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_QT4, 0, (const char*)gStandalone.options.bridge_lv2Qt4); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_QT5, 0, (const char*)gStandalone.options.bridge_lv2Qt5); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA, 0, (const char*)gStandalone.options.bridge_lv2Cocoa); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS, 0, (const char*)gStandalone.options.bridge_lv2Win); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_LV2_X11, 0, (const char*)gStandalone.options.bridge_lv2X11); | |||
#endif | |||
#ifdef WANT_VST | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_VST_MAC, 0, (const char*)gStandalone.options.bridge_vstMac); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_VST_HWND, 0, (const char*)gStandalone.options.bridge_vstHWND); | |||
gStandalone.engine->setOption(CB::OPTION_PATH_BRIDGE_VST_X11, 0, (const char*)gStandalone.options.bridge_vstX11); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_VST_MAC, 0, (const char*)gStandalone.options.bridge_vstMac); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_VST_HWND, 0, (const char*)gStandalone.options.bridge_vstHWND); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PATH_BRIDGE_VST_X11, 0, (const char*)gStandalone.options.bridge_vstX11); | |||
#endif | |||
if (gStandalone.engine->init(clientName)) | |||
@@ -486,14 +500,14 @@ bool carla_engine_init_bridge(const char* audioBaseName, const char* controlBase | |||
if (gStandalone.callback != nullptr) | |||
gStandalone.engine->setCallback(gStandalone.callback, gStandalone.callbackPtr); | |||
gStandalone.engine->setOption(CB::OPTION_PROCESS_MODE, CB::PROCESS_MODE_BRIDGE, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_TRANSPORT_MODE, CB::TRANSPORT_MODE_BRIDGE, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_FORCE_STEREO, false, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr); | |||
gStandalone.engine->setOption(CB::OPTION_PREFER_UI_BRIDGES, false, nullptr); | |||
//gStandalone.engine->setOption(CB::OPTION_UIS_ALWAYS_ON_TOP, gStandalone.options.uisAlwaysOnTop ? 1 : 0, nullptr); | |||
//gStandalone.engine->setOption(CB::OPTION_MAX_PARAMETERS, static_cast<int>(gStandalone.options.maxParameters), nullptr); | |||
//gStandalone.engine->setOption(CB::OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(gStandalone.options.uiBridgesTimeout), nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::PROCESS_MODE_BRIDGE, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::TRANSPORT_MODE_BRIDGE, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_FORCE_STEREO, false, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, false, nullptr); | |||
gStandalone.engine->setOption(CB::ENGINE_OPTION_PREFER_UI_BRIDGES, false, nullptr); | |||
//gStandalone.engine->setOption(CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP, gStandalone.options.uisAlwaysOnTop ? 1 : 0, nullptr); | |||
//gStandalone.engine->setOption(CB::ENGINE_OPTION_MAX_PARAMETERS, static_cast<int>(gStandalone.options.maxParameters), nullptr); | |||
//gStandalone.engine->setOption(CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT, static_cast<int>(gStandalone.options.uiBridgesTimeout), nullptr); | |||
if (gStandalone.engine->init(clientName)) | |||
{ | |||
@@ -559,7 +573,7 @@ void carla_set_engine_about_to_close() | |||
gStandalone.engine->setAboutToClose(); | |||
} | |||
void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr) | |||
void carla_set_engine_callback(CarlaEngineCallbackFunc func, void* ptr) | |||
{ | |||
carla_debug("carla_set_engine_callback(%p, %p)", func, ptr); | |||
@@ -574,165 +588,170 @@ void carla_set_engine_callback(CarlaCallbackFunc func, void* ptr) | |||
//#endif | |||
} | |||
void carla_set_engine_option(CarlaOptionsType option, int value, const char* valueStr) | |||
void carla_set_engine_option(CarlaEngineOption option, int value, const char* valueStr) | |||
{ | |||
carla_debug("carla_set_engine_option(%i:%s, %i, \"%s\")", option, CB::OptionsType2Str(option), value, valueStr); | |||
carla_debug("carla_set_engine_option(%i:%s, %i, \"%s\")", option, CB::EngineOption2Str(option), value, valueStr); | |||
switch (option) | |||
{ | |||
case CB::OPTION_PROCESS_NAME: | |||
case CB::ENGINE_OPTION_PROCESS_NAME: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
#ifdef USE_JUCE | |||
juce::Thread::setCurrentThreadName(valueStr); | |||
#endif | |||
break; | |||
case CB::OPTION_PROCESS_MODE: | |||
CARLA_SAFE_ASSERT_RETURN(value >= CB::PROCESS_MODE_SINGLE_CLIENT && value <= CB::PROCESS_MODE_BRIDGE,); | |||
gStandalone.options.processMode = static_cast<CB::ProcessMode>(value); | |||
case CB::ENGINE_OPTION_PROCESS_MODE: | |||
CARLA_SAFE_ASSERT_RETURN(value >= CB::ENGINE_PROCESS_MODE_SINGLE_CLIENT && value <= CB::ENGINE_PROCESS_MODE_BRIDGE,); | |||
gStandalone.options.processMode = static_cast<CB::EngineProcessMode>(value); | |||
break; | |||
case CB::OPTION_TRANSPORT_MODE: | |||
CARLA_SAFE_ASSERT_RETURN(value >= CB::TRANSPORT_MODE_INTERNAL && value <= CB::TRANSPORT_MODE_BRIDGE,); | |||
gStandalone.options.transportMode = static_cast<CB::TransportMode>(value); | |||
case CB::ENGINE_OPTION_TRANSPORT_MODE: | |||
CARLA_SAFE_ASSERT_RETURN(value >= CB::ENGINE_TRANSPORT_MODE_INTERNAL && value <= CB::ENGINE_TRANSPORT_MODE_BRIDGE,); | |||
gStandalone.options.transportMode = static_cast<CB::EngineTransportMode>(value); | |||
break; | |||
case CB::OPTION_FORCE_STEREO: | |||
case CB::ENGINE_OPTION_FORCE_STEREO: | |||
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); | |||
gStandalone.options.forceStereo = (value != 0); | |||
break; | |||
case CB::OPTION_PREFER_PLUGIN_BRIDGES: | |||
case CB::ENGINE_OPTION_PREFER_PLUGIN_BRIDGES: | |||
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); | |||
gStandalone.options.preferPluginBridges = (value != 0); | |||
break; | |||
case CB::OPTION_PREFER_UI_BRIDGES: | |||
case CB::ENGINE_OPTION_PREFER_UI_BRIDGES: | |||
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); | |||
gStandalone.options.preferUiBridges = (value != 0); | |||
break; | |||
case CB::OPTION_UIS_ALWAYS_ON_TOP: | |||
case CB::ENGINE_OPTION_UIS_ALWAYS_ON_TOP: | |||
CARLA_SAFE_ASSERT_RETURN(value == 0 || value == 1,); | |||
gStandalone.options.uisAlwaysOnTop = (value != 0); | |||
break; | |||
case CB::OPTION_MAX_PARAMETERS: | |||
case CB::ENGINE_OPTION_MAX_PARAMETERS: | |||
CARLA_SAFE_ASSERT_RETURN(value >= 0,); | |||
gStandalone.options.maxParameters = static_cast<unsigned int>(value); | |||
break; | |||
case CB::OPTION_UI_BRIDGES_TIMEOUT: | |||
case CB::ENGINE_OPTION_UI_BRIDGES_TIMEOUT: | |||
CARLA_SAFE_ASSERT_RETURN(value >= 0,); | |||
gStandalone.options.uiBridgesTimeout = static_cast<unsigned int>(value); | |||
break; | |||
case CB::OPTION_AUDIO_NUM_PERIODS: | |||
case CB::ENGINE_OPTION_AUDIO_NUM_PERIODS: | |||
CARLA_SAFE_ASSERT_RETURN(value == 2 || value == 3,); | |||
gStandalone.options.audioNumPeriods = static_cast<unsigned int>(value); | |||
break; | |||
case CB::OPTION_AUDIO_BUFFER_SIZE: | |||
case CB::ENGINE_OPTION_AUDIO_BUFFER_SIZE: | |||
CARLA_SAFE_ASSERT_RETURN(value >= 8,); | |||
gStandalone.options.audioBufferSize = static_cast<unsigned int>(value); | |||
break; | |||
case CB::OPTION_AUDIO_SAMPLE_RATE: | |||
case CB::ENGINE_OPTION_AUDIO_SAMPLE_RATE: | |||
CARLA_SAFE_ASSERT_RETURN(value >= 22050,); | |||
gStandalone.options.audioSampleRate = static_cast<unsigned int>(value); | |||
break; | |||
case CB::OPTION_AUDIO_DEVICE: | |||
case CB::ENGINE_OPTION_AUDIO_DEVICE: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.audioDevice = valueStr; | |||
break; | |||
case CB::OPTION_PATH_RESOURCES: | |||
case CB::ENGINE_OPTION_PATH_RESOURCES: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.resourceDir = valueStr; | |||
break; | |||
#ifndef BUILD_BRIDGE | |||
case CB::OPTION_PATH_BRIDGE_NATIVE: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_NATIVE: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_native = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_POSIX32: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_POSIX32: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_posix32 = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_POSIX64: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_POSIX64: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_posix64 = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_WIN32: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_WIN32: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_win32 = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_WIN64: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_WIN64: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_win64 = valueStr; | |||
break; | |||
#endif | |||
#ifdef WANT_LV2 | |||
case CB::OPTION_PATH_BRIDGE_LV2_EXTERNAL: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Extrn = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_LV2_GTK2: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Gtk2 = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_LV2_GTK3: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Gtk3 = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_LV2_QT4: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_NTK: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Ntk = valueStr; | |||
break; | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_QT4: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Qt4 = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_LV2_QT5: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_QT5: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Qt5 = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_LV2_COCOA: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Cocoa = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2Win = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_LV2_X11: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_LV2_X11: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_lv2X11 = valueStr; | |||
break; | |||
#endif | |||
#ifdef WANT_VST | |||
case CB::OPTION_PATH_BRIDGE_VST_MAC: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_VST_MAC: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_vstMac = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_VST_HWND: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_VST_HWND: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_vstHWND = valueStr; | |||
break; | |||
case CB::OPTION_PATH_BRIDGE_VST_X11: | |||
case CB::ENGINE_OPTION_PATH_BRIDGE_VST_X11: | |||
CARLA_SAFE_ASSERT_RETURN(valueStr != nullptr && valueStr[0] != '\0',); | |||
gStandalone.options.bridge_vstX11 = valueStr; | |||
break; | |||
@@ -745,6 +764,24 @@ void carla_set_engine_option(CarlaOptionsType option, int value, const char* val | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
void carla_set_file_callback(CarlaFileCallbackFunc func, void* ptr) | |||
{ | |||
carla_debug("carla_set_file_callback(%p, %p)", func, ptr); | |||
gFileHandler.callback = func; | |||
gFileHandler.callbackPtr = ptr; | |||
} | |||
const char* carla_file_callback(CarlaFileCallbackOpcode action, bool isDir, const char* title, const char* filter) | |||
{ | |||
if (gFileHandler.callback == nullptr) | |||
return nullptr; | |||
return gFileHandler.callback(gFileHandler.callbackPtr, action, isDir, title, filter); | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
bool carla_load_filename(const char* filename) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(filename != nullptr && filename[0] != '\0', false); | |||
@@ -1034,17 +1071,16 @@ const CarlaPluginInfo* carla_get_plugin_info(unsigned int pluginId) | |||
static CarlaPluginInfo info; | |||
// reset | |||
info.type = CB::PLUGIN_NONE; | |||
info.category = CB::PLUGIN_CATEGORY_NONE; | |||
info.hints = 0x0; | |||
info.hints = 0x0; | |||
info.binary = nullptr; | |||
info.name = nullptr; | |||
info.iconName = nullptr; | |||
info.uniqueId = 0; | |||
info.latency = 0; | |||
info.type = CB::PLUGIN_NONE; | |||
info.category = CB::PLUGIN_CATEGORY_NONE; | |||
info.hints = 0x0; | |||
info.optionsAvailable = 0x0; | |||
info.optionsEnabled = 0x0; | |||
info.binary = nullptr; | |||
info.name = nullptr; | |||
info.iconName = nullptr; | |||
info.patchbayClientId = 0; | |||
info.uniqueId = 0; | |||
// cleanup | |||
if (info.label != nullptr) | |||
@@ -1084,7 +1120,6 @@ const CarlaPluginInfo* carla_get_plugin_info(unsigned int pluginId) | |||
info.name = plugin->getName(); | |||
info.iconName = plugin->getIconName(); | |||
info.uniqueId = plugin->getUniqueId(); | |||
info.latency = plugin->getLatencyInFrames(); | |||
info.optionsAvailable = plugin->getAvailableOptions(); | |||
info.optionsEnabled = plugin->getOptions(); | |||
@@ -1386,6 +1421,7 @@ const char* carla_get_chunk_data(unsigned int pluginId) | |||
if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId)) | |||
{ | |||
#ifdef USE_JUCE | |||
if (plugin->getOptions() & CB::PLUGIN_OPTION_USE_CHUNKS) | |||
{ | |||
void* data = nullptr; | |||
@@ -1402,7 +1438,9 @@ const char* carla_get_chunk_data(unsigned int pluginId) | |||
} | |||
else | |||
carla_stderr2("carla_get_chunk_data(%i) - plugin does not use chunks", pluginId); | |||
#else | |||
carla_stderr2("carla_get_chunk_data(%i) - unsupported", pluginId); | |||
#endif | |||
return nullptr; | |||
} | |||
@@ -2047,7 +2085,7 @@ protected: | |||
carla_msleep(100); | |||
if (std::strcmp(method, "/nsm/server/announce") == 0 && gStandalone.callback != nullptr) | |||
gStandalone.callback(gStandalone.callbackPtr, CB::CALLBACK_NSM_ANNOUNCE, 0, 0, 0, 0.0f, smName); | |||
gStandalone.callback(gStandalone.callbackPtr, CB::ENGINE_CALLBACK_NSM_ANNOUNCE, 0, 0, 0, 0.0f, smName); | |||
return 0; | |||
@@ -2080,7 +2118,7 @@ protected: | |||
fIsOpened = false; | |||
gStandalone.callback(nullptr, CB::CALLBACK_NSM_OPEN, 0, 0, 0, 0.0f, data); | |||
gStandalone.callback(nullptr, CB::ENGINE_CALLBACK_NSM_OPEN, 0, 0, 0, 0.0f, data); | |||
// wait max 10 secs to open | |||
for (int i=0; i < 100 && ! fIsOpened; ++i) | |||
@@ -2115,7 +2153,7 @@ protected: | |||
fIsSaved = false; | |||
gStandalone.callback(nullptr, CB::CALLBACK_NSM_SAVE, 0, 0, 0, 0.0f, nullptr); | |||
gStandalone.callback(nullptr, CB::ENGINE_CALLBACK_NSM_SAVE, 0, 0, 0, 0.0f, nullptr); | |||
// wait max 10 secs to save | |||
for (int i=0; i < 100 && ! fIsSaved; ++i) | |||
@@ -16,12 +16,12 @@ BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) | |||
LINK_FLAGS += $(shell pkg-config --libs liblo) | |||
LINK_FLAGS += $(JACKBRIDGE_LIBS) | |||
LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) | |||
LINK_FLAGS += $(JUCE_CORE_LIBS) | |||
LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS) | |||
LINK_FLAGS += $(JUCE_EVENTS_LIBS) | |||
LINK_FLAGS += $(JUCE_GRAPHICS_LIBS) | |||
LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS) | |||
# LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS) | |||
# LINK_FLAGS += $(JUCE_CORE_LIBS) | |||
# LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS) | |||
# LINK_FLAGS += $(JUCE_EVENTS_LIBS) | |||
# LINK_FLAGS += $(JUCE_GRAPHICS_LIBS) | |||
# LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS) | |||
LINK_FLAGS += $(RTAUDIO_LIBS) | |||
LINK_FLAGS += $(RTMIDI_LIBS) | |||
LINK_FLAGS += $(RTMEMPOOL_LIBS) | |||
@@ -76,12 +76,12 @@ LIBS += ../libcarla_plugin.a | |||
LIBS += ../../modules/carla_native.a | |||
LIBS += ../../modules/jackbridge.a | |||
LIBS += ../../modules/juce_audio_basics.a | |||
LIBS += ../../modules/juce_core.a | |||
LIBS += ../../modules/juce_data_structures.a | |||
LIBS += ../../modules/juce_events.a | |||
LIBS += ../../modules/juce_graphics.a | |||
LIBS += ../../modules/juce_gui_basics.a | |||
# LIBS += ../../modules/juce_audio_basics.a | |||
# LIBS += ../../modules/juce_core.a | |||
# LIBS += ../../modules/juce_data_structures.a | |||
# LIBS += ../../modules/juce_events.a | |||
# LIBS += ../../modules/juce_graphics.a | |||
# LIBS += ../../modules/juce_gui_basics.a | |||
LIBS += ../../modules/rtaudio.a | |||
LIBS += ../../modules/rtmidi.a | |||
LIBS += ../../modules/rtmempool.a | |||
@@ -50,10 +50,12 @@ const char* PluginOption2Str(const unsigned int option) | |||
return "PLUGIN_OPTION_SEND_ALL_SOUND_OFF"; | |||
} | |||
carla_stderr("CarlaBackend::PluginOption2Str(%i) - invalid type", option); | |||
carla_stderr("CarlaBackend::PluginOption2Str(%i) - invalid option", option); | |||
return nullptr; | |||
} | |||
// ----------------------------------------------------------------------- | |||
static inline | |||
const char* BinaryType2Str(const BinaryType type) | |||
{ | |||
@@ -125,6 +127,8 @@ const char* PluginCategory2Str(const PluginCategory category) | |||
return "PLUGIN_CATEGORY_EQ"; | |||
case PLUGIN_CATEGORY_FILTER: | |||
return "PLUGIN_CATEGORY_FILTER"; | |||
case PLUGIN_CATEGORY_DISTORTION: | |||
return "PLUGIN_CATEGORY_DISTORTION"; | |||
case PLUGIN_CATEGORY_DYNAMICS: | |||
return "PLUGIN_CATEGORY_DYNAMICS"; | |||
case PLUGIN_CATEGORY_MODULATOR: | |||
@@ -150,16 +154,8 @@ const char* ParameterType2Str(const ParameterType type) | |||
return "PARAMETER_INPUT"; | |||
case PARAMETER_OUTPUT: | |||
return "PARAMETER_OUTPUT"; | |||
case PARAMETER_LATENCY: | |||
return "PARAMETER_LATENCY"; | |||
case PARAMETER_SAMPLE_RATE: | |||
return "PARAMETER_SAMPLE_RATE"; | |||
#ifdef WANT_LV2 | |||
case PARAMETER_LV2_FREEWHEEL: | |||
return "PARAMETER_LV2_FREEWHEEL"; | |||
case PARAMETER_LV2_TIME: | |||
return "PARAMETER_LV2_TIME"; | |||
#endif | |||
case PARAMETER_SPECIAL: | |||
return "PARAMETER_SPECIAL"; | |||
} | |||
carla_stderr("CarlaBackend::ParameterType2Str(%i) - invalid type", type); | |||
@@ -167,7 +163,7 @@ const char* ParameterType2Str(const ParameterType type) | |||
} | |||
static inline | |||
const char* InternalParametersIndex2Str(const InternalParametersIndex index) | |||
const char* InternalParameterIndex2Str(const InternalParameterIndex index) | |||
{ | |||
switch (index) | |||
{ | |||
@@ -191,211 +187,215 @@ const char* InternalParametersIndex2Str(const InternalParametersIndex index) | |||
return "PARAMETER_MAX"; | |||
} | |||
carla_stderr("CarlaBackend::InternalParametersIndex2Str(%i) - invalid index", index); | |||
carla_stderr("CarlaBackend::InternalParameterIndex2Str(%i) - invalid index", index); | |||
return nullptr; | |||
} | |||
static inline | |||
const char* OptionsType2Str(const OptionsType option) | |||
const char* EngineCallbackOpcode2Str(const EngineCallbackOpcode opcode) | |||
{ | |||
switch (option) | |||
switch (opcode) | |||
{ | |||
case OPTION_PROCESS_NAME: | |||
return "OPTION_PROCESS_NAME"; | |||
case OPTION_PROCESS_MODE: | |||
return "OPTION_PROCESS_MODE"; | |||
case OPTION_TRANSPORT_MODE: | |||
return "OPTION_TRANSPORT_MODE"; | |||
case OPTION_FORCE_STEREO: | |||
return "OPTION_FORCE_STEREO"; | |||
case OPTION_PREFER_PLUGIN_BRIDGES: | |||
return "OPTION_PREFER_PLUGIN_BRIDGES"; | |||
case OPTION_PREFER_UI_BRIDGES: | |||
return "OPTION_PREFER_UI_BRIDGES"; | |||
case OPTION_UIS_ALWAYS_ON_TOP: | |||
return "OPTION_UIS_ALWAYS_ON_TOP"; | |||
case OPTION_MAX_PARAMETERS: | |||
return "OPTION_MAX_PARAMETERS"; | |||
case OPTION_UI_BRIDGES_TIMEOUT: | |||
return "OPTION_UI_BRIDGES_TIMEOUT"; | |||
case OPTION_AUDIO_NUM_PERIODS: | |||
return "OPTION_AUDIO_NUM_PERIODS"; | |||
case OPTION_AUDIO_BUFFER_SIZE: | |||
return "OPTION_AUDIO_BUFFER_SIZE"; | |||
case OPTION_AUDIO_SAMPLE_RATE: | |||
return "OPTION_AUDIO_SAMPLE_RATE"; | |||
case OPTION_AUDIO_DEVICE: | |||
return "OPTION_AUDIO_DEVICE"; | |||
case OPTION_PATH_RESOURCES: | |||
return "OPTION_PATH_RESOURCES"; | |||
#ifndef BUILD_BRIDGE | |||
case OPTION_PATH_BRIDGE_NATIVE: | |||
return "OPTION_PATH_BRIDGE_NATIVE"; | |||
case OPTION_PATH_BRIDGE_POSIX32: | |||
return "OPTION_PATH_BRIDGE_POSIX32"; | |||
case OPTION_PATH_BRIDGE_POSIX64: | |||
return "OPTION_PATH_BRIDGE_POSIX64"; | |||
case OPTION_PATH_BRIDGE_WIN32: | |||
return "OPTION_PATH_BRIDGE_WIN32"; | |||
case OPTION_PATH_BRIDGE_WIN64: | |||
return "OPTION_PATH_BRIDGE_WIN64"; | |||
#endif | |||
#ifdef WANT_LV2 | |||
case OPTION_PATH_BRIDGE_LV2_EXTERNAL: | |||
return "OPTION_PATH_BRIDGE_LV2_EXTERNAL"; | |||
case OPTION_PATH_BRIDGE_LV2_GTK2: | |||
return "OPTION_PATH_BRIDGE_LV2_GTK2"; | |||
case OPTION_PATH_BRIDGE_LV2_GTK3: | |||
return "OPTION_PATH_BRIDGE_LV2_GTK3"; | |||
case OPTION_PATH_BRIDGE_LV2_QT4: | |||
return "OPTION_PATH_BRIDGE_LV2_QT4"; | |||
case OPTION_PATH_BRIDGE_LV2_QT5: | |||
return "OPTION_PATH_BRIDGE_LV2_QT5"; | |||
case OPTION_PATH_BRIDGE_LV2_COCOA: | |||
return "OPTION_PATH_BRIDGE_LV2_COCOA"; | |||
case OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
return "OPTION_PATH_BRIDGE_LV2_WINDOWS"; | |||
case OPTION_PATH_BRIDGE_LV2_X11: | |||
return "OPTION_PATH_BRIDGE_LV2_X11"; | |||
#endif | |||
#ifdef WANT_VST | |||
case OPTION_PATH_BRIDGE_VST_MAC: | |||
return "OPTION_PATH_BRIDGE_VST_MAC"; | |||
case OPTION_PATH_BRIDGE_VST_HWND: | |||
return "OPTION_PATH_BRIDGE_VST_HWND"; | |||
case OPTION_PATH_BRIDGE_VST_X11: | |||
return "OPTION_PATH_BRIDGE_VST_X11"; | |||
#endif | |||
case ENGINE_CALLBACK_DEBUG: | |||
return "ENGINE_CALLBACK_DEBUG"; | |||
case ENGINE_CALLBACK_PLUGIN_ADDED: | |||
return "ENGINE_CALLBACK_PLUGIN_ADDED"; | |||
case ENGINE_CALLBACK_PLUGIN_REMOVED: | |||
return "ENGINE_CALLBACK_PLUGIN_REMOVED"; | |||
case ENGINE_CALLBACK_PLUGIN_RENAMED: | |||
return "ENGINE_CALLBACK_PLUGIN_RENAMED"; | |||
case ENGINE_CALLBACK_PLUGIN_DISABLED: | |||
return "ENGINE_CALLBACK_PLUGIN_DISABLED"; | |||
case ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | |||
return "ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED"; | |||
case ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: | |||
return "ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED"; | |||
case ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: | |||
return "ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED"; | |||
case ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: | |||
return "ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED"; | |||
case ENGINE_CALLBACK_PROGRAM_CHANGED: | |||
return "ENGINE_CALLBACK_PROGRAM_CHANGED"; | |||
case ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: | |||
return "ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED"; | |||
case ENGINE_CALLBACK_UI_STATE_CHANGED: | |||
return "ENGINE_CALLBACK_UI_STATE_CHANGED"; | |||
case ENGINE_CALLBACK_NOTE_ON: | |||
return "ENGINE_CALLBACK_NOTE_ON"; | |||
case ENGINE_CALLBACK_NOTE_OFF: | |||
return "ENGINE_CALLBACK_NOTE_OFF"; | |||
case ENGINE_CALLBACK_UPDATE: | |||
return "ENGINE_CALLBACK_UPDATE"; | |||
case ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED: | |||
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED"; | |||
case ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED: | |||
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED"; | |||
case ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED: | |||
return "ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_ADDED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_ADDED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED"; | |||
case ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED: | |||
return "ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED"; | |||
case ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED: | |||
return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED"; | |||
case ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED: | |||
return "ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED"; | |||
case ENGINE_CALLBACK_PATCHBAY_ICON_CHANGED: | |||
return "ENGINE_CALLBACK_PATCHBAY_ICON_CHANGED"; | |||
case ENGINE_CALLBACK_RELOAD_INFO: | |||
return "ENGINE_CALLBACK_RELOAD_INFO"; | |||
case ENGINE_CALLBACK_RELOAD_PARAMETERS: | |||
return "ENGINE_CALLBACK_RELOAD_PARAMETERS"; | |||
case ENGINE_CALLBACK_RELOAD_PROGRAMS: | |||
return "ENGINE_CALLBACK_RELOAD_PROGRAMS"; | |||
case ENGINE_CALLBACK_RELOAD_ALL: | |||
return "ENGINE_CALLBACK_RELOAD_ALL"; | |||
case ENGINE_CALLBACK_BUFFER_SIZE_CHANGED: | |||
return "ENGINE_CALLBACK_BUFFER_SIZE_CHANGED"; | |||
case ENGINE_CALLBACK_SAMPLE_RATE_CHANGED: | |||
return "ENGINE_CALLBACK_SAMPLE_RATE_CHANGED"; | |||
case ENGINE_CALLBACK_PROCESS_MODE_CHANGED: | |||
return "ENGINE_CALLBACK_PROCESS_MODE_CHANGED"; | |||
case ENGINE_CALLBACK_ENGINE_STARTED: | |||
return "ENGINE_CALLBACK_ENGINE_STARTED"; | |||
case ENGINE_CALLBACK_ENGINE_STOPPED: | |||
return "ENGINE_CALLBACK_ENGINE_STOPPED"; | |||
case ENGINE_CALLBACK_NSM_ANNOUNCE: | |||
return "ENGINE_CALLBACK_NSM_ANNOUNCE"; | |||
case ENGINE_CALLBACK_NSM_OPEN: | |||
return "ENGINE_CALLBACK_NSM_OPEN"; | |||
case ENGINE_CALLBACK_NSM_SAVE: | |||
return "ENGINE_CALLBACK_NSM_SAVE"; | |||
case ENGINE_CALLBACK_ERROR: | |||
return "ENGINE_CALLBACK_ERROR"; | |||
case ENGINE_CALLBACK_INFO: | |||
return "ENGINE_CALLBACK_INFO"; | |||
case ENGINE_CALLBACK_QUIT: | |||
return "ENGINE_CALLBACK_QUIT"; | |||
} | |||
carla_stderr("CarlaBackend::OptionsType2Str(%i) - invalid option", option); | |||
carla_stderr("CarlaBackend::EngineCallbackOpcode2Str(%i) - invalid opcode", opcode); | |||
return nullptr; | |||
} | |||
static inline | |||
const char* CallbackType2Str(const CallbackType type) | |||
const char* EngineOption2Str(const EngineOption option) | |||
{ | |||
switch (type) | |||
switch (option) | |||
{ | |||
case CALLBACK_DEBUG: | |||
return "CALLBACK_DEBUG"; | |||
case CALLBACK_PLUGIN_ADDED: | |||
return "CALLBACK_PLUGIN_ADDED"; | |||
case CALLBACK_PLUGIN_REMOVED: | |||
return "CALLBACK_PLUGIN_REMOVED"; | |||
case CALLBACK_PLUGIN_RENAMED: | |||
return "CALLBACK_PLUGIN_RENAMED"; | |||
case CALLBACK_PARAMETER_VALUE_CHANGED: | |||
return "CALLBACK_PARAMETER_VALUE_CHANGED"; | |||
case CALLBACK_PARAMETER_DEFAULT_CHANGED: | |||
return "CALLBACK_PARAMETER_DEFAULT_CHANGED"; | |||
case CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: | |||
return "CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED"; | |||
case CALLBACK_PARAMETER_MIDI_CC_CHANGED: | |||
return "CALLBACK_PARAMETER_MIDI_CC_CHANGED"; | |||
case CALLBACK_PROGRAM_CHANGED: | |||
return "CALLBACK_PROGRAM_CHANGED"; | |||
case CALLBACK_MIDI_PROGRAM_CHANGED: | |||
return "CALLBACK_MIDI_PROGRAM_CHANGED"; | |||
case CALLBACK_NOTE_ON: | |||
return "CALLBACK_NOTE_ON"; | |||
case CALLBACK_NOTE_OFF: | |||
return "CALLBACK_NOTE_OFF"; | |||
case CALLBACK_SHOW_GUI: | |||
return "CALLBACK_SHOW_GUI"; | |||
case CALLBACK_UPDATE: | |||
return "CALLBACK_UPDATE"; | |||
case CALLBACK_PATCHBAY_CLIENT_ADDED: | |||
return "CALLBACK_PATCHBAY_CLIENT_ADDED"; | |||
case CALLBACK_PATCHBAY_CLIENT_REMOVED: | |||
return "CALLBACK_PATCHBAY_CLIENT_REMOVED"; | |||
case CALLBACK_PATCHBAY_CLIENT_RENAMED: | |||
return "CALLBACK_PATCHBAY_CLIENT_RENAMED"; | |||
case CALLBACK_PATCHBAY_PORT_ADDED: | |||
return "CALLBACK_PATCHBAY_PORT_ADDED"; | |||
case CALLBACK_PATCHBAY_PORT_REMOVED: | |||
return "CALLBACK_PATCHBAY_PORT_REMOVED"; | |||
case CALLBACK_PATCHBAY_PORT_RENAMED: | |||
return "CALLBACK_PATCHBAY_PORT_RENAMED"; | |||
case CALLBACK_PATCHBAY_CONNECTION_ADDED: | |||
return "CALLBACK_PATCHBAY_CONNECTION_ADDED"; | |||
case CALLBACK_PATCHBAY_CONNECTION_REMOVED: | |||
return "CALLBACK_PATCHBAY_CONNECTION_REMOVED"; | |||
case CALLBACK_PATCHBAY_ICON_CHANGED: | |||
return "CALLBACK_PATCHBAY_ICON_CHANGED"; | |||
case CALLBACK_RELOAD_INFO: | |||
return "CALLBACK_RELOAD_INFO"; | |||
case CALLBACK_RELOAD_PARAMETERS: | |||
return "CALLBACK_RELOAD_PARAMETERS"; | |||
case CALLBACK_RELOAD_PROGRAMS: | |||
return "CALLBACK_RELOAD_PROGRAMS"; | |||
case CALLBACK_RELOAD_ALL: | |||
return "CALLBACK_RELOAD_ALL"; | |||
case CALLBACK_BUFFER_SIZE_CHANGED: | |||
return "CALLBACK_BUFFER_SIZE_CHANGED"; | |||
case CALLBACK_SAMPLE_RATE_CHANGED: | |||
return "CALLBACK_SAMPLE_RATE_CHANGED"; | |||
case CALLBACK_PROCESS_MODE_CHANGED: | |||
return "CALLBACK_PROCESS_MODE_CHANGED"; | |||
case CALLBACK_ENGINE_STARTED: | |||
return "CALLBACK_ENGINE_STARTED"; | |||
case CALLBACK_ENGINE_STOPPED: | |||
return "CALLBACK_ENGINE_STOPPED"; | |||
case CALLBACK_NSM_ANNOUNCE: | |||
return "CALLBACK_NSM_ANNOUNCE"; | |||
case CALLBACK_NSM_OPEN: | |||
return "CALLBACK_NSM_OPEN"; | |||
case CALLBACK_NSM_SAVE: | |||
return "CALLBACK_NSM_SAVE"; | |||
case CALLBACK_ERROR: | |||
return "CALLBACK_ERROR"; | |||
case CALLBACK_INFO: | |||
return "CALLBACK_INFO"; | |||
case CALLBACK_QUIT: | |||
return "CALLBACK_QUIT"; | |||
case ENGINE_OPTION_PROCESS_NAME: | |||
return "ENGINE_OPTION_PROCESS_NAME"; | |||
case ENGINE_OPTION_PROCESS_MODE: | |||
return "ENGINE_OPTION_PROCESS_MODE"; | |||
case ENGINE_OPTION_TRANSPORT_MODE: | |||
return "ENGINE_OPTION_TRANSPORT_MODE"; | |||
case ENGINE_OPTION_FORCE_STEREO: | |||
return "ENGINE_OPTION_FORCE_STEREO"; | |||
case ENGINE_OPTION_PREFER_PLUGIN_BRIDGES: | |||
return "ENGINE_OPTION_PREFER_PLUGIN_BRIDGES"; | |||
case ENGINE_OPTION_PREFER_UI_BRIDGES: | |||
return "ENGINE_OPTION_PREFER_UI_BRIDGES"; | |||
case ENGINE_OPTION_UIS_ALWAYS_ON_TOP: | |||
return "ENGINE_OPTION_UIS_ALWAYS_ON_TOP"; | |||
case ENGINE_OPTION_MAX_PARAMETERS: | |||
return "ENGINE_OPTION_MAX_PARAMETERS"; | |||
case ENGINE_OPTION_UI_BRIDGES_TIMEOUT: | |||
return "ENGINE_OPTION_UI_BRIDGES_TIMEOUT"; | |||
case ENGINE_OPTION_AUDIO_NUM_PERIODS: | |||
return "ENGINE_OPTION_AUDIO_NUM_PERIODS"; | |||
case ENGINE_OPTION_AUDIO_BUFFER_SIZE: | |||
return "ENGINE_OPTION_AUDIO_BUFFER_SIZE"; | |||
case ENGINE_OPTION_AUDIO_SAMPLE_RATE: | |||
return "ENGINE_OPTION_AUDIO_SAMPLE_RATE"; | |||
case ENGINE_OPTION_AUDIO_DEVICE: | |||
return "ENGINE_OPTION_AUDIO_DEVICE"; | |||
case ENGINE_OPTION_PATH_RESOURCES: | |||
return "ENGINE_OPTION_PATH_RESOURCES"; | |||
#ifndef BUILD_BRIDGE | |||
case ENGINE_OPTION_PATH_BRIDGE_NATIVE: | |||
return "ENGINE_OPTION_PATH_BRIDGE_NATIVE"; | |||
case ENGINE_OPTION_PATH_BRIDGE_POSIX32: | |||
return "ENGINE_OPTION_PATH_BRIDGE_POSIX32"; | |||
case ENGINE_OPTION_PATH_BRIDGE_POSIX64: | |||
return "ENGINE_OPTION_PATH_BRIDGE_POSIX64"; | |||
case ENGINE_OPTION_PATH_BRIDGE_WIN32: | |||
return "ENGINE_OPTION_PATH_BRIDGE_WIN32"; | |||
case ENGINE_OPTION_PATH_BRIDGE_WIN64: | |||
return "ENGINE_OPTION_PATH_BRIDGE_WIN64"; | |||
#endif | |||
#ifdef WANT_LV2 | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_EXTERNAL"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_GTK2"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_GTK3"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_NTK: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_NTK"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_QT4: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_QT4"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_QT5: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_QT5"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_COCOA"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_WINDOWS"; | |||
case ENGINE_OPTION_PATH_BRIDGE_LV2_X11: | |||
return "ENGINE_OPTION_PATH_BRIDGE_LV2_X11"; | |||
#endif | |||
#ifdef WANT_VST | |||
case ENGINE_OPTION_PATH_BRIDGE_VST_MAC: | |||
return "ENGINE_OPTION_PATH_BRIDGE_VST_MAC"; | |||
case ENGINE_OPTION_PATH_BRIDGE_VST_HWND: | |||
return "ENGINE_OPTION_PATH_BRIDGE_VST_HWND"; | |||
case ENGINE_OPTION_PATH_BRIDGE_VST_X11: | |||
return "ENGINE_OPTION_PATH_BRIDGE_VST_X11"; | |||
#endif | |||
} | |||
carla_stderr("CarlaBackend::CallbackType2Str(%i) - invalid type", type); | |||
carla_stderr("CarlaBackend::EngineOption2Str(%i) - invalid option", option); | |||
return nullptr; | |||
} | |||
static inline | |||
const char* ProcessMode2Str(const ProcessMode mode) | |||
const char* EngineProcessMode2Str(const EngineProcessMode mode) | |||
{ | |||
switch (mode) | |||
{ | |||
case PROCESS_MODE_SINGLE_CLIENT: | |||
return "PROCESS_MODE_SINGLE_CLIENT"; | |||
case PROCESS_MODE_MULTIPLE_CLIENTS: | |||
return "PROCESS_MODE_MULTIPLE_CLIENTS"; | |||
case PROCESS_MODE_CONTINUOUS_RACK: | |||
return "PROCESS_MODE_CONTINUOUS_RACK"; | |||
case PROCESS_MODE_PATCHBAY: | |||
return "PROCESS_MODE_PATCHBAY"; | |||
case PROCESS_MODE_BRIDGE: | |||
return "PROCESS_MODE_BRIDGE"; | |||
case ENGINE_PROCESS_MODE_SINGLE_CLIENT: | |||
return "ENGINE_PROCESS_MODE_SINGLE_CLIENT"; | |||
case ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS: | |||
return "ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS"; | |||
case ENGINE_PROCESS_MODE_CONTINUOUS_RACK: | |||
return "ENGINE_PROCESS_MODE_CONTINUOUS_RACK"; | |||
case ENGINE_PROCESS_MODE_PATCHBAY: | |||
return "ENGINE_PROCESS_MODE_PATCHBAY"; | |||
case ENGINE_PROCESS_MODE_BRIDGE: | |||
return "ENGINE_PROCESS_MODE_BRIDGE"; | |||
} | |||
carla_stderr("CarlaBackend::ProcessMode2Str(%i) - invalid mode", mode); | |||
carla_stderr("CarlaBackend::EngineProcessMode2Str(%i) - invalid mode", mode); | |||
return nullptr; | |||
} | |||
static inline | |||
const char* TransportMode2Str(const TransportMode mode) | |||
const char* EngineTransportMode2Str(const EngineTransportMode mode) | |||
{ | |||
switch (mode) | |||
{ | |||
case TRANSPORT_MODE_INTERNAL: | |||
return "TRANSPORT_MODE_INTERNAL"; | |||
case TRANSPORT_MODE_JACK: | |||
return "TRANSPORT_MODE_JACK"; | |||
case TRANSPORT_MODE_PLUGIN: | |||
return "TRANSPORT_MODE_PLUGIN"; | |||
case TRANSPORT_MODE_BRIDGE: | |||
return "TRANSPORT_MODE_BRIDGE"; | |||
case ENGINE_TRANSPORT_MODE_INTERNAL: | |||
return "ENGINE_TRANSPORT_MODE_INTERNAL"; | |||
case ENGINE_TRANSPORT_MODE_JACK: | |||
return "ENGINE_TRANSPORT_MODE_JACK"; | |||
case ENGINE_TRANSPORT_MODE_PLUGIN: | |||
return "ENGINE_TRANSPORT_MODE_PLUGIN"; | |||
case ENGINE_TRANSPORT_MODE_BRIDGE: | |||
return "ENGINE_TRANSPORT_MODE_BRIDGE"; | |||
} | |||
carla_stderr("CarlaBackend::TransportMode2Str(%i) - invalid mode", mode); | |||
carla_stderr("CarlaBackend::EngineTransportMode2Str(%i) - invalid mode", mode); | |||
return nullptr; | |||
} | |||
@@ -425,7 +425,7 @@ T* getPointerFromAddress(uintptr_t& addr) | |||
static inline | |||
const char* getPluginTypeAsString(const PluginType type) | |||
{ | |||
carla_debug("CarlaBackend::getPluginTypeAsString(%s)", PluginType2Str(type)); | |||
carla_debug("CarlaBackend::getPluginTypeAsString(%i:%s)", type, PluginType2Str(type)); | |||
switch (type) | |||
{ | |||
@@ -518,6 +518,10 @@ PluginCategory getPluginCategoryFromName(const char* const name) | |||
if (sname.contains("filter")) | |||
return PLUGIN_CATEGORY_FILTER; | |||
// distortion | |||
if (sname.contains("distortion")) | |||
return PLUGIN_CATEGORY_DISTORTION; | |||
// dynamics | |||
if (sname.contains("dynamics")) | |||
return PLUGIN_CATEGORY_DYNAMICS; | |||
@@ -22,7 +22,9 @@ | |||
#include "CarlaMIDI.h" | |||
#include "List.hpp" | |||
#include "juce_core.h" | |||
#ifdef USE_JUCE | |||
# include "juce_core.h" | |||
#endif | |||
CARLA_BACKEND_START_NAMESPACE | |||
@@ -211,6 +213,7 @@ struct SaveState { | |||
CARLA_DECLARE_NON_COPY_STRUCT(SaveState) | |||
}; | |||
#ifdef USE_JUCE | |||
// ----------------------------------------------------------------------- | |||
static inline | |||
@@ -578,6 +581,7 @@ void fillXmlStringFromSaveState(juce::String& content, const SaveState& saveStat | |||
} | |||
// ----------------------------------------------------------------------- | |||
#endif | |||
CARLA_BACKEND_END_NAMESPACE | |||
@@ -18,7 +18,7 @@ | |||
#ifndef CARLA_STRING_HPP_INCLUDED | |||
#define CARLA_STRING_HPP_INCLUDED | |||
#include "CarlaUtils.hpp" | |||
#include "CarlaJuceUtils.hpp" | |||
// ----------------------------------------------------------------------- | |||
// CarlaString class | |||
@@ -677,6 +677,7 @@ private: | |||
} | |||
} | |||
CARLA_LEAK_DETECTOR(CarlaString) | |||
CARLA_PREVENT_HEAP_ALLOCATION | |||
}; | |||
@@ -40,7 +40,7 @@ protected: | |||
/* | |||
* Destructor. | |||
*/ | |||
~CarlaThread() | |||
virtual ~CarlaThread() | |||
{ | |||
CARLA_SAFE_ASSERT(! isRunning()); | |||
@@ -155,7 +155,7 @@ public: | |||
private: | |||
const CarlaString fName; // Thread name | |||
volatile CarlaMutex fLock; // Thread lock | |||
CarlaMutex fLock; // Thread lock | |||
volatile pthread_t fHandle; // Handle for this thread | |||
volatile bool fShouldExit; // true if thread should exit | |||
@@ -186,8 +186,7 @@ private: | |||
return nullptr; | |||
} | |||
CARLA_PREVENT_HEAP_ALLOCATION | |||
CARLA_DECLARE_NON_COPY_CLASS(CarlaThread) | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaThread) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
@@ -231,7 +231,7 @@ const char* carla_strdup_free(char* const strBuf) | |||
} | |||
// ----------------------------------------------------------------------- | |||
// math functions | |||
// math functions (base) | |||
/* | |||
* Return the lower of 2 values, with 'min' as the minimum possible value. | |||
@@ -299,6 +299,36 @@ void carla_add(T* dataDst, const T* dataSrc, const size_t size) | |||
*dataDst++ += *dataSrc++; | |||
} | |||
/* | |||
* Copy array values to another array. | |||
*/ | |||
template<typename T> | |||
static inline | |||
void carla_copy(T* dataDst, T* dataSrc, const size_t size) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(dataDst != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(dataSrc != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(size > 0,); | |||
for (size_t i=0; i < size; ++i) | |||
*dataDst++ = *dataSrc++; | |||
} | |||
/* | |||
* Copy array values to another array. | |||
*/ | |||
template<typename T> | |||
static inline | |||
void carla_copy(T* dataDst, const T* dataSrc, const size_t size) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(dataDst != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(dataSrc != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(size > 0,); | |||
for (size_t i=0; i < size; ++i) | |||
*dataDst++ = *dataSrc++; | |||
} | |||
/* | |||
* Fill an array with a fixed value. | |||
*/ | |||
@@ -313,6 +343,36 @@ void carla_fill(T* data, const size_t size, const T v) | |||
*data++ = v; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// math functions (extended) | |||
/* | |||
* Add float array values to another float array. | |||
*/ | |||
static inline | |||
void carla_addFloat(float* dataDst, float* dataSrc, const size_t numSamples) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(dataDst != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(dataSrc != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(numSamples > 0,); | |||
for (size_t i=0; i < numSamples; ++i) | |||
*dataDst++ += *dataSrc++; | |||
} | |||
/* | |||
* Copy float array values to another float array. | |||
*/ | |||
static inline | |||
void carla_copyFloat(float* const dataDst, float* const dataSrc, const size_t numSamples) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(dataDst != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(dataSrc != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(numSamples > 0,); | |||
std::memcpy(dataDst, dataSrc, numSamples*sizeof(float)); | |||
} | |||
#if defined(CARLA_OS_MAC) && ! defined(DISTRHO_OS_MAC) | |||
/* | |||
* Missing functions in OSX. | |||
@@ -346,6 +406,15 @@ void carla_zeroChar(C* const data, const size_t numChars) | |||
std::memset(data, 0, numChars*sizeof(C)); | |||
} | |||
/* | |||
* Clear a float array. | |||
*/ | |||
static inline | |||
void carla_zeroFloat(float* const data, const size_t numSamples) | |||
{ | |||
std::memset(data, 0, numSamples*sizeof(float)); | |||
} | |||
/* | |||
* Clear a memory location. | |||
*/ | |||