diff --git a/agb/examples/JoshWoodward-LetItIn.wav b/agb/examples/JoshWoodward-LetItIn.wav new file mode 100644 index 00000000..cb5417bd Binary files /dev/null and b/agb/examples/JoshWoodward-LetItIn.wav differ diff --git a/agb/examples/stereo_sound.rs b/agb/examples/stereo_sound.rs new file mode 100644 index 00000000..b7dca810 --- /dev/null +++ b/agb/examples/stereo_sound.rs @@ -0,0 +1,28 @@ +#![no_std] +#![no_main] + +extern crate agb; + +use agb::sound::mixer::SoundChannel; +use agb::{include_wav, Gba}; + +// Music - "Let it in" by Josh Woodward, free download at http://joshwoodward.com +const LET_IT_IN: &[u8] = include_wav!("examples/JoshWoodward-LetItIn.wav"); + +#[agb::entry] +fn main() -> ! { + let mut gba = Gba::new(); + let vblank_provider = agb::interrupt::VBlank::get(); + + let mut mixer = gba.mixer.mixer(); + mixer.enable(); + + let mut channel = SoundChannel::new(LET_IT_IN); + channel.stereo(); + mixer.play_sound(channel).unwrap(); + + loop { + vblank_provider.wait_for_vblank(); + mixer.vblank(); + } +}