Skip to main content

AudioOutput

Struct AudioOutput 

Source
pub struct AudioOutput { /* private fields */ }
Expand description

Accumulating state for the audio_chunk event stream.

Implementations§

Source§

impl AudioOutput

Source

pub fn wav(path: &Path) -> Result<Self, FttsError>

Open a WAV file sink.

§Errors

If the file cannot be created or the provisional header cannot be written.

Source

pub const fn raw() -> Self

A raw-PCM sink; the caller supplies the stream on each write.

Source

pub const fn none() -> Self

A sink that discards audio, for paths that synthesise nothing.

Source

pub const fn sink_name(&self) -> &'static str

The stable sink string reported in audio_chunk.

Source

pub const fn byte_offset(&self) -> u64

Bytes of audio emitted so far.

Source

pub fn write_packet( &mut self, pcm: &[f32], raw: &mut dyn Write, run_id: &str, frame_count: u8, ) -> Result<Value, FttsError>

Write one packet and return its audio_chunk event.

raw is where PCM goes under --stream raw; it is ignored by the other sinks. The event’s byte_offset is the offset before this packet, so a consumer can seek with it.

duration_ms is derived from the sample count rather than taken from a caller-supplied clock: it describes how much audio this packet holds, which is a property of the samples, not of how long the run took to produce them.

§Errors

If the sink rejects the write.

Source

pub fn finish(self) -> Result<u64, FttsError>

Finalise the sink, patching the WAV header to the real length.

§Errors

If the header cannot be rewritten.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, _span: NoopSpan) -> Self

Instruments this future with a span (no-op when disabled).
Source§

fn in_current_span(self) -> Self

Instruments this future with the current span (no-op when disabled).
Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

fn into_sample(self) -> T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V