Struct Parameter
pub struct Parameter<'a> { /* private fields */ }Expand description
One parameter, identified permanently by its key.
The key is a stable identifier of up to 64 bytes: an ASCII letter or
underscore followed by letters, digits or underscores. Formats use it as the
LV2 symbol and the editor protocol address. The numeric host ID is either
supplied with Parameter::with_id, to keep sessions from an earlier
product loading, or derived from the key by derive_parameter_id. It never
depends on declaration order.
Implementations§
§impl<'a> Parameter<'a>
impl<'a> Parameter<'a>
pub const fn new(
key: &'a str,
name: &'a str,
range: ParameterRange,
default: f32,
) -> Self
pub const fn new( key: &'a str, name: &'a str, range: ParameterRange, default: f32, ) -> Self
A parameter over an explicit range. Validation happens in Product::resolve.
pub const fn linear(
key: &'a str,
name: &'a str,
minimum: f32,
maximum: f32,
default: f32,
) -> Self
pub const fn linear( key: &'a str, name: &'a str, minimum: f32, maximum: f32, default: f32, ) -> Self
A continuous linear parameter.
§Panics
If the range is invalid (nonfinite, or minimum not below maximum). In a
const product description, as recommended, this is a compile error
rather than a run-time panic.
pub const fn logarithmic(
key: &'a str,
name: &'a str,
minimum: f32,
maximum: f32,
default: f32,
) -> Self
pub const fn logarithmic( key: &'a str, name: &'a str, minimum: f32, maximum: f32, default: f32, ) -> Self
A continuous logarithmic parameter with strictly positive bounds.
§Panics
If the range is invalid; a compile error in a const description.
pub const fn stepped(
key: &'a str,
name: &'a str,
minimum: f32,
maximum: f32,
steps: u16,
default: f32,
) -> Self
pub const fn stepped( key: &'a str, name: &'a str, minimum: f32, maximum: f32, steps: u16, default: f32, ) -> Self
A stepped parameter with steps + 1 equally spaced values.
§Panics
If the range or step count is invalid; a compile error in a const
description.
pub const fn toggle(key: &'a str, name: &'a str, default: bool) -> Self
pub const fn toggle(key: &'a str, name: &'a str, default: bool) -> Self
An on/off parameter with values 0 and 1.
pub const fn with_id(self, id: u32) -> Self
pub const fn with_id(self, id: u32) -> Self
Use an explicit permanent host ID instead of the derived one.
pub const fn not_automatable(self) -> Self
pub const fn not_automatable(self) -> Self
Hosts may not record automation for this parameter.
Hidden from host-generated parameter lists.
pub const fn read_only(self) -> Self
pub const fn read_only(self) -> Self
Written by the processor only, for example a meter or status value.
pub fn key(&self) -> &'a str
pub fn name(&self) -> &'a str
pub fn unit(&self) -> &'a str
pub fn range(&self) -> ParameterRange
pub fn default(&self) -> f32
pub fn role(&self) -> ParameterRole
pub fn is_automatable(&self) -> bool
pub fn is_read_only(&self) -> bool
pub fn explicit_id(&self) -> Option<ParameterId>
pub fn explicit_id(&self) -> Option<ParameterId>
The explicit ID, if one was supplied.
pub fn id(&self) -> ParameterId
pub fn id(&self) -> ParameterId
The host ID: explicit, or derived from the key.