pub struct VitalModel { /* private fields */ }Expand description
A decoded .vital preset.
Duplicate keys in one object keep the first position and the last value, as the JSON reader does.
Implementations§
Source§impl VitalModel
impl VitalModel
Source§impl VitalModel
impl VitalModel
Sourcepub fn route(
&mut self,
source: &str,
destination: &str,
amount: f64,
polarity: Option<RoutePolarity>,
power: Option<f64>,
) -> Result<usize, FormatError>
pub fn route( &mut self, source: &str, destination: &str, amount: f64, polarity: Option<RoutePolarity>, power: Option<f64>, ) -> Result<usize, FormatError>
Adds a route, or updates the slot that joins the same source and destination, so a route never fires twice. It writes the amount, the bipolar flag and, when given, the curve power. An update keeps the slot’s power when none is given, and always keeps its stereo and bypass flags. A new route starts them from their defaults: power 0, stereo and bypass off.
§Errors
A FormatError for an unknown source (it lists the 32 names), a
destination outside the registry (it lists close names), an amount
outside -1 to 1, a power outside -10 to 10, or a full matrix (it
names the 64-slot limit).
Sourcepub fn clear_route(&mut self, slot: usize) -> Result<(), FormatError>
pub fn clear_route(&mut self, slot: usize) -> Result<(), FormatError>
Empties a slot and resets its five controls to their defaults.
§Errors
A FormatError for a slot outside 0 to 63.
Sourcepub fn set_wavetable(
&mut self,
index: usize,
table: &Wavetable,
) -> Result<(), FormatError>
pub fn set_wavetable( &mut self, index: usize, table: &Wavetable, ) -> Result<(), FormatError>
Writes the wavetable of oscillator index (0 to 2), one Wave
Source component with the keyframes sorted by position. The table
asks the synth not to remove DC or normalise, so the frames stay as
written.
§Errors
A FormatError for an index above 2, no keyframe, a position
above 256 or used twice, a frame that is not 2048 samples, or a
sample that is not finite.
Sourcepub fn wavetable(&self, index: usize) -> Result<Wavetable, FormatError>
pub fn wavetable(&self, index: usize) -> Result<Wavetable, FormatError>
Reads back the Wave Source keyframes of oscillator index.
§Errors
A FormatError when the table is missing, holds another component
first, or a wave_data text has the wrong length or is not base64.
The length is checked before decoding.
Sourcepub fn set_lfo_shape(
&mut self,
index: usize,
shape: &LfoShape,
) -> Result<(), FormatError>
pub fn set_lfo_shape( &mut self, index: usize, shape: &LfoShape, ) -> Result<(), FormatError>
Writes the shape of LFO index (0 to 7).
§Errors
A FormatError for an index above 7, fewer than 2 or more than
100 points, a power count that differs from the point count, x that
falls or leaves 0 to 1, y outside 0 to 1, or a value
that is not finite.
Sourcepub fn set_effect_on(
&mut self,
effect: EffectFamily,
on: bool,
) -> Result<(), FormatError>
pub fn set_effect_on( &mut self, effect: EffectFamily, on: bool, ) -> Result<(), FormatError>
Sourcepub fn set_effect_order(
&mut self,
order: &[EffectFamily; 9],
) -> Result<u32, FormatError>
pub fn set_effect_order( &mut self, order: &[EffectFamily; 9], ) -> Result<u32, FormatError>
Sets the order of the effect list, top to bottom, and returns its code.
§Errors
A FormatError when the list does not hold each effect once.
Sourcepub fn set_macro_label(
&mut self,
number: usize,
label: &str,
) -> Result<(), FormatError>
pub fn set_macro_label( &mut self, number: usize, label: &str, ) -> Result<(), FormatError>
Trait Implementations§
Source§impl Clone for VitalModel
impl Clone for VitalModel
Source§impl Debug for VitalModel
impl Debug for VitalModel
Source§impl PartialEq for VitalModel
impl PartialEq for VitalModel
Source§impl PresetModel for VitalModel
impl PresetModel for VitalModel
Source§fn get(&self, key: &str) -> Option<Stored>
fn get(&self, key: &str) -> Option<Stored>
None when the key
is absent. An explicit default is Some.Source§fn set(&mut self, key: &str, value: Stored) -> Result<(), FormatError>
fn set(&mut self, key: &str, value: Stored) -> Result<(), FormatError>
Source§fn reset(&mut self, key: &str)
fn reset(&mut self, key: &str)
Source§fn set_route(
&mut self,
slot: usize,
route: Option<Route>,
) -> Result<(), FormatError>
fn set_route( &mut self, slot: usize, route: Option<Route>, ) -> Result<(), FormatError>
Source§fn set_description(&mut self, description: &str) -> Result<(), FormatError>
fn set_description(&mut self, description: &str) -> Result<(), FormatError>
Source§fn describe(&self, opts: &DescribeOptions) -> Description
fn describe(&self, opts: &DescribeOptions) -> Description
preset inspect prints.Source§fn unknown_keys(&self) -> Vec<String>
fn unknown_keys(&self) -> Vec<String>
settings.custom_warps. They stay in the model and survive a write.impl StructuralPartialEq for VitalModel
Auto Trait Implementations§
impl Freeze for VitalModel
impl RefUnwindSafe for VitalModel
impl Send for VitalModel
impl Sync for VitalModel
impl Unpin for VitalModel
impl UnsafeUnpin for VitalModel
impl UnwindSafe for VitalModel
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