pub struct AudioOutput { /* private fields */ }Expand description
Accumulating state for the audio_chunk event stream.
Implementations§
Source§impl AudioOutput
impl AudioOutput
Sourcepub fn wav(path: &Path) -> Result<Self, FttsError>
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.
Sourcepub const fn byte_offset(&self) -> u64
pub const fn byte_offset(&self) -> u64
Bytes of audio emitted so far.
Sourcepub fn write_packet(
&mut self,
pcm: &[f32],
raw: &mut dyn Write,
run_id: &str,
frame_count: u8,
) -> Result<Value, FttsError>
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 — on the
RAW stream. On a trimmed file sink the chunk events describe samples HANDED to the writer,
up to a quarter second of which the tail trim may withhold, so the final chunk’s advertised
range can exceed the file; run_complete.audio_bytes is the authoritative file size.
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.