use std::{thread, time::Duration};
use maudio::{
audio::sample_rate::SampleRate, data_source::sources::decoder::DecoderBuilder, engine::Engine,
MaResult,
};
const MUSIC_FILE: &[u8] = include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/../maudio-sys/native/miniaudio/data/16-44100-stereo.flac"
));
fn main() -> MaResult<()> {
let engine = Engine::new()?;
let decoder = DecoderBuilder::new_f32(2, SampleRate::Sr44100).from_memory(MUSIC_FILE)?;
let mut sound = engine.new_sound_from_source(&decoder)?;
sound.play_sound()?;
println!("Stopping in 5 seconds...");
thread::sleep(Duration::from_secs(5));
sound.stop_sound()?;
Ok(())
}