pub struct ParamSetter<'a> {
    pub raw_context: &'a dyn GuiContext,
}
Expand description

A convenience helper for setting parameter values. Any changes made here will be broadcasted to the host and reflected in the plugin’s Params object. These functions should only be called from the main thread.

Fields§

§raw_context: &'a dyn GuiContext

Implementations§

source§

impl<'a> ParamSetter<'a>

source

pub fn new(context: &'a dyn GuiContext) -> Self

source

pub fn begin_set_parameter<P: Param>(&self, param: &P)

Inform the host that you will start automating a parameter. This needs to be called before calling set_parameter() for the specified parameter.

source

pub fn set_parameter<P: Param>(&self, param: &P, value: P::Plain)

Set a parameter to the specified parameter value. You will need to call begin_set_parameter() before and end_set_parameter() after calling this so the host can properly record automation for the parameter. This can be called multiple times in a row before calling end_set_parameter(), for instance when moving a slider around.

This function assumes you’re already calling this from a GUI thread. Calling any of these functions from any other thread may result in unexpected behavior.

source

pub fn set_parameter_normalized<P: Param>(&self, param: &P, normalized: f32)

Set a parameter to an already normalized value. Works exactly the same as set_parameter() and needs to follow the same rules, but this may be useful when implementing a GUI.

This does not perform any snapping. Consider converting the normalized value to a plain value and setting that with set_parameter() instead so the normalized value known to the host matches param.normalized_value().

source

pub fn end_set_parameter<P: Param>(&self, param: &P)

Inform the host that you are done automating a parameter. This needs to be called after one or more set_parameter() calls for a parameter so the host knows the automation gesture has finished.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ParamSetter<'a>

§

impl<'a> Send for ParamSetter<'a>

§

impl<'a> Sync for ParamSetter<'a>

§

impl<'a> Unpin for ParamSetter<'a>

§

impl<'a> !UnwindSafe for ParamSetter<'a>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Any for Twhere T: Any,

§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,