pub struct StemCapture { /* private fields */ }Expand description
A running stem capture over one Nes.
Create it right after the console is built and before its first frame
(Self::start); then, after every run_frame, call
Self::after_frame, which returns that frame’s samples for the mix and
each track. All eight streams always have the same length.
Implementations§
Source§impl StemCapture
impl StemCapture
Sourcepub fn start(nes: &mut Nes, sample_rate: u32) -> Result<Self, StemError>
pub fn start(nes: &mut Nes, sample_rate: u32) -> Result<Self, StemError>
Arm the console’s audio provenance and start a capture at the sample
rate the console was built with (sample_rate must be that rate: the
Nes does not report it, and a different one fails the mix check on
the first frame).
§Errors
StemError::StartedLate if the console has already produced audio.
Sourcepub fn after_frame(&mut self, nes: &mut Nes) -> Result<StemFrame<'_>, StemError>
pub fn after_frame(&mut self, nes: &mut Nes) -> Result<StemFrame<'_>, StemError>
Read the frame the console just ran: its mix trace and its audio.
Drains the console’s audio buffer (the returned StemFrame::mix is
that audio), so a host that plays the audio takes it from here.
§Errors
See StemError; a frame that fails leaves the capture unusable.
Sourcepub const fn mix_mismatches(&self) -> u64
pub const fn mix_mismatches(&self) -> u64
How many output samples of the re-rendered mix differed (in bits, or in count) from the console’s own output. Zero on every run so far; a non-zero value means the private pipeline is not the console’s, and the stems should not be trusted.
Sourcepub const fn trace_mismatches(&self) -> u64
pub const fn trace_mismatches(&self) -> u64
How many trace records carried a mixed value that the mixer does not
produce from the record’s own channel values. Zero unless a host set a
channel mask or gain (the trace records raw channel outputs, and the
mix is then the masked or scaled one).
Sourcepub const fn max_sum_error(&self) -> f32
pub const fn max_sum_error(&self) -> f32
The largest |mix - Σ tracks| seen so far, over every sample.