HasParameters

Trait HasParameters 

Source
pub trait HasParameters: Send + 'static {
    type Parameters: ParameterStore + ParameterGroups + Parameters;

    // Required methods
    fn parameters(&self) -> &Self::Parameters;
    fn parameters_mut(&mut self) -> &mut Self::Parameters;
}
Expand description

Trait for types that hold parameters.

This trait provides a common interface for parameter access, shared between Plugin (unprepared state) and AudioProcessor (prepared state). Both traits require HasParameters as a supertrait.

§Derive Macro

Use #[derive(HasParameters)] to automatically implement this trait for structs with a #[parameters] field annotation:

#[derive(Default, HasParameters)]
pub struct GainPlugin {
    #[parameters]
    parameters: GainParameters,
}

#[derive(HasParameters)]
pub struct GainProcessor {
    #[parameters]
    parameters: GainParameters,
}

This eliminates the boilerplate of implementing parameters() and parameters_mut() on both your Plugin and Processor types.

Required Associated Types§

Source

type Parameters: ParameterStore + ParameterGroups + Parameters

The parameter collection type.

Required Methods§

Source

fn parameters(&self) -> &Self::Parameters

Returns a reference to the parameters.

Source

fn parameters_mut(&mut self) -> &mut Self::Parameters

Returns a mutable reference to the parameters.

Implementors§