pub struct Manager { /* private fields */ }
Expand description
A Manager can play sounds by rendering sounds on a Renderer
for a
backend.
Implementations§
Source§impl Manager
impl Manager
Sourcepub fn new() -> (Self, Renderer)
pub fn new() -> (Self, Renderer)
Create a new Manager and the renderer its samples will render to.
Normally you do not need to call this function directly but you instead
call .start(...)
on a backend which will call this function.
Sourcepub fn play(&mut self, sound: Box<dyn Sound>)
pub fn play(&mut self, sound: Box<dyn Sound>)
Add a new Sound to be played in parallel to any existing sounds.
If you want to play Sounds sequentially use a SoundList.
See the modifier functions on Sound to control sounds before and/or after playing.
Examples found in repository?
examples/play.rs (line 12)
3fn main() -> Result<(), Box<dyn std::error::Error>> {
4 let Some(file_path) = args() else {
5 eprintln!("usage: FILE_PATH");
6 std::process::exit(2);
7 };
8
9 let (mut manager, _backend) = awedio::start()?;
10 let (sound, notifier) = awedio::sounds::open_file(file_path)?.with_completion_notifier();
11
12 manager.play(Box::new(sound));
13 let _ = notifier.recv();
14
15 Ok(())
16}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Manager
impl RefUnwindSafe for Manager
impl Send for Manager
impl Sync for Manager
impl Unpin for Manager
impl UnwindSafe for Manager
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