commit d5d3fdf53fb67a3ed5e08e81ab171767df9d7cf3
parent c64350f41acb05b04433979bc96c68b631091ce2
Author: falkTX <falktx@falktx.com>
Date: Mon, 24 May 2021 11:00:59 +0100
Preliminar "parameter value change request" support
Signed-off-by: falkTX <falktx@falktx.com>
Diffstat:
14 files changed, 270 insertions(+), 49 deletions(-)
diff --git a/distrho/DistrhoInfo.hpp b/distrho/DistrhoInfo.hpp
@@ -488,20 +488,20 @@ START_NAMESPACE_DISTRHO
#define DISTRHO_PLUGIN_URI "urn:distrho:name"
/**
- Wherever the plugin has a custom %UI.
+ Whether the plugin has a custom %UI.
@see DISTRHO_UI_USE_NANOVG
@see UI
*/
#define DISTRHO_PLUGIN_HAS_UI 1
/**
- Wherever the plugin processing is realtime-safe.@n
+ Whether the plugin processing is realtime-safe.@n
TODO - list rtsafe requirements
*/
#define DISTRHO_PLUGIN_IS_RT_SAFE 1
/**
- Wherever the plugin is a synth.@n
+ Whether the plugin is a synth.@n
@ref DISTRHO_PLUGIN_WANT_MIDI_INPUT is automatically enabled when this is too.
@see DISTRHO_PLUGIN_WANT_MIDI_INPUT
*/
@@ -516,39 +516,47 @@ START_NAMESPACE_DISTRHO
#define DISTRHO_PLUGIN_WANT_DIRECT_ACCESS 0
/**
- Wherever the plugin introduces latency during audio or midi processing.
+ Whether the plugin introduces latency during audio or midi processing.
@see Plugin::setLatency(uint32_t)
*/
#define DISTRHO_PLUGIN_WANT_LATENCY 1
/**
- Wherever the plugin wants MIDI input.@n
+ Whether the plugin wants MIDI input.@n
This is automatically enabled if @ref DISTRHO_PLUGIN_IS_SYNTH is true.
*/
#define DISTRHO_PLUGIN_WANT_MIDI_INPUT 1
/**
- Wherever the plugin wants MIDI output.
+ Whether the plugin wants MIDI output.
@see Plugin::writeMidiEvent(const MidiEvent&)
*/
#define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 1
/**
- Wherever the plugin provides its own internal programs.
+ Whether the plugin wants to change its own parameter inputs.@n
+ Not all hosts or plugin formats support this,
+ so Plugin::canRequestParameterValueChanges() can be used to query support at runtime.
+ @see Plugin::requestParameterValueChange(uint32_t, float)
+ */
+#define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 1
+
+/**
+ Whether the plugin provides its own internal programs.
@see Plugin::initProgramName(uint32_t, String&)
@see Plugin::loadProgram(uint32_t)
*/
#define DISTRHO_PLUGIN_WANT_PROGRAMS 1
/**
- Wherever the plugin uses internal non-parameter data.
+ Whether the plugin uses internal non-parameter data.
@see Plugin::initState(uint32_t, String&, String&)
@see Plugin::setState(const char*, const char*)
*/
#define DISTRHO_PLUGIN_WANT_STATE 1
/**
- Wherever the plugin implements the full state API.
+ Whether the plugin implements the full state API.
When this macro is enabled, the plugin must implement a new getState(const char* key) function, which the host calls when saving its session/project.
This is useful for plugins that have custom internal values not exposed to the host as key-value state pairs or parameters.
Most simple effects and synths will not need this.
@@ -558,13 +566,13 @@ START_NAMESPACE_DISTRHO
#define DISTRHO_PLUGIN_WANT_FULL_STATE 1
/**
- Wherever the plugin wants time position information from the host.
+ Whether the plugin wants time position information from the host.
@see Plugin::getTimePosition()
*/
#define DISTRHO_PLUGIN_WANT_TIMEPOS 1
/**
- Wherever the %UI uses a custom toolkit implementation based on OpenGL.@n
+ Whether the %UI uses a custom toolkit implementation based on OpenGL.@n
When enabled, the macros @ref DISTRHO_UI_CUSTOM_INCLUDE_PATH and @ref DISTRHO_UI_CUSTOM_WIDGET_TYPE are required.
*/
#define DISTRHO_UI_USE_CUSTOM 1
@@ -586,13 +594,13 @@ START_NAMESPACE_DISTRHO
#define DISTRHO_UI_CUSTOM_WIDGET_TYPE
/**
- Wherever the %UI uses NanoVG for drawing instead of the default raw OpenGL calls.@n
+ Whether the %UI uses NanoVG for drawing instead of the default raw OpenGL calls.@n
When enabled your %UI instance will subclass @ref NanoWidget instead of @ref Widget.
*/
#define DISTRHO_UI_USE_NANOVG 1
/**
- Wherever the %UI is resizable to any size by the user.@n
+ Whether the %UI is resizable to any size by the user.@n
By default this is false, and resizing is only allowed under the plugin UI control,@n
Enabling this options makes it possible for the user to resize the plugin UI at anytime.
@see UI::setGeometryConstraints(uint, uint, bool, bool)
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -746,6 +746,22 @@ public:
bool writeMidiEvent(const MidiEvent& midiEvent) noexcept;
#endif
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+ /**
+ Check if parameter value change requests will work with the current plugin host.
+ @note This function is only available if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST is enabled.
+ */
+ bool canRequestParameterValueChanges() const noexcept;
+
+ /**
+ Request a parameter value change from the host.
+ This function can fail, for example if the host is busy with the parameter for read-only automation.
+ Some hosts simply do not have this functionality, which can be verified with canRequestParameterValueChanges().
+ @note This function is only available if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST is enabled.
+ */
+ bool requestParameterValueChange(uint32_t index, float value) noexcept;
+#endif
+
protected:
/* --------------------------------------------------------------------------------------------------------
* Information */
diff --git a/distrho/src/DistrhoPlugin.cpp b/distrho/src/DistrhoPlugin.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -109,6 +109,18 @@ bool Plugin::writeMidiEvent(const MidiEvent& midiEvent) noexcept
}
#endif
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+bool Plugin::canRequestParameterValueChanges() const noexcept
+{
+ return pData->requestParameterValueChangeCallbackFunc != nullptr;
+}
+
+bool Plugin::requestParameterValueChange(const uint32_t index, const float value) noexcept
+{
+ return pData->requestParameterValueChangeCallback(index, value);
+}
+#endif
+
/* ------------------------------------------------------------------------------------------------------------
* Init */
diff --git a/distrho/src/DistrhoPluginCarla.cpp b/distrho/src/DistrhoPluginCarla.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -22,6 +22,10 @@
#include "CarlaNative.hpp"
+// TODO
+#undef DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+#define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
+
// -----------------------------------------------------------------------
START_NAMESPACE_DISTRHO
@@ -29,6 +33,9 @@ START_NAMESPACE_DISTRHO
#if ! DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
static const writeMidiFunc writeMidiCallback = nullptr;
#endif
+#if ! DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+static const requestParameterValueChangeFunc requestParameterValueChangeCallback = nullptr;
+#endif
#if DISTRHO_PLUGIN_HAS_UI
// -----------------------------------------------------------------------
@@ -184,7 +191,7 @@ class PluginCarla : public NativePluginClass
public:
PluginCarla(const NativeHostDescriptor* const host)
: NativePluginClass(host),
- fPlugin(this, writeMidiCallback),
+ fPlugin(this, writeMidiCallback, requestParameterValueChangeCallback),
fScalePointsCache(nullptr)
{
#if DISTRHO_PLUGIN_HAS_UI
@@ -512,6 +519,19 @@ private:
}
#endif
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+ bool requestParameterValueChange(const uint32_t index, const float value)
+ {
+ // TODO implementation
+ return false;
+ }
+
+ static bool requestParameterValueChangeCallback(void* ptr, const uint32_t index, const float value)
+ {
+ return thisPtr->requestParameterValueChange(index, value);
+ }
+#endif
+
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(PluginCarla)
// -------------------------------------------------------------------
diff --git a/distrho/src/DistrhoPluginChecks.h b/distrho/src/DistrhoPluginChecks.h
@@ -69,6 +69,10 @@
# define DISTRHO_PLUGIN_WANT_MIDI_OUTPUT 0
#endif
+#ifndef DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+# define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
+#endif
+
#ifndef DISTRHO_PLUGIN_WANT_PROGRAMS
# define DISTRHO_PLUGIN_WANT_PROGRAMS 0
#endif
diff --git a/distrho/src/DistrhoPluginInternal.hpp b/distrho/src/DistrhoPluginInternal.hpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2018 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -36,6 +36,7 @@ extern double d_lastSampleRate;
// DSP callbacks
typedef bool (*writeMidiFunc) (void* ptr, const MidiEvent& midiEvent);
+typedef bool (*requestParameterValueChangeFunc) (void* ptr, uint32_t index, float value);
// -----------------------------------------------------------------------
// Plugin private data
@@ -73,6 +74,7 @@ struct Plugin::PrivateData {
// Callbacks
void* callbacksPtr;
writeMidiFunc writeMidiCallbackFunc;
+ requestParameterValueChangeFunc requestParameterValueChangeCallbackFunc;
uint32_t bufferSize;
double sampleRate;
@@ -99,6 +101,7 @@ struct Plugin::PrivateData {
#endif
callbacksPtr(nullptr),
writeMidiCallbackFunc(nullptr),
+ requestParameterValueChangeCallbackFunc(nullptr),
bufferSize(d_lastBufferSize),
sampleRate(d_lastSampleRate)
{
@@ -170,6 +173,16 @@ struct Plugin::PrivateData {
return false;
}
#endif
+
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+ bool requestParameterValueChangeCallback(const uint32_t index, const float value)
+ {
+ if (requestParameterValueChangeCallbackFunc != nullptr)
+ return requestParameterValueChangeCallbackFunc(callbacksPtr, index, value);
+
+ return false;
+ }
+#endif
};
// -----------------------------------------------------------------------
@@ -178,7 +191,9 @@ struct Plugin::PrivateData {
class PluginExporter
{
public:
- PluginExporter(void* const callbacksPtr, const writeMidiFunc writeMidiCall)
+ PluginExporter(void* const callbacksPtr,
+ const writeMidiFunc writeMidiCall,
+ const requestParameterValueChangeFunc requestParameterValueChangeCall)
: fPlugin(createPlugin()),
fData((fPlugin != nullptr) ? fPlugin->pData : nullptr),
fIsActive(false)
@@ -213,8 +228,9 @@ public:
fPlugin->initState(i, fData->stateKeys[i], fData->stateDefValues[i]);
#endif
- fData->callbacksPtr = callbacksPtr;
+ fData->callbacksPtr = callbacksPtr;
fData->writeMidiCallbackFunc = writeMidiCall;
+ fData->requestParameterValueChangeCallbackFunc = requestParameterValueChangeCall;
}
~PluginExporter()
diff --git a/distrho/src/DistrhoPluginJack.cpp b/distrho/src/DistrhoPluginJack.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -31,6 +31,10 @@
# include <signal.h>
#endif
+// TODO
+#undef DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+#define DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST 0
+
// -----------------------------------------------------------------------
START_NAMESPACE_DISTRHO
@@ -41,6 +45,9 @@ static const setStateFunc setStateCallback = nullptr;
#if ! DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
static const writeMidiFunc writeMidiCallback = nullptr;
#endif
+#if ! DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+static const requestParameterValueChangeFunc requestParameterValueChangeCallback = nullptr;
+#endif
// -----------------------------------------------------------------------
@@ -90,7 +97,7 @@ class PluginJack
{
public:
PluginJack(jack_client_t* const client)
- : fPlugin(this, writeMidiCallback),
+ : fPlugin(this, writeMidiCallback, requestParameterValueChangeCallback),
#if DISTRHO_PLUGIN_HAS_UI
fUI(this, 0,
nullptr, // edit param
@@ -472,18 +479,6 @@ protected:
}
#endif
-#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
- bool writeMidi(const MidiEvent& midiEvent)
- {
- DISTRHO_SAFE_ASSERT_RETURN(fPortMidiOutBuffer != nullptr, false);
-
- return jack_midi_event_write(fPortMidiOutBuffer,
- midiEvent.frame,
- midiEvent.size > MidiEvent::kDataSize ? midiEvent.dataExt : midiEvent.data,
- midiEvent.size) == 0;
- }
-#endif
-
// NOTE: no trigger support for JACK, simulate it here
void updateParameterTriggers()
{
@@ -584,7 +579,30 @@ private:
}
#endif
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+ bool requestParameterValueChange(const uint32_t index, const float value)
+ {
+ // TODO implementation
+ return false;
+ }
+
+ static bool requestParameterValueChangeCallback(void* ptr, const uint32_t index, const float value)
+ {
+ return thisPtr->requestParameterValueChange(index, value);
+ }
+#endif
+
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
+ bool writeMidi(const MidiEvent& midiEvent)
+ {
+ DISTRHO_SAFE_ASSERT_RETURN(fPortMidiOutBuffer != nullptr, false);
+
+ return jack_midi_event_write(fPortMidiOutBuffer,
+ midiEvent.frame,
+ midiEvent.size > MidiEvent::kDataSize ? midiEvent.dataExt : midiEvent.data,
+ midiEvent.size) == 0;
+ }
+
static bool writeMidiCallback(void* ptr, const MidiEvent& midiEvent)
{
return thisPtr->writeMidi(midiEvent);
diff --git a/distrho/src/DistrhoPluginLADSPA+DSSI.cpp b/distrho/src/DistrhoPluginLADSPA+DSSI.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -16,6 +16,9 @@
#include "DistrhoPluginInternal.hpp"
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+# error Cannot use parameter value change request with LADSPA or DSSI
+#endif
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
# error Cannot use MIDI Output with LADSPA or DSSI
#endif
@@ -47,7 +50,7 @@ class PluginLadspaDssi
{
public:
PluginLadspaDssi()
- : fPlugin(nullptr, nullptr),
+ : fPlugin(nullptr, nullptr, nullptr),
fPortControls(nullptr),
fLastControlValues(nullptr)
{
@@ -550,7 +553,7 @@ static const struct DescriptorInitializer
// Create dummy plugin to get data from
d_lastBufferSize = 512;
d_lastSampleRate = 44100.0;
- const PluginExporter plugin(nullptr, nullptr);
+ const PluginExporter plugin(nullptr, nullptr, nullptr);
d_lastBufferSize = 0;
d_lastSampleRate = 0.0;
diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -31,6 +31,7 @@
#include "lv2/worker.h"
#include "lv2/lv2_kxstudio_properties.h"
#include "lv2/lv2_programs.h"
+#include "lv2/control-input-port-change-request.h"
#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
# include "libmodla.h"
@@ -61,6 +62,9 @@ typedef std::map<const LV2_URID, String> UridToStringMap;
#if ! DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
static const writeMidiFunc writeMidiCallback = nullptr;
#endif
+#if ! DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+static const requestParameterValueChangeFunc requestParameterValueChangeCallback = nullptr;
+#endif
// -----------------------------------------------------------------------
@@ -70,8 +74,9 @@ public:
PluginLv2(const double sampleRate,
const LV2_URID_Map* const uridMap,
const LV2_Worker_Schedule* const worker,
+ const LV2_ControlInputPort_Change_Request* const ctrlInPortChangeReq,
const bool usingNominal)
- : fPlugin(this, writeMidiCallback),
+ : fPlugin(this, writeMidiCallback, requestParameterValueChangeCallback),
fUsingNominal(usingNominal),
#ifdef DISTRHO_PLUGIN_LICENSED_FOR_MOD
fRunCount(0),
@@ -81,7 +86,8 @@ public:
fSampleRate(sampleRate),
fURIDs(uridMap),
fUridMap(uridMap),
- fWorker(worker)
+ fWorker(worker),
+ fCtrlInPortChangeReq(ctrlInPortChangeReq)
{
#if DISTRHO_PLUGIN_NUM_INPUTS > 0
for (uint32_t i=0; i < DISTRHO_PLUGIN_NUM_INPUTS; ++i)
@@ -1174,6 +1180,7 @@ private:
// LV2 features
const LV2_URID_Map* const fUridMap;
const LV2_Worker_Schedule* const fWorker;
+ const LV2_ControlInputPort_Change_Request* const fCtrlInPortChangeReq;
#if DISTRHO_PLUGIN_WANT_STATE
StringToStringMap fStateMap;
@@ -1231,6 +1238,20 @@ private:
#endif
}
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+ bool requestParameterValueChange(const uint32_t index, const float value)
+ {
+ if (fCtrlInPortChangeReq == nullptr)
+ return false;
+ return fCtrlInPortChangeReq->request_change(fCtrlInPortChangeReq->handle, index, value);
+ }
+
+ static bool requestParameterValueChangeCallback(void* const ptr, const uint32_t index, const float value)
+ {
+ return (((PluginLv2*)ptr)->requestParameterValueChange(index, value) == 0);
+ }
+#endif
+
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
bool writeMidi(const MidiEvent& midiEvent)
{
@@ -1271,6 +1292,7 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor*, double sampleRate, cons
const LV2_Options_Option* options = nullptr;
const LV2_URID_Map* uridMap = nullptr;
const LV2_Worker_Schedule* worker = nullptr;
+ const LV2_ControlInputPort_Change_Request* ctrlInPortChangeReq = nullptr;
for (int i=0; features[i] != nullptr; ++i)
{
@@ -1280,6 +1302,8 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor*, double sampleRate, cons
uridMap = (const LV2_URID_Map*)features[i]->data;
else if (std::strcmp(features[i]->URI, LV2_WORKER__schedule) == 0)
worker = (const LV2_Worker_Schedule*)features[i]->data;
+ else if (std::strcmp(features[i]->URI, LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI) == 0)
+ ctrlInPortChangeReq = (const LV2_ControlInputPort_Change_Request*)features[i]->data;
}
if (options == nullptr)
@@ -1344,7 +1368,7 @@ static LV2_Handle lv2_instantiate(const LV2_Descriptor*, double sampleRate, cons
d_lastSampleRate = sampleRate;
- return new PluginLv2(sampleRate, uridMap, worker, usingNominal);
+ return new PluginLv2(sampleRate, uridMap, worker, ctrlInPortChangeReq, usingNominal);
}
#define instancePtr ((PluginLv2*)instance)
diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp
@@ -226,7 +226,7 @@ void lv2_generate_ttl(const char* const basename)
// Dummy plugin to get data from
d_lastBufferSize = 512;
d_lastSampleRate = 44100.0;
- PluginExporter plugin(nullptr, nullptr);
+ PluginExporter plugin(nullptr, nullptr, nullptr);
d_lastBufferSize = 0;
d_lastSampleRate = 0.0;
diff --git a/distrho/src/DistrhoPluginVST.cpp b/distrho/src/DistrhoPluginVST.cpp
@@ -25,7 +25,7 @@
#if DISTRHO_PLUGIN_HAS_UI
# undef DISTRHO_UI_USER_RESIZABLE
# define DISTRHO_UI_USER_RESIZABLE 0
-# define DISTRHO_UI_IS_STANDALONE 0
+# define DISTRHO_UI_IS_STANDALONE false
# include "DistrhoUIInternal.hpp"
#endif
@@ -73,6 +73,9 @@ static const int kVstMidiEventSize = static_cast<int>(sizeof(VstMidiEvent));
#if ! DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
static const writeMidiFunc writeMidiCallback = nullptr;
#endif
+#if ! DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+static const requestParameterValueChangeFunc requestParameterValueChangeCallback = nullptr;
+#endif
// -----------------------------------------------------------------------
@@ -429,7 +432,7 @@ class PluginVst : public ParameterCheckHelper
{
public:
PluginVst(const audioMasterCallback audioMaster, AEffect* const effect)
- : fPlugin(this, writeMidiCallback),
+ : fPlugin(this, writeMidiCallback, requestParameterValueChangeCallback),
fAudioMaster(audioMaster),
fEffect(effect)
{
@@ -1184,6 +1187,19 @@ private:
}
#endif
+#if DISTRHO_PLUGIN_WANT_PARAMETER_VALUE_CHANGE_REQUEST
+ bool requestParameterValueChange(const uint32_t index, const float value)
+ {
+ hostCallback(audioMasterAutomate, index, 0, nullptr, value);
+ return true;
+ }
+
+ static bool requestParameterValueChangeCallback(void* const ptr, const uint32_t index, const float value)
+ {
+ return ((PluginVst*)ptr)->requestParameterValueChange(index, value);
+ }
+#endif
+
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
bool writeMidi(const MidiEvent& midiEvent)
{
@@ -1273,7 +1289,7 @@ static intptr_t vst_dispatcherCallback(AEffect* effect, int32_t opcode, int32_t
}
// Create dummy plugin to get data from
- static PluginExporter plugin(nullptr, nullptr);
+ static PluginExporter plugin(nullptr, nullptr, nullptr);
if (doInternalInit)
{
diff --git a/distrho/src/DistrhoUIDSSI.cpp b/distrho/src/DistrhoUIDSSI.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2016 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -14,7 +14,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define DISTRHO_UI_IS_STANDALONE 1
+#define DISTRHO_UI_IS_STANDALONE true
#include "DistrhoUIInternal.hpp"
#if DISTRHO_PLUGIN_WANT_DIRECT_ACCESS
diff --git a/distrho/src/DistrhoUILV2.cpp b/distrho/src/DistrhoUILV2.cpp
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
- * Copyright (C) 2012-2020 Filipe Coelho <falktx@falktx.com>
+ * Copyright (C) 2012-2021 Filipe Coelho <falktx@falktx.com>
*
* Permission to use, copy, modify, and/or distribute this software for any purpose with
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -14,7 +14,7 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#define DISTRHO_UI_IS_STANDALONE 0
+#define DISTRHO_UI_IS_STANDALONE false
#include "DistrhoUIInternal.hpp"
#include "../extra/String.hpp"
diff --git a/distrho/src/lv2/control-input-port-change-request.h b/distrho/src/lv2/control-input-port-change-request.h
@@ -0,0 +1,84 @@
+/*
+ LV2 ControlInputPort change request extension
+ Copyright 2020 Filipe Coelho <falktx@falktx.com>
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+/**
+ @file control-input-port-change-request.h
+ C header for the LV2 ControlInputPort change request extension <http://kx.studio/ns/lv2ext/control-input-port-change-request>.
+*/
+
+#ifndef LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_H
+#define LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_H
+
+#include "lv2/lv2plug.in/ns/lv2core/lv2.h"
+
+#define LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI "http://kx.studio/ns/lv2ext/control-input-port-change-request"
+#define LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_PREFIX LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI "#"
+
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#else
+#include <stdbool.h>
+#endif
+
+/** A status code for LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI functions. */
+typedef enum {
+ LV2_CONTROL_INPUT_PORT_CHANGE_SUCCESS = 0, /**< Completed successfully. */
+ LV2_CONTROL_INPUT_PORT_CHANGE_ERR_UNKNOWN = 1, /**< Unknown error. */
+ LV2_CONTROL_INPUT_PORT_CHANGE_ERR_INVALID_INDEX = 2 /**< Failed due to invalid port index. */
+} LV2_ControlInputPort_Change_Status;
+
+/**
+ * Opaque handle for LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI feature.
+ */
+typedef void* LV2_ControlInputPort_Change_Request_Handle;
+
+/**
+ * On instantiation, host must supply LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_URI feature.
+ * LV2_Feature::data must be pointer to LV2_ControlInputPort_Change_Request.
+*/
+typedef struct _LV2_ControlInputPort_Change_Request {
+ /**
+ * Opaque host data.
+ */
+ LV2_ControlInputPort_Change_Request_Handle handle;
+
+ /**
+ * request_change()
+ *
+ * Ask the host to change a plugin's control input port value.
+ * Parameter handle MUST be the 'handle' member of this struct.
+ * Parameter index is port index to change.
+ * Parameter value is the requested value to change the control port input to.
+ *
+ * Returns status of the request.
+ * The host may decline this request, if e.g. it is currently automating this port.
+ *
+ * The plugin MUST call this function during run().
+ */
+ LV2_ControlInputPort_Change_Status (*request_change)(LV2_ControlInputPort_Change_Request_Handle handle,
+ uint32_t index,
+ float value);
+
+} LV2_ControlInputPort_Change_Request;
+
+#ifdef __cplusplus
+} /* extern "C" */
+#endif
+
+#endif /* LV2_CONTROL_INPUT_PORT_CHANGE_REQUEST_H */