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)
3 4 5 6 7 8 9 10 11 12 13 14 15 16
fn main() -> Result<(), Box<dyn std::error::Error>> {
let Some(file_path) = args() else {
eprintln!("usage: FILE_PATH");
std::process::exit(2);
};
let (mut manager, _backend) = awedio::start()?;
let (sound, notifier) = awedio::sounds::open_file(file_path)?.with_completion_notifier();
manager.play(Box::new(sound));
let _ = notifier.recv();
Ok(())
}
Trait Implementations§
Auto Trait Implementations§
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