From 52a73fdb33fbf103f8f604265442c3248b767a67 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 25 Apr 2023 23:12:57 +0200 Subject: [PATCH] VST3: fix manually setting parameters VST3PI::performEdit already updates the shadow data, so since 979f9876a7d76bec9bdccf8085beaaa690f0c000 VST3Plugin::set_parameter effectively did nothing (unless a user rapidly moves the control slider, in which case the next process cycle sets a previous value). --- libs/ardour/vst3_plugin.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libs/ardour/vst3_plugin.cc b/libs/ardour/vst3_plugin.cc index e9e3d9a374..9e99182312 100644 --- a/libs/ardour/vst3_plugin.cc +++ b/libs/ardour/vst3_plugin.cc @@ -177,7 +177,7 @@ VST3Plugin::set_parameter (uint32_t port, float val, sampleoffset_t when) { if (!_plug->active () || _plug->is_loading_state () || AudioEngine::instance ()->in_process_thread ()) { /* directly use VST3PI::_input_param_changes */ - _plug->set_parameter (port, val, when); + _plug->set_parameter (port, val, when, true); } else { assert (when == 0); _plug->set_parameter (port, val, when, false); @@ -799,7 +799,7 @@ VST3Plugin::connect_and_run (BufferSet& bufs, /* apply parameter changes */ PV pv; while (_parameter_queue.read (&pv, 1)) { - _plug->set_parameter (pv.port, pv.val, 0); + _plug->set_parameter (pv.port, pv.val, 0, true); } in_index = 0; @@ -1953,7 +1953,7 @@ VST3PI::set_parameter (uint32_t p, float value, int32 sample_off, bool to_list) { Vst::ParamID id = index_to_id (p); value = _controller->plainParamToNormalized (id, value); - if (_shadow_data[p] == value && sample_off == 0) { + if (_shadow_data[p] == value && sample_off == 0 && to_list) { return; } if (to_list) { @@ -2037,6 +2037,7 @@ VST3PI::update_shadow_data () _input_param_changes.addParameterData (i->second, index)->addPoint (0, v, index); #endif _shadow_data[i->first] = v; + _update_ctrl[i->first] = true; OnParameterChange (ParamValueChanged, i->first, v); /* EMIT SIGNAL */ } }