pub struct Transport { /* private fields */ }Expand description
A sequencer transport: position, tempo, run-state, and an optional loop.
Implementations§
Source§impl Transport
impl Transport
Sourcepub fn new(ppq: u32, bpm: f64) -> Result<Self, AudioError>
pub fn new(ppq: u32, bpm: f64) -> Result<Self, AudioError>
A stopped transport at position 0 with the given resolution and tempo.
Errors if ppq == 0 or bpm is not a positive finite number.
Sourcepub fn state(&self) -> TransportState
pub fn state(&self) -> TransportState
Current run-state.
Sourcepub fn position_ticks(&self) -> u64
pub fn position_ticks(&self) -> u64
Current integer tick position (floor of the fractional position).
Sourcepub fn position_ticks_f64(&self) -> f64
pub fn position_ticks_f64(&self) -> f64
Current fractional tick position.
Sourcepub fn seek(&mut self, tick: u64)
pub fn seek(&mut self, tick: u64)
Jump to an absolute tick position (does not change run-state).
Sourcepub fn set_tempo(&mut self, bpm: f64) -> Result<(), AudioError>
pub fn set_tempo(&mut self, bpm: f64) -> Result<(), AudioError>
Set the tempo. Errors if bpm is not positive/finite.
Sourcepub fn set_loop(&mut self, start: u64, end: u64) -> Result<(), AudioError>
pub fn set_loop(&mut self, start: u64, end: u64) -> Result<(), AudioError>
Enable a loop over [start, end) ticks. Errors if end <= start.
Sourcepub fn clear_loop(&mut self)
pub fn clear_loop(&mut self)
Disable looping.
Sourcepub fn advance(&mut self, delta_seconds: f64) -> Result<(), AudioError>
pub fn advance(&mut self, delta_seconds: f64) -> Result<(), AudioError>
Advance the position by delta_seconds of wall-clock time. Only moves
while TransportState::Playing. Honors the loop if enabled.
Errors if delta_seconds is negative or not finite.
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