Skip to main content

bake_audio

Function bake_audio 

Source
pub(crate) fn bake_audio(
    animations: &[AnimNode],
    total_secs: f64,
    sample_rate: f64,
) -> Vec<f32>
Expand description

Bake the tree’s whole audio plane over [0, total_secs] into one interleaved stereo buffer at sample_rate.

Two passes, neither mutating the tree: (1) a single descent pre-mixes every sound leaf whose path is entirely linear into pcm; (2) the collected paths of everything behind non-linear rates are folded into a Residual forest and walked once per output sample — shared ancestors evaluate once, linear and silent branches are gone entirely.