pub struct Controller<const B: usize = MAX_BUTTONS, const E: usize = MAX_ENCODERS> { /* private fields */ }Expand description
Implementations§
Source§impl<const B: usize, const E: usize> Controller<B, E>
impl<const B: usize, const E: usize> Controller<B, E>
pub fn new() -> Self
Sourcepub fn with_state(store: PresetStateStore<B, E>) -> Self
pub fn with_state(store: PresetStateStore<B, E>) -> Self
Create with a restored state store (from EEPROM/persistence).
Sourcepub fn process<const A: usize>(
&mut self,
event: Event,
now_ms: u32,
config: &Config<B, E, A>,
) -> Output
pub fn process<const A: usize>( &mut self, event: Event, now_ms: u32, config: &Config<B, E, A>, ) -> Output
Process a single input event. Returns all MIDI output, display events, and flags. System actions (preset switch, tap tempo) are handled internally.
Returns true if any button is currently held.
Returns the current button active state (toggle ON / momentary held).
Sourcepub fn active_preset(&self) -> u8
pub fn active_preset(&self) -> u8
Get the active preset index.
Sourcepub fn encoder_values(&self) -> [u8; E]
pub fn encoder_values(&self) -> [u8; E]
Get the encoder values.
Sourcepub fn snapshot_store(&self) -> PresetStateStore<B, E>
pub fn snapshot_store(&self) -> PresetStateStore<B, E>
Get a snapshot of the state store (with current working state saved). Use this for persistence — the caller decides the serialization format.
Sourcepub fn select_preset<const A: usize>(
&mut self,
preset_idx: u8,
config: &Config<B, E, A>,
) -> Output
pub fn select_preset<const A: usize>( &mut self, preset_idx: u8, config: &Config<B, E, A>, ) -> Output
Manually switch to a preset (e.g., on boot or from external command). Returns on_enter + recall MIDI in the result.
Sourcepub fn set_encoder_value(&mut self, index: usize, value: u8)
pub fn set_encoder_value(&mut self, index: usize, value: u8)
Set encoder value (for initial state setup from config defaults).
Trait Implementations§
Auto Trait Implementations§
impl<const B: usize, const E: usize> Freeze for Controller<B, E>
impl<const B: usize, const E: usize> RefUnwindSafe for Controller<B, E>
impl<const B: usize, const E: usize> Send for Controller<B, E>
impl<const B: usize, const E: usize> Sync for Controller<B, E>
impl<const B: usize, const E: usize> Unpin for Controller<B, E>
impl<const B: usize, const E: usize> UnsafeUnpin for Controller<B, E>
impl<const B: usize, const E: usize> UnwindSafe for Controller<B, E>
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