Skip to main content

ParamSetter

Struct ParamSetter 

Source
pub struct ParamSetter<'a> {
    pub raw_context: &'a (dyn GuiContext + 'static),
}
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 + 'static)

Implementations§

Source§

impl<'a> ParamSetter<'a>

Source

pub fn new(context: &'a (dyn GuiContext + 'static)) -> ParamSetter<'a>

Source

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

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>(&self, param: &P, value: <P as Param>::Plain)
where P: Param,

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>(&self, param: &P, normalized: f32)
where P: Param,

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>(&self, param: &P)
where P: Param,

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> !UnwindSafe for ParamSetter<'a>

§

impl<'a> Freeze for ParamSetter<'a>

§

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

§

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

§

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

§

impl<'a> UnsafeUnpin for ParamSetter<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

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

Source§

fn to_sample_(self) -> U

Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.