Skip to main content

Parameter

Struct Parameter 

Source
pub struct Parameter {
    pub id: u32,
    pub name: String,
    pub value: f64,
    pub min: f64,
    pub max: f64,
    pub default: f64,
    pub unit: String,
    pub step_count: i32,
    pub can_automate: bool,
    pub is_read_only: bool,
    pub is_bypass: bool,
    pub flags: u32,
}
Expand description

Plugin parameter information

Fields§

§id: u32

Parameter ID

§name: String

Parameter name

§value: f64

Current normalized value (0.0 to 1.0)

§min: f64

Minimum value in normalized space (VST3 parameters are always 0.0..=1.0; the plain/engineering range is private to the plugin — use crate::Plugin::format_parameter for human-readable values).

§max: f64

Maximum value in normalized space (always 1.0 for VST3 parameters).

§default: f64

Default value

§unit: String

Parameter unit (e.g., “Hz”, “dB”, “%”)

§step_count: i32

Step count, straight from VST3 ParameterInfo::stepCount, which counts the gaps between discrete values rather than the values themselves: 0 is continuous, 1 is a two-state toggle, and n is a list of n + 1 values. So a three-way selector reports 2, not 3.

§can_automate: bool

Whether the parameter can be automated

§is_read_only: bool

Whether the parameter is read-only

§is_bypass: bool

Whether the parameter is a bypass control

§flags: u32

Parameter flags

Implementations§

Source§

impl Parameter

Source

pub fn normalized_to_plain(&self, normalized: f64) -> f64

Convert normalized value (0.0-1.0) to plain value

Source

pub fn step_index(&self, normalized: f64) -> Option<i32>

Which discrete value a normalized position selects, for a stepped parameter: 0..=step_count (so step_count + 1 possible values). None for a continuous parameter.

Source

pub fn plain_to_normalized(&self, plain: f64) -> f64

Convert plain value to normalized value (0.0-1.0)

Source

pub fn format_value(&self, normalized: f64) -> String

Approximate a human-readable value string from normalized space.

This cannot know the plugin’s internal mapping (VST3 keeps that private), so for continuous parameters it just reports the normalized number with the unit. For accurate display (e.g. "440.00 Hz"), use crate::Plugin::format_parameter, which asks the plugin to format it.

Source

pub fn is_discrete(&self) -> bool

Whether this parameter takes discrete steps rather than a continuous range.

True for toggles too — a toggle is just the one-step case. See Self::step_count for the VST3 counting convention.

Source

pub fn is_boolean(&self) -> bool

Whether this parameter is a two-state toggle (VST3 stepCount == 1).

Trait Implementations§

Source§

impl Clone for Parameter

Source§

fn clone(&self) -> Parameter

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Parameter

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Parameter

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Parameter

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.