Struct Flac Recorder
pub struct FlacRecorder<W> { /* private fields */ }Expand description
Worker-owned incremental FLAC capture sink fed by a prepared f32 audio ring. Audio callbacks only publish; pump quantizes/encodes/writes on its caller. Any failure after dequeue poisons because accepted ring frames cannot roll back. Producer full-ring drops remain producer policy. Drop does not finalize. No hidden worker, path/device/clock choice or physical recording claim.
Implementations§
§impl<W: Write + Seek> FlacRecorder<W>
impl<W: Write + Seek> FlacRecorder<W>
pub fn new(
destination: W,
format: FlacFormat,
maximum_pump_frames: usize,
maximum_total_frames: u64,
maximum_bytes: u64,
policy: FlacCapturePolicy,
consumer: AudioConsumer,
) -> Result<Self, Error>
pub fn new( destination: W, format: FlacFormat, maximum_pump_frames: usize, maximum_total_frames: u64, maximum_bytes: u64, policy: FlacCapturePolicy, consumer: AudioConsumer, ) -> Result<Self, Error>
Validate ring channels and 1..65536 pump frames before creating the writer header. Writer format, total frame/byte budgets and empty sink rules apply.
pub fn frames(&self) -> u64
pub fn frames(&self) -> u64
Frames accepted by the encoder, including its retained pending block. A rejected dequeued batch is excluded; successful capture is not yet final.
pub fn is_poisoned(&self) -> bool
pub fn pump(&mut self) -> Result<usize, Error>
pub fn pump(&mut self) -> Result<usize, Error>
Drain at most one prepared scratch batch; an empty ring performs no I/O. Malformed/nonfinite/overload input, writer capacity or I/O failure poisons after dequeue. Failed batches may have an irreversible accepted prefix.
pub fn finish(self) -> Result<W, Error>
pub fn finish(self) -> Result<W, Error>
Stop/join the producer first. Drain at most one ring capacity then finalize the nonempty FLAC writer. Concurrent late publication can reject or lose late data; stopped producer is the caller’s lifecycle obligation. Consumes the sink, with no retry after final output/header/seek/flush failures.