mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 16:51:33 +11:00
Add stereo sound example
This commit is contained in:
parent
5bd656d8cb
commit
050ee184b0
BIN
agb/examples/JoshWoodward-LetItIn.wav
Normal file
BIN
agb/examples/JoshWoodward-LetItIn.wav
Normal file
Binary file not shown.
28
agb/examples/stereo_sound.rs
Normal file
28
agb/examples/stereo_sound.rs
Normal file
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue