pub struct ParamSpec {Show 14 fields
pub key: String,
pub kind: ParamKind,
pub stored_min: f64,
pub stored_max: f64,
pub default: f64,
pub law: Option<UnitLaw>,
pub label: String,
pub choices: Vec<String>,
pub provenance: Provenance,
pub evidence: String,
pub first_build: Option<Build>,
pub verified_on: Option<Build>,
pub tuning_note: Option<String>,
pub legacy: bool,
}Expand description
One control of a synth.
Fields§
§key: StringThe key in the preset file. Unique within a registry.
kind: ParamKindWhat the stored value is.
stored_min: f64The smallest stored value.
stored_max: f64The largest stored value.
default: f64The stored value of a new patch, inside the range.
law: Option<UnitLaw>The physical unit and its law, or None when no unit is claimed.
label: StringThe on-screen name of the control.
choices: Vec<String>Menu labels of a ParamKind::Choice: choices[i] names the
stored value stored_min + i.
provenance: ProvenanceWhere the law comes from.
evidence: StringThe source file, document or probe behind the entry.
first_build: Option<Build>The first build that has the control.
verified_on: Option<Build>The build where a load check or a probe confirmed the key and its
default. A confirmed range or law is named in evidence.
tuning_note: Option<String>How to tune an interim control by ear and what to hear.
legacy: boolThe control is in the table, but no module creates it. Readers accept it and writers refuse it.
Implementations§
Source§impl ParamSpec
impl ParamSpec
Sourcepub fn range_text(&self) -> String
pub fn range_text(&self) -> String
The stored range as text, such as 8.0 to 136.0.
Sourcepub fn accepts(&self, stored: f64) -> bool
pub fn accepts(&self, stored: f64) -> bool
Whether a stored value lies inside the range and suits the kind.
Sourcepub fn accepts_saved(&self, stored: f64) -> bool
pub fn accepts_saved(&self, stored: f64) -> bool
Whether a saved preset may hold stored: Self::accepts, with
each bound widened to its 32-bit float form, which a synth that
keeps controls as f32 saves.
Sourcepub fn physical(&self, stored: f64) -> Result<Physical, ParamError>
pub fn physical(&self, stored: f64) -> Result<Physical, ParamError>
The physical value of a stored value.
§Errors
A ParamError naming the key when the entry has no unit, the
stored value is outside the range or not whole where it must be,
or the law or the unit type rejects it.
Sourcepub fn stored(&self, value: &Physical) -> Result<f64, ParamError>
pub fn stored(&self, value: &Physical) -> Result<f64, ParamError>
The stored value of a physical value.
§Errors
A ParamError naming the key when the unit type differs from the
entry’s, the law rejects the value, or the result is outside the
stored range or not whole where it must be.
Trait Implementations§
impl StructuralPartialEq for ParamSpec
Auto Trait Implementations§
impl !RefUnwindSafe for ParamSpec
impl !UnwindSafe for ParamSpec
impl Freeze for ParamSpec
impl Send for ParamSpec
impl Sync for ParamSpec
impl Unpin for ParamSpec
impl UnsafeUnpin for ParamSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more