Skip to main content

AudioWorkerSource

Trait AudioWorkerSource 

Source
pub trait AudioWorkerSource: Send + 'static {
    type Chunk: Send + 'static;

    // Required methods
    fn step_track(&mut self) -> TrackStep<Self::Chunk>;
    fn timeline(&self) -> &Timeline;
}
Expand description

Trait for audio sources processed in a blocking worker thread.

The worker calls step_track() once per scheduling round. Each call performs at most one FSM transition and returns a [TrackStep] that tells the worker what happened.

Required Associated Types§

Source

type Chunk: Send + 'static

Required Methods§

Source

fn step_track(&mut self) -> TrackStep<Self::Chunk>

Advance the track FSM by one step.

Handles seek preemption, source readiness, decoding, and all internal state transitions. Returns:

  • Produced — decoded chunk ready for the consumer.
  • StateChanged — internal transition; caller should call again.
  • Blocked — the source is not ready; the caller should wait for a wake.
  • Eof — end of stream (may transition out via seek-after-EOF).
  • Failed — terminal failure.
Source

fn timeline(&self) -> &Timeline

Access the shared timeline for epoch queries.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§