pub struct PresetStateStore { /* private fields */ }Expand description
Manages per-preset state and generates recall MIDI on switch.
Implementations§
Source§impl PresetStateStore
impl PresetStateStore
pub fn new() -> Self
Sourcepub fn current(&self) -> &PresetState
pub fn current(&self) -> &PresetState
Get a reference to the current active preset’s state.
Sourcepub fn current_mut(&mut self) -> &mut PresetState
pub fn current_mut(&mut self) -> &mut PresetState
Get a mutable reference to the current active preset’s state.
Sourcepub fn active_index(&self) -> u8
pub fn active_index(&self) -> u8
Current active preset index.
Sourcepub fn save_working(&mut self, working: &PresetState)
pub fn save_working(&mut self, working: &PresetState)
Save working state into the active preset slot (for serialization without switching).
Sourcepub fn set_state(&mut self, index: usize, state: PresetState)
pub fn set_state(&mut self, index: usize, state: PresetState)
Set state for a specific preset slot.
Sourcepub fn apply_defaults(&mut self, presets: &[&Preset])
pub fn apply_defaults(&mut self, presets: &[&Preset])
Reset state using preset defaults (after upload / first boot). Each preset’s declared initial state is applied.
Sourcepub fn cleared_eeprom() -> [u8; 128]
pub fn cleared_eeprom() -> [u8; 128]
Return a cleared EEPROM buffer (for writing after preset upload).
Sourcepub fn switch(
&mut self,
new_preset: u8,
working: &mut PresetState,
preset: &Preset,
) -> Vec<MidiMessage, 16>
pub fn switch( &mut self, new_preset: u8, working: &mut PresetState, preset: &Preset, ) -> Vec<MidiMessage, 16>
Switch to a new preset. Saves current working state, loads new state, and returns MIDI messages to recall the new preset’s state to external gear.
Trait Implementations§
Source§impl Clone for PresetStateStore
impl Clone for PresetStateStore
Source§fn clone(&self) -> PresetStateStore
fn clone(&self) -> PresetStateStore
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PresetStateStore
impl RefUnwindSafe for PresetStateStore
impl Send for PresetStateStore
impl Sync for PresetStateStore
impl Unpin for PresetStateStore
impl UnsafeUnpin for PresetStateStore
impl UnwindSafe for PresetStateStore
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
Mutably borrows from an owned value. Read more