Skip to main content

render_playback

Function render_playback 

Source
pub fn render_playback(
    tree: &PatchTree,
    spec: &PhraseSpec,
    gain_db: f64,
) -> Result<Audition, PatchError>
Expand description

Re-derive the audition buffer of an already-featurized term without re-running the loudness analysis, using the gain_db its crate::Features recorded.

Bit-identical to what crate::featurize produced for the same term: crate::loudness::normalize_to measures a gain and then applies it as a uniform scalar multiply over the buffer, so replaying the recorded gain reproduces the same products exactly. gain_db is stored already bounded — by loudness::MAX_GAIN_DB above and by loudness::PEAK_CEILING below — so no bound is re-applied here. Re-applying would be a no-op; not applying is what keeps this in lockstep with the one place the decision is made.

That single-scalar shape is why the peak ceiling is a gain reduction rather than a limiter: a limiter would have to exist here too, identically, forever.

This is the second code path that must stay in lockstep with featurize’s normalization forever; render_playback_is_bit_identical is the test that keeps it honest.