AUDIO
Source snapshot · 11 November 2026

API reference / ravet_audio_file::AiffReadAhead

Struct AiffReadAhead 

pub struct AiffReadAhead<R> { /* private fields */ }
Expand description

Worker-owned AIFF read-ahead with retained suffixes under ring backpressure. Requires matching channels and 1..65,536 scratch frames within reader capacity. Pump/seek perform file I/O outside callbacks; only prepared consumer pop or BufferedPlayback rendering belongs in audio. No rate conversion is implicit. Wrap in ReadAheadWorker for explicit automatic worker/transport ownership.

Implementations§

§

impl<R: Read + Seek> AiffReadAhead<R>

pub fn new( reader: AiffReader<R>, producer: AudioProducer, maximum_frames: usize, ) -> Result<Self, AudioFileError>

pub fn format(&self) -> AiffFormat

pub fn reader_position(&self) -> u64

Includes queued/pending frames; this is not an audible sample clock.

pub fn pump(&mut self) -> Result<ReadAheadProgress, AudioFileError>

At most one bounded read; retain all unqueued suffixes. Read I/O failure preserves logical position and publication and may be retried explicitly. EOF alone does not mean pending/queued audio has been consumed.

pub fn seek_stopped( &mut self, consumer: &mut AudioConsumer, frame: u64, ) -> Result<(), AudioFileError>

Reclaim matching stopped endpoints. Failed seeks preserve queue/pending/ cursor; successful seeks clear all old-generation audio including scratch.

Trait Implementations§

§

impl<R: Read + Seek + Send + 'static> ReadAheadPump for AiffReadAhead<R>

§

fn pump(&mut self) -> Result<ReadAheadProgress, AudioFileError>

Perform one bounded read/publication attempt outside the audio callback.
§

fn owns(&self, consumer: &AudioConsumer) -> bool

Check that this source owns the consumer’s matching producer.
§

fn pending_frames(&self) -> usize

Remaining worker scratch frames not yet published to the ring.
§

fn reader_position(&self) -> u64

Queue-source generated/read position, including pending and queued frames. Converted implementations use target-rate output frames, not input frames.
§

fn sample_rate(&self) -> u32

Fixed queue-source sample rate; conversion is explicit in its implementation.
§

fn seek_stopped( &mut self, consumer: &mut AudioConsumer, frame: u64, ) -> Result<(), AudioFileError>

Position exactly in queue-source frames, clearing generation only after success.
§

fn worker_progressed(&self, progress: &ReadAheadProgress) -> bool

Whether the immediately preceding pump made bounded worker progress. Pure, bounded observation only: no I/O, blocking or allocation. Native default uses new publication; explicitly converted sources can include input read/consumption/output generation. An unchanged full ring is false.

Auto Trait Implementations§

§

impl<R> Freeze for AiffReadAhead<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for AiffReadAhead<R>
where R: RefUnwindSafe,

§

impl<R> Send for AiffReadAhead<R>
where R: Send,

§

impl<R> Sync for AiffReadAhead<R>
where R: Sync,

§

impl<R> Unpin for AiffReadAhead<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for AiffReadAhead<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for AiffReadAhead<R>
where R: UnwindSafe,

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<F, T> IntoSample<T> for Fwhere T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.