Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-alpha2
@@ -6,7 +6,7 @@ | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>1058</width> | |||
<width>1057</width> | |||
<height>716</height> | |||
</rect> | |||
</property> | |||
@@ -14,10 +14,7 @@ | |||
<string>MainWindow</string> | |||
</property> | |||
<widget class="QWidget" name="centralwidget"> | |||
<layout class="QHBoxLayout" name="horizontalLayout_3"> | |||
<property name="spacing"> | |||
<number>0</number> | |||
</property> | |||
<layout class="QVBoxLayout" name="verticalLayout_4"> | |||
<property name="leftMargin"> | |||
<number>0</number> | |||
</property> | |||
@@ -32,6 +29,9 @@ | |||
</property> | |||
<item> | |||
<widget class="QTabWidget" name="tabWidget"> | |||
<property name="tabPosition"> | |||
<enum>QTabWidget::North</enum> | |||
</property> | |||
<property name="currentIndex"> | |||
<number>0</number> | |||
</property> | |||
@@ -222,6 +222,112 @@ | |||
</widget> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QFrame" name="tw_statusbar"> | |||
<property name="sizePolicy"> | |||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> | |||
<horstretch>0</horstretch> | |||
<verstretch>0</verstretch> | |||
</sizepolicy> | |||
</property> | |||
<layout class="QHBoxLayout" name="horizontalLayout_3"> | |||
<property name="leftMargin"> | |||
<number>6</number> | |||
</property> | |||
<property name="topMargin"> | |||
<number>0</number> | |||
</property> | |||
<property name="rightMargin"> | |||
<number>6</number> | |||
</property> | |||
<property name="bottomMargin"> | |||
<number>4</number> | |||
</property> | |||
<item> | |||
<widget class="QLabel" name="label_buffer_size"> | |||
<property name="text"> | |||
<string>Buffer Size:</string> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QComboBox" name="cb_buffer_size"/> | |||
</item> | |||
<item> | |||
<widget class="Line" name="line_1"> | |||
<property name="lineWidth"> | |||
<number>0</number> | |||
</property> | |||
<property name="midLineWidth"> | |||
<number>1</number> | |||
</property> | |||
<property name="orientation"> | |||
<enum>Qt::Vertical</enum> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QLabel" name="label_sample_rate"> | |||
<property name="text"> | |||
<string>Sample Rate:</string> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QComboBox" name="cb_sample_rate"/> | |||
</item> | |||
<item> | |||
<widget class="Line" name="line_2"> | |||
<property name="lineWidth"> | |||
<number>0</number> | |||
</property> | |||
<property name="midLineWidth"> | |||
<number>1</number> | |||
</property> | |||
<property name="orientation"> | |||
<enum>Qt::Vertical</enum> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="b_xruns"> | |||
<property name="text"> | |||
<string>? Xruns</string> | |||
</property> | |||
<property name="flat"> | |||
<bool>true</bool> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="Line" name="line_4"> | |||
<property name="lineWidth"> | |||
<number>0</number> | |||
</property> | |||
<property name="midLineWidth"> | |||
<number>1</number> | |||
</property> | |||
<property name="orientation"> | |||
<enum>Qt::Vertical</enum> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QProgressBar" name="pb_dsp_load"> | |||
<property name="value"> | |||
<number>0</number> | |||
</property> | |||
<property name="alignment"> | |||
<set>Qt::AlignCenter</set> | |||
</property> | |||
<property name="format"> | |||
<string>DSP Load: %p%</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
<widget class="QMenuBar" name="menubar"> | |||
@@ -229,8 +335,8 @@ | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>1058</width> | |||
<height>25</height> | |||
<width>1057</width> | |||
<height>20</height> | |||
</rect> | |||
</property> | |||
<widget class="QMenu" name="menu_File"> | |||
@@ -596,6 +702,22 @@ | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
<property name="sizeType"> | |||
<enum>QSizePolicy::Fixed</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>20</width> | |||
<height>1</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
</layout> | |||
</item> | |||
<item> | |||
@@ -622,6 +744,22 @@ | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer_2"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
<property name="sizeType"> | |||
<enum>QSizePolicy::Fixed</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>20</width> | |||
<height>1</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
</layout> | |||
</item> | |||
<item> | |||
@@ -648,6 +786,22 @@ | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<spacer name="horizontalSpacer_3"> | |||
<property name="orientation"> | |||
<enum>Qt::Horizontal</enum> | |||
</property> | |||
<property name="sizeType"> | |||
<enum>QSizePolicy::Fixed</enum> | |||
</property> | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>20</width> | |||
<height>1</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
</item> | |||
</layout> | |||
</item> | |||
</layout> | |||
@@ -700,7 +854,7 @@ | |||
<property name="sizeHint" stdset="0"> | |||
<size> | |||
<width>20</width> | |||
<height>40</height> | |||
<height>188</height> | |||
</size> | |||
</property> | |||
</spacer> | |||
@@ -722,7 +876,7 @@ | |||
<number>0</number> | |||
</property> | |||
<property name="tabBarAutoHide" stdset="0"> | |||
<bool>true</bool> | |||
<bool>false</bool> | |||
</property> | |||
<widget class="QWidget" name="tab_3"> | |||
<property name="sizePolicy"> | |||
@@ -716,7 +716,7 @@ typedef enum { | |||
* A parameter value has changed. | |||
* @a pluginId Plugin Id | |||
* @a value1 Parameter index | |||
* @a value3 New parameter value | |||
* @a valuef New parameter value | |||
*/ | |||
ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5, | |||
@@ -724,7 +724,7 @@ typedef enum { | |||
* A parameter default has changed. | |||
* @a pluginId Plugin Id | |||
* @a value1 Parameter index | |||
* @a value3 New default value | |||
* @a valuef New default value | |||
*/ | |||
ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6, | |||
@@ -902,7 +902,8 @@ typedef enum { | |||
* Engine started. | |||
* @a value1 Process mode | |||
* @a value2 Transport mode | |||
* @a value3 Sample rate | |||
* @a value3 Buffer size | |||
* @a valuef Sample rate | |||
* @a valuestr Engine driver | |||
* @see EngineProcessMode | |||
* @see EngineTransportMode | |||
@@ -937,7 +938,7 @@ typedef enum { | |||
/*! | |||
* Engine sample-rate changed. | |||
* @a value3 New sample rate | |||
* @a valuef New sample rate | |||
*/ | |||
ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34, | |||
@@ -955,8 +956,12 @@ typedef enum { | |||
ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36, | |||
/*! | |||
* NSM callback. | |||
* (Work in progress, values are not defined yet) | |||
* NSM callback, to be handled by a frontend. | |||
* Frontend must call carla_nsm_ready() with opcode as parameter as a response | |||
* @a value1 NSM opcode | |||
* @a value2 Integer value | |||
* @a valueStr String value | |||
* @see NsmCallbackOpcode | |||
*/ | |||
ENGINE_CALLBACK_NSM = 37, | |||
@@ -986,6 +991,61 @@ typedef enum { | |||
} EngineCallbackOpcode; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* NSM Callback Opcode */ | |||
/*! | |||
* NSM callback opcodes. | |||
* @see ENGINE_CALLBACK_NSM | |||
*/ | |||
typedef enum { | |||
/*! | |||
* NSM is available and initialized. | |||
*/ | |||
NSM_CALLBACK_INIT = 0, | |||
/*! | |||
* Error from NSM side. | |||
* @a valueInt Error code | |||
* @a valueStr Error string | |||
*/ | |||
NSM_CALLBACK_ERROR = 1, | |||
/*! | |||
* Announce message. | |||
* @a valueInt SM Flags (WIP, to be defined) | |||
* @a valueStr SM Name | |||
*/ | |||
NSM_CALLBACK_ANNOUNCE = 2, | |||
/*! | |||
* Open message. | |||
* @a valueStr Project filename | |||
*/ | |||
NSM_CALLBACK_OPEN = 3, | |||
/*! | |||
* Save message. | |||
*/ | |||
NSM_CALLBACK_SAVE = 4, | |||
/*! | |||
* Session-is-loaded message. | |||
*/ | |||
NSM_CALLBACK_SESSION_IS_LOADED = 5, | |||
/*! | |||
* Show-optional-gui message. | |||
*/ | |||
NSM_CALLBACK_SHOW_OPTIONAL_GUI = 6, | |||
/*! | |||
* Hide-optional-gui message. | |||
*/ | |||
NSM_CALLBACK_HIDE_OPTIONAL_GUI = 7, | |||
} NsmCallbackOpcode; | |||
/* ------------------------------------------------------------------------------------------------------------ | |||
* Engine Option */ | |||
@@ -1300,7 +1360,9 @@ enum PatchbayIcon { | |||
* Front-ends must never block indefinitely during a callback. | |||
* @see EngineCallbackOpcode, CarlaEngine::setCallback() and carla_set_engine_callback() | |||
*/ | |||
typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, uint pluginId, int value1, int value2, float value3, const char* valueStr); | |||
typedef void (*EngineCallbackFunc)(void* ptr, EngineCallbackOpcode action, uint pluginId, | |||
int value1, int value2, int value3, | |||
float valuef, const char* valueStr); | |||
/*! | |||
* File callback function. | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin Host | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -808,6 +808,16 @@ public: | |||
*/ | |||
virtual CarlaEngineClient* addClient(CarlaPlugin* const plugin); | |||
/*! | |||
* Get the current CPU load estimated by the engine. | |||
*/ | |||
virtual float getDSPLoad() const noexcept; | |||
/*! | |||
* Get the total number of xruns so far. | |||
*/ | |||
virtual uint32_t getTotalXruns() const noexcept; | |||
// ------------------------------------------------------------------- | |||
// Plugin management | |||
@@ -978,7 +988,9 @@ public: | |||
* Call the main engine callback, if set. | |||
* May be called by plugins. | |||
*/ | |||
virtual void callback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept; | |||
virtual void callback(const EngineCallbackOpcode action, const uint pluginId, | |||
const int value1, const int value2, const int value3, | |||
const float valueF, const char* const valueStr) noexcept; | |||
/*! | |||
* Set the main engine callback to @a func. | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin Host | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -26,6 +26,7 @@ using CarlaBackend::PluginType; | |||
using CarlaBackend::PluginCategory; | |||
using CarlaBackend::InternalParameterIndex; | |||
using CarlaBackend::EngineCallbackOpcode; | |||
using CarlaBackend::NsmCallbackOpcode; | |||
using CarlaBackend::EngineOption; | |||
using CarlaBackend::EngineProcessMode; | |||
using CarlaBackend::EngineTransportMode; | |||
@@ -273,6 +274,22 @@ typedef struct _CarlaTransportInfo { | |||
} CarlaTransportInfo; | |||
/*! | |||
* Runtime engine information. | |||
*/ | |||
typedef struct _CarlaRuntimeEngineInfo { | |||
/*! | |||
* DSP load. | |||
*/ | |||
float load; | |||
/*! | |||
* Number of xruns. | |||
*/ | |||
uint32_t xruns; | |||
} CarlaRuntimeEngineInfo; | |||
/*! | |||
* Image data for LV2 inline display API. | |||
* raw image pixmap format is ARGB32, | |||
@@ -353,6 +370,11 @@ CARLA_EXPORT void carla_engine_idle(); | |||
*/ | |||
CARLA_EXPORT bool carla_is_engine_running(); | |||
/*! | |||
* Get information about the currently running engine. | |||
*/ | |||
CARLA_EXPORT const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info(); | |||
/*! | |||
* Tell the engine to stop the current cancelable action. | |||
* @see ENGINE_CALLBACK_CANCELABLE_ACTION | |||
@@ -960,6 +982,18 @@ CARLA_EXPORT const char* carla_get_library_filename(); | |||
*/ | |||
CARLA_EXPORT const char* carla_get_library_folder(); | |||
/*! | |||
* Initialize NSM (that is, announce ourselves to it). | |||
* Must be called as early as possible in the program's lifecycle. | |||
* Returns true if NSM is available and initialized correctly. | |||
*/ | |||
CARLA_EXPORT bool carla_nsm_init(int pid, const char* executableName); | |||
/*! | |||
* Respond to an NSM callback. | |||
*/ | |||
CARLA_EXPORT void carla_nsm_ready(NsmCallbackOpcode opcode); | |||
/** @} */ | |||
#endif /* CARLA_HOST_H_INCLUDED */ |
@@ -475,11 +475,11 @@ bool carla_engine_init_bridge(const char audioBaseName[6+1], const char rtClient | |||
CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(engine != nullptr, "The seleted audio driver is not available", false); | |||
carla_engine_init_common(engine); | |||
engine->setOption(CB::ENGINE_OPTION_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_BRIDGE, nullptr); | |||
engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_MODE_BRIDGE, nullptr); | |||
carla_engine_init_common(engine); | |||
if (engine->init(clientName)) | |||
{ | |||
gStandalone.lastError = "No error"; | |||
@@ -544,6 +544,22 @@ bool carla_is_engine_running() | |||
return (gStandalone.engine != nullptr && gStandalone.engine->isRunning()); | |||
} | |||
const CarlaRuntimeEngineInfo* carla_get_runtime_engine_info() | |||
{ | |||
static CarlaRuntimeEngineInfo retInfo; | |||
// reset | |||
retInfo.load = 0.0f; | |||
retInfo.xruns = 0; | |||
CARLA_SAFE_ASSERT_RETURN(gStandalone.engine != nullptr, &retInfo); | |||
retInfo.load = gStandalone.engine->getDSPLoad(); | |||
retInfo.xruns = gStandalone.engine->getTotalXruns(); | |||
return &retInfo; | |||
} | |||
void carla_cancel_engine_action() | |||
{ | |||
if (gStandalone.engine != nullptr) | |||
@@ -596,8 +612,10 @@ void carla_set_engine_option(EngineOption option, int value, const char* valueSt | |||
// jack transport cannot be disabled in multi-client | |||
if (gStandalone.engineCallback != nullptr) | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED, 0, | |||
CB::ENGINE_TRANSPORT_MODE_JACK, 0, 0.0f, | |||
CB::ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED, | |||
0, | |||
CB::ENGINE_TRANSPORT_MODE_JACK, | |||
0, 0, 0.0f, | |||
gStandalone.engineOptions.transportExtra); | |||
CARLA_SAFE_ASSERT_RETURN(gStandalone.engineOptions.processMode != CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,); | |||
} | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Standalone | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -134,39 +134,48 @@ public: | |||
lo_address_free(nsmAddress); | |||
if (gStandalone.engineCallback != nullptr) | |||
{ | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_INIT, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
return true; | |||
} | |||
void ready(const int action) | |||
void ready(const CB::NsmCallbackOpcode action) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fServerThread != nullptr,); | |||
switch (action) | |||
{ | |||
case -1: // init | |||
case CB::NSM_CALLBACK_INIT: | |||
CARLA_SAFE_ASSERT_BREAK(! fStarted); | |||
fStarted = true; | |||
lo_server_thread_start(fServerThread); | |||
break; | |||
case 0: // error | |||
case CB::NSM_CALLBACK_ERROR: | |||
break; | |||
case 1: // reply | |||
case CB::NSM_CALLBACK_ANNOUNCE: | |||
break; | |||
case 2: // open | |||
case CB::NSM_CALLBACK_OPEN: | |||
fReadyActionOpen = true; | |||
break; | |||
case 3: // save | |||
case CB::NSM_CALLBACK_SAVE: | |||
fReadyActionSave = true; | |||
break; | |||
case 4: // session loaded | |||
case CB::NSM_CALLBACK_SESSION_IS_LOADED: | |||
break; | |||
case 5: // show gui | |||
case CB::NSM_CALLBACK_SHOW_OPTIONAL_GUI: | |||
CARLA_SAFE_ASSERT_BREAK(fReplyAddress != nullptr); | |||
CARLA_SAFE_ASSERT_BREAK(fServer != nullptr); | |||
{ | |||
@@ -175,7 +184,7 @@ public: | |||
} | |||
break; | |||
case 6: // hide gui | |||
case CB::NSM_CALLBACK_HIDE_OPTIONAL_GUI: | |||
CARLA_SAFE_ASSERT_BREAK(fReplyAddress != nullptr); | |||
CARLA_SAFE_ASSERT_BREAK(fServer != nullptr); | |||
{ | |||
@@ -198,9 +207,15 @@ protected: | |||
carla_stdout("CarlaNSM::handleError(\"%s\", %i, \"%s\")", method, code, message); | |||
if (gStandalone.engineCallback != nullptr) | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, CB::ENGINE_CALLBACK_NSM, 0, 0, code, 0.0f, message); | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_ERROR, | |||
code, | |||
0, 0.0f, | |||
message); | |||
return 1; | |||
return 0; | |||
// may be unused | |||
(void)method; | |||
@@ -249,7 +264,13 @@ protected: | |||
if (fHasServerControl) | |||
flags |= 1 << 2; | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, CB::ENGINE_CALLBACK_NSM, 0, 1, flags, 0.0f, smName); | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_ANNOUNCE, | |||
flags, | |||
0, 0.0f, | |||
smName); | |||
} | |||
std::free(msgURL); | |||
@@ -271,7 +292,12 @@ protected: | |||
if (gStandalone.engineCallback != nullptr) | |||
{ | |||
fReadyActionOpen = false; | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, CB::ENGINE_CALLBACK_NSM, 0, 2, 0, 0.0f, projectPath); | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_OPEN, | |||
0, 0, 0.0f, | |||
projectPath); | |||
for (; ! fReadyActionOpen;) | |||
carla_msleep(10); | |||
@@ -322,7 +348,11 @@ protected: | |||
if (gStandalone.engineCallback != nullptr) | |||
{ | |||
fReadyActionSave = false; | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, CB::ENGINE_CALLBACK_NSM, 0, 3, 0, 0.0f, nullptr); | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_SAVE, | |||
0, 0, 0.0f, nullptr); | |||
for (; ! fReadyActionSave;) | |||
carla_msleep(10); | |||
@@ -346,7 +376,11 @@ protected: | |||
carla_stdout("CarlaNSM::handleSessionIsLoaded()"); | |||
if (gStandalone.engineCallback != nullptr) | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, CB::ENGINE_CALLBACK_NSM, 0, 4, 0, 0.0f, nullptr); | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_SESSION_IS_LOADED, | |||
0, 0, 0.0f, nullptr); | |||
return 0; | |||
} | |||
@@ -358,7 +392,11 @@ protected: | |||
carla_stdout("CarlaNSM::handleShowOptionalGui()"); | |||
if (gStandalone.engineCallback != nullptr) | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, CB::ENGINE_CALLBACK_NSM, 0, 5, 0, 0.0f, nullptr); | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_SHOW_OPTIONAL_GUI, | |||
0, 0, 0.0f, nullptr); | |||
return 0; | |||
} | |||
@@ -370,7 +408,11 @@ protected: | |||
carla_stdout("CarlaNSM::handleHideOptionalGui()"); | |||
if (gStandalone.engineCallback != nullptr) | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, CB::ENGINE_CALLBACK_NSM, 0, 6, 0, 0.0f, nullptr); | |||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | |||
CB::ENGINE_CALLBACK_NSM, | |||
0, | |||
CB::NSM_CALLBACK_HIDE_OPTIONAL_GUI, | |||
0, 0, 0.0f, nullptr); | |||
return 0; | |||
} | |||
@@ -594,9 +636,6 @@ private: | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
CARLA_EXPORT | |||
bool carla_nsm_init(int pid, const char* executableName); | |||
bool carla_nsm_init(int pid, const char* executableName) | |||
{ | |||
#ifdef HAVE_LIBLO | |||
@@ -609,10 +648,7 @@ bool carla_nsm_init(int pid, const char* executableName) | |||
#endif | |||
} | |||
CARLA_EXPORT | |||
void carla_nsm_ready(int action); | |||
void carla_nsm_ready(int action) | |||
void carla_nsm_ready(CB::NsmCallbackOpcode action) | |||
{ | |||
#ifdef HAVE_LIBLO | |||
CarlaNSM::getInstance().ready(action); | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin Host | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -305,7 +305,7 @@ bool CarlaEngine::close() | |||
pData->close(); | |||
callback(ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0, 0.0f, nullptr); | |||
return true; | |||
} | |||
@@ -347,6 +347,20 @@ CarlaEngineClient* CarlaEngine::addClient(CarlaPlugin* const) | |||
return new CarlaEngineClient(*this); | |||
} | |||
float CarlaEngine::getDSPLoad() const noexcept | |||
{ | |||
return 0.0f; | |||
} | |||
uint32_t CarlaEngine::getTotalXruns() const noexcept | |||
{ | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
return pData->xruns; | |||
#else | |||
return 0; | |||
#endif | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Plugin management | |||
@@ -611,7 +625,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, | |||
plugin->setActive(wasActive, true, true); | |||
plugin->setEnabled(true); | |||
callback(ENGINE_CALLBACK_RELOAD_ALL, id, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_RELOAD_ALL, id, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
else if (! pData->loadingProject) | |||
#endif | |||
@@ -619,7 +633,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, | |||
plugin->setEnabled(true); | |||
++pData->curPluginCount; | |||
callback(ENGINE_CALLBACK_PLUGIN_ADDED, id, 0, 0, 0.0f, plugin->getName()); | |||
callback(ENGINE_CALLBACK_PLUGIN_ADDED, id, 0, 0, 0, 0.0f, plugin->getName()); | |||
if (getType() != kEngineTypeBridge) | |||
plugin->setActive(true, false, true); | |||
@@ -686,7 +700,7 @@ bool CarlaEngine::removePlugin(const uint id) | |||
delete plugin; | |||
callback(ENGINE_CALLBACK_PLUGIN_REMOVED, id, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PLUGIN_REMOVED, id, 0, 0, 0, 0.0f, nullptr); | |||
return true; | |||
} | |||
@@ -722,7 +736,7 @@ bool CarlaEngine::removeAllPlugins() | |||
const ScopedActionLock sal(this, kEnginePostActionZeroCount, 0, 0); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
for (uint i=0; i < curPluginCount; ++i) | |||
{ | |||
@@ -737,8 +751,8 @@ bool CarlaEngine::removeAllPlugins() | |||
carla_zeroFloats(pluginData.peaks, 4); | |||
callback(ENGINE_CALLBACK_PLUGIN_REMOVED, id, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PLUGIN_REMOVED, id, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
return true; | |||
@@ -1094,7 +1108,7 @@ bool CarlaEngine::loadFile(const char* const filename) | |||
//nicerName | |||
if (addPlugin(PLUGIN_INTERNAL, nullptr, nicerName, "zynaddsubfx", 0, nullptr)) | |||
{ | |||
callback(ENGINE_CALLBACK_UI_STATE_CHANGED, curPluginId, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_UI_STATE_CHANGED, curPluginId, 0, 0, 0, 0.0f, nullptr); | |||
if (CarlaPlugin* const plugin = getPlugin(curPluginId)) | |||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, (extension == "xmz") ? "CarlaAlternateFile1" : "CarlaAlternateFile2", filename, true); | |||
@@ -1284,15 +1298,17 @@ float CarlaEngine::getOutputPeak(const uint pluginId, const bool isLeft) const n | |||
// ----------------------------------------------------------------------- | |||
// Callback | |||
void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept | |||
void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginId, | |||
const int value1, const int value2, const int value3, | |||
const float valueF, const char* const valueStr) noexcept | |||
{ | |||
#ifdef DEBUG | |||
if (pData->isIdling) | |||
carla_stdout("CarlaEngine::callback [while idling] (%i:%s, %i, %i, %i, %f, \"%s\")", | |||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | |||
carla_stdout("CarlaEngine::callback [while idling] (%i:%s, %i, %i, %i, %i, %f, \"%s\")", | |||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueF, valueStr); | |||
else if (action != ENGINE_CALLBACK_IDLE && action != ENGINE_CALLBACK_NOTE_ON && action != ENGINE_CALLBACK_NOTE_OFF) | |||
carla_debug("CarlaEngine::callback(%i:%s, %i, %i, %i, %f, \"%s\")", | |||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | |||
carla_debug("CarlaEngine::callback(%i:%s, %i, %i, %i, %i, %f, \"%s\")", | |||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueF. valueStr); | |||
#endif | |||
if (pData->callback != nullptr) | |||
@@ -1301,7 +1317,7 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI | |||
++pData->isIdling; | |||
try { | |||
pData->callback(pData->callbackPtr, action, pluginId, value1, value2, value3, valueStr); | |||
pData->callback(pData->callbackPtr, action, pluginId, value1, value2, value3, valueF, valueStr); | |||
#if defined(CARLA_OS_LINUX) && defined(__arm__) | |||
} catch (__cxxabiv1::__forced_unwind&) { | |||
carla_stderr2("Caught forced unwind exception in callback"); | |||
@@ -1775,7 +1791,7 @@ void CarlaEngine::bufferSizeChanged(const uint32_t newBufferSize) | |||
} | |||
} | |||
callback(ENGINE_CALLBACK_BUFFER_SIZE_CHANGED, 0, static_cast<int>(newBufferSize), 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_BUFFER_SIZE_CHANGED, 0, static_cast<int>(newBufferSize), 0, 0, 0.0f, nullptr); | |||
} | |||
void CarlaEngine::sampleRateChanged(const double newSampleRate) | |||
@@ -1804,7 +1820,7 @@ void CarlaEngine::sampleRateChanged(const double newSampleRate) | |||
} | |||
} | |||
callback(ENGINE_CALLBACK_SAMPLE_RATE_CHANGED, 0, 0, 0, static_cast<float>(newSampleRate), nullptr); | |||
callback(ENGINE_CALLBACK_SAMPLE_RATE_CHANGED, 0, 0, 0, 0, static_cast<float>(newSampleRate), nullptr); | |||
} | |||
void CarlaEngine::offlineModeChanged(const bool isOfflineNow) | |||
@@ -2087,13 +2103,13 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
if (! (xmlType.equalsIgnoreCase("carla-project") || isPreset)) | |||
{ | |||
callback(ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0, 0.0f, nullptr); | |||
setLastError("Not a valid Carla project or preset file"); | |||
return false; | |||
} | |||
pData->actionCanceled = false; | |||
callback(ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 1, 0, 0.0f, "Loading project"); | |||
callback(ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 1, 0, 0, 0.0f, "Loading project"); | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
const ScopedValueSetter<bool> _svs2(pData->loadingProject, true, false); | |||
@@ -2103,7 +2119,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
xmlElement = xmlDoc.getDocumentElement(false); | |||
CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to completely parse project file"); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2228,7 +2244,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
setOption(static_cast<EngineOption>(option), value, valueStr); | |||
} | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2252,7 +2268,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
if (bpm >= 20.0 && bpm < 400.0) | |||
pData->time.setBPM(bpm); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2275,7 +2291,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
CarlaStateSave stateSave; | |||
stateSave.fillFromXmlElement(isPreset ? xmlElement.get() : elem); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2299,7 +2315,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
if (CarlaPlugin* const plugin = pData->plugins[pluginId].plugin) | |||
{ | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2332,7 +2348,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
++pData->curPluginCount; | |||
plugin->setEnabled(true); | |||
callback(ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0.0f, plugin->getName()); | |||
callback(ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0, 0.0f, plugin->getName()); | |||
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | |||
pData->graph.addPlugin(plugin); | |||
@@ -2450,7 +2466,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
if (CarlaPlugin* const plugin = pData->plugins[pluginId].plugin) | |||
{ | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2474,7 +2490,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
plugin->setEnabled(true); | |||
++pData->curPluginCount; | |||
callback(ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0.0f, plugin->getName()); | |||
callback(ENGINE_CALLBACK_PLUGIN_ADDED, pluginId, 0, 0, 0, 0.0f, plugin->getName()); | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | |||
@@ -2494,8 +2510,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
if (isPreset) | |||
{ | |||
callback(ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 0, 0, 0.0f, "Loading project"); | |||
callback(ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 0, 0, 0, 0.0f, "Loading project"); | |||
return true; | |||
} | |||
} | |||
@@ -2510,7 +2526,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false); | |||
} | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2558,7 +2574,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
restorePatchbayConnection(false, sourcePort, targetPort, !isUsingExternal); | |||
} | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->aboutToClose) | |||
return true; | |||
@@ -2640,8 +2656,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||
} | |||
#endif | |||
callback(ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 0, 0, 0.0f, "Loading project"); | |||
callback(ENGINE_CALLBACK_PROJECT_LOAD_FINISHED, 0, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_CANCELABLE_ACTION, 0, 0, 0, 0, 0.0f, "Loading project"); | |||
return true; | |||
} | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin Host | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -576,13 +576,15 @@ public: | |||
{ | |||
carla_stderr("Did not receive ping message from server for 30 secs, closing..."); | |||
signalThreadShouldExit(); | |||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
void callback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept override | |||
void callback(const EngineCallbackOpcode action, const uint pluginId, | |||
const int value1, const int value2, const int value3, | |||
const float valueF, const char* const valueStr) noexcept override | |||
{ | |||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valueStr); | |||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||
if (fClosingDown) | |||
return; | |||
@@ -595,7 +597,7 @@ public: | |||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | |||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterValue); | |||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | |||
fShmNonRtServerControl.writeFloat(value3); | |||
fShmNonRtServerControl.writeFloat(valueF); | |||
fShmNonRtServerControl.commitWrite(); | |||
} break; | |||
@@ -605,7 +607,7 @@ public: | |||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | |||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerDefaultValue); | |||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | |||
fShmNonRtServerControl.writeFloat(value3); | |||
fShmNonRtServerControl.writeFloat(valueF); | |||
fShmNonRtServerControl.commitWrite(); | |||
} break; | |||
@@ -1020,7 +1022,7 @@ public: | |||
case kPluginBridgeNonRtClientQuit: | |||
fClosingDown = true; | |||
signalThreadShouldExit(); | |||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0, 0.0f, nullptr); | |||
break; | |||
} | |||
} | |||
@@ -1367,7 +1369,7 @@ protected: | |||
} | |||
} | |||
callback(ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (! quitReceived) | |||
{ | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin Host | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -221,7 +221,7 @@ bool ExternalGraph::connect(const uint groupA, const uint portA, const uint grou | |||
std::snprintf(strBuf, STR_MAX, "%u:%u:%u:%u", groupA, portA, groupB, portB); | |||
if (sendCallback) | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0, 0.0f, strBuf); | |||
connections.list.append(connectionToId); | |||
return true; | |||
@@ -300,7 +300,7 @@ bool ExternalGraph::disconnect(const uint connectionId) noexcept | |||
return false; | |||
} | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connectionToId.id, 0, 0, 0.0f, nullptr); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connectionToId.id, 0, 0, 0, 0.0f, nullptr); | |||
connections.list.remove(it); | |||
return true; | |||
@@ -318,18 +318,57 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
// Main | |||
{ | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, kExternalGraphGroupCarla, PATCHBAY_ICON_CARLA, MAIN_CARLA_PLUGIN_ID, 0.0f, kEngine->getName()); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
kExternalGraphGroupCarla, | |||
PATCHBAY_ICON_CARLA, | |||
MAIN_CARLA_PLUGIN_ID, | |||
0, 0.0f, | |||
kEngine->getName()); | |||
if (isRack) | |||
{ | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupCarla, kExternalGraphCarlaPortAudioIn1, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, "audio-in1"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupCarla, kExternalGraphCarlaPortAudioIn2, PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, "audio-in2"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupCarla, kExternalGraphCarlaPortAudioOut1, PATCHBAY_PORT_TYPE_AUDIO, 0.0f, "audio-out1"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupCarla, kExternalGraphCarlaPortAudioOut2, PATCHBAY_PORT_TYPE_AUDIO, 0.0f, "audio-out2"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupCarla, | |||
kExternalGraphCarlaPortAudioIn1, | |||
PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, | |||
0, 0.0f, | |||
"audio-in1"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupCarla, | |||
kExternalGraphCarlaPortAudioIn2, | |||
PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, | |||
0, 0.0f, | |||
"audio-in2"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupCarla, | |||
kExternalGraphCarlaPortAudioOut1, | |||
PATCHBAY_PORT_TYPE_AUDIO, | |||
0, 0.0f, | |||
"audio-out1"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupCarla, | |||
kExternalGraphCarlaPortAudioOut2, | |||
PATCHBAY_PORT_TYPE_AUDIO, | |||
0, 0.0f, | |||
"audio-out2"); | |||
} | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupCarla, kExternalGraphCarlaPortMidiIn, PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, 0.0f, "midi-in"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupCarla, kExternalGraphCarlaPortMidiOut, PATCHBAY_PORT_TYPE_MIDI, 0.0f, "midi-out"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupCarla, | |||
kExternalGraphCarlaPortMidiIn, | |||
PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, | |||
0, 0.0f, | |||
"midi-in"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupCarla, | |||
kExternalGraphCarlaPortMidiOut, | |||
PATCHBAY_PORT_TYPE_MIDI, | |||
0, 0.0f, | |||
"midi-out"); | |||
} | |||
char strBuf[STR_MAX+1]; | |||
@@ -343,7 +382,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
else | |||
std::strncpy(strBuf, "Capture", STR_MAX); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, kExternalGraphGroupAudioIn, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
kExternalGraphGroupAudioIn, | |||
PATCHBAY_ICON_HARDWARE, | |||
-1, | |||
0, 0.0f, | |||
strBuf); | |||
const CarlaString groupNameIn(strBuf); | |||
@@ -355,8 +399,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
portNameToId.setFullName(groupNameIn + portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupAudioIn, ++h, | |||
PATCHBAY_PORT_TYPE_AUDIO, 0.0f, portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupAudioIn, | |||
++h, | |||
PATCHBAY_PORT_TYPE_AUDIO, | |||
0, 0.0f, | |||
portNameToId.name); | |||
} | |||
// Audio Out | |||
@@ -365,7 +413,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
else | |||
std::strncpy(strBuf, "Playback", STR_MAX); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, kExternalGraphGroupAudioOut, PATCHBAY_ICON_HARDWARE, -1, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
kExternalGraphGroupAudioOut, | |||
PATCHBAY_ICON_HARDWARE, | |||
-1, | |||
0, 0.0f, | |||
strBuf); | |||
const CarlaString groupNameOut(strBuf); | |||
@@ -377,14 +430,23 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
portNameToId.setFullName(groupNameOut + portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupAudioOut, ++h, | |||
PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupAudioOut, | |||
++h, | |||
PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, | |||
0, 0.0f, | |||
portNameToId.name); | |||
} | |||
} | |||
// MIDI In | |||
{ | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, kExternalGraphGroupMidiIn, PATCHBAY_ICON_HARDWARE, -1, 0.0f, "Readable MIDI ports"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
kExternalGraphGroupMidiIn, | |||
PATCHBAY_ICON_HARDWARE, | |||
-1, | |||
0, 0.0f, | |||
"Readable MIDI ports"); | |||
const CarlaString groupNamePlus("Readable MIDI ports:"); | |||
@@ -396,14 +458,23 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
portNameToId.setFullName(groupNamePlus + portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupMidiIn, ++h, | |||
PATCHBAY_PORT_TYPE_MIDI, 0.0f, portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupMidiIn, | |||
++h, | |||
PATCHBAY_PORT_TYPE_MIDI, | |||
0, 0.0f, | |||
portNameToId.name); | |||
} | |||
} | |||
// MIDI Out | |||
{ | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, kExternalGraphGroupMidiOut, PATCHBAY_ICON_HARDWARE, -1, 0.0f, "Writable MIDI ports"); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
kExternalGraphGroupMidiOut, | |||
PATCHBAY_ICON_HARDWARE, | |||
-1, | |||
0, 0.0f, | |||
"Writable MIDI ports"); | |||
const CarlaString groupNamePlus("Writable MIDI ports:"); | |||
@@ -415,8 +486,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||
portNameToId.setFullName(groupNamePlus + portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, kExternalGraphGroupMidiOut, ++h, | |||
PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, 0.0f, portNameToId.name); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
kExternalGraphGroupMidiOut, | |||
++h, | |||
PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, | |||
0, 0.0f, | |||
portNameToId.name); | |||
} | |||
} | |||
} | |||
@@ -713,7 +788,10 @@ void RackGraph::refresh(const char* const deviceName) | |||
std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
extGraph.connections.list.append(connectionToId); | |||
} | |||
@@ -729,7 +807,10 @@ void RackGraph::refresh(const char* const deviceName) | |||
std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
extGraph.connections.list.append(connectionToId); | |||
} | |||
@@ -745,7 +826,10 @@ void RackGraph::refresh(const char* const deviceName) | |||
std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
extGraph.connections.list.append(connectionToId); | |||
} | |||
@@ -761,7 +845,10 @@ void RackGraph::refresh(const char* const deviceName) | |||
std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
extGraph.connections.list.append(connectionToId); | |||
} | |||
@@ -1089,31 +1176,51 @@ void addNodeToPatchbay(CarlaEngine* const engine, const uint32_t groupId, const | |||
CARLA_SAFE_ASSERT_RETURN(engine != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(proc != nullptr,); | |||
const int icon((clientId >= 0) ? PATCHBAY_ICON_PLUGIN : PATCHBAY_ICON_HARDWARE); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupId, icon, clientId, 0.0f, proc->getName().toRawUTF8()); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
groupId, | |||
clientId >= 0 ? PATCHBAY_ICON_PLUGIN : PATCHBAY_ICON_HARDWARE, | |||
clientId, | |||
0, 0.0f, | |||
proc->getName().toRawUTF8()); | |||
for (int i=0, numInputs=proc->getTotalNumInputChannels(); i<numInputs; ++i) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, groupId, static_cast<int>(kAudioInputPortOffset)+i, | |||
PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, 0.0f, proc->getInputChannelName(i).toRawUTF8()); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
groupId, | |||
static_cast<int>(kAudioInputPortOffset)+i, | |||
PATCHBAY_PORT_TYPE_AUDIO|PATCHBAY_PORT_IS_INPUT, | |||
0, 0.0f, | |||
proc->getInputChannelName(i).toRawUTF8()); | |||
} | |||
for (int i=0, numOutputs=proc->getTotalNumOutputChannels(); i<numOutputs; ++i) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, groupId, static_cast<int>(kAudioOutputPortOffset)+i, | |||
PATCHBAY_PORT_TYPE_AUDIO, 0.0f, proc->getOutputChannelName(i).toRawUTF8()); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
groupId, | |||
static_cast<int>(kAudioOutputPortOffset)+i, | |||
PATCHBAY_PORT_TYPE_AUDIO, | |||
0, 0.0f, | |||
proc->getOutputChannelName(i).toRawUTF8()); | |||
} | |||
if (proc->acceptsMidi()) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, groupId, static_cast<int>(kMidiInputPortOffset), | |||
PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, 0.0f, "events-in"); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
groupId, | |||
static_cast<int>(kMidiInputPortOffset), | |||
PATCHBAY_PORT_TYPE_MIDI|PATCHBAY_PORT_IS_INPUT, | |||
0, 0.0f, | |||
"events-in"); | |||
} | |||
if (proc->producesMidi()) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, groupId, static_cast<int>(kMidiOutputPortOffset), | |||
PATCHBAY_PORT_TYPE_MIDI, 0.0f, "events-out"); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
groupId, | |||
static_cast<int>(kMidiOutputPortOffset), | |||
PATCHBAY_PORT_TYPE_MIDI, | |||
0, 0.0f, | |||
"events-out"); | |||
} | |||
} | |||
@@ -1125,29 +1232,40 @@ void removeNodeFromPatchbay(CarlaEngine* const engine, const uint32_t groupId, c | |||
for (int i=0, numInputs=proc->getTotalNumInputChannels(); i<numInputs; ++i) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, groupId, static_cast<int>(kAudioInputPortOffset)+i, | |||
0, 0.0f, nullptr); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, | |||
groupId, | |||
static_cast<int>(kAudioInputPortOffset)+i, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
for (int i=0, numOutputs=proc->getTotalNumOutputChannels(); i<numOutputs; ++i) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, groupId, static_cast<int>(kAudioOutputPortOffset)+i, | |||
0, 0.0f, nullptr); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, | |||
groupId, | |||
static_cast<int>(kAudioOutputPortOffset)+i, | |||
0, 0, 0.0f, | |||
nullptr); | |||
} | |||
if (proc->acceptsMidi()) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, groupId, static_cast<int>(kMidiInputPortOffset), | |||
0, 0.0f, nullptr); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, | |||
groupId, | |||
static_cast<int>(kMidiInputPortOffset), | |||
0, 0, 0.0f, nullptr); | |||
} | |||
if (proc->producesMidi()) | |||
{ | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, groupId, static_cast<int>(kMidiOutputPortOffset), | |||
0, 0.0f, nullptr); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, | |||
groupId, | |||
static_cast<int>(kMidiOutputPortOffset), | |||
0, 0, 0.0f, nullptr); | |||
} | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED, groupId, 0, 0, 0.0f, nullptr); | |||
engine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED, | |||
groupId, | |||
0, 0, 0, 0.0f, nullptr); | |||
} | |||
// ----------------------------------------------------------------------- | |||
@@ -1503,7 +1621,10 @@ void PatchbayGraph::renamePlugin(CarlaPlugin* const plugin, const char* const ne | |||
CARLA_SAFE_ASSERT_RETURN(node != nullptr,); | |||
if (! usingExternal) | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED, node->nodeId, 0, 0, 0.0f, newName); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_RENAMED, | |||
node->nodeId, | |||
0, 0, 0, 0.0f, | |||
newName); | |||
} | |||
void PatchbayGraph::removePlugin(CarlaPlugin* const plugin) | |||
@@ -1589,7 +1710,10 @@ bool PatchbayGraph::connect(const bool external, const uint groupA, const uint p | |||
std::snprintf(strBuf, STR_MAX, "%u:%u:%u:%u", groupA, portA, groupB, portB); | |||
if (sendCallback) | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
connections.list.append(connectionToId); | |||
return true; | |||
@@ -1622,7 +1746,10 @@ bool PatchbayGraph::disconnect(const uint connectionId) | |||
connectionToId.groupB, static_cast<int>(adjustedPortB))) | |||
return false; | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connectionToId.id, 0, 0, 0.0f, nullptr); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
nullptr); | |||
connections.list.remove(it); | |||
return true; | |||
@@ -1660,7 +1787,10 @@ void PatchbayGraph::disconnectInternalGroup(const uint groupId) noexcept | |||
*/ | |||
if (! usingExternal) | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connectionToId.id, 0, 0, 0.0f, nullptr); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
nullptr); | |||
connections.list.remove(it); | |||
} | |||
@@ -1724,7 +1854,10 @@ void PatchbayGraph::refresh(const char* const deviceName) | |||
std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", groupA, portA, groupB, portB); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
kEngine->callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
connections.list.append(connectionToId); | |||
} | |||
@@ -392,6 +392,7 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept | |||
timeInfo(), | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
plugins(nullptr), | |||
xruns(0), | |||
#endif | |||
events(), | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
@@ -481,6 +482,7 @@ bool CarlaEngine::ProtectedData::init(const char* const clientName) | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
plugins = new EnginePluginData[maxPluginNumber]; | |||
carla_zeroStructs(plugins, maxPluginNumber); | |||
xruns = 0; | |||
#endif | |||
nextAction.clearAndReset(); | |||
@@ -246,6 +246,7 @@ struct CarlaEngine::ProtectedData { | |||
EnginePluginData plugins[1]; | |||
#else | |||
EnginePluginData* plugins; | |||
uint32_t xruns; | |||
#endif | |||
float peaks[4]; | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin Host | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -965,6 +965,7 @@ public: | |||
jackbridge_set_port_registration_callback(fClient, carla_jack_port_registration_callback, this); | |||
jackbridge_set_port_connect_callback(fClient, carla_jack_port_connect_callback, this); | |||
jackbridge_set_port_rename_callback(fClient, carla_jack_port_rename_callback, this); | |||
jackbridge_set_xrun_callback(fClient, carla_jack_xrun_callback, this); | |||
if (opts.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || opts.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | |||
{ | |||
@@ -1030,7 +1031,9 @@ public: | |||
startThread(); | |||
callback(ENGINE_CALLBACK_ENGINE_STARTED, 0, | |||
opts.processMode, opts.transportMode, | |||
opts.processMode, | |||
opts.transportMode, | |||
static_cast<int>(pData->bufferSize), | |||
static_cast<float>(pData->sampleRate), | |||
getCurrentDriverName()); | |||
return true; | |||
@@ -1129,6 +1132,15 @@ public: | |||
return "JACK"; | |||
} | |||
#ifndef BUILD_BRIDGE | |||
float getDSPLoad() const noexcept override | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(fClient != nullptr, 0.0f); | |||
return jackbridge_cpu_load(fClient); | |||
} | |||
#endif | |||
EngineTimeInfo getTimeInfo() const noexcept override | |||
{ | |||
if (pData->options.transportMode != ENGINE_TRANSPORT_MODE_JACK) | |||
@@ -1193,7 +1205,8 @@ public: | |||
{ | |||
// jack transport cannot be disabled in multi-client | |||
callback(ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED, 0, | |||
ENGINE_TRANSPORT_MODE_JACK, 0, 0.0f, | |||
ENGINE_TRANSPORT_MODE_JACK, | |||
0, 0, 0.0f, | |||
pData->options.transportExtra); | |||
CARLA_SAFE_ASSERT_RETURN(pData->options.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,); | |||
@@ -1358,7 +1371,9 @@ public: | |||
if (connectionToId.groupA != groupId && connectionToId.groupB != groupId) | |||
continue; | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connectionToId.id, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, nullptr); | |||
fUsedConnections.list.remove(it2); | |||
} | |||
@@ -1370,7 +1385,10 @@ public: | |||
if (portNameToId.group != groupId) | |||
continue; | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, portNameToId.group, static_cast<int>(portNameToId.port), 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, | |||
portNameToId.group, | |||
static_cast<int>(portNameToId.port), | |||
0, 0, 0.0f, nullptr); | |||
fUsedPorts.list.remove(it); | |||
} | |||
} | |||
@@ -1890,7 +1908,7 @@ protected: | |||
GroupNameToId groupNameToId; | |||
groupNameToId.setData(groupId, name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED, groupNameToId.group, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_REMOVED, groupNameToId.group, 0, 0, 0, 0.0f, nullptr); | |||
fUsedGroups.list.removeOne(groupNameToId); | |||
} | |||
@@ -1923,12 +1941,16 @@ protected: | |||
if (groupId == 0) | |||
{ | |||
groupId = ++fUsedGroups.lastId; | |||
PatchbayIcon icon = (jackPortFlags & JackPortIsPhysical) ? PATCHBAY_ICON_HARDWARE : PATCHBAY_ICON_APPLICATION; | |||
GroupNameToId groupNameToId; | |||
groupNameToId.setData(groupId, groupName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupNameToId.group, icon, -1, 0.0f, groupNameToId.name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
groupNameToId.group, | |||
(jackPortFlags & JackPortIsPhysical) ? PATCHBAY_ICON_HARDWARE : PATCHBAY_ICON_APPLICATION, | |||
-1, | |||
0, 0.0f, | |||
groupNameToId.name); | |||
fNewGroups.append(groupId); | |||
fUsedGroups.list.append(groupNameToId); | |||
@@ -1944,7 +1966,10 @@ protected: | |||
See the comment on CarlaEngineJack::renamePlugin() for more information. */ | |||
if (portNameToId.group <= 0 || portNameToId.port <= 0) return; | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, portNameToId.group, static_cast<int>(portNameToId.port), 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_REMOVED, | |||
portNameToId.group, | |||
static_cast<int>(portNameToId.port), | |||
0, 0, 0.0f, nullptr); | |||
fUsedPorts.list.removeOne(portNameToId); | |||
} | |||
} | |||
@@ -1983,7 +2008,10 @@ protected: | |||
ConnectionToId connectionToId; | |||
connectionToId.setData(++fUsedConnections.lastId, portNameToIdA.group, portNameToIdA.port, portNameToIdB.group, portNameToIdB.port); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
fUsedConnections.list.append(connectionToId); | |||
} | |||
else | |||
@@ -2009,8 +2037,11 @@ protected: | |||
} | |||
} | |||
if (found) | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, connectionToId.id, 0, 0, 0.0f, nullptr); | |||
if (found) { | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
} | |||
@@ -2049,7 +2080,11 @@ protected: | |||
CARLA_SAFE_ASSERT_CONTINUE(portNameToId.group == groupId); | |||
portNameToId.rename(shortPortName, newFullName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED, portNameToId.group, static_cast<int>(portNameToId.port), 0, 0.0f, portNameToId.name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_RENAMED, | |||
portNameToId.group, | |||
static_cast<int>(portNameToId.port), | |||
0, 0, 0.0f, | |||
portNameToId.name); | |||
break; | |||
} | |||
} | |||
@@ -2082,7 +2117,7 @@ protected: | |||
carla_zeroPointers(fRackPorts, kRackPortCount); | |||
#endif | |||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -2099,7 +2134,7 @@ protected: | |||
//if (pData->nextAction.pluginId == plugin->getId()) | |||
// pData->nextAction.clearAndReset(); | |||
callback(ENGINE_CALLBACK_PLUGIN_UNAVAILABLE, plugin->getId(), 0, 0, 0.0f, "Killed by JACK"); | |||
callback(ENGINE_CALLBACK_PLUGIN_UNAVAILABLE, plugin->getId(), 0, 0, 0, 0.0f, "Killed by JACK"); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -2201,7 +2236,12 @@ private: | |||
GroupNameToId groupNameToId; | |||
groupNameToId.setData(++fUsedGroups.lastId, ourName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupNameToId.group, PATCHBAY_ICON_CARLA, -1, 0.0f, groupNameToId.name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
groupNameToId.group, | |||
PATCHBAY_ICON_CARLA, | |||
-1, | |||
0, 0.0f, | |||
groupNameToId.name); | |||
fUsedGroups.list.append(groupNameToId); | |||
} | |||
@@ -2247,7 +2287,12 @@ private: | |||
GroupNameToId groupNameToId; | |||
groupNameToId.setData(groupId, groupName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, groupNameToId.group, icon, pluginId, 0.0f, groupNameToId.name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_ADDED, | |||
groupNameToId.group, | |||
icon, | |||
pluginId, | |||
0, 0.0f, | |||
groupNameToId.name); | |||
fUsedGroups.list.append(groupNameToId); | |||
} | |||
@@ -2293,7 +2338,10 @@ private: | |||
ConnectionToId connectionToId; | |||
connectionToId.setData(++fUsedConnections.lastId, thisPort.group, thisPort.port, targetPort.group, targetPort.port); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
fUsedConnections.list.append(connectionToId); | |||
} | |||
@@ -2343,7 +2391,12 @@ private: | |||
PortNameToId portNameToId; | |||
portNameToId.setData(groupId, ++fUsedPorts.lastId, shortPortName, fullPortName); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, portNameToId.group, static_cast<int>(portNameToId.port), static_cast<int>(canvasPortFlags), 0.0f, portNameToId.name); | |||
callback(ENGINE_CALLBACK_PATCHBAY_PORT_ADDED, | |||
portNameToId.group, | |||
static_cast<int>(portNameToId.port), | |||
static_cast<int>(canvasPortFlags), | |||
0, 0.0f, | |||
portNameToId.name); | |||
fUsedPorts.list.append(portNameToId); | |||
} | |||
#endif | |||
@@ -2509,8 +2562,13 @@ private: | |||
int pluginId = -1; | |||
PatchbayIcon icon = PATCHBAY_ICON_PLUGIN; | |||
if (findPluginIdAndIcon(groupName, pluginId, icon)) | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED, groupId, icon, pluginId, 0.0f, nullptr); | |||
if (findPluginIdAndIcon(groupName, pluginId, icon)) { | |||
callback(ENGINE_CALLBACK_PATCHBAY_CLIENT_DATA_CHANGED, | |||
groupId, | |||
icon, | |||
pluginId, | |||
0, 0.0f, nullptr); | |||
} | |||
} | |||
events.clear(); | |||
@@ -2618,6 +2676,12 @@ private: | |||
std::strncpy(ev.name2, newName, STR_MAX); | |||
handlePtr->postPoneJackCallback(ev); | |||
} | |||
static int JACKBRIDGE_API carla_jack_xrun_callback(void* arg) | |||
{ | |||
++(handlePtr->pData->xruns); | |||
return 0; | |||
} | |||
#endif | |||
static void JACKBRIDGE_API carla_jack_shutdown_callback(void* arg) | |||
@@ -227,7 +227,13 @@ public: | |||
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | |||
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false); | |||
callback(ENGINE_CALLBACK_ENGINE_STARTED, 0, pData->options.processMode, pData->options.transportMode, 0.0f, getCurrentDriverName()); | |||
callback(ENGINE_CALLBACK_ENGINE_STARTED, | |||
0, | |||
pData->options.processMode, | |||
pData->options.transportMode, | |||
static_cast<int>(pData->bufferSize), | |||
static_cast<float>(pData->sampleRate), | |||
getCurrentDriverName()); | |||
return true; | |||
} | |||
@@ -404,7 +410,10 @@ public: | |||
std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
strBuf[STR_MAX-1] = '\0'; | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
extGraph.connections.list.append(connectionToId); | |||
} | |||
@@ -425,7 +434,10 @@ public: | |||
std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||
strBuf[STR_MAX-1] = '\0'; | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
extGraph.connections.list.append(connectionToId); | |||
} | |||
@@ -582,7 +594,7 @@ protected: | |||
void audioDeviceError(const juce::String& errorMessage) override | |||
{ | |||
callback(ENGINE_CALLBACK_ERROR, 0, 0, 0, 0.0f, errorMessage.toRawUTF8()); | |||
callback(ENGINE_CALLBACK_ERROR, 0, 0, 0, 0, 0.0f, errorMessage.toRawUTF8()); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -645,9 +645,14 @@ private: | |||
void _updateParamValues(CarlaPlugin* const plugin, const uint32_t pluginId) const noexcept | |||
{ | |||
for (uint32_t i=0, count=plugin->getParameterCount(); i<count; ++i) | |||
for (uint32_t i=0, count=plugin->getParameterCount(); i<count; ++i) { | |||
fEngine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pluginId, static_cast<int>(i), 0, plugin->getParameterValue(i), nullptr); | |||
pluginId, | |||
static_cast<int>(i), | |||
0, 0, | |||
plugin->getParameterValue(i), | |||
nullptr); | |||
} | |||
} | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineNativeUI) | |||
@@ -803,12 +808,17 @@ protected: | |||
return "Plugin"; | |||
} | |||
void callback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) noexcept override | |||
void callback(const EngineCallbackOpcode action, const uint pluginId, | |||
const int value1, const int value2, const int value3, | |||
const float valueF, const char* const valueStr) noexcept override | |||
{ | |||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valueStr); | |||
CarlaEngine::callback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||
if (action == ENGINE_CALLBACK_IDLE && ! pData->aboutToClose) | |||
pHost->dispatcher(pHost->handle, NATIVE_HOST_OPCODE_HOST_IDLE, 0, 0, nullptr, 0.0f); | |||
if (action == ENGINE_CALLBACK_IDLE && ! pData->aboutToClose) { | |||
pHost->dispatcher(pHost->handle, | |||
NATIVE_HOST_OPCODE_HOST_IDLE, | |||
0, 0, nullptr, 0.0f); | |||
} | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -817,7 +827,7 @@ protected: | |||
{ | |||
if (const char* const retName = CarlaEngine::renamePlugin(id, newName)) | |||
{ | |||
uiServerCallback(ENGINE_CALLBACK_PLUGIN_RENAMED, id, 0, 0, 0.0f, retName); | |||
uiServerCallback(ENGINE_CALLBACK_PLUGIN_RENAMED, id, 0, 0, 0, 0.0f, retName); | |||
return retName; | |||
} | |||
@@ -1126,7 +1136,9 @@ protected: | |||
fUiServer.flushMessages(); | |||
} | |||
void uiServerCallback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) | |||
void uiServerCallback(const EngineCallbackOpcode action, const uint pluginId, | |||
const int value1, const int value2, const int value3, | |||
const float valueF, const char* const valueStr) | |||
{ | |||
if (! fIsRunning) | |||
return; | |||
@@ -1210,11 +1222,14 @@ protected: | |||
if (! fUiServer.writeMessage(tmpBuf)) | |||
return; | |||
std::sprintf(tmpBuf, "%i\n", value2); | |||
if (! fUiServer.writeMessage(tmpBuf)) | |||
return; | |||
std::sprintf(tmpBuf, "%i\n", value3); | |||
if (! fUiServer.writeMessage(tmpBuf)) | |||
return; | |||
{ | |||
const CarlaScopedLocale csl; | |||
std::sprintf(tmpBuf, "%f\n", static_cast<double>(value3)); | |||
std::sprintf(tmpBuf, "%f\n", static_cast<double>(valueF)); | |||
} | |||
if (! fUiServer.writeMessage(tmpBuf)) | |||
return; | |||
@@ -1741,9 +1756,13 @@ protected: | |||
uiServerInfo(); | |||
uiServerOptions(); | |||
uiServerCallback(ENGINE_CALLBACK_ENGINE_STARTED, 0, | |||
pData->options.processMode, pData->options.transportMode, | |||
static_cast<float>(pData->sampleRate), "Plugin"); | |||
uiServerCallback(ENGINE_CALLBACK_ENGINE_STARTED, | |||
0, | |||
pData->options.processMode, | |||
pData->options.transportMode, | |||
static_cast<int>(pData->bufferSize), | |||
static_cast<float>(pData->sampleRate), | |||
"Plugin"); | |||
fUiServer.writeShowMessage(); | |||
@@ -1753,7 +1772,7 @@ protected: | |||
if (plugin != nullptr && plugin->isEnabled()) | |||
{ | |||
uiServerCallback(ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0.0f, plugin->getName()); | |||
uiServerCallback(ENGINE_CALLBACK_PLUGIN_ADDED, i, 0, 0, 0, 0.0f, plugin->getName()); | |||
} | |||
} | |||
@@ -1913,7 +1932,7 @@ protected: | |||
{ | |||
// remove all plugins from UI side | |||
for (uint i=0, count=pData->curPluginCount; i < count; ++i) | |||
CarlaEngine::callback(ENGINE_CALLBACK_PLUGIN_REMOVED, count-i-1, 0, 0, 0.0f, nullptr); | |||
CarlaEngine::callback(ENGINE_CALLBACK_PLUGIN_REMOVED, count-i-1, 0, 0, 0, 0.0f, nullptr); | |||
// remove all plugins from backend, no lock | |||
fIsRunning = false; | |||
@@ -2075,12 +2094,15 @@ public: | |||
// ------------------------------------------------------------------- | |||
static void _ui_server_callback(void* handle, EngineCallbackOpcode action, uint pluginId, int value1, int value2, float value3, const char* valueStr) | |||
static void _ui_server_callback(void* handle, EngineCallbackOpcode action, uint pluginId, | |||
int value1, int value2, int value3, | |||
float valueF, const char* valueStr) | |||
{ | |||
handlePtr->uiServerCallback(action, pluginId, value1, value2, value3, valueStr); | |||
handlePtr->uiServerCallback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||
} | |||
static const char* _ui_file_callback(void* handle, FileCallbackOpcode action, bool isDir, const char* title, const char* filter) | |||
static const char* _ui_file_callback(void* handle, FileCallbackOpcode action, bool isDir, | |||
const char* title, const char* filter) | |||
{ | |||
return handlePtr->uiFileCallback(action, isDir, title, filter); | |||
} | |||
@@ -349,9 +349,13 @@ public: | |||
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | |||
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false); | |||
callback(ENGINE_CALLBACK_ENGINE_STARTED, 0, | |||
pData->options.processMode, pData->options.transportMode, | |||
static_cast<float>(pData->sampleRate), getCurrentDriverName()); | |||
callback(ENGINE_CALLBACK_ENGINE_STARTED, | |||
0, | |||
pData->options.processMode, | |||
pData->options.transportMode, | |||
static_cast<int>(pData->bufferSize), | |||
static_cast<float>(pData->sampleRate), | |||
getCurrentDriverName()); | |||
return true; | |||
} | |||
@@ -551,8 +555,12 @@ public: | |||
extGraph.connections.list.append(connectionToId); | |||
if (sendCallback) | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
if (sendCallback) { | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
} | |||
} | |||
fMidiOutMutex.lock(); | |||
@@ -574,8 +582,12 @@ public: | |||
extGraph.connections.list.append(connectionToId); | |||
if (sendCallback) | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | |||
if (sendCallback) { | |||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, | |||
connectionToId.id, | |||
0, 0, 0, 0.0f, | |||
strBuf); | |||
} | |||
} | |||
fMidiOutMutex.unlock(); | |||
@@ -50,7 +50,7 @@ static const MidiProgramData kMidiProgramDataNull = { 0, 0, nullptr }; | |||
static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr }; | |||
static /* */ CustomData kCustomDataFallbackNC = { nullptr, nullptr, nullptr }; | |||
static const PluginPostRtEvent kPluginPostRtEventFallback = { kPluginPostRtEventNull, 0, 0, 0.0f }; | |||
static const PluginPostRtEvent kPluginPostRtEventFallback = { kPluginPostRtEventNull, 0, 0, 0, 0.0f }; | |||
// ------------------------------------------------------------------- | |||
// ParamSymbol struct, needed for CarlaPlugin::loadStateSave() | |||
@@ -890,7 +890,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) | |||
setActive(stateSave.active, true, true); | |||
if (! pData->engine->isLoadingProject()) | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
#endif | |||
} | |||
@@ -1293,7 +1293,11 @@ void CarlaPlugin::setOption(const uint option, const bool yesNo, const bool send | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_OPTION_CHANGED, pData->id, static_cast<int>(option), yesNo ? 1 : 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_OPTION_CHANGED, | |||
pData->id, | |||
static_cast<int>(option), | |||
yesNo ? 1 : 0, | |||
0, 0.0f, nullptr); | |||
#else | |||
// unused | |||
return; (void)sendCallback; | |||
@@ -1347,7 +1351,12 @@ void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool se | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_ACTIVE, 0, value, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_ACTIVE, | |||
0, 0, | |||
value, | |||
nullptr); | |||
#endif | |||
// maybe unused | |||
@@ -1377,7 +1386,12 @@ void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool se | |||
# endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_DRYWET, 0, fixedValue, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_DRYWET, | |||
0, 0, | |||
fixedValue, | |||
nullptr); | |||
} | |||
void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool sendCallback) noexcept | |||
@@ -1402,7 +1416,12 @@ void CarlaPlugin::setVolume(const float value, const bool sendOsc, const bool se | |||
# endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_VOLUME, 0, fixedValue, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_VOLUME, | |||
0, 0, | |||
fixedValue, | |||
nullptr); | |||
} | |||
void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bool sendCallback) noexcept | |||
@@ -1427,7 +1446,12 @@ void CarlaPlugin::setBalanceLeft(const float value, const bool sendOsc, const bo | |||
# endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_LEFT, 0, fixedValue, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_BALANCE_LEFT, | |||
0, 0, | |||
fixedValue, | |||
nullptr); | |||
} | |||
void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const bool sendCallback) noexcept | |||
@@ -1452,7 +1476,12 @@ void CarlaPlugin::setBalanceRight(const float value, const bool sendOsc, const b | |||
# endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_BALANCE_RIGHT, 0, fixedValue, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_BALANCE_RIGHT, | |||
0, 0, | |||
fixedValue, | |||
nullptr); | |||
} | |||
void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool sendCallback) noexcept | |||
@@ -1477,7 +1506,12 @@ void CarlaPlugin::setPanning(const float value, const bool sendOsc, const bool s | |||
# endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_PANNING, 0, fixedValue, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_PANNING, | |||
0, 0, | |||
fixedValue, | |||
nullptr); | |||
} | |||
void CarlaPlugin::setDryWetRT(const float value) noexcept | |||
@@ -1490,7 +1524,7 @@ void CarlaPlugin::setDryWetRT(const float value) noexcept | |||
return; | |||
pData->postProc.dryWet = fixedValue; | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, fixedValue); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, 0, fixedValue); | |||
} | |||
void CarlaPlugin::setVolumeRT(const float value) noexcept | |||
@@ -1503,7 +1537,7 @@ void CarlaPlugin::setVolumeRT(const float value) noexcept | |||
return; | |||
pData->postProc.volume = fixedValue; | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, fixedValue); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, 0, fixedValue); | |||
} | |||
void CarlaPlugin::setBalanceLeftRT(const float value) noexcept | |||
@@ -1516,7 +1550,7 @@ void CarlaPlugin::setBalanceLeftRT(const float value) noexcept | |||
return; | |||
pData->postProc.balanceLeft = fixedValue; | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, fixedValue); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, 0, fixedValue); | |||
} | |||
void CarlaPlugin::setBalanceRightRT(const float value) noexcept | |||
@@ -1529,7 +1563,7 @@ void CarlaPlugin::setBalanceRightRT(const float value) noexcept | |||
return; | |||
pData->postProc.balanceRight = fixedValue; | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, fixedValue); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, 0, fixedValue); | |||
} | |||
void CarlaPlugin::setPanningRT(const float value) noexcept | |||
@@ -1568,7 +1602,11 @@ void CarlaPlugin::setCtrlChannel(const int8_t channel, const bool sendOsc, const | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_CTRL_CHANNEL, 0, channelf, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_CTRL_CHANNEL, | |||
0, 0, | |||
channelf, nullptr); | |||
#endif | |||
// maybe unused | |||
@@ -1599,12 +1637,17 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu | |||
#endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(parameterId), 0, value, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
static_cast<int>(parameterId), | |||
0, 0, | |||
value, | |||
nullptr); | |||
} | |||
void CarlaPlugin::setParameterValueRT(const uint32_t parameterId, const float value) noexcept | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(parameterId), 0, value); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(parameterId), 0, 0, value); | |||
} | |||
void CarlaPlugin::setParameterValueByRealIndex(const int32_t rindex, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) noexcept | |||
@@ -1662,7 +1705,11 @@ void CarlaPlugin::setParameterMidiChannel(const uint32_t parameterId, const uint | |||
# endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, pData->id, static_cast<int>(parameterId), channel, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED, | |||
pData->id, | |||
static_cast<int>(parameterId), | |||
channel, | |||
0, 0.0f, nullptr); | |||
#endif | |||
} | |||
@@ -1685,7 +1732,11 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, const int16_t c | |||
# endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED, pData->id, static_cast<int>(parameterId), cc, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED, | |||
pData->id, | |||
static_cast<int>(parameterId), | |||
cc, | |||
0, 0.0f, nullptr); | |||
#endif | |||
} | |||
@@ -1753,7 +1804,10 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool | |||
#endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, pData->id, index, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, | |||
pData->id, | |||
index, | |||
0, 0, 0.0f, nullptr); | |||
// Change default parameter values | |||
if (index >= 0) | |||
@@ -1793,7 +1847,10 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const | |||
#endif | |||
if (sendCallback) | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, pData->id, index, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, | |||
pData->id, | |||
index, | |||
0, 0, 0.0f, nullptr); | |||
// Change default parameter values | |||
if (index >= 0) | |||
@@ -1845,7 +1902,7 @@ void CarlaPlugin::setProgramRT(const uint32_t uindex) noexcept | |||
break; | |||
} | |||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, index, 0, 0.0f); | |||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, index, 0, 0, 0.0f); | |||
} | |||
void CarlaPlugin::setMidiProgramRT(const uint32_t uindex) noexcept | |||
@@ -1867,7 +1924,7 @@ void CarlaPlugin::setMidiProgramRT(const uint32_t uindex) noexcept | |||
break; | |||
} | |||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, index, 0, 0.0f); | |||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, index, 0, 0, 0.0f); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -1944,7 +2001,11 @@ void CarlaPlugin::idle() | |||
} break; | |||
case kPluginPostRtEventDebug: { | |||
pData->engine->callback(ENGINE_CALLBACK_DEBUG, pData->id, event.value1, event.value2, event.value3, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_DEBUG, pData->id, | |||
event.value1, event.value2, | |||
0, | |||
event.valueF, | |||
nullptr); | |||
} break; | |||
case kPluginPostRtEventParameterChange: { | |||
@@ -1954,7 +2015,7 @@ void CarlaPlugin::idle() | |||
if (needsUiMainThread) | |||
pData->postUiEvents.append(event); | |||
else | |||
uiParameterChange(static_cast<uint32_t>(event.value1), event.value3); | |||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valueF); | |||
} | |||
if (event.value2 != 1) | |||
@@ -1962,10 +2023,15 @@ void CarlaPlugin::idle() | |||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | |||
// Update OSC control client | |||
if (sendOsc) | |||
pData->engine->oscSend_control_set_parameter_value(pData->id, event.value1, event.value3); | |||
pData->engine->oscSend_control_set_parameter_value(pData->id, event.value1, event.valueF); | |||
#endif | |||
// Update Host | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, event.value1, 0, event.value3, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
event.value1, | |||
0, 0, | |||
event.valueF, | |||
nullptr); | |||
} | |||
} break; | |||
@@ -1992,8 +2058,18 @@ void CarlaPlugin::idle() | |||
pData->engine->oscSend_control_set_default_value(pData->id, j, paramDefault); | |||
} | |||
#endif | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(j), 0, paramValue, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast<int>(j), 0, paramDefault, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
static_cast<int>(j), | |||
0, 0, | |||
paramValue, | |||
nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, | |||
pData->id, | |||
static_cast<int>(j), | |||
0, 0, | |||
paramDefault, | |||
nullptr); | |||
} | |||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | |||
@@ -2002,7 +2078,10 @@ void CarlaPlugin::idle() | |||
pData->engine->oscSend_control_set_current_program(pData->id, event.value1); | |||
#endif | |||
// Update Host | |||
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, pData->id, event.value1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, | |||
pData->id, | |||
event.value1, | |||
0, 0, 0.0f, nullptr); | |||
} break; | |||
@@ -2029,8 +2108,18 @@ void CarlaPlugin::idle() | |||
pData->engine->oscSend_control_set_default_value(pData->id, j, paramDefault); | |||
} | |||
#endif | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, static_cast<int>(j), 0, paramValue, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, pData->id, static_cast<int>(j), 0, paramDefault, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
static_cast<int>(j), | |||
0, 0, | |||
paramValue, | |||
nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, | |||
pData->id, | |||
static_cast<int>(j), | |||
0, 0, | |||
paramDefault, | |||
nullptr); | |||
} | |||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | |||
@@ -2039,18 +2128,21 @@ void CarlaPlugin::idle() | |||
pData->engine->oscSend_control_set_current_midi_program(pData->id, event.value1); | |||
#endif | |||
// Update Host | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, pData->id, event.value1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, | |||
pData->id, | |||
event.value1, | |||
0, 0, 0.0f, nullptr); | |||
} break; | |||
case kPluginPostRtEventNoteOn: { | |||
CARLA_SAFE_ASSERT_BREAK(event.value1 >= 0 && event.value1 < MAX_MIDI_CHANNELS); | |||
CARLA_SAFE_ASSERT_BREAK(event.value2 >= 0 && event.value2 < MAX_MIDI_NOTE); | |||
CARLA_SAFE_ASSERT_BREAK(event.value3 >= 0 && event.value3 < MAX_MIDI_VALUE); | |||
CARLA_SAFE_ASSERT_BREAK(event.value4 >= 0 && event.value4 < MAX_MIDI_VALUE); | |||
const uint8_t channel = static_cast<uint8_t>(event.value1); | |||
const uint8_t note = static_cast<uint8_t>(event.value2); | |||
const uint8_t velocity = uint8_t(event.value3); | |||
const uint8_t velocity = static_cast<uint8_t>(event.value4); | |||
// Update UI | |||
if (hasUI) | |||
@@ -2067,7 +2159,12 @@ void CarlaPlugin::idle() | |||
pData->engine->oscSend_control_note_on(pData->id, channel, note, velocity); | |||
#endif | |||
// Update Host | |||
pData->engine->callback(ENGINE_CALLBACK_NOTE_ON, pData->id, event.value1, event.value2, event.value3, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_NOTE_ON, | |||
pData->id, | |||
event.value1, | |||
event.value2, | |||
event.value4, | |||
0.0f, nullptr); | |||
} break; | |||
@@ -2093,7 +2190,11 @@ void CarlaPlugin::idle() | |||
pData->engine->oscSend_control_note_off(pData->id, channel, note); | |||
#endif | |||
// Update Host | |||
pData->engine->callback(ENGINE_CALLBACK_NOTE_OFF, pData->id, event.value1, event.value2, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_NOTE_OFF, | |||
pData->id, | |||
event.value1, | |||
event.value2, | |||
0, 0.0f, nullptr); | |||
} break; | |||
} | |||
@@ -2312,7 +2413,12 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note, | |||
#endif | |||
if (sendCallback) | |||
pData->engine->callback((velo > 0) ? ENGINE_CALLBACK_NOTE_ON : ENGINE_CALLBACK_NOTE_OFF, pData->id, channel, note, velo, nullptr); | |||
pData->engine->callback((velo > 0) ? ENGINE_CALLBACK_NOTE_ON : ENGINE_CALLBACK_NOTE_OFF, | |||
pData->id, | |||
channel, | |||
note, | |||
velo, | |||
0.0f, nullptr); | |||
// may be unused | |||
return; (void)sendOsc; | |||
@@ -2328,7 +2434,8 @@ void CarlaPlugin::sendMidiAllNotesOffToCallback() | |||
postEvent.type = kPluginPostRtEventNoteOff; | |||
postEvent.value1 = pData->ctrlChannel; | |||
postEvent.value2 = 0; | |||
postEvent.value3 = 0.0f; | |||
postEvent.value4 = 0; | |||
postEvent.valueF = 0.0f; | |||
for (int32_t i=0; i < MAX_MIDI_NOTE; ++i) | |||
{ | |||
@@ -2373,7 +2480,7 @@ void CarlaPlugin::uiIdle() | |||
break; | |||
case kPluginPostRtEventParameterChange: | |||
uiParameterChange(static_cast<uint32_t>(event.value1), event.value3); | |||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valueF); | |||
break; | |||
case kPluginPostRtEventProgramChange: | |||
@@ -2385,11 +2492,14 @@ void CarlaPlugin::uiIdle() | |||
break; | |||
case kPluginPostRtEventNoteOn: | |||
uiNoteOn(static_cast<uint8_t>(event.value1), static_cast<uint8_t>(event.value2), uint8_t(event.value3)); | |||
uiNoteOn(static_cast<uint8_t>(event.value1), | |||
static_cast<uint8_t>(event.value2), | |||
static_cast<uint8_t>(event.value4)); | |||
break; | |||
case kPluginPostRtEventNoteOff: | |||
uiNoteOff(static_cast<uint8_t>(event.value1), static_cast<uint8_t>(event.value2)); | |||
uiNoteOff(static_cast<uint8_t>(event.value1), | |||
static_cast<uint8_t>(event.value2)); | |||
break; | |||
} | |||
} | |||
@@ -348,7 +348,7 @@ protected: | |||
CarlaString errorString("Plugin '" + CarlaString(kPlugin->getName()) + "' has crashed!\n" | |||
"Saving now will lose its current settings.\n" | |||
"Please remove this plugin, and not rely on it from this point."); | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_ERROR, kPlugin->getId(), 0, 0, 0.0f, errorString); | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_ERROR, kPlugin->getId(), 0, 0, 0, 0.0f, errorString); | |||
} | |||
} | |||
@@ -625,7 +625,7 @@ public: | |||
#if 0 | |||
// we waited and blocked for 5 secs, give host idle time now | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->engine->getType() != kEngineTypePlugin) | |||
pData->engine->idle(); | |||
@@ -645,7 +645,7 @@ public: | |||
for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();) | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (needsEngineIdle) | |||
pData->engine->idle(); | |||
@@ -1365,9 +1365,20 @@ public: | |||
fShmRtClientControl.commitWrite(); | |||
if (status == MIDI_STATUS_NOTE_ON) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, midiData[1], midiData[2]); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, | |||
event.channel, | |||
midiData[1], | |||
midiData[2], | |||
0.0f); | |||
} | |||
else if (status == MIDI_STATUS_NOTE_OFF) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, midiData[1], 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, | |||
event.channel, | |||
midiData[1], | |||
0, 0.0f); | |||
} | |||
} break; | |||
} | |||
} | |||
@@ -2240,7 +2251,7 @@ public: | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
pData->transientTryCounter = 0; | |||
#endif | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
break; | |||
case kPluginBridgeNonRtServerError: { | |||
@@ -2252,7 +2263,7 @@ public: | |||
if (fInitiated) | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_ERROR, pData->id, 0, 0, 0.0f, error); | |||
pData->engine->callback(ENGINE_CALLBACK_ERROR, pData->id, 0, 0, 0, 0.0f, error); | |||
// just in case | |||
pData->engine->setLastError(error); | |||
@@ -2584,12 +2595,23 @@ private: | |||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | |||
if (pData->engine->isOscControlRegistered()) | |||
pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_ACTIVE, 0.0f); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_ACTIVE, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_ACTIVE, | |||
0, 0, | |||
0.0f, | |||
nullptr); | |||
#endif | |||
} | |||
if (pData->hints & PLUGIN_HAS_CUSTOM_UI) | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
void resizeAudioPool(const uint32_t bufferSize) | |||
@@ -2665,13 +2687,17 @@ private: | |||
if (needsCancelableAction) | |||
{ | |||
pData->engine->setActionCanceled(false); | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, pData->id, 1, 0, 0.0f, "Loading plugin bridge"); | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, | |||
pData->id, | |||
1, | |||
0, 0, 0.0f, | |||
"Loading plugin bridge"); | |||
} | |||
#endif | |||
for (;fBridgeThread.isThreadRunning();) | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (needsEngineIdle) | |||
pData->engine->idle(); | |||
@@ -2688,7 +2714,13 @@ private: | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
if (needsCancelableAction) | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, pData->id, 0, 0, 0.0f, "Loading JACK application"); | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, | |||
"Loading JACK application"); | |||
} | |||
#endif | |||
if (fInitError || ! fInitiated) | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin, DSSI implementation | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -112,7 +112,10 @@ public: | |||
fProcess->kill(); | |||
fProcess = nullptr; | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, kPlugin->getId(), 0, 0, 0.0f, nullptr); | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
kPlugin->getId(), | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
return; | |||
} | |||
@@ -219,7 +222,10 @@ public: | |||
} | |||
fProcess = nullptr; | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, kPlugin->getId(), 0, 0, 0.0f, nullptr); | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
kPlugin->getId(), | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
carla_stdout("DSSI UI thread finished"); | |||
} | |||
@@ -1272,7 +1278,7 @@ public: | |||
if (programChanged) | |||
setMidiProgram(pData->midiprog.current, true, true, true, false); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -1643,7 +1649,7 @@ public: | |||
seqEvent.data.note.channel = event.channel; | |||
seqEvent.data.note.note = note; | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0.0f); | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0, 0.0f); | |||
break; | |||
} | |||
@@ -1656,7 +1662,7 @@ public: | |||
seqEvent.data.note.note = note; | |||
seqEvent.data.note.velocity = velo; | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo); | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo, 0.0f); | |||
break; | |||
} | |||
@@ -2379,7 +2385,10 @@ public: | |||
showCustomUI(false); | |||
// tell frontend | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
// ------------------------------------------------------------------- | |||
@@ -522,7 +522,10 @@ public: | |||
if (pData->ctrlChannel == static_cast<int32_t>(channel)) | |||
{ | |||
pData->midiprog.current = index; | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, pData->id, index, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, | |||
pData->id, | |||
index, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -1072,7 +1075,7 @@ public: | |||
} | |||
else | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -1296,7 +1299,11 @@ public: | |||
fCurMidiProgs[event.channel] = static_cast<int32_t>(k); | |||
if (event.channel == pData->ctrlChannel) | |||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, static_cast<int32_t>(k), 0, 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, | |||
static_cast<int32_t>(k), | |||
0, 0, 0.0f); | |||
} | |||
break; | |||
} | |||
@@ -1347,7 +1354,7 @@ public: | |||
fluid_synth_noteoff(fSynth, event.channel, note); | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0.0f); | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0, 0.0f); | |||
break; | |||
} | |||
@@ -1357,7 +1364,7 @@ public: | |||
fluid_synth_noteon(fSynth, event.channel, note, velo); | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo); | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo, 0.0f); | |||
break; | |||
} | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -749,11 +749,15 @@ void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEvent& rtEven | |||
postRtEvents.appendRT(rtEvent); | |||
} | |||
void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEventType type, const int32_t value1, const int32_t value2, const float value3) noexcept | |||
void CarlaPlugin::ProtectedData::postponeRtEvent(const PluginPostRtEventType type, | |||
const int32_t value1, | |||
const int32_t value2, | |||
const int32_t value3, | |||
const float valueF) noexcept | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); | |||
PluginPostRtEvent rtEvent = { type, value1, value2, value3 }; | |||
PluginPostRtEvent rtEvent = { type, value1, value2, value3, valueF }; | |||
postRtEvents.appendRT(rtEvent); | |||
} | |||
@@ -826,9 +830,21 @@ void CarlaPlugin::ProtectedData::updateParameterValues(CarlaPlugin* const plugin | |||
if (sendCallback) | |||
{ | |||
if (useDefault) | |||
engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, id, static_cast<int>(i), 0, value, nullptr); | |||
engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, id, static_cast<int>(i), 0, value, nullptr); | |||
if (useDefault) { | |||
engine->callback(ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED, | |||
id, | |||
static_cast<int>(i), | |||
0, 0, | |||
value, | |||
nullptr); | |||
} | |||
engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
id, | |||
static_cast<int>(i), | |||
0, 0, | |||
value, | |||
nullptr); | |||
} | |||
} | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Plugin | |||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -89,7 +89,8 @@ struct PluginPostRtEvent { | |||
PluginPostRtEventType type; | |||
int32_t value1; | |||
int32_t value2; | |||
float value3; | |||
int32_t value4; | |||
float valueF; | |||
}; | |||
// ----------------------------------------------------------------------- | |||
@@ -358,7 +359,9 @@ struct CarlaPlugin::ProtectedData { | |||
// Post-poned events | |||
void postponeRtEvent(const PluginPostRtEvent& rtEvent) noexcept; | |||
void postponeRtEvent(const PluginPostRtEventType type, const int32_t value1, const int32_t value2, const float value3) noexcept; | |||
void postponeRtEvent(const PluginPostRtEventType type, | |||
const int32_t value1, const int32_t value2, const int32_t value3, | |||
const float valueF) noexcept; | |||
// ------------------------------------------------------------------- | |||
// Library functions | |||
@@ -209,14 +209,20 @@ protected: | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(std::strcmp(types, "") == 0, 0); | |||
kEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, kPlugin->getId(), 1, 0, 0.0f, nullptr); | |||
kEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
kPlugin->getId(), | |||
1, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
else if (std::strcmp(path, "/nsm/client/gui_is_hidden") == 0) | |||
{ | |||
CARLA_SAFE_ASSERT_RETURN(std::strcmp(types, "") == 0, 0); | |||
kEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, kPlugin->getId(), 0, 0, 0.0f, nullptr); | |||
kEngine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
kPlugin->getId(), | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
return 0; | |||
@@ -357,7 +363,10 @@ protected: | |||
CarlaString errorString("Plugin '" + CarlaString(kPlugin->getName()) + "' has crashed!\n" | |||
"Saving now will lose its current settings.\n" | |||
"Please remove this plugin, and not rely on it from this point."); | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_ERROR, kPlugin->getId(), 0, 0, 0.0f, errorString); | |||
kEngine->callback(CarlaBackend::ENGINE_CALLBACK_ERROR, | |||
kPlugin->getId(), | |||
0, 0, 0, 0.0f, | |||
errorString); | |||
} | |||
} | |||
@@ -1080,9 +1089,20 @@ public: | |||
fShmRtClientControl.commitWrite(); | |||
if (status == MIDI_STATUS_NOTE_ON) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, midiData[1], midiData[2]); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, | |||
event.channel, | |||
midiData[1], | |||
midiData[2], | |||
0.0f); | |||
} | |||
else if (status == MIDI_STATUS_NOTE_OFF) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, midiData[1], 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, | |||
event.channel, | |||
midiData[1], | |||
0, 0.0f); | |||
} | |||
} break; | |||
} | |||
} | |||
@@ -1401,7 +1421,10 @@ public: | |||
break; | |||
case kPluginBridgeNonRtServerUiClosed: | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
break; | |||
case kPluginBridgeNonRtServerError: { | |||
@@ -1413,7 +1436,7 @@ public: | |||
if (fInitiated) | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_ERROR, pData->id, 0, 0, 0.0f, error); | |||
pData->engine->callback(ENGINE_CALLBACK_ERROR, pData->id, 0, 0, 0, 0.0f, error); | |||
// just in case | |||
pData->engine->setLastError(error); | |||
@@ -1633,12 +1656,20 @@ private: | |||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | |||
if (pData->engine->isOscControlRegistered()) | |||
pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_ACTIVE, 0.0f); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, pData->id, PARAMETER_ACTIVE, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED, | |||
pData->id, | |||
PARAMETER_ACTIVE, | |||
0, 0, | |||
0.0f, | |||
nullptr); | |||
#endif | |||
} | |||
if (pData->hints & PLUGIN_HAS_CUSTOM_UI) | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
void resizeAudioPool(const uint32_t bufferSize) | |||
@@ -1744,12 +1775,16 @@ private: | |||
if (needsCancelableAction) | |||
{ | |||
pData->engine->setActionCanceled(false); | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, pData->id, 1, 0, 0.0f, "Loading JACK application"); | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, | |||
pData->id, | |||
1, | |||
0, 0, 0.0f, | |||
"Loading JACK application"); | |||
} | |||
for (;fBridgeThread.isThreadRunning();) | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (needsEngineIdle) | |||
pData->engine->idle(); | |||
@@ -1765,7 +1800,13 @@ private: | |||
} | |||
if (needsCancelableAction) | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, pData->id, 0, 0, 0.0f, "Loading JACK application"); | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_CANCELABLE_ACTION, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, | |||
"Loading JACK application"); | |||
} | |||
if (fInitError || ! fInitiated) | |||
{ | |||
@@ -380,7 +380,10 @@ public: | |||
if (fWindow->wasClosedByUser()) | |||
{ | |||
showCustomUI(false); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -699,7 +702,7 @@ public: | |||
fInstance->setCurrentProgram(pData->prog.current); | |||
} | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -813,14 +816,14 @@ public: | |||
{ | |||
value = ctrlEvent.value; | |||
setDryWet(value, false, false); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, value); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_DRYWET, 0, 0, value); | |||
} | |||
if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) | |||
{ | |||
value = ctrlEvent.value*127.0f/100.0f; | |||
setVolume(value, false, false); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, value); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_VOLUME, 0, 0, value); | |||
} | |||
if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) | |||
@@ -846,8 +849,8 @@ public: | |||
setBalanceLeft(left, false, false); | |||
setBalanceRight(right, false, false); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, left); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, right); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_LEFT, 0, 0, left); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, PARAMETER_BALANCE_RIGHT, 0, 0, right); | |||
} | |||
} | |||
#endif | |||
@@ -882,7 +885,7 @@ public: | |||
} | |||
setParameterValue(k, value, false, false, false); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, value); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, 0, value); | |||
} | |||
if ((pData->options & PLUGIN_OPTION_SEND_CONTROL_CHANGES) != 0 && ctrlEvent.param < MAX_MIDI_CONTROL) | |||
@@ -907,7 +910,7 @@ public: | |||
if (ctrlEvent.param < pData->prog.count) | |||
{ | |||
setProgramRT(ctrlEvent.param); | |||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, ctrlEvent.param, 0, 0.0f); | |||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, ctrlEvent.param, 0, 0, 0.0f); | |||
break; | |||
} | |||
} | |||
@@ -976,9 +979,20 @@ public: | |||
fMidiBuffer.addEvent(midiData2, midiEvent.size, static_cast<int>(event.time)); | |||
if (status == MIDI_STATUS_NOTE_ON) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, midiData[1], midiData[2]); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, | |||
event.channel, | |||
midiData[1], | |||
midiData[2], | |||
0.0f); | |||
} | |||
else if (status == MIDI_STATUS_NOTE_OFF) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, midiData[1], 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, | |||
event.channel, | |||
midiData[1], | |||
0, 0.0f); | |||
} | |||
} break; | |||
} // switch (event.type) | |||
} | |||
@@ -1152,7 +1166,7 @@ protected: | |||
void audioProcessorChanged(juce::AudioProcessor*) override | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
void audioProcessorParameterChangeGestureBegin(juce::AudioProcessor*, int) override {} | |||
@@ -1405,7 +1405,7 @@ public: | |||
{ | |||
CARLA_SAFE_ASSERT(!yesNo); | |||
} | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
return; | |||
} | |||
@@ -1428,7 +1428,7 @@ public: | |||
if (! fPipeServer.startPipeServer(std::min(fLv2Options.sequenceSize, 819200))) | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
return; | |||
} | |||
@@ -1577,7 +1577,7 @@ public: | |||
} | |||
if (fUI.window == nullptr && fExt.uishow == nullptr) | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, msg); | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0, 0.0f, msg); | |||
if (fUI.window != nullptr) | |||
fFeatures[kFeatureIdUiParent]->data = fUI.window->getPtr(); | |||
@@ -1608,7 +1608,11 @@ public: | |||
fUI.handle = nullptr; | |||
} | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, "Plugin refused to open its own UI"); | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
-1, | |||
0, 0, 0.0f, | |||
"Plugin refused to open its own UI"); | |||
} | |||
updateUi(); | |||
@@ -1725,7 +1729,10 @@ public: | |||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | |||
pData->transientTryCounter = 0; | |||
#endif | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
break; | |||
} | |||
} | |||
@@ -1738,7 +1745,10 @@ public: | |||
{ | |||
fNeedsUiClose = false; | |||
showCustomUI(false); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
else if (fUI.handle != nullptr && fUI.descriptor != nullptr) | |||
{ | |||
@@ -1756,7 +1766,10 @@ public: | |||
else if (fUI.handle != nullptr && fExt.uiidle != nullptr && fExt.uiidle->idle(fUI.handle) != 0) | |||
{ | |||
showCustomUI(false); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
CARLA_SAFE_ASSERT(fUI.handle == nullptr); | |||
} | |||
#endif | |||
@@ -2894,7 +2907,7 @@ public: | |||
if (programChanged) | |||
setMidiProgram(pData->midiprog.current, true, true, true, false); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -3173,7 +3186,11 @@ public: | |||
} | |||
if (doPostRt) | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 1, fParamBuffers[k]); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | |||
static_cast<int32_t>(k), | |||
1, | |||
0, | |||
fParamBuffers[k]); | |||
} | |||
for (uint32_t i=0; i < fEventsIn.count; ++i) | |||
@@ -3675,9 +3692,20 @@ public: | |||
lv2midi_put_event(&evInMidiStates[j], mtime, midiEvent.size, midiData2); | |||
if (status == MIDI_STATUS_NOTE_ON) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, midiData[1], midiData[2]); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, | |||
event.channel, | |||
midiData[1], | |||
midiData[2], | |||
0.0f); | |||
} | |||
else if (status == MIDI_STATUS_NOTE_OFF) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, midiData[1], 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, | |||
event.channel, | |||
midiData[1], | |||
0, 0.0f); | |||
} | |||
} break; | |||
} // switch (event.type) | |||
} | |||
@@ -3953,7 +3981,10 @@ public: | |||
if (carla_isNotEqual(fParamBuffers[k], pData->param.ranges[k].def)) | |||
{ | |||
fParamBuffers[k] = pData->param.ranges[k].def; | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 0, fParamBuffers[k]); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | |||
static_cast<int32_t>(k), | |||
0, 0, | |||
fParamBuffers[k]); | |||
} | |||
} | |||
} | |||
@@ -4221,7 +4252,11 @@ public: | |||
continue; | |||
fParamBuffers[k] = sampleRatef; | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 1, fParamBuffers[k]); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | |||
static_cast<int32_t>(k), | |||
1, | |||
0, | |||
fParamBuffers[k]); | |||
break; | |||
} | |||
@@ -4235,7 +4270,11 @@ public: | |||
if (pData->param.data[k].type == PARAMETER_INPUT && pData->param.special[k] == PARAMETER_SPECIAL_FREEWHEEL) | |||
{ | |||
fParamBuffers[k] = isOffline ? pData->param.ranges[k].max : pData->param.ranges[k].min; | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, static_cast<int32_t>(k), 1, fParamBuffers[k]); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, | |||
static_cast<int32_t>(k), | |||
1, | |||
0, | |||
fParamBuffers[k]); | |||
break; | |||
} | |||
} | |||
@@ -4777,9 +4816,9 @@ public: | |||
pData->midiprog.data[index].name = carla_strdup(progDesc->name); | |||
if (index == pData->midiprog.current) | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0.0, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, 0, 0, 0, 0.0, nullptr); | |||
else | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0, nullptr); | |||
} | |||
} | |||
} | |||
@@ -754,7 +754,10 @@ public: | |||
if (pData->ctrlChannel == static_cast<int32_t>(channel)) | |||
{ | |||
pData->midiprog.current = index; | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, pData->id, index, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED, | |||
pData->id, | |||
index, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -1386,7 +1389,9 @@ public: | |||
if (programChanged) | |||
setMidiProgram(pData->midiprog.current, true, true, true, false); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, | |||
pData->id, | |||
0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -1843,7 +1848,11 @@ public: | |||
fCurMidiProgs[event.channel] = static_cast<int32_t>(k); | |||
if (event.channel == pData->ctrlChannel) | |||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, static_cast<int32_t>(k), 0, 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, | |||
static_cast<int32_t>(k), | |||
0, 0, 0.0f); | |||
} | |||
break; | |||
} | |||
@@ -1950,9 +1959,20 @@ public: | |||
nativeEvent.data[3] = midiEvent.size == 4 ? midiEvent.data[3] : 0; | |||
if (status == MIDI_STATUS_NOTE_ON) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, midiEvent.data[1], midiEvent.data[2]); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, | |||
event.channel, | |||
midiEvent.data[1], | |||
midiEvent.data[2], | |||
0.0f); | |||
} | |||
else if (status == MIDI_STATUS_NOTE_OFF) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, midiEvent.data[1], 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, | |||
event.channel, | |||
midiEvent.data[1], | |||
0, 0.0f); | |||
} | |||
} break; | |||
} // switch (event.type) | |||
} | |||
@@ -2386,7 +2406,7 @@ protected: | |||
void handleUiClosed() | |||
{ | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
fIsUiVisible = false; | |||
} | |||
@@ -2412,30 +2432,30 @@ protected: | |||
break; | |||
case NATIVE_HOST_OPCODE_UPDATE_PARAMETER: | |||
// TODO | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, -1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, -1, 0, 0, 0.0f, nullptr); | |||
break; | |||
case NATIVE_HOST_OPCODE_UPDATE_MIDI_PROGRAM: | |||
// TODO | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, -1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UPDATE, pData->id, -1, 0, 0, 0.0f, nullptr); | |||
break; | |||
case NATIVE_HOST_OPCODE_RELOAD_PARAMETERS: | |||
reload(); // FIXME | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PARAMETERS, pData->id, -1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PARAMETERS, pData->id, -1, 0, 0, 0.0f, nullptr); | |||
break; | |||
case NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS: | |||
reloadPrograms(false); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, -1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, -1, 0, 0, 0.0f, nullptr); | |||
break; | |||
case NATIVE_HOST_OPCODE_RELOAD_ALL: | |||
reload(); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_ALL, pData->id, -1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_ALL, pData->id, -1, 0, 0, 0.0f, nullptr); | |||
break; | |||
case NATIVE_HOST_OPCODE_UI_UNAVAILABLE: | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0, 0.0f, nullptr); | |||
fIsUiAvailable = false; | |||
break; | |||
case NATIVE_HOST_OPCODE_HOST_IDLE: | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
break; | |||
case NATIVE_HOST_OPCODE_INTERNAL_PLUGIN: | |||
ret = 1; | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla SFZero Plugin | |||
* Copyright (C) 2018 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2018-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -41,7 +41,7 @@ static const ExternalMidiNote kExternalMidiNoteFallback = { -1, 0, 0 }; | |||
static void loadingIdleCallbackFunction(void* ptr) | |||
{ | |||
((CarlaEngine*)ptr)->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
((CarlaEngine*)ptr)->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
// ------------------------------------------------------------------------------------------------------------------- | |||
@@ -538,9 +538,20 @@ public: | |||
fSynth.handleMidiEvent(midiMessage); | |||
if (status == MIDI_STATUS_NOTE_ON) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, midiData[1], midiData[2]); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, | |||
event.channel, | |||
midiData[1], | |||
midiData[2], | |||
0.0f); | |||
} | |||
else if (status == MIDI_STATUS_NOTE_OFF) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, midiData[1], 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, | |||
event.channel, | |||
midiData[1], | |||
0, 0.0f); | |||
} | |||
} break; | |||
} | |||
} | |||
@@ -508,7 +508,11 @@ public: | |||
#endif | |||
if (fUI.window == nullptr) | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, msg); | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
-1, | |||
0, 0, 0.0f, | |||
msg); | |||
fUI.window->setTitle(uiTitle.buffer()); | |||
@@ -541,7 +545,11 @@ public: | |||
fUI.window = nullptr; | |||
carla_stderr2("Plugin refused to open its own UI"); | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, -1, 0, 0.0f, "Plugin refused to open its own UI"); | |||
return pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
-1, | |||
0, 0, 0.0f, | |||
"Plugin refused to open its own UI"); | |||
} | |||
} | |||
@@ -1037,7 +1045,7 @@ public: | |||
dispatcher(effSetProgram, 0, pData->prog.current, nullptr, 0.0f); | |||
} | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PROGRAMS, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
@@ -1512,9 +1520,20 @@ public: | |||
vstMidiEvent.midiData[2] = char(midiEvent.size >= 3 ? midiEvent.data[2] : 0); | |||
if (status == MIDI_STATUS_NOTE_ON) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, midiEvent.data[1], midiEvent.data[2]); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, | |||
event.channel, | |||
midiEvent.data[1], | |||
midiEvent.data[2], | |||
0.0f); | |||
} | |||
else if (status == MIDI_STATUS_NOTE_OFF) | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, midiEvent.data[1], 0.0f); | |||
{ | |||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, | |||
event.channel, | |||
midiEvent.data[1], | |||
0, 0.0f); | |||
} | |||
} break; | |||
} // switch (event.type) | |||
} | |||
@@ -1769,7 +1788,10 @@ protected: | |||
carla_debug("CarlaPluginVST2::handlePluginUIClosed()"); | |||
showCustomUI(false); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_UI_STATE_CHANGED, | |||
pData->id, | |||
0, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
void handlePluginUIResized(const uint width, const uint height) override | |||
@@ -1831,12 +1853,12 @@ protected: | |||
{ | |||
// Called from plugin process thread, nasty! (likely MIDI learn) | |||
CARLA_SAFE_ASSERT(fIsProcessing); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, fixedValue); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||
} | |||
else if (fChangingValuesThread != kNullThread && pthread_equal(thisThread, fChangingValuesThread)) | |||
{ | |||
// Called from effSetChunk or effSetProgram | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, fixedValue); | |||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||
} | |||
else if (fUI.isVisible) | |||
{ | |||
@@ -1850,7 +1872,7 @@ protected: | |||
carla_stdout("audioMasterAutomate called from unknown source"); | |||
setParameterValue(uindex, fixedValue, true, true, true); | |||
//pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, fixedValue); | |||
//pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||
} | |||
break; | |||
} | |||
@@ -1862,7 +1884,7 @@ protected: | |||
case audioMasterIdle: | |||
CARLA_SAFE_ASSERT_BREAK(pthread_equal(pthread_self(), fMainThread)); | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_IDLE, 0, 0, 0, 0, 0.0f, nullptr); | |||
if (pData->engine->getType() != kEngineTypePlugin) | |||
pData->engine->idle(); | |||
@@ -1976,7 +1998,7 @@ protected: | |||
effect->dispatcher(effect, effStartProcess); | |||
} | |||
x_engine->callback(CALLBACK_RELOAD_ALL, m_id, 0, 0, 0.0, nullptr); | |||
x_engine->callback(CALLBACK_RELOAD_ALL, m_id, 0, 0, 0, 0.0, nullptr); | |||
ret = 1; | |||
break; | |||
@@ -2111,13 +2133,16 @@ protected: | |||
if (pData->prog.current != current) | |||
{ | |||
pData->prog.current = current; | |||
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, pData->id, current, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_PROGRAM_CHANGED, | |||
pData->id, | |||
current, | |||
0, 0, 0.0f, nullptr); | |||
} | |||
} | |||
} | |||
if (! fIsInitializing) | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PARAMETERS, pData->id, 0, 0, 0.0f, nullptr); | |||
pData->engine->callback(ENGINE_CALLBACK_RELOAD_PARAMETERS, pData->id, 0, 0, 0, 0.0f, nullptr); | |||
ret = 1; | |||
break; | |||
@@ -290,7 +290,9 @@ public: | |||
// --------------------------------------------------------------------- | |||
protected: | |||
void handleCallback(const EngineCallbackOpcode action, const int value1, const int, const float, const char* const) | |||
void handleCallback(const EngineCallbackOpcode action, | |||
const int value1, | |||
const int, const int, const float, const char* const) | |||
{ | |||
CARLA_BACKEND_USE_NAMESPACE; | |||
@@ -322,13 +324,17 @@ private: | |||
bool fUsingBridge; | |||
bool fUsingExec; | |||
static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) | |||
static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, | |||
int value1, int value2, int value3, | |||
float valueF, const char* valueStr) | |||
{ | |||
carla_debug("CarlaBridgePlugin::callback(%p, %i:%s, %i, %i, %i, %f, \"%s\")", ptr, action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | |||
carla_debug("CarlaBridgePlugin::callback(%p, %i:%s, %i, %i, %i, %i, %f, \"%s\")", | |||
ptr, action, EngineCallbackOpcode2Str(action), | |||
pluginId, value1, value2, value3, valueF, valueStr); | |||
CARLA_SAFE_ASSERT_RETURN(ptr != nullptr,); | |||
CARLA_SAFE_ASSERT_RETURN(pluginId == 0,); | |||
return ((CarlaBridgePlugin*)ptr)->handleCallback(action, value1, value2, value3, valueStr); | |||
return ((CarlaBridgePlugin*)ptr)->handleCallback(action, value1, value2, value3, valueF, valueStr); | |||
} | |||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgePlugin) | |||
@@ -411,7 +411,9 @@ protected: | |||
return "LV2 Plugin"; | |||
} | |||
void engineCallback(const EngineCallbackOpcode action, const uint pluginId, const int value1, const int value2, const float value3, const char* const valueStr) | |||
void engineCallback(const EngineCallbackOpcode action, const uint pluginId, | |||
const int value1, const int value2, const int value3, | |||
const float valueF, const char* const valueStr) | |||
{ | |||
switch (action) | |||
{ | |||
@@ -423,7 +425,7 @@ protected: | |||
{ | |||
fUI.writeFunction(fUI.controller, | |||
static_cast<uint32_t>(value1)+fPorts.indexOffset, | |||
sizeof(float), 0, &value3); | |||
sizeof(float), 0, &valueF); | |||
} | |||
break; | |||
@@ -438,8 +440,9 @@ protected: | |||
default: | |||
carla_stdout("engineCallback(%i:%s, %u, %i, %i, %f, %s)", | |||
action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, | |||
static_cast<double>(value3), valueStr); | |||
action, EngineCallbackOpcode2Str(action), pluginId, | |||
value1, value2, value3, | |||
static_cast<double>(valueF), valueStr); | |||
break; | |||
} | |||
} | |||
@@ -541,9 +544,11 @@ private: | |||
#define handlePtr ((CarlaEngineSingleLV2*)handle) | |||
static void _engine_callback(void* handle, EngineCallbackOpcode action, uint pluginId, int value1, int value2, float value3, const char* valueStr) | |||
static void _engine_callback(void* handle, EngineCallbackOpcode action, uint pluginId, | |||
int value1, int value2, int value3, | |||
float valueF, const char* valueStr) | |||
{ | |||
handlePtr->engineCallback(action, pluginId, value1, value2, value3, valueStr); | |||
handlePtr->engineCallback(action, pluginId, value1, value2, value3, valueF, valueStr); | |||
} | |||
#undef handlePtr | |||
@@ -529,13 +529,13 @@ ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4 | |||
# A parameter value has changed. | |||
# @a pluginId Plugin Id | |||
# @a value1 Parameter index | |||
# @a value3 New parameter value | |||
# @a valuef New parameter value | |||
ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5 | |||
# A parameter default has changed. | |||
# @a pluginId Plugin Id | |||
# @a value1 Parameter index | |||
# @a value3 New default value | |||
# @a valuef New default value | |||
ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6 | |||
# A parameter's MIDI CC has changed. | |||
@@ -663,7 +663,8 @@ ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28 | |||
# Engine started. | |||
# @a value1 Process mode | |||
# @a value2 Transport mode | |||
# @a value3 Sample rate | |||
# @a value3 Buffer size | |||
# @a valuef Sample rate | |||
# @a valuestr Engine driver | |||
# @see EngineProcessMode | |||
# @see EngineTransportMode | |||
@@ -688,7 +689,7 @@ ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32 | |||
ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33 | |||
# Engine sample-rate changed. | |||
# @a value3 New sample rate | |||
# @a valuef New sample rate | |||
ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34 | |||
# A cancelable action has been started or stopped. | |||
@@ -701,7 +702,11 @@ ENGINE_CALLBACK_CANCELABLE_ACTION = 35 | |||
ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36 | |||
# NSM callback. | |||
# (Work in progress, values are not defined yet) | |||
# Frontend must call carla_nsm_ready() with opcode as parameter as a response | |||
# @a value1 NSM opcode | |||
# @a value2 Integer value | |||
# @a valueStr String value | |||
# @see NsmCallbackOpcode | |||
ENGINE_CALLBACK_NSM = 37 | |||
# Idle frontend. | |||
@@ -720,6 +725,40 @@ ENGINE_CALLBACK_ERROR = 40 | |||
# The engine has crashed or malfunctioned and will no longer work. | |||
ENGINE_CALLBACK_QUIT = 41 | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# NSM Callback Opcode | |||
# NSM callback opcodes. | |||
# @see ENGINE_CALLBACK_NSM | |||
# NSM is available and initialized. | |||
NSM_CALLBACK_INIT = 0 | |||
# Error from NSM side. | |||
# @a valueInt Error code | |||
# @a valueStr Error string | |||
NSM_CALLBACK_ERROR = 1 | |||
# Announce message. | |||
# @a valueInt SM Flags (WIP, to be defined) | |||
# @a valueStr SM Name | |||
NSM_CALLBACK_ANNOUNCE = 2 | |||
# Open message. | |||
# @a valueStr Project filename | |||
NSM_CALLBACK_OPEN = 3 | |||
# Save message. | |||
NSM_CALLBACK_SAVE = 4 | |||
# Session-is-loaded message. | |||
NSM_CALLBACK_SESSION_IS_LOADED = 5 | |||
# Show-optional-gui message. | |||
NSM_CALLBACK_SHOW_OPTIONAL_GUI = 6 | |||
# Hide-optional-gui message. | |||
NSM_CALLBACK_HIDE_OPTIONAL_GUI = 7 | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Engine Option | |||
# Engine options. | |||
@@ -918,7 +957,7 @@ PATCHBAY_ICON_FILE = 5 | |||
# Engine callback function. | |||
# Front-ends must never block indefinitely during a callback. | |||
# @see EngineCallbackOpcode and carla_set_engine_callback() | |||
EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_float, c_char_p) | |||
EngineCallbackFunc = CFUNCTYPE(None, c_void_p, c_enum, c_uint, c_int, c_int, c_int, c_float, c_char_p) | |||
# File callback function. | |||
# @see FileCallbackOpcode | |||
@@ -1178,6 +1217,16 @@ class CarlaTransportInfo(Structure): | |||
("bpm", c_double) | |||
] | |||
# Runtime engine information. | |||
class CarlaRuntimeEngineInfo(Structure): | |||
_fields_ = [ | |||
# DSP load. | |||
("load", c_float), | |||
# Number of xruns. | |||
("xruns", c_uint32) | |||
] | |||
# Image data for LV2 inline display API. | |||
# raw image pixmap format is ARGB32, | |||
class CarlaInlineDisplayImageSurface(Structure): | |||
@@ -1237,6 +1286,12 @@ PyCarlaTransportInfo = { | |||
"bpm": 0.0 | |||
} | |||
# @see CarlaRuntimeEngineInfo | |||
PyCarlaRuntimeEngineInfo = { | |||
"load": 0.0, | |||
"xruns": 0 | |||
} | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Set BINARY_NATIVE | |||
@@ -1336,6 +1391,11 @@ class CarlaHostMeta(object): | |||
def is_engine_running(self): | |||
raise NotImplementedError | |||
# Get information about the currently running engine. | |||
@abstractmethod | |||
def get_runtime_engine_info(self): | |||
raise NotImplementedError | |||
@abstractmethod | |||
def cancel_engine_action(self): | |||
raise NotImplementedError | |||
@@ -1908,6 +1968,18 @@ class CarlaHostMeta(object): | |||
def get_host_osc_url_udp(self): | |||
raise NotImplementedError | |||
# Initialize NSM (that is, announce ourselves to it). | |||
# Must be called as early as possible in the program's lifecycle. | |||
# Returns true if NSM is available and initialized correctly. | |||
@abstractmethod | |||
def nsm_init(self, pid, executableName): | |||
raise NotImplementedError | |||
# Respond to an NSM callback. | |||
@abstractmethod | |||
def nsm_ready(self, opcode): | |||
raise NotImplementedError | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Carla Host object (dummy/null, does nothing) | |||
@@ -1934,13 +2006,19 @@ class CarlaHostNull(CarlaHostMeta): | |||
def engine_init(self, driverName, clientName): | |||
self.fEngineRunning = True | |||
if self.fEngineCallback is not None: | |||
self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STARTED, 0, self.processMode, self.transportMode, 0.0, driverName) | |||
self.fEngineCallback(None, | |||
ENGINE_CALLBACK_ENGINE_STARTED, | |||
0, | |||
self.processMode, | |||
self.transportMode, | |||
0, 0.0, | |||
driverName) | |||
return True | |||
def engine_close(self): | |||
self.fEngineRunning = False | |||
if self.fEngineCallback is not None: | |||
self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0.0, "") | |||
self.fEngineCallback(None, ENGINE_CALLBACK_ENGINE_STOPPED, 0, 0, 0, 0, 0.0, "") | |||
return True | |||
def engine_idle(self): | |||
@@ -1949,6 +2027,9 @@ class CarlaHostNull(CarlaHostMeta): | |||
def is_engine_running(self): | |||
return self.fEngineRunning | |||
def get_runtime_engine_info(self): | |||
return PyCarlaRuntimeEngineInfo | |||
def cancel_engine_action(self): | |||
return | |||
@@ -2201,7 +2282,7 @@ class CarlaHostNull(CarlaHostMeta): | |||
def nsm_init(self, pid, executableName): | |||
return False | |||
def nsm_ready(self, action): | |||
def nsm_ready(self, opcode): | |||
return | |||
# ------------------------------------------------------------------------------------------------------------ | |||
@@ -2240,6 +2321,9 @@ class CarlaHostDLL(CarlaHostMeta): | |||
self.lib.carla_is_engine_running.argtypes = None | |||
self.lib.carla_is_engine_running.restype = c_bool | |||
self.lib.carla_get_runtime_engine_info.argtypes = None | |||
self.lib.carla_get_runtime_engine_info.restype = POINTER(CarlaRuntimeEngineInfo) | |||
self.lib.carla_cancel_engine_action.argtypes = None | |||
self.lib.carla_cancel_engine_action.restype = None | |||
@@ -2521,6 +2605,9 @@ class CarlaHostDLL(CarlaHostMeta): | |||
def is_engine_running(self): | |||
return bool(self.lib.carla_is_engine_running()) | |||
def get_runtime_engine_info(self): | |||
return structToDict(self.lib.carla_get_runtime_engine_info().contents) | |||
def cancel_engine_action(self): | |||
return self.lib.carla_cancel_engine_action() | |||
@@ -2778,8 +2865,8 @@ class CarlaHostDLL(CarlaHostMeta): | |||
def nsm_init(self, pid, executableName): | |||
return bool(self.lib.carla_nsm_init(pid, executableName.encode("utf-8"))) | |||
def nsm_ready(self, action): | |||
self.lib.carla_nsm_ready(action) | |||
def nsm_ready(self, opcode): | |||
self.lib.carla_nsm_ready(opcode) | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Helper object for CarlaHostPlugin | |||
@@ -2827,6 +2914,12 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
# plugin info | |||
self.fPluginsInfo = [] | |||
# runtime engine info | |||
self.fRuntimeEngineInfo = { | |||
"load": 0.0, | |||
"xruns": 0 | |||
} | |||
# transport info | |||
self.fTransportInfo = { | |||
"playing": False, | |||
@@ -2872,6 +2965,9 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
def get_engine_driver_device_info(self, index, name): | |||
return PyEngineDriverDeviceInfo | |||
def get_runtime_engine_info(self): | |||
return self.fRuntimeEngineInfo | |||
def cancel_engine_action(self): | |||
self.sendMsg(["cancel_engine_action"]) | |||
@@ -3157,6 +3253,12 @@ class CarlaHostPlugin(CarlaHostMeta): | |||
# -------------------------------------------------------------------------------------------------------- | |||
def _set_runtime_info(self, load, xruns): | |||
self.fRuntimeEngineInfo = { | |||
"load": load, | |||
"xruns": xruns | |||
} | |||
def _set_transport(self, playing, frame, bar, beat, tick, bpm): | |||
self.fTransportInfo = { | |||
"playing": playing, | |||
@@ -31,7 +31,7 @@ from carla_backend import * | |||
class CarlaHostSignals(QObject): | |||
# signals | |||
DebugCallback = pyqtSignal(int, int, int, float, str) | |||
DebugCallback = pyqtSignal(int, int, int, int, float, str) | |||
PluginAddedCallback = pyqtSignal(int, str) | |||
PluginRemovedCallback = pyqtSignal(int) | |||
PluginRenamedCallback = pyqtSignal(int, str) | |||
@@ -60,7 +60,7 @@ class CarlaHostSignals(QObject): | |||
PatchbayPortRenamedCallback = pyqtSignal(int, int, str) | |||
PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int) | |||
PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int) | |||
EngineStartedCallback = pyqtSignal(int, int, float, str) | |||
EngineStartedCallback = pyqtSignal(int, int, int, float, str) | |||
EngineStoppedCallback = pyqtSignal() | |||
ProcessModeChangedCallback = pyqtSignal(int) | |||
TransportModeChangedCallback = pyqtSignal(int, str) | |||
@@ -143,6 +143,7 @@ class HostWindow(QMainWindow): | |||
self.fLastTransportBPM = 0.0 | |||
self.fLastTransportFrame = 0 | |||
self.fLastTransportState = False | |||
self.fBufferSize = 0 | |||
self.fSampleRate = 0.0 | |||
if MACOS: | |||
@@ -496,6 +497,7 @@ class HostWindow(QMainWindow): | |||
host.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | |||
host.EngineStoppedCallback.connect(self.slot_handleEngineStoppedCallback) | |||
host.TransportModeChangedCallback.connect(self.slot_handleTransportModeChangedCallback) | |||
host.BufferSizeChangedCallback.connect(self.slot_handleBufferSizeChangedCallback) | |||
host.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | |||
host.CancelableActionCallback.connect(self.slot_handleCancelableActionCallback) | |||
host.ProjectLoadFinishedCallback.connect(self.slot_handleProjectLoadFinishedCallback) | |||
@@ -651,6 +653,23 @@ class HostWindow(QMainWindow): | |||
self.setWindowTitle(title) | |||
def updateBufferSize(self, newBufferSize): | |||
if self.fBufferSize == newBufferSize: | |||
return | |||
self.fBufferSize = newBufferSize | |||
self.ui.cb_buffer_size.clear() | |||
self.ui.cb_buffer_size.addItem(str(newBufferSize)) | |||
self.ui.cb_buffer_size.setCurrentIndex(0) | |||
def updateSampleRate(self, newSampleRate): | |||
if self.fSampleRate == newSampleRate: | |||
return | |||
self.fSampleRate = newSampleRate | |||
self.ui.cb_sample_rate.clear() | |||
self.ui.cb_sample_rate.addItem(str(newSampleRate)) | |||
self.ui.cb_sample_rate.setCurrentIndex(0) | |||
self.refreshTransport(True) | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Files | |||
@@ -879,10 +898,8 @@ class HostWindow(QMainWindow): | |||
# -------------------------------------------------------------------------------------------------------- | |||
# Engine (host callbacks) | |||
@pyqtSlot(int, int, float, str) | |||
def slot_handleEngineStartedCallback(self, processMode, transportMode, sampleRate, driverName): | |||
self.fSampleRate = sampleRate | |||
@pyqtSlot(int, int, int, float, str) | |||
def slot_handleEngineStartedCallback(self, processMode, transportMode, bufferSize, sampleRate, driverName): | |||
self.ui.menu_PluginMacros.setEnabled(True) | |||
self.ui.menu_Canvas.setEnabled(True) | |||
self.ui.w_transport.setEnabled(True) | |||
@@ -915,14 +932,15 @@ class HostWindow(QMainWindow): | |||
self.ui.act_file_open.setEnabled(True) | |||
self.ui.act_file_save_as.setEnabled(True) | |||
self.refreshTransport(True) | |||
self.ui.cb_transport_jack.setChecked(transportMode == ENGINE_TRANSPORT_MODE_JACK) | |||
self.ui.cb_transport_jack.setEnabled(driverName == "JACK" and processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | |||
if self.ui.cb_transport_link.isEnabled(): | |||
self.ui.cb_transport_link.setChecked(":link:" in self.host.transportExtra) | |||
self.updateBufferSize(bufferSize) | |||
self.updateSampleRate(sampleRate) | |||
self.refreshRuntimeInfo(0.0, 0) | |||
self.startTimers() | |||
self.ui.text_logs.appendPlainText("======= Engine started ========") | |||
@@ -940,6 +958,7 @@ class HostWindow(QMainWindow): | |||
# just in case | |||
self.removeAllPlugins() | |||
self.refreshRuntimeInfo(0.0, 0) | |||
self.ui.menu_PluginMacros.setEnabled(False) | |||
self.ui.menu_Canvas.setEnabled(False) | |||
@@ -961,10 +980,13 @@ class HostWindow(QMainWindow): | |||
self.ui.cb_transport_jack.setChecked(transportMode == ENGINE_TRANSPORT_MODE_JACK) | |||
self.ui.cb_transport_link.setChecked(":link:" in transportExtra) | |||
@pyqtSlot(int) | |||
def slot_handleBufferSizeChangedCallback(self, newBufferSize): | |||
self.updateBufferSize(newBufferSize) | |||
@pyqtSlot(float) | |||
def slot_handleSampleRateChangedCallback(self, newSampleRate): | |||
self.fSampleRate = newSampleRate | |||
self.refreshTransport(True) | |||
self.updateSampleRate(newSampleRate) | |||
@pyqtSlot(int, bool, str) | |||
def slot_handleCancelableActionCallback(self, pluginId, started, action): | |||
@@ -2084,19 +2106,22 @@ class HostWindow(QMainWindow): | |||
# -------------------------------------------------------------------------------------------------------- | |||
@pyqtSlot(int, int, str) | |||
def slot_handleNSMCallback(self, value1, value2, valueStr): | |||
def slot_handleNSMCallback(self, opcode, valueInt, valueStr): | |||
if opcode == NSM_CALLBACK_INIT: | |||
return | |||
# Error | |||
if value1 == 0: | |||
elif opcode == NSM_CALLBACK_ERROR: | |||
pass | |||
# Reply | |||
elif value1 == 1: | |||
elif opcode == NSM_CALLBACK_ANNOUNCE: | |||
self.fFirstEngineInit = False | |||
self.fSessionManagerName = valueStr | |||
self.setProperWindowTitle() | |||
# Open | |||
elif value1 == 2: | |||
elif opcode == NSM_CALLBACK_OPEN: | |||
self.fClientName = os.path.basename(valueStr) | |||
self.fProjectFilename = QFileInfo(valueStr+".carxp").absoluteFilePath() | |||
self.setProperWindowTitle() | |||
@@ -2106,22 +2131,22 @@ class HostWindow(QMainWindow): | |||
return | |||
# Save | |||
elif value1 == 3: | |||
elif opcode == NSM_CALLBACK_SAVE: | |||
self.saveProjectNow() | |||
# Session is Loaded | |||
elif value1 == 4: | |||
elif opcode == NSM_CALLBACK_SESSION_IS_LOADED: | |||
pass | |||
# Show Optional Gui | |||
elif value1 == 5: | |||
elif opcode == NSM_CALLBACK_SHOW_OPTIONAL_GUI: | |||
self.show() | |||
# Hide Optional Gui | |||
elif value1 == 6: | |||
elif opcode == NSM_CALLBACK_HIDE_OPTIONAL_GUI: | |||
self.hide() | |||
self.host.nsm_ready(value1) | |||
self.host.nsm_ready(opcode) | |||
# -------------------------------------------------------------------------------------------------------- | |||
@@ -2129,7 +2154,7 @@ class HostWindow(QMainWindow): | |||
return text.replace("\x1b[30;1m", "").replace("\x1b[31m", "").replace("\x1b[0m", "") | |||
@pyqtSlot(int, int, int, float, str) | |||
def slot_handleDebugCallback(self, pluginId, value1, value2, value3, valueStr): | |||
def slot_handleDebugCallback(self, pluginId, value1, value2, value3, valuef, valueStr): | |||
self.ui.text_logs.appendPlainText(self.fixLogText(valueStr)) | |||
@pyqtSlot(str) | |||
@@ -2251,6 +2276,7 @@ class HostWindow(QMainWindow): | |||
# show/hide event | |||
def showEvent(self, event): | |||
self.getAndRefreshRuntimeInfo() | |||
self.refreshTransport(True) | |||
QMainWindow.showEvent(self, event) | |||
@@ -2282,6 +2308,20 @@ class HostWindow(QMainWindow): | |||
# -------------------------------------------------------------------------------------------------------- | |||
# timer event | |||
def refreshRuntimeInfo(self, load, xruns): | |||
txt1 = str(xruns) if (xruns >= 0) else "--" | |||
txt2 = "" if (xruns == 1) else "s" | |||
self.ui.b_xruns.setText("%s Xrun%s" % (txt1, txt2)) | |||
self.ui.pb_dsp_load.setValue(int(load)) | |||
def getAndRefreshRuntimeInfo(self): | |||
if not self.isVisible(): | |||
return | |||
if not self.host.is_engine_running(): | |||
return | |||
info = self.host.get_runtime_engine_info() | |||
self.refreshRuntimeInfo(info['load'], info['xruns']) | |||
def idleFast(self): | |||
self.host.engine_idle() | |||
self.refreshTransport() | |||
@@ -2315,6 +2355,8 @@ class HostWindow(QMainWindow): | |||
self.ui.peak_out.displayMeter(2, 0.0, True) | |||
def idleSlow(self): | |||
self.getAndRefreshRuntimeInfo() | |||
if self.fPluginCount == 0 or self.fCurrentlyRemovingAllPlugins: | |||
return | |||
@@ -2528,7 +2570,7 @@ def canvasCallback(action, value1, value2, valueStr): | |||
# ------------------------------------------------------------------------------------------------------------ | |||
# Engine callback | |||
def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||
def engineCallback(host, action, pluginId, value1, value2, value3, valuef, valueStr): | |||
# kdevelop likes this :) | |||
if False: host = CarlaHostNull() | |||
@@ -2544,7 +2586,7 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||
host.transportExtra = valueStr | |||
if action == ENGINE_CALLBACK_DEBUG: | |||
host.DebugCallback.emit(pluginId, value1, value2, value3, valueStr) | |||
host.DebugCallback.emit(pluginId, value1, value2, value3, valuef, valueStr) | |||
elif action == ENGINE_CALLBACK_PLUGIN_ADDED: | |||
host.PluginAddedCallback.emit(pluginId, valueStr) | |||
elif action == ENGINE_CALLBACK_PLUGIN_REMOVED: | |||
@@ -2554,9 +2596,9 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||
elif action == ENGINE_CALLBACK_PLUGIN_UNAVAILABLE: | |||
host.PluginUnavailableCallback.emit(pluginId, valueStr) | |||
elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | |||
host.ParameterValueChangedCallback.emit(pluginId, value1, value3) | |||
host.ParameterValueChangedCallback.emit(pluginId, value1, valuef) | |||
elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: | |||
host.ParameterDefaultChangedCallback.emit(pluginId, value1, value3) | |||
host.ParameterDefaultChangedCallback.emit(pluginId, value1, valuef) | |||
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: | |||
host.ParameterMidiCcChangedCallback.emit(pluginId, value1, value2) | |||
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: | |||
@@ -2570,7 +2612,7 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||
elif action == ENGINE_CALLBACK_UI_STATE_CHANGED: | |||
host.UiStateChangedCallback.emit(pluginId, value1) | |||
elif action == ENGINE_CALLBACK_NOTE_ON: | |||
host.NoteOnCallback.emit(pluginId, value1, value2, round(value3)) | |||
host.NoteOnCallback.emit(pluginId, value1, value2, value3) | |||
elif action == ENGINE_CALLBACK_NOTE_OFF: | |||
host.NoteOffCallback.emit(pluginId, value1, value2) | |||
elif action == ENGINE_CALLBACK_UPDATE: | |||
@@ -2603,7 +2645,7 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||
elif action == ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED: | |||
host.PatchbayConnectionRemovedCallback.emit(pluginId, value1, value2) | |||
elif action == ENGINE_CALLBACK_ENGINE_STARTED: | |||
host.EngineStartedCallback.emit(value1, value2, value3, valueStr) | |||
host.EngineStartedCallback.emit(value1, value2, value3, valuef, valueStr) | |||
elif action == ENGINE_CALLBACK_ENGINE_STOPPED: | |||
host.EngineStoppedCallback.emit() | |||
elif action == ENGINE_CALLBACK_PROCESS_MODE_CHANGED: | |||
@@ -2613,7 +2655,7 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||
elif action == ENGINE_CALLBACK_BUFFER_SIZE_CHANGED: | |||
host.BufferSizeChangedCallback.emit(value1) | |||
elif action == ENGINE_CALLBACK_SAMPLE_RATE_CHANGED: | |||
host.SampleRateChangedCallback.emit(value3) | |||
host.SampleRateChangedCallback.emit(valuef) | |||
elif action == ENGINE_CALLBACK_CANCELABLE_ACTION: | |||
host.CancelableActionCallback.emit(pluginId, bool(value1 != 0), valueStr) | |||
elif action == ENGINE_CALLBACK_PROJECT_LOAD_FINISHED: | |||
@@ -2710,7 +2752,7 @@ def initHost(initName, libPrefix, isControl, isPlugin, failError, HostClass = No | |||
host.isControl = isControl | |||
host.isPlugin = isPlugin | |||
host.set_engine_callback(lambda h,a,p,v1,v2,v3,vs: engineCallback(host,a,p,v1,v2,v3,vs)) | |||
host.set_engine_callback(lambda h,a,p,v1,v2,v3,vf,vs: engineCallback(host,a,p,v1,v2,v3,vf,vs)) | |||
host.set_file_callback(fileCallback) | |||
# If it's a plugin the paths are already set | |||
@@ -182,18 +182,19 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||
pluginId = int(self.readlineblock()) | |||
value1 = int(self.readlineblock()) | |||
value2 = int(self.readlineblock()) | |||
value3 = float(self.readlineblock()) | |||
value3 = int(self.readlineblock()) | |||
valuef = float(self.readlineblock()) | |||
valueStr = self.readlineblock().replace("\r", "\n") | |||
if action == ENGINE_CALLBACK_PLUGIN_RENAMED: | |||
self.host._set_pluginName(pluginId, valueStr) | |||
elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | |||
if value1 < 0: | |||
self.host._set_internalValue(pluginId, value1, value3) | |||
self.host._set_internalValue(pluginId, value1, valuef) | |||
else: | |||
self.host._set_parameterValue(pluginId, value1, value3) | |||
self.host._set_parameterValue(pluginId, value1, valuef) | |||
elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: | |||
self.host._set_parameterDefault(pluginId, value1, value3) | |||
self.host._set_parameterDefault(pluginId, value1, valuef) | |||
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: | |||
self.host._set_parameterMidiCC(pluginId, value1, value2) | |||
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: | |||
@@ -203,7 +204,7 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||
elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: | |||
self.host._set_currentMidiProgram(pluginId, value1) | |||
engineCallback(self.host, action, pluginId, value1, value2, value3, valueStr) | |||
engineCallback(self.host, action, pluginId, value1, value2, value3, valuef, valueStr) | |||
elif msg.startswith("ENGINE_OPTION_"): | |||
option = int(msg.replace("ENGINE_OPTION_", "")) | |||
@@ -374,7 +375,7 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||
elif msg == "error": | |||
error = self.readlineblock().replace("\r", "\n") | |||
engineCallback(self.host, ENGINE_CALLBACK_ERROR, 0, 0, 0, 0.0, error) | |||
engineCallback(self.host, ENGINE_CALLBACK_ERROR, 0, 0, 0, 0, 0.0, error) | |||
elif msg == "show": | |||
self.fFirstInit = False | |||
@@ -1,6 +1,6 @@ | |||
/* | |||
* Carla Log Thread | |||
* Copyright (C) 2013-2016 Filipe Coelho <falktx@falktx.com> | |||
* Copyright (C) 2013-2019 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* This program is free software; you can redistribute it and/or | |||
* modify it under the terms of the GNU General Public License as | |||
@@ -176,7 +176,7 @@ protected: | |||
bufTemp[0] = '\0'; | |||
bufTempPos = 0; | |||
fCallback(fCallbackPtr, CarlaBackend::ENGINE_CALLBACK_DEBUG, 0, 0, 0, 0.0f, bufSend); | |||
fCallback(fCallbackPtr, CarlaBackend::ENGINE_CALLBACK_DEBUG, 0, 0, 0, 0, 0.0f, bufSend); | |||
} | |||
if (lastRead > 0 && lastRead != r) | |||