pub fn dispatch_audio_fill(
world: &World,
out: &mut [f32],
sample_rate: u32,
channels: u16,
)Expand description
Run every OnAudioFill in world once, mixing their samples into out.
out is interleaved frames and is zeroed first; each source adds its
contribution in AudioFillOrder order — the order is the only thing the
dispatcher states, so sources at the same order run in no stated order.
Then the world’s GlobalAudioGain — one when it carries none — scales
the sum, which clamps to the unit range. This is the whole of the audio
thread’s per-chunk work, and a caller stepping a world inline calls it the
same way. The gain is the finished buffer’s alone: every source ran before
it, which is why a source that mirrors the output applies it itself.
A source must not change the world’s set of sources while it runs: it
has a shared &World, so structural work goes through
unlit_ecs::Scope::queue and is applied by the world’s own driver between fills.