AUDIO
Source snapshot · 11 November 2026

API reference / ravet_audio_file::AiffRecorder

Struct AiffRecorder 

pub struct AiffRecorder<W> { /* private fields */ }
Expand description

AIFF PCM16/24/32 recorder draining a prepared input ring on a worker. Preparation writes a header to a caller-selected empty seekable sink. Capture callbacks only push frames. A dequeued write failure poisons the recorder; accepted/output prefixes cannot be rolled back. Drop never finalizes or drains. No physical device, path, worker thread, rate conversion or clock is selected.

Implementations§

§

impl<W: Write + Seek> AiffRecorder<W>

pub fn new( destination: W, format: AiffFormat, maximum_frames: usize, consumer: AudioConsumer, ) -> Result<Self, AudioFileError>

Validate matching channels before header I/O; scratch capacity 1..65,536. Writer format/count/FORM-size and finite PCM conversion rules still apply.

pub fn frames(&self) -> u64

Successfully written frames; excludes a rejected/partially written call.

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

Drain at most scratch capacity. Empty calls perform no file I/O. Any write or PCM validation failure after dequeue poisons future pump/finalization.

pub fn finish(self) -> Result<W, AudioFileError>

Stop/join the producer first. Drain at most one ring capacity, finalize FORM/COMM/SSND lengths and flush. Continuing publication can reject finish or lose late frames; no implicit capture stop or unlimited drain occurs.

Trait Implementations§

§

impl<W: Write + Seek + Send + 'static> RecordingPump for AiffRecorder<W>

§

type Destination = W

Caller-selected sink returned only after successful consuming finish.
§

fn consumer(&self) -> &AudioConsumer

Stable exact owned consumer drained by pump/finish. It must identify the same ring for the recorder’s lifetime, including permanent retirement proof.
§

fn owns(&self, producer: &AudioProducer) -> bool

Check exact prepared producer/consumer identity outside callbacks.
§

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

Drain one bounded worker batch, returning successfully accepted frames.
§

fn frames(&self) -> u64

Source count semantics remain explicit: WAV/AIFF count successful writes; FLAC counts accepted encoder frames, including retained pending blocks.
§

fn finish(self) -> Result<W, AudioFileError>

Drain bounded remaining input and finalize the sink with producer stopped.

Auto Trait Implementations§

§

impl<W> Freeze for AiffRecorder<W>
where W: Freeze,

§

impl<W> RefUnwindSafe for AiffRecorder<W>
where W: RefUnwindSafe,

§

impl<W> Send for AiffRecorder<W>
where W: Send,

§

impl<W> Sync for AiffRecorder<W>
where W: Sync,

§

impl<W> Unpin for AiffRecorder<W>
where W: Unpin,

§

impl<W> UnsafeUnpin for AiffRecorder<W>
where W: UnsafeUnpin,

§

impl<W> UnwindSafe for AiffRecorder<W>
where W: 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.