Skip to main content

StemCapture

Struct StemCapture 

Source
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

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub const fn max_sum_error(&self) -> f32

The largest |mix - Σ tracks| seen so far, over every sample.

Source

pub const fn samples(&self) -> u64

Output samples captured so far (per track).

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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<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 = !

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

fn try_from(value: U) -> Result<T, !>

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.