pub struct Scene { /* private fields */ }Expand description
Sounds and the events that play them. Immutable; share it with Arc and hand it to the audio thread whole.
Implementations§
Source§impl Scene
impl Scene
Sourcepub fn new(
sample_rate: u32,
channels: u16,
sounds: Vec<Waveform>,
events: Vec<SceneEvent>,
release_frames: u32,
) -> Result<Scene, SceneError>
pub fn new( sample_rate: u32, channels: u16, sounds: Vec<Waveform>, events: Vec<SceneEvent>, release_frames: u32, ) -> Result<Scene, SceneError>
A scene. Every sound must run at sample_rate and have channels channels or be mono (a mono sound plays on every channel at
the same level). Events are sorted by frame (events on the same frame keep their order). release_frames is the fade-out of a
gated voice; zero cuts it.
Sourcepub fn with_loop(self, frames: u64) -> Result<Scene, SceneError>
pub fn with_loop(self, frames: u64) -> Result<Scene, SceneError>
Makes the scene repeat every frames frames: when the cursor reaches the end it returns to frame 0, and voices that are sounding
carry on across the wrap. Events at or past frames never play.
Sourcepub fn loop_frames(&self) -> Option<u64>
pub fn loop_frames(&self) -> Option<u64>
The loop length in frames, if the scene repeats.
pub fn sample_rate(&self) -> u32
pub fn channels(&self) -> u16
pub fn sounds(&self) -> &[Waveform]
Sourcepub fn events(&self) -> &[SceneEvent]
pub fn events(&self) -> &[SceneEvent]
The events, sorted by frame.
pub fn release_frames(&self) -> u32
Trait Implementations§
impl StructuralPartialEq for Scene
Auto Trait Implementations§
impl Forget for Scene
impl Freeze for Scene
impl Move for Scene
impl RefUnwindSafe for Scene
impl Send for Scene
impl Sync for Scene
impl Unpin for Scene
impl UnsafeUnpin for Scenewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Waveform>: UnsafeUnpin,
PhantomData<SceneEvent>: UnsafeUnpin,
impl UnwindSafe for Scene
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more