From 08c6729ed1a132a184c0d152235d43e95b11d01f Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 11 Jan 2023 14:45:05 +0100 Subject: [PATCH] Also add an Editor::param_modulation_changed() --- nih_plug_egui/src/editor.rs | 2 ++ nih_plug_iced/src/editor.rs | 4 ++++ nih_plug_vizia/src/editor.rs | 5 +++++ src/editor.rs | 11 ++++++++--- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/nih_plug_egui/src/editor.rs b/nih_plug_egui/src/editor.rs index 4c5aa811..9647e606 100644 --- a/nih_plug_egui/src/editor.rs +++ b/nih_plug_egui/src/editor.rs @@ -107,6 +107,8 @@ where // that boolean is set. } + fn param_modulation_changed(&self, _id: &str, _modulation_offset: f32) {} + fn param_values_changed(&self) { // Same } diff --git a/nih_plug_iced/src/editor.rs b/nih_plug_iced/src/editor.rs index e90d5c7e..249724e4 100644 --- a/nih_plug_iced/src/editor.rs +++ b/nih_plug_iced/src/editor.rs @@ -109,6 +109,10 @@ impl Editor for IcedEditorWrapper { let _ = self.parameter_updates_sender.try_send(ParameterUpdate); } + fn param_modulation_changed(&self, _id: &str, _modulation_offset: f32) { + let _ = self.parameter_updates_sender.try_send(ParameterUpdate); + } + fn param_values_changed(&self) { let _ = self.parameter_updates_sender.try_send(ParameterUpdate); } diff --git a/nih_plug_vizia/src/editor.rs b/nih_plug_vizia/src/editor.rs index 272cb6c7..75d8fb6d 100644 --- a/nih_plug_vizia/src/editor.rs +++ b/nih_plug_vizia/src/editor.rs @@ -131,6 +131,11 @@ impl Editor for ViziaEditor { .store(true, Ordering::Relaxed); } + fn param_modulation_changed(&self, _id: &str, _modulation_offset: f32) { + self.emit_parameters_changed_event + .store(true, Ordering::Relaxed); + } + fn param_values_changed(&self) { self.emit_parameters_changed_event .store(true, Ordering::Relaxed); diff --git a/src/editor.rs b/src/editor.rs index 19ec556d..9ef87e18 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -58,9 +58,14 @@ pub trait Editor: Send { /// new value for a parameter or when a parameter change sent to the host gets processed. fn param_value_changed(&self, id: &str, normalized_value: f32); - /// Called whenever one or more parameter values changed while the editor is open. This may be - /// called in place of [`param_value_changed()`][Self::param_value_changed()] when multiple - /// parameter values hcange at the same time. For example, when a preset is loaded. + /// Called whenever a specific parameter's monophonic modulation value has changed while the + /// editor is open. + fn param_modulation_changed(&self, id: &str, modulation_offset: f32); + + /// Called whenever one or more parameter values or modulations have changed while the editor is + /// open. This may be called in place of [`param_value_changed()`][Self::param_value_changed()] + /// when multiple parameter values hcange at the same time. For example, when a preset is + /// loaded. fn param_values_changed(&self); // TODO: Reconsider adding a tick function here for the Linux `IRunLoop`. To keep this platform