VST3: fix manually setting parameters

VST3PI::performEdit already updates the shadow data, so
since 979f9876a7
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).
This commit is contained in:
Robin Gareus 2023-04-25 23:12:57 +02:00
parent 5b19882be3
commit 52a73fdb33
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -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 ()) { if (!_plug->active () || _plug->is_loading_state () || AudioEngine::instance ()->in_process_thread ()) {
/* directly use VST3PI::_input_param_changes */ /* directly use VST3PI::_input_param_changes */
_plug->set_parameter (port, val, when); _plug->set_parameter (port, val, when, true);
} else { } else {
assert (when == 0); assert (when == 0);
_plug->set_parameter (port, val, when, false); _plug->set_parameter (port, val, when, false);
@ -799,7 +799,7 @@ VST3Plugin::connect_and_run (BufferSet& bufs,
/* apply parameter changes */ /* apply parameter changes */
PV pv; PV pv;
while (_parameter_queue.read (&pv, 1)) { 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; 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); Vst::ParamID id = index_to_id (p);
value = _controller->plainParamToNormalized (id, value); value = _controller->plainParamToNormalized (id, value);
if (_shadow_data[p] == value && sample_off == 0) { if (_shadow_data[p] == value && sample_off == 0 && to_list) {
return; return;
} }
if (to_list) { if (to_list) {
@ -2037,6 +2037,7 @@ VST3PI::update_shadow_data ()
_input_param_changes.addParameterData (i->second, index)->addPoint (0, v, index); _input_param_changes.addParameterData (i->second, index)->addPoint (0, v, index);
#endif #endif
_shadow_data[i->first] = v; _shadow_data[i->first] = v;
_update_ctrl[i->first] = true;
OnParameterChange (ParamValueChanged, i->first, v); /* EMIT SIGNAL */ OnParameterChange (ParamValueChanged, i->first, v); /* EMIT SIGNAL */
} }
} }