pub struct Transport { /* private fields */ }Expand description
Playback state readable from any thread without locking.
Implementations§
Source§impl Transport
impl Transport
pub fn new(bpm: f64) -> Self
pub fn play(&self)
pub fn pause(&self)
pub fn stop(&self)
pub fn toggle_record(&self)
pub fn toggle_loop(&self)
pub fn toggle_metronome(&self)
pub fn is_metronome_on(&self) -> bool
pub fn set_tempo(&self, bpm: f64)
pub fn set_position(&self, ticks: i64)
pub fn set_loop_range(&self, start_ticks: i64, end_ticks: i64)
Sourcepub fn set_loop_bars(&self, start_bar: u32, end_bar: u32)
pub fn set_loop_bars(&self, start_bar: u32, end_bar: u32)
Set loop range by bar numbers (1-based, in 4/4 time). E.g., bars 1-4 = ticks 0..3840.
pub fn loop_start(&self) -> i64
pub fn loop_end(&self) -> i64
Sourcepub fn start_loop_record(&self)
pub fn start_loop_record(&self)
Start recording within the loop range. Sets up loop, rewinds to loop start, enables record + play.
Sourcepub fn stop_loop_record(&self)
pub fn stop_loop_record(&self)
Stop loop recording. Disables record, stops playback.
pub fn is_playing(&self) -> bool
pub fn is_recording(&self) -> bool
pub fn is_looping(&self) -> bool
pub fn position_ticks(&self) -> i64
pub fn tempo_bpm(&self) -> f64
Sourcepub fn advance(&self, num_samples: u32, sample_rate: u32)
pub fn advance(&self, num_samples: u32, sample_rate: u32)
Advance position by the given number of samples. Handles loop wrapping. Called from the audio thread each buffer cycle.
Sourcepub fn snapshot(&self) -> TransportSnapshot
pub fn snapshot(&self) -> TransportSnapshot
Take a snapshot for the UI to display.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Transport
impl RefUnwindSafe for Transport
impl Send for Transport
impl Sync for Transport
impl Unpin for Transport
impl UnsafeUnpin for Transport
impl UnwindSafe for Transport
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