pub struct ExactPcmSession { /* private fields */ }Expand description
A fixed-format source session with no modifying processing stages.
This is a software building block, separate from super::session::PcmSession.
It owns no decoder, transport, sound device or listening records. The existing
driver remains responsible for selection, cancellation/seeking, queue writes
and history after accepted output. There are no gain, tone, rate conversion,
downmix, guard, limiter or dither controls to silently apply or ignore here.
Call end_track only after successful decoder EOF, including a present FLAC
MD5 verification. Each occurrence completes once, without delayed frames or
flushing silence. Invalid blocks/lifecycle requests leave state unchanged.
A transport interruption or output failure requires discarding this session
and queued audio. Neither its output metadata nor produced completion markers
establish device eligibility, audible completion or physical bit identity.
Implementations§
Source§impl ExactPcmSession
impl ExactPcmSession
Sourcepub fn new(
input: IntegerPcmFormat,
output: ExactOutputFormat,
) -> Result<Self, ExactSessionError>
pub fn new( input: IntegerPcmFormat, output: ExactOutputFormat, ) -> Result<Self, ExactSessionError>
Validate fixed source/output representation outside the audio callback.
Sourcepub fn input_format(&self) -> IntegerPcmFormat
pub fn input_format(&self) -> IntegerPcmFormat
Original precision, rate and channel association.
Sourcepub fn output_format(&self) -> ExactOutputFormat
pub fn output_format(&self) -> ExactOutputFormat
Exact representation metadata, distinct from device-route evidence.
Sourcepub fn source_frames(&self) -> u64
pub fn source_frames(&self) -> u64
Cumulative accepted source frames, with no converted or delayed frames.
Sourcepub fn compatible(
&self,
input: IntegerPcmFormat,
output: ExactOutputFormat,
) -> bool
pub fn compatible( &self, input: IntegerPcmFormat, output: ExactOutputFormat, ) -> bool
Whether a natural next occurrence can share this fixed-format session.
Sourcepub fn begin_track(&mut self, token: usize) -> Result<(), ExactSessionError>
pub fn begin_track(&mut self, token: usize) -> Result<(), ExactSessionError>
Start a driver-identified occurrence without selecting any processing.
Sourcepub fn push_source(
&mut self,
samples: &[i32],
) -> Result<ExactSessionBlock<'_>, ExactSessionError>
pub fn push_source( &mut self, samples: &[i32], ) -> Result<ExactSessionBlock<'_>, ExactSessionError>
Preserve one bounded block of complete source frames and encode exactly.
The adapter checks source-depth range, frame alignment and block bounds before replacing any output. Observational peaks use an independent normalized value; canonical source integers are never altered.
Sourcepub fn end_track(&mut self) -> Result<ExactSessionBlock<'_>, ExactSessionError>
pub fn end_track(&mut self) -> Result<ExactSessionBlock<'_>, ExactSessionError>
Seal one successfully decoded source, with no tail or extra samples.
Sourcepub fn finish(&mut self) -> Result<ExactSessionBlock<'_>, ExactSessionError>
pub fn finish(&mut self) -> Result<ExactSessionBlock<'_>, ExactSessionError>
Finish the sealed group; repeated calls emit no duplicate completion.