Browse Source

VST3: trigger restart component for preset and latency changes

Signed-off-by: falkTX <falktx@falktx.com>
pull/330/head
falkTX 3 years ago
parent
commit
a51cb9f8db
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
2 changed files with 32 additions and 4 deletions
  1. +29
    -2
      distrho/src/DistrhoPluginVST3.cpp
  2. +3
    -2
      examples/Latency/Makefile

+ 29
- 2
distrho/src/DistrhoPluginVST3.cpp View File

@@ -63,8 +63,7 @@
* - set factory sub_categories
* - set factory email (needs new DPF API, useful for LV2 as well)
* - do something with get_controller_class_id and set_io_mode?
* - call component handler restart with params-changed flag after changing program (doesnt seem to be needed..?)
* - call component handler restart with latency-changed flag when latency changes
* - replace dpf_message_create with host-side message creation
*/

START_NAMESPACE_DISTRHO
@@ -334,6 +333,9 @@ public:
#if DISTRHO_PLUGIN_HAS_UI
, fChangedParameterValues(nullptr)
#endif
#if DISTRHO_PLUGIN_WANT_LATENCY
, fLastKnownLatency(fPlugin.getLatency())
#endif
#if DISTRHO_PLUGIN_WANT_MIDI_OUTPUT
, fHostEventOutputHandle(nullptr)
#endif
@@ -1295,6 +1297,16 @@ public:
{
fCurrentProgram = std::round(value * fProgramCountMinusOne);
fPlugin.loadProgram(fCurrentProgram);

for (uint32_t i=0, count=fPlugin.getParameterCount(); i < count; ++i)
{
if (fPlugin.isParameterOutputOrTrigger(i))
continue;
fParameterValues[i] = fPlugin.getParameterValue(i);
}

if (fComponentHandler != nullptr)
v3_cpp_obj(fComponentHandler)->restart_component(fComponentHandler, V3_RESTART_PARAM_VALUES_CHANGED);
}
else
#endif
@@ -1518,6 +1530,9 @@ private:
#if DISTRHO_PLUGIN_HAS_UI
bool* fChangedParameterValues;
#endif
#if DISTRHO_PLUGIN_WANT_LATENCY
uint32_t fLastKnownLatency;
#endif
#if DISTRHO_PLUGIN_WANT_MIDI_INPUT
MidiEvent fMidiEvents[kMaxMidiEvents];
# if DISTRHO_PLUGIN_HAS_UI
@@ -1577,6 +1592,18 @@ private:

requestParameterValueChange(i, curValue);
}

#if DISTRHO_PLUGIN_WANT_LATENCY
const uint32_t latency = fPlugin.getLatency();

if (fLastKnownLatency != latency)
{
fLastKnownLatency = latency;

if (fComponentHandler != nullptr)
v3_cpp_obj(fComponentHandler)->restart_component(fComponentHandler, V3_RESTART_LATENCY_CHANGED);
}
#endif
}

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


+ 3
- 2
examples/Latency/Makefile View File

@@ -24,8 +24,9 @@ include ../../Makefile.plugins.mk
# Enable all possible plugin types

TARGETS += ladspa
TARGETS += lv2_dsp
TARGETS += vst
TARGETS += lv2_sep
TARGETS += vst2
TARGETS += vst3

all: $(TARGETS)



Loading…
Cancel
Save