From 0633fddb5c08427f18c6268f3b0eb27aefd9d65a Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 9 Feb 2022 01:07:17 +0100 Subject: [PATCH] Add a function for setting pre-normalized values --- src/context.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/context.rs b/src/context.rs index d51d4988..cb8a6d80 100644 --- a/src/context.rs +++ b/src/context.rs @@ -142,6 +142,14 @@ impl<'a> ParamSetter<'a> { unsafe { self.context.raw_set_parameter_normalized(ptr, normalized) }; } + /// Set a parameter to an already normalized value. Works exactly the same as + /// [Self::set_parameter] and needs to follow the same rules, but this may be useful when + /// implementigna a GUI. + pub fn set_parameter_normalized(&self, param: &P, normalized: f32) { + let ptr = param.as_ptr(); + unsafe { self.context.raw_set_parameter_normalized(ptr, normalized) }; + } + /// Inform the host that you are done automating a parameter. This needs to be called after one /// or more [Self::set_parameter()] calls for a parameter so the host knows the automation /// gesture has finished.