pub struct SceneRenderer { /* private fields */ }Expand description
Mixes a Scene block by block.
Implementations§
Source§impl SceneRenderer
impl SceneRenderer
pub fn new(scene: Arc<Scene>) -> SceneRenderer
pub fn scene(&self) -> &Arc<Scene> ⓘ
Sourcepub fn cursor(&self) -> u64
pub fn cursor(&self) -> u64
The frame the next block starts on (inside the loop, for a looping scene).
Sourcepub fn active_voices(&self) -> usize
pub fn active_voices(&self) -> usize
How many voices are sounding.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Nothing is sounding and no event is left. A looping scene is never finished.
Sourcepub fn seek(&mut self, frame: u64)
pub fn seek(&mut self, frame: u64)
Moves to frame: every voice stops, and events from frame on are still to come.
Sourcepub fn locate(&mut self, frame: u64)
pub fn locate(&mut self, frame: u64)
Moves to frame and lets the voices that are sounding finish. In a looping scene frame wraps into the loop.
Sourcepub fn replace_scene(&mut self, scene: Arc<Scene>, cursor: u64) -> Arc<Scene> ⓘ
pub fn replace_scene(&mut self, scene: Arc<Scene>, cursor: u64) -> Arc<Scene> ⓘ
Swaps the scene for scene and starts at cursor. Every voice stops. Returns the old scene, so the caller can drop it where
dropping is allowed.
Sourcepub fn press(&mut self, sound: u32, gain: f32, gated: bool, tag: u32) -> bool
pub fn press(&mut self, sound: u32, gain: f32, gated: bool, tag: u32) -> bool
Starts sound of the scene now, with tag to find it again. A gated voice plays until release and then
fades out over the scene’s release; one that is not gated plays to its end. false if the scene has no such sound.
Sourcepub fn release(&mut self, tag: u32) -> usize
pub fn release(&mut self, tag: u32) -> usize
Begins the fade-out of every held voice with tag. Returns how many it released.
Sourcepub fn drain_ended(&mut self, f: impl FnMut(u32))
pub fn drain_ended(&mut self, f: impl FnMut(u32))
Calls f with the tag of each tagged voice that ended since the last call, oldest first. Allocation-free.
Sourcepub fn render(&mut self, out: &mut [f32])
pub fn render(&mut self, out: &mut [f32])
Fills out (interleaved, scene.channels() per frame; a trailing partial frame is silenced) and advances. Scene events start on
their frames and a looping scene wraps. Allocation-free and lock-free.
Sourcepub fn render_voices(&mut self, out: &mut [f32])
pub fn render_voices(&mut self, out: &mut [f32])
Fills out with the voices that are sounding and nothing else: the cursor stays and no scene event starts. This is a stopped
transport, where live presses still sound, and the tail of a scene that was swapped out.