transport reference
Generated from the source by scripts/reference.py. Do not edit this file. The short page, with the examples, is [transport](transport.md).
Reference
Every function of the transport flow: what it takes, what it returns, what it refuses, and how it undoes. A Result<T> is Ok(T) or a SuperbError; the errors listed are the ones you can cause.
start
pub fn start(session: &mut Session) -> Result<()>Starts playing from where the playhead is. Rebuilds the mixer first if the memory changed since it was built.
Takes
session: &mut Session— the open session, borrowed mutably
Returns Result<()> — nothing
Errors the mixer cannot be built (the memory names audio that is not in memory, say); the command queue is full.
Undo none: not an edit.
Made of session::steps::rebuild when needed → EngineHandle::send(Play).
Example
transport::start(&mut session)?;stop
pub fn stop(session: &mut Session) -> Result<()>Stops the transport where it is.
Takes
session: &mut Session— the open session, borrowed mutably
Returns Result<()> — nothing
Errors the command queue is full.
Undo none: not an edit.
Made of EngineHandle::send(Stop).
Example
transport::stop(&mut session)?;seek
pub fn seek(session: &mut Session, to: TimePosition) -> Result<()>Moves the playhead. Works while stopped or rolling.
Takes
session: &mut Session— the open session, borrowed mutablyto: TimePosition— where to put the playhead
Returns Result<()> — nothing
Errors the command queue is full.
Undo none: not an edit.
Made of EngineHandle::send(Seek).
Example
transport::seek(&mut session, TimePosition::from_seconds(30.0, rate))?;rewind
pub fn rewind(session: &mut Session) -> Result<()>Moves the playhead to the start of the session.
Takes
session: &mut Session— the open session, borrowed mutably
Returns Result<()> — nothing
Errors the command queue is full.
Undo none: not an edit.
Made of seek to zero.
Example
transport::rewind(&mut session)?;looping
pub fn looping(session: &mut Session, on: bool) -> Result<()>Turns looping over the session's loop range on or off (set the range with
session::set_loop). State, like mute: saved with the session, applied at
the engine's next block, not an undo step.
Takes
session: &mut Session— the open session, borrowed mutablyon: bool—trueto switch on,falseto switch off
Returns Result<()> — nothing
Errors the command queue is full.
Undo none: state, not an edit (saved through the state file, see session::state_file).
Made of Memory::set_looping through session::set_state → EngineHandle::send(SetLoopEnabled).
Example
transport::looping(&mut session, true)?;playhead
pub fn playhead(session: &Session) -> TimePositionWhere the playhead is: the position after the last block the engine
rendered, or where the last seek sent it if no block has run since.
Takes
session: &Session— the open session, borrowed
Returns TimePosition — where the playhead is after the last block the engine rendered, in samples
Errors never; a query.
Undo none.
Example
let seconds = transport::playhead(&session).to_seconds(rate);state
pub fn state(session: &Session) -> TransportStateThe transport state after the last block the engine rendered.
Takes
session: &Session— the open session, borrowed
Returns TransportState — TransportState::Stopped, Playing or Recording, as of the last rendered block
Errors never; a query.
Undo none.
Example
if transport::state(&session).is_rolling() { /* draw a moving playhead */ }