Signed-off-by: falkTX <falktx@falktx.com>tags/v2.1-alpha2
@@ -6,7 +6,7 @@ | |||||
<rect> | <rect> | ||||
<x>0</x> | <x>0</x> | ||||
<y>0</y> | <y>0</y> | ||||
<width>1058</width> | |||||
<width>1057</width> | |||||
<height>716</height> | <height>716</height> | ||||
</rect> | </rect> | ||||
</property> | </property> | ||||
@@ -14,10 +14,7 @@ | |||||
<string>MainWindow</string> | <string>MainWindow</string> | ||||
</property> | </property> | ||||
<widget class="QWidget" name="centralwidget"> | <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"> | <property name="leftMargin"> | ||||
<number>0</number> | <number>0</number> | ||||
</property> | </property> | ||||
@@ -32,6 +29,9 @@ | |||||
</property> | </property> | ||||
<item> | <item> | ||||
<widget class="QTabWidget" name="tabWidget"> | <widget class="QTabWidget" name="tabWidget"> | ||||
<property name="tabPosition"> | |||||
<enum>QTabWidget::North</enum> | |||||
</property> | |||||
<property name="currentIndex"> | <property name="currentIndex"> | ||||
<number>0</number> | <number>0</number> | ||||
</property> | </property> | ||||
@@ -222,6 +222,112 @@ | |||||
</widget> | </widget> | ||||
</widget> | </widget> | ||||
</item> | </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> | </layout> | ||||
</widget> | </widget> | ||||
<widget class="QMenuBar" name="menubar"> | <widget class="QMenuBar" name="menubar"> | ||||
@@ -229,8 +335,8 @@ | |||||
<rect> | <rect> | ||||
<x>0</x> | <x>0</x> | ||||
<y>0</y> | <y>0</y> | ||||
<width>1058</width> | |||||
<height>25</height> | |||||
<width>1057</width> | |||||
<height>20</height> | |||||
</rect> | </rect> | ||||
</property> | </property> | ||||
<widget class="QMenu" name="menu_File"> | <widget class="QMenu" name="menu_File"> | ||||
@@ -596,6 +702,22 @@ | |||||
</property> | </property> | ||||
</widget> | </widget> | ||||
</item> | </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> | </layout> | ||||
</item> | </item> | ||||
<item> | <item> | ||||
@@ -622,6 +744,22 @@ | |||||
</property> | </property> | ||||
</widget> | </widget> | ||||
</item> | </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> | </layout> | ||||
</item> | </item> | ||||
<item> | <item> | ||||
@@ -648,6 +786,22 @@ | |||||
</property> | </property> | ||||
</widget> | </widget> | ||||
</item> | </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> | </layout> | ||||
</item> | </item> | ||||
</layout> | </layout> | ||||
@@ -700,7 +854,7 @@ | |||||
<property name="sizeHint" stdset="0"> | <property name="sizeHint" stdset="0"> | ||||
<size> | <size> | ||||
<width>20</width> | <width>20</width> | ||||
<height>40</height> | |||||
<height>188</height> | |||||
</size> | </size> | ||||
</property> | </property> | ||||
</spacer> | </spacer> | ||||
@@ -722,7 +876,7 @@ | |||||
<number>0</number> | <number>0</number> | ||||
</property> | </property> | ||||
<property name="tabBarAutoHide" stdset="0"> | <property name="tabBarAutoHide" stdset="0"> | ||||
<bool>true</bool> | |||||
<bool>false</bool> | |||||
</property> | </property> | ||||
<widget class="QWidget" name="tab_3"> | <widget class="QWidget" name="tab_3"> | ||||
<property name="sizePolicy"> | <property name="sizePolicy"> | ||||
@@ -716,7 +716,7 @@ typedef enum { | |||||
* A parameter value has changed. | * A parameter value has changed. | ||||
* @a pluginId Plugin Id | * @a pluginId Plugin Id | ||||
* @a value1 Parameter index | * @a value1 Parameter index | ||||
* @a value3 New parameter value | |||||
* @a valuef New parameter value | |||||
*/ | */ | ||||
ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5, | ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5, | ||||
@@ -724,7 +724,7 @@ typedef enum { | |||||
* A parameter default has changed. | * A parameter default has changed. | ||||
* @a pluginId Plugin Id | * @a pluginId Plugin Id | ||||
* @a value1 Parameter index | * @a value1 Parameter index | ||||
* @a value3 New default value | |||||
* @a valuef New default value | |||||
*/ | */ | ||||
ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6, | ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6, | ||||
@@ -902,7 +902,8 @@ typedef enum { | |||||
* Engine started. | * Engine started. | ||||
* @a value1 Process mode | * @a value1 Process mode | ||||
* @a value2 Transport mode | * @a value2 Transport mode | ||||
* @a value3 Sample rate | |||||
* @a value3 Buffer size | |||||
* @a valuef Sample rate | |||||
* @a valuestr Engine driver | * @a valuestr Engine driver | ||||
* @see EngineProcessMode | * @see EngineProcessMode | ||||
* @see EngineTransportMode | * @see EngineTransportMode | ||||
@@ -937,7 +938,7 @@ typedef enum { | |||||
/*! | /*! | ||||
* Engine sample-rate changed. | * Engine sample-rate changed. | ||||
* @a value3 New sample rate | |||||
* @a valuef New sample rate | |||||
*/ | */ | ||||
ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34, | ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34, | ||||
@@ -955,8 +956,12 @@ typedef enum { | |||||
ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36, | 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, | ENGINE_CALLBACK_NSM = 37, | ||||
@@ -986,6 +991,61 @@ typedef enum { | |||||
} EngineCallbackOpcode; | } 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 */ | * Engine Option */ | ||||
@@ -1300,7 +1360,9 @@ enum PatchbayIcon { | |||||
* Front-ends must never block indefinitely during a callback. | * Front-ends must never block indefinitely during a callback. | ||||
* @see EngineCallbackOpcode, CarlaEngine::setCallback() and carla_set_engine_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. | * File callback function. | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin Host | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -808,6 +808,16 @@ public: | |||||
*/ | */ | ||||
virtual CarlaEngineClient* addClient(CarlaPlugin* const plugin); | 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 | // Plugin management | ||||
@@ -978,7 +988,9 @@ public: | |||||
* Call the main engine callback, if set. | * Call the main engine callback, if set. | ||||
* May be called by plugins. | * 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. | * Set the main engine callback to @a func. | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin Host | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -26,6 +26,7 @@ using CarlaBackend::PluginType; | |||||
using CarlaBackend::PluginCategory; | using CarlaBackend::PluginCategory; | ||||
using CarlaBackend::InternalParameterIndex; | using CarlaBackend::InternalParameterIndex; | ||||
using CarlaBackend::EngineCallbackOpcode; | using CarlaBackend::EngineCallbackOpcode; | ||||
using CarlaBackend::NsmCallbackOpcode; | |||||
using CarlaBackend::EngineOption; | using CarlaBackend::EngineOption; | ||||
using CarlaBackend::EngineProcessMode; | using CarlaBackend::EngineProcessMode; | ||||
using CarlaBackend::EngineTransportMode; | using CarlaBackend::EngineTransportMode; | ||||
@@ -273,6 +274,22 @@ typedef struct _CarlaTransportInfo { | |||||
} 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. | * Image data for LV2 inline display API. | ||||
* raw image pixmap format is ARGB32, | * raw image pixmap format is ARGB32, | ||||
@@ -353,6 +370,11 @@ CARLA_EXPORT void carla_engine_idle(); | |||||
*/ | */ | ||||
CARLA_EXPORT bool carla_is_engine_running(); | 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. | * Tell the engine to stop the current cancelable action. | ||||
* @see ENGINE_CALLBACK_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(); | 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 */ | #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_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_PROCESS_MODE, CB::ENGINE_PROCESS_MODE_BRIDGE, nullptr); | ||||
engine->setOption(CB::ENGINE_OPTION_TRANSPORT_MODE, CB::ENGINE_TRANSPORT_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)) | if (engine->init(clientName)) | ||||
{ | { | ||||
gStandalone.lastError = "No error"; | gStandalone.lastError = "No error"; | ||||
@@ -544,6 +544,22 @@ bool carla_is_engine_running() | |||||
return (gStandalone.engine != nullptr && gStandalone.engine->isRunning()); | 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() | void carla_cancel_engine_action() | ||||
{ | { | ||||
if (gStandalone.engine != nullptr) | 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 | // jack transport cannot be disabled in multi-client | ||||
if (gStandalone.engineCallback != nullptr) | if (gStandalone.engineCallback != nullptr) | ||||
gStandalone.engineCallback(gStandalone.engineCallbackPtr, | 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); | gStandalone.engineOptions.transportExtra); | ||||
CARLA_SAFE_ASSERT_RETURN(gStandalone.engineOptions.processMode != CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,); | CARLA_SAFE_ASSERT_RETURN(gStandalone.engineOptions.processMode != CB::ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,); | ||||
} | } | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Standalone | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -134,39 +134,48 @@ public: | |||||
lo_address_free(nsmAddress); | 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; | return true; | ||||
} | } | ||||
void ready(const int action) | |||||
void ready(const CB::NsmCallbackOpcode action) | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fServerThread != nullptr,); | CARLA_SAFE_ASSERT_RETURN(fServerThread != nullptr,); | ||||
switch (action) | switch (action) | ||||
{ | { | ||||
case -1: // init | |||||
case CB::NSM_CALLBACK_INIT: | |||||
CARLA_SAFE_ASSERT_BREAK(! fStarted); | CARLA_SAFE_ASSERT_BREAK(! fStarted); | ||||
fStarted = true; | fStarted = true; | ||||
lo_server_thread_start(fServerThread); | lo_server_thread_start(fServerThread); | ||||
break; | break; | ||||
case 0: // error | |||||
case CB::NSM_CALLBACK_ERROR: | |||||
break; | break; | ||||
case 1: // reply | |||||
case CB::NSM_CALLBACK_ANNOUNCE: | |||||
break; | break; | ||||
case 2: // open | |||||
case CB::NSM_CALLBACK_OPEN: | |||||
fReadyActionOpen = true; | fReadyActionOpen = true; | ||||
break; | break; | ||||
case 3: // save | |||||
case CB::NSM_CALLBACK_SAVE: | |||||
fReadyActionSave = true; | fReadyActionSave = true; | ||||
break; | break; | ||||
case 4: // session loaded | |||||
case CB::NSM_CALLBACK_SESSION_IS_LOADED: | |||||
break; | break; | ||||
case 5: // show gui | |||||
case CB::NSM_CALLBACK_SHOW_OPTIONAL_GUI: | |||||
CARLA_SAFE_ASSERT_BREAK(fReplyAddress != nullptr); | CARLA_SAFE_ASSERT_BREAK(fReplyAddress != nullptr); | ||||
CARLA_SAFE_ASSERT_BREAK(fServer != nullptr); | CARLA_SAFE_ASSERT_BREAK(fServer != nullptr); | ||||
{ | { | ||||
@@ -175,7 +184,7 @@ public: | |||||
} | } | ||||
break; | break; | ||||
case 6: // hide gui | |||||
case CB::NSM_CALLBACK_HIDE_OPTIONAL_GUI: | |||||
CARLA_SAFE_ASSERT_BREAK(fReplyAddress != nullptr); | CARLA_SAFE_ASSERT_BREAK(fReplyAddress != nullptr); | ||||
CARLA_SAFE_ASSERT_BREAK(fServer != nullptr); | CARLA_SAFE_ASSERT_BREAK(fServer != nullptr); | ||||
{ | { | ||||
@@ -198,9 +207,15 @@ protected: | |||||
carla_stdout("CarlaNSM::handleError(\"%s\", %i, \"%s\")", method, code, message); | carla_stdout("CarlaNSM::handleError(\"%s\", %i, \"%s\")", method, code, message); | ||||
if (gStandalone.engineCallback != nullptr) | 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 | // may be unused | ||||
(void)method; | (void)method; | ||||
@@ -249,7 +264,13 @@ protected: | |||||
if (fHasServerControl) | if (fHasServerControl) | ||||
flags |= 1 << 2; | 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); | std::free(msgURL); | ||||
@@ -271,7 +292,12 @@ protected: | |||||
if (gStandalone.engineCallback != nullptr) | if (gStandalone.engineCallback != nullptr) | ||||
{ | { | ||||
fReadyActionOpen = false; | 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;) | for (; ! fReadyActionOpen;) | ||||
carla_msleep(10); | carla_msleep(10); | ||||
@@ -322,7 +348,11 @@ protected: | |||||
if (gStandalone.engineCallback != nullptr) | if (gStandalone.engineCallback != nullptr) | ||||
{ | { | ||||
fReadyActionSave = false; | 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;) | for (; ! fReadyActionSave;) | ||||
carla_msleep(10); | carla_msleep(10); | ||||
@@ -346,7 +376,11 @@ protected: | |||||
carla_stdout("CarlaNSM::handleSessionIsLoaded()"); | carla_stdout("CarlaNSM::handleSessionIsLoaded()"); | ||||
if (gStandalone.engineCallback != nullptr) | 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; | return 0; | ||||
} | } | ||||
@@ -358,7 +392,11 @@ protected: | |||||
carla_stdout("CarlaNSM::handleShowOptionalGui()"); | carla_stdout("CarlaNSM::handleShowOptionalGui()"); | ||||
if (gStandalone.engineCallback != nullptr) | 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; | return 0; | ||||
} | } | ||||
@@ -370,7 +408,11 @@ protected: | |||||
carla_stdout("CarlaNSM::handleHideOptionalGui()"); | carla_stdout("CarlaNSM::handleHideOptionalGui()"); | ||||
if (gStandalone.engineCallback != nullptr) | 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; | 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) | bool carla_nsm_init(int pid, const char* executableName) | ||||
{ | { | ||||
#ifdef HAVE_LIBLO | #ifdef HAVE_LIBLO | ||||
@@ -609,10 +648,7 @@ bool carla_nsm_init(int pid, const char* executableName) | |||||
#endif | #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 | #ifdef HAVE_LIBLO | ||||
CarlaNSM::getInstance().ready(action); | CarlaNSM::getInstance().ready(action); | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin Host | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -305,7 +305,7 @@ bool CarlaEngine::close() | |||||
pData->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; | return true; | ||||
} | } | ||||
@@ -347,6 +347,20 @@ CarlaEngineClient* CarlaEngine::addClient(CarlaPlugin* const) | |||||
return new CarlaEngineClient(*this); | 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 | // Plugin management | ||||
@@ -611,7 +625,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, | |||||
plugin->setActive(wasActive, true, true); | plugin->setActive(wasActive, true, true); | ||||
plugin->setEnabled(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) | else if (! pData->loadingProject) | ||||
#endif | #endif | ||||
@@ -619,7 +633,7 @@ bool CarlaEngine::addPlugin(const BinaryType btype, const PluginType ptype, | |||||
plugin->setEnabled(true); | plugin->setEnabled(true); | ||||
++pData->curPluginCount; | ++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) | if (getType() != kEngineTypeBridge) | ||||
plugin->setActive(true, false, true); | plugin->setActive(true, false, true); | ||||
@@ -686,7 +700,7 @@ bool CarlaEngine::removePlugin(const uint id) | |||||
delete plugin; | 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; | return true; | ||||
} | } | ||||
@@ -722,7 +736,7 @@ bool CarlaEngine::removeAllPlugins() | |||||
const ScopedActionLock sal(this, kEnginePostActionZeroCount, 0, 0); | 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) | for (uint i=0; i < curPluginCount; ++i) | ||||
{ | { | ||||
@@ -737,8 +751,8 @@ bool CarlaEngine::removeAllPlugins() | |||||
carla_zeroFloats(pluginData.peaks, 4); | 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; | return true; | ||||
@@ -1094,7 +1108,7 @@ bool CarlaEngine::loadFile(const char* const filename) | |||||
//nicerName | //nicerName | ||||
if (addPlugin(PLUGIN_INTERNAL, nullptr, nicerName, "zynaddsubfx", 0, nullptr)) | 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)) | if (CarlaPlugin* const plugin = getPlugin(curPluginId)) | ||||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, (extension == "xmz") ? "CarlaAlternateFile1" : "CarlaAlternateFile2", filename, true); | 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 | // 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 | #ifdef DEBUG | ||||
if (pData->isIdling) | 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) | 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 | #endif | ||||
if (pData->callback != nullptr) | if (pData->callback != nullptr) | ||||
@@ -1301,7 +1317,7 @@ void CarlaEngine::callback(const EngineCallbackOpcode action, const uint pluginI | |||||
++pData->isIdling; | ++pData->isIdling; | ||||
try { | 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__) | #if defined(CARLA_OS_LINUX) && defined(__arm__) | ||||
} catch (__cxxabiv1::__forced_unwind&) { | } catch (__cxxabiv1::__forced_unwind&) { | ||||
carla_stderr2("Caught forced unwind exception in callback"); | 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) | 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) | void CarlaEngine::offlineModeChanged(const bool isOfflineNow) | ||||
@@ -2087,13 +2103,13 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
if (! (xmlType.equalsIgnoreCase("carla-project") || isPreset)) | 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"); | setLastError("Not a valid Carla project or preset file"); | ||||
return false; | return false; | ||||
} | } | ||||
pData->actionCanceled = 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 | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
const ScopedValueSetter<bool> _svs2(pData->loadingProject, true, false); | const ScopedValueSetter<bool> _svs2(pData->loadingProject, true, false); | ||||
@@ -2103,7 +2119,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
xmlElement = xmlDoc.getDocumentElement(false); | xmlElement = xmlDoc.getDocumentElement(false); | ||||
CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to completely parse project file"); | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2228,7 +2244,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
setOption(static_cast<EngineOption>(option), value, valueStr); | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2252,7 +2268,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
if (bpm >= 20.0 && bpm < 400.0) | if (bpm >= 20.0 && bpm < 400.0) | ||||
pData->time.setBPM(bpm); | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2275,7 +2291,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
CarlaStateSave stateSave; | CarlaStateSave stateSave; | ||||
stateSave.fillFromXmlElement(isPreset ? xmlElement.get() : elem); | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2299,7 +2315,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
if (CarlaPlugin* const plugin = pData->plugins[pluginId].plugin) | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2332,7 +2348,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
++pData->curPluginCount; | ++pData->curPluginCount; | ||||
plugin->setEnabled(true); | 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) | if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | ||||
pData->graph.addPlugin(plugin); | pData->graph.addPlugin(plugin); | ||||
@@ -2450,7 +2466,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
if (CarlaPlugin* const plugin = pData->plugins[pluginId].plugin) | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2474,7 +2490,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
plugin->setEnabled(true); | plugin->setEnabled(true); | ||||
++pData->curPluginCount; | ++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 | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | ||||
@@ -2494,8 +2510,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
if (isPreset) | 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; | return true; | ||||
} | } | ||||
} | } | ||||
@@ -2510,7 +2526,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
plugin->setCustomData(CUSTOM_DATA_TYPE_STRING, "__CarlaPingOnOff__", "true", false); | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2558,7 +2574,7 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
restorePatchbayConnection(false, sourcePort, targetPort, !isUsingExternal); | 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) | if (pData->aboutToClose) | ||||
return true; | return true; | ||||
@@ -2640,8 +2656,8 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) | |||||
} | } | ||||
#endif | #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; | return true; | ||||
} | } | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin Host | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * 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..."); | carla_stderr("Did not receive ping message from server for 30 secs, closing..."); | ||||
signalThreadShouldExit(); | 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) | if (fClosingDown) | ||||
return; | return; | ||||
@@ -595,7 +597,7 @@ public: | |||||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | ||||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterValue); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerParameterValue); | ||||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | ||||
fShmNonRtServerControl.writeFloat(value3); | |||||
fShmNonRtServerControl.writeFloat(valueF); | |||||
fShmNonRtServerControl.commitWrite(); | fShmNonRtServerControl.commitWrite(); | ||||
} break; | } break; | ||||
@@ -605,7 +607,7 @@ public: | |||||
const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | const CarlaMutexLocker _cml(fShmNonRtServerControl.mutex); | ||||
fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerDefaultValue); | fShmNonRtServerControl.writeOpcode(kPluginBridgeNonRtServerDefaultValue); | ||||
fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | fShmNonRtServerControl.writeUInt(static_cast<uint>(value1)); | ||||
fShmNonRtServerControl.writeFloat(value3); | |||||
fShmNonRtServerControl.writeFloat(valueF); | |||||
fShmNonRtServerControl.commitWrite(); | fShmNonRtServerControl.commitWrite(); | ||||
} break; | } break; | ||||
@@ -1020,7 +1022,7 @@ public: | |||||
case kPluginBridgeNonRtClientQuit: | case kPluginBridgeNonRtClientQuit: | ||||
fClosingDown = true; | fClosingDown = true; | ||||
signalThreadShouldExit(); | signalThreadShouldExit(); | ||||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0.0f, nullptr); | |||||
callback(ENGINE_CALLBACK_QUIT, 0, 0, 0, 0, 0.0f, nullptr); | |||||
break; | 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) | if (! quitReceived) | ||||
{ | { | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin Host | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * 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); | std::snprintf(strBuf, STR_MAX, "%u:%u:%u:%u", groupA, portA, groupB, portB); | ||||
if (sendCallback) | 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); | connections.list.append(connectionToId); | ||||
return true; | return true; | ||||
@@ -300,7 +300,7 @@ bool ExternalGraph::disconnect(const uint connectionId) noexcept | |||||
return false; | 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); | connections.list.remove(it); | ||||
return true; | return true; | ||||
@@ -318,18 +318,57 @@ void ExternalGraph::refresh(const char* const deviceName) | |||||
// Main | // 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) | 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]; | char strBuf[STR_MAX+1]; | ||||
@@ -343,7 +382,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||||
else | else | ||||
std::strncpy(strBuf, "Capture", STR_MAX); | 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); | const CarlaString groupNameIn(strBuf); | ||||
@@ -355,8 +399,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||||
portNameToId.setFullName(groupNameIn + portNameToId.name); | 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 | // Audio Out | ||||
@@ -365,7 +413,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||||
else | else | ||||
std::strncpy(strBuf, "Playback", STR_MAX); | 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); | const CarlaString groupNameOut(strBuf); | ||||
@@ -377,14 +430,23 @@ void ExternalGraph::refresh(const char* const deviceName) | |||||
portNameToId.setFullName(groupNameOut + portNameToId.name); | 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 | // 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:"); | const CarlaString groupNamePlus("Readable MIDI ports:"); | ||||
@@ -396,14 +458,23 @@ void ExternalGraph::refresh(const char* const deviceName) | |||||
portNameToId.setFullName(groupNamePlus + portNameToId.name); | 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 | // 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:"); | const CarlaString groupNamePlus("Writable MIDI ports:"); | ||||
@@ -415,8 +486,12 @@ void ExternalGraph::refresh(const char* const deviceName) | |||||
portNameToId.setFullName(groupNamePlus + portNameToId.name); | 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); | 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); | 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); | 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); | 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); | 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); | 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); | 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); | 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(engine != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(proc != 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) | 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) | 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()) | 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()) | 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) | 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) | 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()) | 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()) | 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,); | CARLA_SAFE_ASSERT_RETURN(node != nullptr,); | ||||
if (! usingExternal) | 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) | 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); | std::snprintf(strBuf, STR_MAX, "%u:%u:%u:%u", groupA, portA, groupB, portB); | ||||
if (sendCallback) | 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); | connections.list.append(connectionToId); | ||||
return true; | return true; | ||||
@@ -1622,7 +1746,10 @@ bool PatchbayGraph::disconnect(const uint connectionId) | |||||
connectionToId.groupB, static_cast<int>(adjustedPortB))) | connectionToId.groupB, static_cast<int>(adjustedPortB))) | ||||
return false; | 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); | connections.list.remove(it); | ||||
return true; | return true; | ||||
@@ -1660,7 +1787,10 @@ void PatchbayGraph::disconnectInternalGroup(const uint groupId) noexcept | |||||
*/ | */ | ||||
if (! usingExternal) | 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); | 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); | 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); | connections.list.append(connectionToId); | ||||
} | } | ||||
@@ -392,6 +392,7 @@ CarlaEngine::ProtectedData::ProtectedData(CarlaEngine* const engine) noexcept | |||||
timeInfo(), | timeInfo(), | ||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
plugins(nullptr), | plugins(nullptr), | ||||
xruns(0), | |||||
#endif | #endif | ||||
events(), | events(), | ||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
@@ -481,6 +482,7 @@ bool CarlaEngine::ProtectedData::init(const char* const clientName) | |||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
plugins = new EnginePluginData[maxPluginNumber]; | plugins = new EnginePluginData[maxPluginNumber]; | ||||
carla_zeroStructs(plugins, maxPluginNumber); | carla_zeroStructs(plugins, maxPluginNumber); | ||||
xruns = 0; | |||||
#endif | #endif | ||||
nextAction.clearAndReset(); | nextAction.clearAndReset(); | ||||
@@ -246,6 +246,7 @@ struct CarlaEngine::ProtectedData { | |||||
EnginePluginData plugins[1]; | EnginePluginData plugins[1]; | ||||
#else | #else | ||||
EnginePluginData* plugins; | EnginePluginData* plugins; | ||||
uint32_t xruns; | |||||
#endif | #endif | ||||
float peaks[4]; | float peaks[4]; | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin Host | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * 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_registration_callback(fClient, carla_jack_port_registration_callback, this); | ||||
jackbridge_set_port_connect_callback(fClient, carla_jack_port_connect_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_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) | if (opts.processMode == ENGINE_PROCESS_MODE_CONTINUOUS_RACK || opts.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | ||||
{ | { | ||||
@@ -1030,7 +1031,9 @@ public: | |||||
startThread(); | startThread(); | ||||
callback(ENGINE_CALLBACK_ENGINE_STARTED, 0, | callback(ENGINE_CALLBACK_ENGINE_STARTED, 0, | ||||
opts.processMode, opts.transportMode, | |||||
opts.processMode, | |||||
opts.transportMode, | |||||
static_cast<int>(pData->bufferSize), | |||||
static_cast<float>(pData->sampleRate), | static_cast<float>(pData->sampleRate), | ||||
getCurrentDriverName()); | getCurrentDriverName()); | ||||
return true; | return true; | ||||
@@ -1129,6 +1132,15 @@ public: | |||||
return "JACK"; | 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 | EngineTimeInfo getTimeInfo() const noexcept override | ||||
{ | { | ||||
if (pData->options.transportMode != ENGINE_TRANSPORT_MODE_JACK) | if (pData->options.transportMode != ENGINE_TRANSPORT_MODE_JACK) | ||||
@@ -1193,7 +1205,8 @@ public: | |||||
{ | { | ||||
// jack transport cannot be disabled in multi-client | // jack transport cannot be disabled in multi-client | ||||
callback(ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED, 0, | 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); | pData->options.transportExtra); | ||||
CARLA_SAFE_ASSERT_RETURN(pData->options.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,); | CARLA_SAFE_ASSERT_RETURN(pData->options.processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS,); | ||||
@@ -1358,7 +1371,9 @@ public: | |||||
if (connectionToId.groupA != groupId && connectionToId.groupB != groupId) | if (connectionToId.groupA != groupId && connectionToId.groupB != groupId) | ||||
continue; | 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); | fUsedConnections.list.remove(it2); | ||||
} | } | ||||
@@ -1370,7 +1385,10 @@ public: | |||||
if (portNameToId.group != groupId) | if (portNameToId.group != groupId) | ||||
continue; | 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); | fUsedPorts.list.remove(it); | ||||
} | } | ||||
} | } | ||||
@@ -1890,7 +1908,7 @@ protected: | |||||
GroupNameToId groupNameToId; | GroupNameToId groupNameToId; | ||||
groupNameToId.setData(groupId, name); | 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); | fUsedGroups.list.removeOne(groupNameToId); | ||||
} | } | ||||
@@ -1923,12 +1941,16 @@ protected: | |||||
if (groupId == 0) | if (groupId == 0) | ||||
{ | { | ||||
groupId = ++fUsedGroups.lastId; | groupId = ++fUsedGroups.lastId; | ||||
PatchbayIcon icon = (jackPortFlags & JackPortIsPhysical) ? PATCHBAY_ICON_HARDWARE : PATCHBAY_ICON_APPLICATION; | |||||
GroupNameToId groupNameToId; | GroupNameToId groupNameToId; | ||||
groupNameToId.setData(groupId, groupName); | 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); | fNewGroups.append(groupId); | ||||
fUsedGroups.list.append(groupNameToId); | fUsedGroups.list.append(groupNameToId); | ||||
@@ -1944,7 +1966,10 @@ protected: | |||||
See the comment on CarlaEngineJack::renamePlugin() for more information. */ | See the comment on CarlaEngineJack::renamePlugin() for more information. */ | ||||
if (portNameToId.group <= 0 || portNameToId.port <= 0) return; | 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); | fUsedPorts.list.removeOne(portNameToId); | ||||
} | } | ||||
} | } | ||||
@@ -1983,7 +2008,10 @@ protected: | |||||
ConnectionToId connectionToId; | ConnectionToId connectionToId; | ||||
connectionToId.setData(++fUsedConnections.lastId, portNameToIdA.group, portNameToIdA.port, portNameToIdB.group, portNameToIdB.port); | 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); | fUsedConnections.list.append(connectionToId); | ||||
} | } | ||||
else | 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); | CARLA_SAFE_ASSERT_CONTINUE(portNameToId.group == groupId); | ||||
portNameToId.rename(shortPortName, newFullName); | 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; | break; | ||||
} | } | ||||
} | } | ||||
@@ -2082,7 +2117,7 @@ protected: | |||||
carla_zeroPointers(fRackPorts, kRackPortCount); | carla_zeroPointers(fRackPorts, kRackPortCount); | ||||
#endif | #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()) | //if (pData->nextAction.pluginId == plugin->getId()) | ||||
// pData->nextAction.clearAndReset(); | // 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 groupNameToId; | ||||
groupNameToId.setData(++fUsedGroups.lastId, ourName); | 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); | fUsedGroups.list.append(groupNameToId); | ||||
} | } | ||||
@@ -2247,7 +2287,12 @@ private: | |||||
GroupNameToId groupNameToId; | GroupNameToId groupNameToId; | ||||
groupNameToId.setData(groupId, groupName); | 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); | fUsedGroups.list.append(groupNameToId); | ||||
} | } | ||||
@@ -2293,7 +2338,10 @@ private: | |||||
ConnectionToId connectionToId; | ConnectionToId connectionToId; | ||||
connectionToId.setData(++fUsedConnections.lastId, thisPort.group, thisPort.port, targetPort.group, targetPort.port); | 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); | fUsedConnections.list.append(connectionToId); | ||||
} | } | ||||
@@ -2343,7 +2391,12 @@ private: | |||||
PortNameToId portNameToId; | PortNameToId portNameToId; | ||||
portNameToId.setData(groupId, ++fUsedPorts.lastId, shortPortName, fullPortName); | 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); | fUsedPorts.list.append(portNameToId); | ||||
} | } | ||||
#endif | #endif | ||||
@@ -2509,8 +2562,13 @@ private: | |||||
int pluginId = -1; | int pluginId = -1; | ||||
PatchbayIcon icon = PATCHBAY_ICON_PLUGIN; | 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(); | events.clear(); | ||||
@@ -2618,6 +2676,12 @@ private: | |||||
std::strncpy(ev.name2, newName, STR_MAX); | std::strncpy(ev.name2, newName, STR_MAX); | ||||
handlePtr->postPoneJackCallback(ev); | handlePtr->postPoneJackCallback(ev); | ||||
} | } | ||||
static int JACKBRIDGE_API carla_jack_xrun_callback(void* arg) | |||||
{ | |||||
++(handlePtr->pData->xruns); | |||||
return 0; | |||||
} | |||||
#endif | #endif | ||||
static void JACKBRIDGE_API carla_jack_shutdown_callback(void* arg) | static void JACKBRIDGE_API carla_jack_shutdown_callback(void* arg) | ||||
@@ -227,7 +227,13 @@ public: | |||||
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | ||||
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false); | 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; | 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); | std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | ||||
strBuf[STR_MAX-1] = '\0'; | 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); | 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); | std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | ||||
strBuf[STR_MAX-1] = '\0'; | 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); | extGraph.connections.list.append(connectionToId); | ||||
} | } | ||||
@@ -582,7 +594,7 @@ protected: | |||||
void audioDeviceError(const juce::String& errorMessage) override | 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 | 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, | 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) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaEngineNativeUI) | ||||
@@ -803,12 +808,17 @@ protected: | |||||
return "Plugin"; | 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)) | 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; | return retName; | ||||
} | } | ||||
@@ -1126,7 +1136,9 @@ protected: | |||||
fUiServer.flushMessages(); | 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) | if (! fIsRunning) | ||||
return; | return; | ||||
@@ -1210,11 +1222,14 @@ protected: | |||||
if (! fUiServer.writeMessage(tmpBuf)) | if (! fUiServer.writeMessage(tmpBuf)) | ||||
return; | return; | ||||
std::sprintf(tmpBuf, "%i\n", value2); | std::sprintf(tmpBuf, "%i\n", value2); | ||||
if (! fUiServer.writeMessage(tmpBuf)) | |||||
return; | |||||
std::sprintf(tmpBuf, "%i\n", value3); | |||||
if (! fUiServer.writeMessage(tmpBuf)) | if (! fUiServer.writeMessage(tmpBuf)) | ||||
return; | return; | ||||
{ | { | ||||
const CarlaScopedLocale csl; | 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)) | if (! fUiServer.writeMessage(tmpBuf)) | ||||
return; | return; | ||||
@@ -1741,9 +1756,13 @@ protected: | |||||
uiServerInfo(); | uiServerInfo(); | ||||
uiServerOptions(); | 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(); | fUiServer.writeShowMessage(); | ||||
@@ -1753,7 +1772,7 @@ protected: | |||||
if (plugin != nullptr && plugin->isEnabled()) | 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 | // remove all plugins from UI side | ||||
for (uint i=0, count=pData->curPluginCount; i < count; ++i) | 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 | // remove all plugins from backend, no lock | ||||
fIsRunning = false; | 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); | return handlePtr->uiFileCallback(action, isDir, title, filter); | ||||
} | } | ||||
@@ -349,9 +349,13 @@ public: | |||||
if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | if (pData->options.processMode == ENGINE_PROCESS_MODE_PATCHBAY) | ||||
refreshExternalGraphPorts<PatchbayGraph>(pData->graph.getPatchbayGraph(), false); | 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; | return true; | ||||
} | } | ||||
@@ -551,8 +555,12 @@ public: | |||||
extGraph.connections.list.append(connectionToId); | 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(); | fMidiOutMutex.lock(); | ||||
@@ -574,8 +582,12 @@ public: | |||||
extGraph.connections.list.append(connectionToId); | 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(); | fMidiOutMutex.unlock(); | ||||
@@ -50,7 +50,7 @@ static const MidiProgramData kMidiProgramDataNull = { 0, 0, nullptr }; | |||||
static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr }; | static const CustomData kCustomDataFallback = { nullptr, nullptr, nullptr }; | ||||
static /* */ CustomData kCustomDataFallbackNC = { 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() | // ParamSymbol struct, needed for CarlaPlugin::loadStateSave() | ||||
@@ -890,7 +890,7 @@ void CarlaPlugin::loadStateSave(const CarlaStateSave& stateSave) | |||||
setActive(stateSave.active, true, true); | setActive(stateSave.active, true, true); | ||||
if (! pData->engine->isLoadingProject()) | 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 | #endif | ||||
} | } | ||||
@@ -1293,7 +1293,11 @@ void CarlaPlugin::setOption(const uint option, const bool yesNo, const bool send | |||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
if (sendCallback) | 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 | #else | ||||
// unused | // unused | ||||
return; (void)sendCallback; | return; (void)sendCallback; | ||||
@@ -1347,7 +1351,12 @@ void CarlaPlugin::setActive(const bool active, const bool sendOsc, const bool se | |||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
if (sendCallback) | 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 | #endif | ||||
// maybe unused | // maybe unused | ||||
@@ -1377,7 +1386,12 @@ void CarlaPlugin::setDryWet(const float value, const bool sendOsc, const bool se | |||||
# endif | # endif | ||||
if (sendCallback) | 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 | 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 | # endif | ||||
if (sendCallback) | 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 | 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 | # endif | ||||
if (sendCallback) | 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 | 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 | # endif | ||||
if (sendCallback) | 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 | 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 | # endif | ||||
if (sendCallback) | 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 | void CarlaPlugin::setDryWetRT(const float value) noexcept | ||||
@@ -1490,7 +1524,7 @@ void CarlaPlugin::setDryWetRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.dryWet = fixedValue; | 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 | void CarlaPlugin::setVolumeRT(const float value) noexcept | ||||
@@ -1503,7 +1537,7 @@ void CarlaPlugin::setVolumeRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.volume = fixedValue; | 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 | void CarlaPlugin::setBalanceLeftRT(const float value) noexcept | ||||
@@ -1516,7 +1550,7 @@ void CarlaPlugin::setBalanceLeftRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.balanceLeft = fixedValue; | 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 | void CarlaPlugin::setBalanceRightRT(const float value) noexcept | ||||
@@ -1529,7 +1563,7 @@ void CarlaPlugin::setBalanceRightRT(const float value) noexcept | |||||
return; | return; | ||||
pData->postProc.balanceRight = fixedValue; | 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 | 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 | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
if (sendCallback) | 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 | #endif | ||||
// maybe unused | // maybe unused | ||||
@@ -1599,12 +1637,17 @@ void CarlaPlugin::setParameterValue(const uint32_t parameterId, const float valu | |||||
#endif | #endif | ||||
if (sendCallback) | 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 | 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 | 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 | # endif | ||||
if (sendCallback) | 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 | #endif | ||||
} | } | ||||
@@ -1685,7 +1732,11 @@ void CarlaPlugin::setParameterMidiCC(const uint32_t parameterId, const int16_t c | |||||
# endif | # endif | ||||
if (sendCallback) | 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 | #endif | ||||
} | } | ||||
@@ -1753,7 +1804,10 @@ void CarlaPlugin::setProgram(const int32_t index, const bool sendGui, const bool | |||||
#endif | #endif | ||||
if (sendCallback) | 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 | // Change default parameter values | ||||
if (index >= 0) | if (index >= 0) | ||||
@@ -1793,7 +1847,10 @@ void CarlaPlugin::setMidiProgram(const int32_t index, const bool sendGui, const | |||||
#endif | #endif | ||||
if (sendCallback) | 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 | // Change default parameter values | ||||
if (index >= 0) | if (index >= 0) | ||||
@@ -1845,7 +1902,7 @@ void CarlaPlugin::setProgramRT(const uint32_t uindex) noexcept | |||||
break; | break; | ||||
} | } | ||||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, index, 0, 0.0f); | |||||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, index, 0, 0, 0.0f); | |||||
} | } | ||||
void CarlaPlugin::setMidiProgramRT(const uint32_t uindex) noexcept | void CarlaPlugin::setMidiProgramRT(const uint32_t uindex) noexcept | ||||
@@ -1867,7 +1924,7 @@ void CarlaPlugin::setMidiProgramRT(const uint32_t uindex) noexcept | |||||
break; | break; | ||||
} | } | ||||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, index, 0, 0.0f); | |||||
pData->postponeRtEvent(kPluginPostRtEventMidiProgramChange, index, 0, 0, 0.0f); | |||||
} | } | ||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
@@ -1944,7 +2001,11 @@ void CarlaPlugin::idle() | |||||
} break; | } break; | ||||
case kPluginPostRtEventDebug: { | 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; | } break; | ||||
case kPluginPostRtEventParameterChange: { | case kPluginPostRtEventParameterChange: { | ||||
@@ -1954,7 +2015,7 @@ void CarlaPlugin::idle() | |||||
if (needsUiMainThread) | if (needsUiMainThread) | ||||
pData->postUiEvents.append(event); | pData->postUiEvents.append(event); | ||||
else | else | ||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.value3); | |||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valueF); | |||||
} | } | ||||
if (event.value2 != 1) | if (event.value2 != 1) | ||||
@@ -1962,10 +2023,15 @@ void CarlaPlugin::idle() | |||||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | #if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | ||||
// Update OSC control client | // Update OSC control client | ||||
if (sendOsc) | 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 | #endif | ||||
// Update Host | // 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; | } break; | ||||
@@ -1992,8 +2058,18 @@ void CarlaPlugin::idle() | |||||
pData->engine->oscSend_control_set_default_value(pData->id, j, paramDefault); | pData->engine->oscSend_control_set_default_value(pData->id, j, paramDefault); | ||||
} | } | ||||
#endif | #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) | #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); | pData->engine->oscSend_control_set_current_program(pData->id, event.value1); | ||||
#endif | #endif | ||||
// Update Host | // 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; | } break; | ||||
@@ -2029,8 +2108,18 @@ void CarlaPlugin::idle() | |||||
pData->engine->oscSend_control_set_default_value(pData->id, j, paramDefault); | pData->engine->oscSend_control_set_default_value(pData->id, j, paramDefault); | ||||
} | } | ||||
#endif | #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) | #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); | pData->engine->oscSend_control_set_current_midi_program(pData->id, event.value1); | ||||
#endif | #endif | ||||
// Update Host | // 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; | } break; | ||||
case kPluginPostRtEventNoteOn: { | case kPluginPostRtEventNoteOn: { | ||||
CARLA_SAFE_ASSERT_BREAK(event.value1 >= 0 && event.value1 < MAX_MIDI_CHANNELS); | 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.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 channel = static_cast<uint8_t>(event.value1); | ||||
const uint8_t note = static_cast<uint8_t>(event.value2); | 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 | // Update UI | ||||
if (hasUI) | if (hasUI) | ||||
@@ -2067,7 +2159,12 @@ void CarlaPlugin::idle() | |||||
pData->engine->oscSend_control_note_on(pData->id, channel, note, velocity); | pData->engine->oscSend_control_note_on(pData->id, channel, note, velocity); | ||||
#endif | #endif | ||||
// Update Host | // 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; | } break; | ||||
@@ -2093,7 +2190,11 @@ void CarlaPlugin::idle() | |||||
pData->engine->oscSend_control_note_off(pData->id, channel, note); | pData->engine->oscSend_control_note_off(pData->id, channel, note); | ||||
#endif | #endif | ||||
// Update Host | // 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; | } break; | ||||
} | } | ||||
@@ -2312,7 +2413,12 @@ void CarlaPlugin::sendMidiSingleNote(const uint8_t channel, const uint8_t note, | |||||
#endif | #endif | ||||
if (sendCallback) | 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 | // may be unused | ||||
return; (void)sendOsc; | return; (void)sendOsc; | ||||
@@ -2328,7 +2434,8 @@ void CarlaPlugin::sendMidiAllNotesOffToCallback() | |||||
postEvent.type = kPluginPostRtEventNoteOff; | postEvent.type = kPluginPostRtEventNoteOff; | ||||
postEvent.value1 = pData->ctrlChannel; | postEvent.value1 = pData->ctrlChannel; | ||||
postEvent.value2 = 0; | postEvent.value2 = 0; | ||||
postEvent.value3 = 0.0f; | |||||
postEvent.value4 = 0; | |||||
postEvent.valueF = 0.0f; | |||||
for (int32_t i=0; i < MAX_MIDI_NOTE; ++i) | for (int32_t i=0; i < MAX_MIDI_NOTE; ++i) | ||||
{ | { | ||||
@@ -2373,7 +2480,7 @@ void CarlaPlugin::uiIdle() | |||||
break; | break; | ||||
case kPluginPostRtEventParameterChange: | case kPluginPostRtEventParameterChange: | ||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.value3); | |||||
uiParameterChange(static_cast<uint32_t>(event.value1), event.valueF); | |||||
break; | break; | ||||
case kPluginPostRtEventProgramChange: | case kPluginPostRtEventProgramChange: | ||||
@@ -2385,11 +2492,14 @@ void CarlaPlugin::uiIdle() | |||||
break; | break; | ||||
case kPluginPostRtEventNoteOn: | 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; | break; | ||||
case kPluginPostRtEventNoteOff: | 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; | break; | ||||
} | } | ||||
} | } | ||||
@@ -348,7 +348,7 @@ protected: | |||||
CarlaString errorString("Plugin '" + CarlaString(kPlugin->getName()) + "' has crashed!\n" | CarlaString errorString("Plugin '" + CarlaString(kPlugin->getName()) + "' has crashed!\n" | ||||
"Saving now will lose its current settings.\n" | "Saving now will lose its current settings.\n" | ||||
"Please remove this plugin, and not rely on it from this point."); | "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 | #if 0 | ||||
// we waited and blocked for 5 secs, give host idle time now | // 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) | if (pData->engine->getType() != kEngineTypePlugin) | ||||
pData->engine->idle(); | pData->engine->idle(); | ||||
@@ -645,7 +645,7 @@ public: | |||||
for (; Time::getMillisecondCounter() < timeoutEnd && fBridgeThread.isThreadRunning();) | 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) | if (needsEngineIdle) | ||||
pData->engine->idle(); | pData->engine->idle(); | ||||
@@ -1365,9 +1365,20 @@ public: | |||||
fShmRtClientControl.commitWrite(); | fShmRtClientControl.commitWrite(); | ||||
if (status == MIDI_STATUS_NOTE_ON) | 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) | 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; | } break; | ||||
} | } | ||||
} | } | ||||
@@ -2240,7 +2251,7 @@ public: | |||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
pData->transientTryCounter = 0; | pData->transientTryCounter = 0; | ||||
#endif | #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; | break; | ||||
case kPluginBridgeNonRtServerError: { | case kPluginBridgeNonRtServerError: { | ||||
@@ -2252,7 +2263,7 @@ public: | |||||
if (fInitiated) | 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 | // just in case | ||||
pData->engine->setLastError(error); | pData->engine->setLastError(error); | ||||
@@ -2584,12 +2595,23 @@ private: | |||||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | #if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | ||||
if (pData->engine->isOscControlRegistered()) | if (pData->engine->isOscControlRegistered()) | ||||
pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_ACTIVE, 0.0f); | 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 | #endif | ||||
} | } | ||||
if (pData->hints & PLUGIN_HAS_CUSTOM_UI) | 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) | void resizeAudioPool(const uint32_t bufferSize) | ||||
@@ -2665,13 +2687,17 @@ private: | |||||
if (needsCancelableAction) | if (needsCancelableAction) | ||||
{ | { | ||||
pData->engine->setActionCanceled(false); | 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 | #endif | ||||
for (;fBridgeThread.isThreadRunning();) | 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) | if (needsEngineIdle) | ||||
pData->engine->idle(); | pData->engine->idle(); | ||||
@@ -2688,7 +2714,13 @@ private: | |||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
if (needsCancelableAction) | 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 | #endif | ||||
if (fInitError || ! fInitiated) | if (fInitError || ! fInitiated) | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin, DSSI implementation | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -112,7 +112,10 @@ public: | |||||
fProcess->kill(); | fProcess->kill(); | ||||
fProcess = nullptr; | 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; | return; | ||||
} | } | ||||
@@ -219,7 +222,10 @@ public: | |||||
} | } | ||||
fProcess = nullptr; | 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"); | carla_stdout("DSSI UI thread finished"); | ||||
} | } | ||||
@@ -1272,7 +1278,7 @@ public: | |||||
if (programChanged) | if (programChanged) | ||||
setMidiProgram(pData->midiprog.current, true, true, true, false); | 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.channel = event.channel; | ||||
seqEvent.data.note.note = note; | seqEvent.data.note.note = note; | ||||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0.0f); | |||||
pData->postponeRtEvent(kPluginPostRtEventNoteOff, event.channel, note, 0, 0.0f); | |||||
break; | break; | ||||
} | } | ||||
@@ -1656,7 +1662,7 @@ public: | |||||
seqEvent.data.note.note = note; | seqEvent.data.note.note = note; | ||||
seqEvent.data.note.velocity = velo; | seqEvent.data.note.velocity = velo; | ||||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo); | |||||
pData->postponeRtEvent(kPluginPostRtEventNoteOn, event.channel, note, velo, 0.0f); | |||||
break; | break; | ||||
} | } | ||||
@@ -2379,7 +2385,10 @@ public: | |||||
showCustomUI(false); | showCustomUI(false); | ||||
// tell frontend | // 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)) | if (pData->ctrlChannel == static_cast<int32_t>(channel)) | ||||
{ | { | ||||
pData->midiprog.current = index; | 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 | 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); | fCurMidiProgs[event.channel] = static_cast<int32_t>(k); | ||||
if (event.channel == pData->ctrlChannel) | 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; | break; | ||||
} | } | ||||
@@ -1347,7 +1354,7 @@ public: | |||||
fluid_synth_noteoff(fSynth, event.channel, note); | 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; | break; | ||||
} | } | ||||
@@ -1357,7 +1364,7 @@ public: | |||||
fluid_synth_noteon(fSynth, event.channel, note, velo); | 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; | break; | ||||
} | } | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * 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); | 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,); | CARLA_SAFE_ASSERT_RETURN(type != kPluginPostRtEventNull,); | ||||
PluginPostRtEvent rtEvent = { type, value1, value2, value3 }; | |||||
PluginPostRtEvent rtEvent = { type, value1, value2, value3, valueF }; | |||||
postRtEvents.appendRT(rtEvent); | postRtEvents.appendRT(rtEvent); | ||||
} | } | ||||
@@ -826,9 +830,21 @@ void CarlaPlugin::ProtectedData::updateParameterValues(CarlaPlugin* const plugin | |||||
if (sendCallback) | 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 | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -89,7 +89,8 @@ struct PluginPostRtEvent { | |||||
PluginPostRtEventType type; | PluginPostRtEventType type; | ||||
int32_t value1; | int32_t value1; | ||||
int32_t value2; | int32_t value2; | ||||
float value3; | |||||
int32_t value4; | |||||
float valueF; | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -358,7 +359,9 @@ struct CarlaPlugin::ProtectedData { | |||||
// Post-poned events | // Post-poned events | ||||
void postponeRtEvent(const PluginPostRtEvent& rtEvent) noexcept; | 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 | // Library functions | ||||
@@ -209,14 +209,20 @@ protected: | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(std::strcmp(types, "") == 0, 0); | 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) | else if (std::strcmp(path, "/nsm/client/gui_is_hidden") == 0) | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(std::strcmp(types, "") == 0, 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; | return 0; | ||||
@@ -357,7 +363,10 @@ protected: | |||||
CarlaString errorString("Plugin '" + CarlaString(kPlugin->getName()) + "' has crashed!\n" | CarlaString errorString("Plugin '" + CarlaString(kPlugin->getName()) + "' has crashed!\n" | ||||
"Saving now will lose its current settings.\n" | "Saving now will lose its current settings.\n" | ||||
"Please remove this plugin, and not rely on it from this point."); | "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(); | fShmRtClientControl.commitWrite(); | ||||
if (status == MIDI_STATUS_NOTE_ON) | 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) | 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; | } break; | ||||
} | } | ||||
} | } | ||||
@@ -1401,7 +1421,10 @@ public: | |||||
break; | break; | ||||
case kPluginBridgeNonRtServerUiClosed: | 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; | break; | ||||
case kPluginBridgeNonRtServerError: { | case kPluginBridgeNonRtServerError: { | ||||
@@ -1413,7 +1436,7 @@ public: | |||||
if (fInitiated) | 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 | // just in case | ||||
pData->engine->setLastError(error); | pData->engine->setLastError(error); | ||||
@@ -1633,12 +1656,20 @@ private: | |||||
#if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | #if defined(HAVE_LIBLO) && ! defined(BUILD_BRIDGE) | ||||
if (pData->engine->isOscControlRegistered()) | if (pData->engine->isOscControlRegistered()) | ||||
pData->engine->oscSend_control_set_parameter_value(pData->id, PARAMETER_ACTIVE, 0.0f); | 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 | #endif | ||||
} | } | ||||
if (pData->hints & PLUGIN_HAS_CUSTOM_UI) | 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) | void resizeAudioPool(const uint32_t bufferSize) | ||||
@@ -1744,12 +1775,16 @@ private: | |||||
if (needsCancelableAction) | if (needsCancelableAction) | ||||
{ | { | ||||
pData->engine->setActionCanceled(false); | 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();) | 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) | if (needsEngineIdle) | ||||
pData->engine->idle(); | pData->engine->idle(); | ||||
@@ -1765,7 +1800,13 @@ private: | |||||
} | } | ||||
if (needsCancelableAction) | 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) | if (fInitError || ! fInitiated) | ||||
{ | { | ||||
@@ -380,7 +380,10 @@ public: | |||||
if (fWindow->wasClosedByUser()) | if (fWindow->wasClosedByUser()) | ||||
{ | { | ||||
showCustomUI(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); | |||||
} | } | ||||
} | } | ||||
@@ -699,7 +702,7 @@ public: | |||||
fInstance->setCurrentProgram(pData->prog.current); | 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; | value = ctrlEvent.value; | ||||
setDryWet(value, false, false); | 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) | if (MIDI_IS_CONTROL_CHANNEL_VOLUME(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_VOLUME) != 0) | ||||
{ | { | ||||
value = ctrlEvent.value*127.0f/100.0f; | value = ctrlEvent.value*127.0f/100.0f; | ||||
setVolume(value, false, false); | 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) | if (MIDI_IS_CONTROL_BALANCE(ctrlEvent.param) && (pData->hints & PLUGIN_CAN_BALANCE) != 0) | ||||
@@ -846,8 +849,8 @@ public: | |||||
setBalanceLeft(left, false, false); | setBalanceLeft(left, false, false); | ||||
setBalanceRight(right, 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 | #endif | ||||
@@ -882,7 +885,7 @@ public: | |||||
} | } | ||||
setParameterValue(k, value, false, false, false); | 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) | 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) | if (ctrlEvent.param < pData->prog.count) | ||||
{ | { | ||||
setProgramRT(ctrlEvent.param); | setProgramRT(ctrlEvent.param); | ||||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, ctrlEvent.param, 0, 0.0f); | |||||
pData->postponeRtEvent(kPluginPostRtEventProgramChange, ctrlEvent.param, 0, 0, 0.0f); | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
@@ -976,9 +979,20 @@ public: | |||||
fMidiBuffer.addEvent(midiData2, midiEvent.size, static_cast<int>(event.time)); | fMidiBuffer.addEvent(midiData2, midiEvent.size, static_cast<int>(event.time)); | ||||
if (status == MIDI_STATUS_NOTE_ON) | 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) | 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; | } break; | ||||
} // switch (event.type) | } // switch (event.type) | ||||
} | } | ||||
@@ -1152,7 +1166,7 @@ protected: | |||||
void audioProcessorChanged(juce::AudioProcessor*) override | 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 {} | void audioProcessorParameterChangeGestureBegin(juce::AudioProcessor*, int) override {} | ||||
@@ -1405,7 +1405,7 @@ public: | |||||
{ | { | ||||
CARLA_SAFE_ASSERT(!yesNo); | 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; | return; | ||||
} | } | ||||
@@ -1428,7 +1428,7 @@ public: | |||||
if (! fPipeServer.startPipeServer(std::min(fLv2Options.sequenceSize, 819200))) | 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; | return; | ||||
} | } | ||||
@@ -1577,7 +1577,7 @@ public: | |||||
} | } | ||||
if (fUI.window == nullptr && fExt.uishow == nullptr) | 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) | if (fUI.window != nullptr) | ||||
fFeatures[kFeatureIdUiParent]->data = fUI.window->getPtr(); | fFeatures[kFeatureIdUiParent]->data = fUI.window->getPtr(); | ||||
@@ -1608,7 +1608,11 @@ public: | |||||
fUI.handle = nullptr; | 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(); | updateUi(); | ||||
@@ -1725,7 +1729,10 @@ public: | |||||
#ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | #ifndef BUILD_BRIDGE_ALTERNATIVE_ARCH | ||||
pData->transientTryCounter = 0; | pData->transientTryCounter = 0; | ||||
#endif | #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; | break; | ||||
} | } | ||||
} | } | ||||
@@ -1738,7 +1745,10 @@ public: | |||||
{ | { | ||||
fNeedsUiClose = false; | fNeedsUiClose = false; | ||||
showCustomUI(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) | 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) | else if (fUI.handle != nullptr && fExt.uiidle != nullptr && fExt.uiidle->idle(fUI.handle) != 0) | ||||
{ | { | ||||
showCustomUI(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); | |||||
CARLA_SAFE_ASSERT(fUI.handle == nullptr); | CARLA_SAFE_ASSERT(fUI.handle == nullptr); | ||||
} | } | ||||
#endif | #endif | ||||
@@ -2894,7 +2907,7 @@ public: | |||||
if (programChanged) | if (programChanged) | ||||
setMidiProgram(pData->midiprog.current, true, true, true, false); | 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) | 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) | for (uint32_t i=0; i < fEventsIn.count; ++i) | ||||
@@ -3675,9 +3692,20 @@ public: | |||||
lv2midi_put_event(&evInMidiStates[j], mtime, midiEvent.size, midiData2); | lv2midi_put_event(&evInMidiStates[j], mtime, midiEvent.size, midiData2); | ||||
if (status == MIDI_STATUS_NOTE_ON) | 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) | 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; | } break; | ||||
} // switch (event.type) | } // switch (event.type) | ||||
} | } | ||||
@@ -3953,7 +3981,10 @@ public: | |||||
if (carla_isNotEqual(fParamBuffers[k], pData->param.ranges[k].def)) | if (carla_isNotEqual(fParamBuffers[k], pData->param.ranges[k].def)) | ||||
{ | { | ||||
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; | continue; | ||||
fParamBuffers[k] = sampleRatef; | 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; | break; | ||||
} | } | ||||
@@ -4235,7 +4270,11 @@ public: | |||||
if (pData->param.data[k].type == PARAMETER_INPUT && pData->param.special[k] == PARAMETER_SPECIAL_FREEWHEEL) | 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; | 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; | break; | ||||
} | } | ||||
} | } | ||||
@@ -4777,9 +4816,9 @@ public: | |||||
pData->midiprog.data[index].name = carla_strdup(progDesc->name); | pData->midiprog.data[index].name = carla_strdup(progDesc->name); | ||||
if (index == pData->midiprog.current) | 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 | 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)) | if (pData->ctrlChannel == static_cast<int32_t>(channel)) | ||||
{ | { | ||||
pData->midiprog.current = index; | 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) | if (programChanged) | ||||
setMidiProgram(pData->midiprog.current, true, true, true, false); | 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); | fCurMidiProgs[event.channel] = static_cast<int32_t>(k); | ||||
if (event.channel == pData->ctrlChannel) | 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; | break; | ||||
} | } | ||||
@@ -1950,9 +1959,20 @@ public: | |||||
nativeEvent.data[3] = midiEvent.size == 4 ? midiEvent.data[3] : 0; | nativeEvent.data[3] = midiEvent.size == 4 ? midiEvent.data[3] : 0; | ||||
if (status == MIDI_STATUS_NOTE_ON) | 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) | 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; | } break; | ||||
} // switch (event.type) | } // switch (event.type) | ||||
} | } | ||||
@@ -2386,7 +2406,7 @@ protected: | |||||
void handleUiClosed() | 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; | fIsUiVisible = false; | ||||
} | } | ||||
@@ -2412,30 +2432,30 @@ protected: | |||||
break; | break; | ||||
case NATIVE_HOST_OPCODE_UPDATE_PARAMETER: | case NATIVE_HOST_OPCODE_UPDATE_PARAMETER: | ||||
// TODO | // 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; | break; | ||||
case NATIVE_HOST_OPCODE_UPDATE_MIDI_PROGRAM: | case NATIVE_HOST_OPCODE_UPDATE_MIDI_PROGRAM: | ||||
// TODO | // 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; | break; | ||||
case NATIVE_HOST_OPCODE_RELOAD_PARAMETERS: | case NATIVE_HOST_OPCODE_RELOAD_PARAMETERS: | ||||
reload(); // FIXME | 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; | break; | ||||
case NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS: | case NATIVE_HOST_OPCODE_RELOAD_MIDI_PROGRAMS: | ||||
reloadPrograms(false); | 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; | break; | ||||
case NATIVE_HOST_OPCODE_RELOAD_ALL: | case NATIVE_HOST_OPCODE_RELOAD_ALL: | ||||
reload(); | 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; | break; | ||||
case NATIVE_HOST_OPCODE_UI_UNAVAILABLE: | 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; | fIsUiAvailable = false; | ||||
break; | break; | ||||
case NATIVE_HOST_OPCODE_HOST_IDLE: | 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; | break; | ||||
case NATIVE_HOST_OPCODE_INTERNAL_PLUGIN: | case NATIVE_HOST_OPCODE_INTERNAL_PLUGIN: | ||||
ret = 1; | ret = 1; | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla SFZero Plugin | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * 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) | 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); | fSynth.handleMidiEvent(midiMessage); | ||||
if (status == MIDI_STATUS_NOTE_ON) | 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) | 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; | } break; | ||||
} | } | ||||
} | } | ||||
@@ -508,7 +508,11 @@ public: | |||||
#endif | #endif | ||||
if (fUI.window == nullptr) | 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()); | fUI.window->setTitle(uiTitle.buffer()); | ||||
@@ -541,7 +545,11 @@ public: | |||||
fUI.window = nullptr; | fUI.window = nullptr; | ||||
carla_stderr2("Plugin refused to open its own UI"); | 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); | 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); | vstMidiEvent.midiData[2] = char(midiEvent.size >= 3 ? midiEvent.data[2] : 0); | ||||
if (status == MIDI_STATUS_NOTE_ON) | 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) | 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; | } break; | ||||
} // switch (event.type) | } // switch (event.type) | ||||
} | } | ||||
@@ -1769,7 +1788,10 @@ protected: | |||||
carla_debug("CarlaPluginVST2::handlePluginUIClosed()"); | carla_debug("CarlaPluginVST2::handlePluginUIClosed()"); | ||||
showCustomUI(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); | |||||
} | } | ||||
void handlePluginUIResized(const uint width, const uint height) override | void handlePluginUIResized(const uint width, const uint height) override | ||||
@@ -1831,12 +1853,12 @@ protected: | |||||
{ | { | ||||
// Called from plugin process thread, nasty! (likely MIDI learn) | // Called from plugin process thread, nasty! (likely MIDI learn) | ||||
CARLA_SAFE_ASSERT(fIsProcessing); | 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)) | else if (fChangingValuesThread != kNullThread && pthread_equal(thisThread, fChangingValuesThread)) | ||||
{ | { | ||||
// Called from effSetChunk or effSetProgram | // Called from effSetChunk or effSetProgram | ||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, fixedValue); | |||||
pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||||
} | } | ||||
else if (fUI.isVisible) | else if (fUI.isVisible) | ||||
{ | { | ||||
@@ -1850,7 +1872,7 @@ protected: | |||||
carla_stdout("audioMasterAutomate called from unknown source"); | carla_stdout("audioMasterAutomate called from unknown source"); | ||||
setParameterValue(uindex, fixedValue, true, true, true); | setParameterValue(uindex, fixedValue, true, true, true); | ||||
//pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, fixedValue); | |||||
//pData->postponeRtEvent(kPluginPostRtEventParameterChange, index, 0, 0, fixedValue); | |||||
} | } | ||||
break; | break; | ||||
} | } | ||||
@@ -1862,7 +1884,7 @@ protected: | |||||
case audioMasterIdle: | case audioMasterIdle: | ||||
CARLA_SAFE_ASSERT_BREAK(pthread_equal(pthread_self(), fMainThread)); | 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) | if (pData->engine->getType() != kEngineTypePlugin) | ||||
pData->engine->idle(); | pData->engine->idle(); | ||||
@@ -1976,7 +1998,7 @@ protected: | |||||
effect->dispatcher(effect, effStartProcess); | 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; | ret = 1; | ||||
break; | break; | ||||
@@ -2111,13 +2133,16 @@ protected: | |||||
if (pData->prog.current != current) | if (pData->prog.current != current) | ||||
{ | { | ||||
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) | 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; | ret = 1; | ||||
break; | break; | ||||
@@ -290,7 +290,9 @@ public: | |||||
// --------------------------------------------------------------------- | // --------------------------------------------------------------------- | ||||
protected: | 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; | CARLA_BACKEND_USE_NAMESPACE; | ||||
@@ -322,13 +324,17 @@ private: | |||||
bool fUsingBridge; | bool fUsingBridge; | ||||
bool fUsingExec; | 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(ptr != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(pluginId == 0,); | 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) | CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CarlaBridgePlugin) | ||||
@@ -411,7 +411,9 @@ protected: | |||||
return "LV2 Plugin"; | 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) | switch (action) | ||||
{ | { | ||||
@@ -423,7 +425,7 @@ protected: | |||||
{ | { | ||||
fUI.writeFunction(fUI.controller, | fUI.writeFunction(fUI.controller, | ||||
static_cast<uint32_t>(value1)+fPorts.indexOffset, | static_cast<uint32_t>(value1)+fPorts.indexOffset, | ||||
sizeof(float), 0, &value3); | |||||
sizeof(float), 0, &valueF); | |||||
} | } | ||||
break; | break; | ||||
@@ -438,8 +440,9 @@ protected: | |||||
default: | default: | ||||
carla_stdout("engineCallback(%i:%s, %u, %i, %i, %f, %s)", | 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; | break; | ||||
} | } | ||||
} | } | ||||
@@ -541,9 +544,11 @@ private: | |||||
#define handlePtr ((CarlaEngineSingleLV2*)handle) | #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 | #undef handlePtr | ||||
@@ -529,13 +529,13 @@ ENGINE_CALLBACK_PLUGIN_UNAVAILABLE = 4 | |||||
# A parameter value has changed. | # A parameter value has changed. | ||||
# @a pluginId Plugin Id | # @a pluginId Plugin Id | ||||
# @a value1 Parameter index | # @a value1 Parameter index | ||||
# @a value3 New parameter value | |||||
# @a valuef New parameter value | |||||
ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5 | ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED = 5 | ||||
# A parameter default has changed. | # A parameter default has changed. | ||||
# @a pluginId Plugin Id | # @a pluginId Plugin Id | ||||
# @a value1 Parameter index | # @a value1 Parameter index | ||||
# @a value3 New default value | |||||
# @a valuef New default value | |||||
ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6 | ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED = 6 | ||||
# A parameter's MIDI CC has changed. | # A parameter's MIDI CC has changed. | ||||
@@ -663,7 +663,8 @@ ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED = 28 | |||||
# Engine started. | # Engine started. | ||||
# @a value1 Process mode | # @a value1 Process mode | ||||
# @a value2 Transport mode | # @a value2 Transport mode | ||||
# @a value3 Sample rate | |||||
# @a value3 Buffer size | |||||
# @a valuef Sample rate | |||||
# @a valuestr Engine driver | # @a valuestr Engine driver | ||||
# @see EngineProcessMode | # @see EngineProcessMode | ||||
# @see EngineTransportMode | # @see EngineTransportMode | ||||
@@ -688,7 +689,7 @@ ENGINE_CALLBACK_TRANSPORT_MODE_CHANGED = 32 | |||||
ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33 | ENGINE_CALLBACK_BUFFER_SIZE_CHANGED = 33 | ||||
# Engine sample-rate changed. | # Engine sample-rate changed. | ||||
# @a value3 New sample rate | |||||
# @a valuef New sample rate | |||||
ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34 | ENGINE_CALLBACK_SAMPLE_RATE_CHANGED = 34 | ||||
# A cancelable action has been started or stopped. | # A cancelable action has been started or stopped. | ||||
@@ -701,7 +702,11 @@ ENGINE_CALLBACK_CANCELABLE_ACTION = 35 | |||||
ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36 | ENGINE_CALLBACK_PROJECT_LOAD_FINISHED = 36 | ||||
# NSM callback. | # 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 | ENGINE_CALLBACK_NSM = 37 | ||||
# Idle frontend. | # Idle frontend. | ||||
@@ -720,6 +725,40 @@ ENGINE_CALLBACK_ERROR = 40 | |||||
# The engine has crashed or malfunctioned and will no longer work. | # The engine has crashed or malfunctioned and will no longer work. | ||||
ENGINE_CALLBACK_QUIT = 41 | 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 Option | ||||
# Engine options. | # Engine options. | ||||
@@ -918,7 +957,7 @@ PATCHBAY_ICON_FILE = 5 | |||||
# Engine callback function. | # Engine callback function. | ||||
# Front-ends must never block indefinitely during a callback. | # Front-ends must never block indefinitely during a callback. | ||||
# @see EngineCallbackOpcode and carla_set_engine_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. | # File callback function. | ||||
# @see FileCallbackOpcode | # @see FileCallbackOpcode | ||||
@@ -1178,6 +1217,16 @@ class CarlaTransportInfo(Structure): | |||||
("bpm", c_double) | ("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. | # Image data for LV2 inline display API. | ||||
# raw image pixmap format is ARGB32, | # raw image pixmap format is ARGB32, | ||||
class CarlaInlineDisplayImageSurface(Structure): | class CarlaInlineDisplayImageSurface(Structure): | ||||
@@ -1237,6 +1286,12 @@ PyCarlaTransportInfo = { | |||||
"bpm": 0.0 | "bpm": 0.0 | ||||
} | } | ||||
# @see CarlaRuntimeEngineInfo | |||||
PyCarlaRuntimeEngineInfo = { | |||||
"load": 0.0, | |||||
"xruns": 0 | |||||
} | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Set BINARY_NATIVE | # Set BINARY_NATIVE | ||||
@@ -1336,6 +1391,11 @@ class CarlaHostMeta(object): | |||||
def is_engine_running(self): | def is_engine_running(self): | ||||
raise NotImplementedError | raise NotImplementedError | ||||
# Get information about the currently running engine. | |||||
@abstractmethod | |||||
def get_runtime_engine_info(self): | |||||
raise NotImplementedError | |||||
@abstractmethod | @abstractmethod | ||||
def cancel_engine_action(self): | def cancel_engine_action(self): | ||||
raise NotImplementedError | raise NotImplementedError | ||||
@@ -1908,6 +1968,18 @@ class CarlaHostMeta(object): | |||||
def get_host_osc_url_udp(self): | def get_host_osc_url_udp(self): | ||||
raise NotImplementedError | 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) | # Carla Host object (dummy/null, does nothing) | ||||
@@ -1934,13 +2006,19 @@ class CarlaHostNull(CarlaHostMeta): | |||||
def engine_init(self, driverName, clientName): | def engine_init(self, driverName, clientName): | ||||
self.fEngineRunning = True | self.fEngineRunning = True | ||||
if self.fEngineCallback is not None: | 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 | return True | ||||
def engine_close(self): | def engine_close(self): | ||||
self.fEngineRunning = False | self.fEngineRunning = False | ||||
if self.fEngineCallback is not None: | 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 | return True | ||||
def engine_idle(self): | def engine_idle(self): | ||||
@@ -1949,6 +2027,9 @@ class CarlaHostNull(CarlaHostMeta): | |||||
def is_engine_running(self): | def is_engine_running(self): | ||||
return self.fEngineRunning | return self.fEngineRunning | ||||
def get_runtime_engine_info(self): | |||||
return PyCarlaRuntimeEngineInfo | |||||
def cancel_engine_action(self): | def cancel_engine_action(self): | ||||
return | return | ||||
@@ -2201,7 +2282,7 @@ class CarlaHostNull(CarlaHostMeta): | |||||
def nsm_init(self, pid, executableName): | def nsm_init(self, pid, executableName): | ||||
return False | return False | ||||
def nsm_ready(self, action): | |||||
def nsm_ready(self, opcode): | |||||
return | return | ||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
@@ -2240,6 +2321,9 @@ class CarlaHostDLL(CarlaHostMeta): | |||||
self.lib.carla_is_engine_running.argtypes = None | self.lib.carla_is_engine_running.argtypes = None | ||||
self.lib.carla_is_engine_running.restype = c_bool | 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.argtypes = None | ||||
self.lib.carla_cancel_engine_action.restype = None | self.lib.carla_cancel_engine_action.restype = None | ||||
@@ -2521,6 +2605,9 @@ class CarlaHostDLL(CarlaHostMeta): | |||||
def is_engine_running(self): | def is_engine_running(self): | ||||
return bool(self.lib.carla_is_engine_running()) | 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): | def cancel_engine_action(self): | ||||
return self.lib.carla_cancel_engine_action() | return self.lib.carla_cancel_engine_action() | ||||
@@ -2778,8 +2865,8 @@ class CarlaHostDLL(CarlaHostMeta): | |||||
def nsm_init(self, pid, executableName): | def nsm_init(self, pid, executableName): | ||||
return bool(self.lib.carla_nsm_init(pid, executableName.encode("utf-8"))) | 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 | # Helper object for CarlaHostPlugin | ||||
@@ -2827,6 +2914,12 @@ class CarlaHostPlugin(CarlaHostMeta): | |||||
# plugin info | # plugin info | ||||
self.fPluginsInfo = [] | self.fPluginsInfo = [] | ||||
# runtime engine info | |||||
self.fRuntimeEngineInfo = { | |||||
"load": 0.0, | |||||
"xruns": 0 | |||||
} | |||||
# transport info | # transport info | ||||
self.fTransportInfo = { | self.fTransportInfo = { | ||||
"playing": False, | "playing": False, | ||||
@@ -2872,6 +2965,9 @@ class CarlaHostPlugin(CarlaHostMeta): | |||||
def get_engine_driver_device_info(self, index, name): | def get_engine_driver_device_info(self, index, name): | ||||
return PyEngineDriverDeviceInfo | return PyEngineDriverDeviceInfo | ||||
def get_runtime_engine_info(self): | |||||
return self.fRuntimeEngineInfo | |||||
def cancel_engine_action(self): | def cancel_engine_action(self): | ||||
self.sendMsg(["cancel_engine_action"]) | 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): | def _set_transport(self, playing, frame, bar, beat, tick, bpm): | ||||
self.fTransportInfo = { | self.fTransportInfo = { | ||||
"playing": playing, | "playing": playing, | ||||
@@ -31,7 +31,7 @@ from carla_backend import * | |||||
class CarlaHostSignals(QObject): | class CarlaHostSignals(QObject): | ||||
# signals | # signals | ||||
DebugCallback = pyqtSignal(int, int, int, float, str) | |||||
DebugCallback = pyqtSignal(int, int, int, int, float, str) | |||||
PluginAddedCallback = pyqtSignal(int, str) | PluginAddedCallback = pyqtSignal(int, str) | ||||
PluginRemovedCallback = pyqtSignal(int) | PluginRemovedCallback = pyqtSignal(int) | ||||
PluginRenamedCallback = pyqtSignal(int, str) | PluginRenamedCallback = pyqtSignal(int, str) | ||||
@@ -60,7 +60,7 @@ class CarlaHostSignals(QObject): | |||||
PatchbayPortRenamedCallback = pyqtSignal(int, int, str) | PatchbayPortRenamedCallback = pyqtSignal(int, int, str) | ||||
PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int) | PatchbayConnectionAddedCallback = pyqtSignal(int, int, int, int, int) | ||||
PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int) | PatchbayConnectionRemovedCallback = pyqtSignal(int, int, int) | ||||
EngineStartedCallback = pyqtSignal(int, int, float, str) | |||||
EngineStartedCallback = pyqtSignal(int, int, int, float, str) | |||||
EngineStoppedCallback = pyqtSignal() | EngineStoppedCallback = pyqtSignal() | ||||
ProcessModeChangedCallback = pyqtSignal(int) | ProcessModeChangedCallback = pyqtSignal(int) | ||||
TransportModeChangedCallback = pyqtSignal(int, str) | TransportModeChangedCallback = pyqtSignal(int, str) | ||||
@@ -143,6 +143,7 @@ class HostWindow(QMainWindow): | |||||
self.fLastTransportBPM = 0.0 | self.fLastTransportBPM = 0.0 | ||||
self.fLastTransportFrame = 0 | self.fLastTransportFrame = 0 | ||||
self.fLastTransportState = False | self.fLastTransportState = False | ||||
self.fBufferSize = 0 | |||||
self.fSampleRate = 0.0 | self.fSampleRate = 0.0 | ||||
if MACOS: | if MACOS: | ||||
@@ -496,6 +497,7 @@ class HostWindow(QMainWindow): | |||||
host.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | host.EngineStartedCallback.connect(self.slot_handleEngineStartedCallback) | ||||
host.EngineStoppedCallback.connect(self.slot_handleEngineStoppedCallback) | host.EngineStoppedCallback.connect(self.slot_handleEngineStoppedCallback) | ||||
host.TransportModeChangedCallback.connect(self.slot_handleTransportModeChangedCallback) | host.TransportModeChangedCallback.connect(self.slot_handleTransportModeChangedCallback) | ||||
host.BufferSizeChangedCallback.connect(self.slot_handleBufferSizeChangedCallback) | |||||
host.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | host.SampleRateChangedCallback.connect(self.slot_handleSampleRateChangedCallback) | ||||
host.CancelableActionCallback.connect(self.slot_handleCancelableActionCallback) | host.CancelableActionCallback.connect(self.slot_handleCancelableActionCallback) | ||||
host.ProjectLoadFinishedCallback.connect(self.slot_handleProjectLoadFinishedCallback) | host.ProjectLoadFinishedCallback.connect(self.slot_handleProjectLoadFinishedCallback) | ||||
@@ -651,6 +653,23 @@ class HostWindow(QMainWindow): | |||||
self.setWindowTitle(title) | 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 | # Files | ||||
@@ -879,10 +898,8 @@ class HostWindow(QMainWindow): | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
# Engine (host callbacks) | # 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_PluginMacros.setEnabled(True) | ||||
self.ui.menu_Canvas.setEnabled(True) | self.ui.menu_Canvas.setEnabled(True) | ||||
self.ui.w_transport.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_open.setEnabled(True) | ||||
self.ui.act_file_save_as.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.setChecked(transportMode == ENGINE_TRANSPORT_MODE_JACK) | ||||
self.ui.cb_transport_jack.setEnabled(driverName == "JACK" and processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | self.ui.cb_transport_jack.setEnabled(driverName == "JACK" and processMode != ENGINE_PROCESS_MODE_MULTIPLE_CLIENTS) | ||||
if self.ui.cb_transport_link.isEnabled(): | if self.ui.cb_transport_link.isEnabled(): | ||||
self.ui.cb_transport_link.setChecked(":link:" in self.host.transportExtra) | 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.startTimers() | ||||
self.ui.text_logs.appendPlainText("======= Engine started ========") | self.ui.text_logs.appendPlainText("======= Engine started ========") | ||||
@@ -940,6 +958,7 @@ class HostWindow(QMainWindow): | |||||
# just in case | # just in case | ||||
self.removeAllPlugins() | self.removeAllPlugins() | ||||
self.refreshRuntimeInfo(0.0, 0) | |||||
self.ui.menu_PluginMacros.setEnabled(False) | self.ui.menu_PluginMacros.setEnabled(False) | ||||
self.ui.menu_Canvas.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_jack.setChecked(transportMode == ENGINE_TRANSPORT_MODE_JACK) | ||||
self.ui.cb_transport_link.setChecked(":link:" in transportExtra) | self.ui.cb_transport_link.setChecked(":link:" in transportExtra) | ||||
@pyqtSlot(int) | |||||
def slot_handleBufferSizeChangedCallback(self, newBufferSize): | |||||
self.updateBufferSize(newBufferSize) | |||||
@pyqtSlot(float) | @pyqtSlot(float) | ||||
def slot_handleSampleRateChangedCallback(self, newSampleRate): | def slot_handleSampleRateChangedCallback(self, newSampleRate): | ||||
self.fSampleRate = newSampleRate | |||||
self.refreshTransport(True) | |||||
self.updateSampleRate(newSampleRate) | |||||
@pyqtSlot(int, bool, str) | @pyqtSlot(int, bool, str) | ||||
def slot_handleCancelableActionCallback(self, pluginId, started, action): | def slot_handleCancelableActionCallback(self, pluginId, started, action): | ||||
@@ -2084,19 +2106,22 @@ class HostWindow(QMainWindow): | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
@pyqtSlot(int, int, str) | @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 | # Error | ||||
if value1 == 0: | |||||
elif opcode == NSM_CALLBACK_ERROR: | |||||
pass | pass | ||||
# Reply | # Reply | ||||
elif value1 == 1: | |||||
elif opcode == NSM_CALLBACK_ANNOUNCE: | |||||
self.fFirstEngineInit = False | self.fFirstEngineInit = False | ||||
self.fSessionManagerName = valueStr | self.fSessionManagerName = valueStr | ||||
self.setProperWindowTitle() | self.setProperWindowTitle() | ||||
# Open | # Open | ||||
elif value1 == 2: | |||||
elif opcode == NSM_CALLBACK_OPEN: | |||||
self.fClientName = os.path.basename(valueStr) | self.fClientName = os.path.basename(valueStr) | ||||
self.fProjectFilename = QFileInfo(valueStr+".carxp").absoluteFilePath() | self.fProjectFilename = QFileInfo(valueStr+".carxp").absoluteFilePath() | ||||
self.setProperWindowTitle() | self.setProperWindowTitle() | ||||
@@ -2106,22 +2131,22 @@ class HostWindow(QMainWindow): | |||||
return | return | ||||
# Save | # Save | ||||
elif value1 == 3: | |||||
elif opcode == NSM_CALLBACK_SAVE: | |||||
self.saveProjectNow() | self.saveProjectNow() | ||||
# Session is Loaded | # Session is Loaded | ||||
elif value1 == 4: | |||||
elif opcode == NSM_CALLBACK_SESSION_IS_LOADED: | |||||
pass | pass | ||||
# Show Optional Gui | # Show Optional Gui | ||||
elif value1 == 5: | |||||
elif opcode == NSM_CALLBACK_SHOW_OPTIONAL_GUI: | |||||
self.show() | self.show() | ||||
# Hide Optional Gui | # Hide Optional Gui | ||||
elif value1 == 6: | |||||
elif opcode == NSM_CALLBACK_HIDE_OPTIONAL_GUI: | |||||
self.hide() | 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", "") | return text.replace("\x1b[30;1m", "").replace("\x1b[31m", "").replace("\x1b[0m", "") | ||||
@pyqtSlot(int, int, int, float, str) | @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)) | self.ui.text_logs.appendPlainText(self.fixLogText(valueStr)) | ||||
@pyqtSlot(str) | @pyqtSlot(str) | ||||
@@ -2251,6 +2276,7 @@ class HostWindow(QMainWindow): | |||||
# show/hide event | # show/hide event | ||||
def showEvent(self, event): | def showEvent(self, event): | ||||
self.getAndRefreshRuntimeInfo() | |||||
self.refreshTransport(True) | self.refreshTransport(True) | ||||
QMainWindow.showEvent(self, event) | QMainWindow.showEvent(self, event) | ||||
@@ -2282,6 +2308,20 @@ class HostWindow(QMainWindow): | |||||
# -------------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------------- | ||||
# timer event | # 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): | def idleFast(self): | ||||
self.host.engine_idle() | self.host.engine_idle() | ||||
self.refreshTransport() | self.refreshTransport() | ||||
@@ -2315,6 +2355,8 @@ class HostWindow(QMainWindow): | |||||
self.ui.peak_out.displayMeter(2, 0.0, True) | self.ui.peak_out.displayMeter(2, 0.0, True) | ||||
def idleSlow(self): | def idleSlow(self): | ||||
self.getAndRefreshRuntimeInfo() | |||||
if self.fPluginCount == 0 or self.fCurrentlyRemovingAllPlugins: | if self.fPluginCount == 0 or self.fCurrentlyRemovingAllPlugins: | ||||
return | return | ||||
@@ -2528,7 +2570,7 @@ def canvasCallback(action, value1, value2, valueStr): | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Engine callback | # Engine callback | ||||
def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||||
def engineCallback(host, action, pluginId, value1, value2, value3, valuef, valueStr): | |||||
# kdevelop likes this :) | # kdevelop likes this :) | ||||
if False: host = CarlaHostNull() | if False: host = CarlaHostNull() | ||||
@@ -2544,7 +2586,7 @@ def engineCallback(host, action, pluginId, value1, value2, value3, valueStr): | |||||
host.transportExtra = valueStr | host.transportExtra = valueStr | ||||
if action == ENGINE_CALLBACK_DEBUG: | 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: | elif action == ENGINE_CALLBACK_PLUGIN_ADDED: | ||||
host.PluginAddedCallback.emit(pluginId, valueStr) | host.PluginAddedCallback.emit(pluginId, valueStr) | ||||
elif action == ENGINE_CALLBACK_PLUGIN_REMOVED: | 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: | elif action == ENGINE_CALLBACK_PLUGIN_UNAVAILABLE: | ||||
host.PluginUnavailableCallback.emit(pluginId, valueStr) | host.PluginUnavailableCallback.emit(pluginId, valueStr) | ||||
elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | 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: | 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: | elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: | ||||
host.ParameterMidiCcChangedCallback.emit(pluginId, value1, value2) | host.ParameterMidiCcChangedCallback.emit(pluginId, value1, value2) | ||||
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: | 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: | elif action == ENGINE_CALLBACK_UI_STATE_CHANGED: | ||||
host.UiStateChangedCallback.emit(pluginId, value1) | host.UiStateChangedCallback.emit(pluginId, value1) | ||||
elif action == ENGINE_CALLBACK_NOTE_ON: | 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: | elif action == ENGINE_CALLBACK_NOTE_OFF: | ||||
host.NoteOffCallback.emit(pluginId, value1, value2) | host.NoteOffCallback.emit(pluginId, value1, value2) | ||||
elif action == ENGINE_CALLBACK_UPDATE: | 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: | elif action == ENGINE_CALLBACK_PATCHBAY_CONNECTION_REMOVED: | ||||
host.PatchbayConnectionRemovedCallback.emit(pluginId, value1, value2) | host.PatchbayConnectionRemovedCallback.emit(pluginId, value1, value2) | ||||
elif action == ENGINE_CALLBACK_ENGINE_STARTED: | 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: | elif action == ENGINE_CALLBACK_ENGINE_STOPPED: | ||||
host.EngineStoppedCallback.emit() | host.EngineStoppedCallback.emit() | ||||
elif action == ENGINE_CALLBACK_PROCESS_MODE_CHANGED: | 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: | elif action == ENGINE_CALLBACK_BUFFER_SIZE_CHANGED: | ||||
host.BufferSizeChangedCallback.emit(value1) | host.BufferSizeChangedCallback.emit(value1) | ||||
elif action == ENGINE_CALLBACK_SAMPLE_RATE_CHANGED: | elif action == ENGINE_CALLBACK_SAMPLE_RATE_CHANGED: | ||||
host.SampleRateChangedCallback.emit(value3) | |||||
host.SampleRateChangedCallback.emit(valuef) | |||||
elif action == ENGINE_CALLBACK_CANCELABLE_ACTION: | elif action == ENGINE_CALLBACK_CANCELABLE_ACTION: | ||||
host.CancelableActionCallback.emit(pluginId, bool(value1 != 0), valueStr) | host.CancelableActionCallback.emit(pluginId, bool(value1 != 0), valueStr) | ||||
elif action == ENGINE_CALLBACK_PROJECT_LOAD_FINISHED: | elif action == ENGINE_CALLBACK_PROJECT_LOAD_FINISHED: | ||||
@@ -2710,7 +2752,7 @@ def initHost(initName, libPrefix, isControl, isPlugin, failError, HostClass = No | |||||
host.isControl = isControl | host.isControl = isControl | ||||
host.isPlugin = isPlugin | 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) | host.set_file_callback(fileCallback) | ||||
# If it's a plugin the paths are already set | # If it's a plugin the paths are already set | ||||
@@ -182,18 +182,19 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||||
pluginId = int(self.readlineblock()) | pluginId = int(self.readlineblock()) | ||||
value1 = int(self.readlineblock()) | value1 = int(self.readlineblock()) | ||||
value2 = 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") | valueStr = self.readlineblock().replace("\r", "\n") | ||||
if action == ENGINE_CALLBACK_PLUGIN_RENAMED: | if action == ENGINE_CALLBACK_PLUGIN_RENAMED: | ||||
self.host._set_pluginName(pluginId, valueStr) | self.host._set_pluginName(pluginId, valueStr) | ||||
elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | elif action == ENGINE_CALLBACK_PARAMETER_VALUE_CHANGED: | ||||
if value1 < 0: | if value1 < 0: | ||||
self.host._set_internalValue(pluginId, value1, value3) | |||||
self.host._set_internalValue(pluginId, value1, valuef) | |||||
else: | else: | ||||
self.host._set_parameterValue(pluginId, value1, value3) | |||||
self.host._set_parameterValue(pluginId, value1, valuef) | |||||
elif action == ENGINE_CALLBACK_PARAMETER_DEFAULT_CHANGED: | 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: | elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CC_CHANGED: | ||||
self.host._set_parameterMidiCC(pluginId, value1, value2) | self.host._set_parameterMidiCC(pluginId, value1, value2) | ||||
elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: | elif action == ENGINE_CALLBACK_PARAMETER_MIDI_CHANNEL_CHANGED: | ||||
@@ -203,7 +204,7 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||||
elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: | elif action == ENGINE_CALLBACK_MIDI_PROGRAM_CHANGED: | ||||
self.host._set_currentMidiProgram(pluginId, value1) | 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_"): | elif msg.startswith("ENGINE_OPTION_"): | ||||
option = int(msg.replace("ENGINE_OPTION_", "")) | option = int(msg.replace("ENGINE_OPTION_", "")) | ||||
@@ -374,7 +375,7 @@ class CarlaMiniW(ExternalUI, HostWindow): | |||||
elif msg == "error": | elif msg == "error": | ||||
error = self.readlineblock().replace("\r", "\n") | 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": | elif msg == "show": | ||||
self.fFirstInit = False | self.fFirstInit = False | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Log Thread | * 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 | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -176,7 +176,7 @@ protected: | |||||
bufTemp[0] = '\0'; | bufTemp[0] = '\0'; | ||||
bufTempPos = 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) | if (lastRead > 0 && lastRead != r) | ||||