agb/tracker/agb-tracker/examples/basic.rs

27 lines
626 B
Rust
Raw Normal View History

2023-07-13 00:38:09 +10:00
#![no_std]
#![no_main]
use agb::sound::mixer::Frequency;
use agb::Gba;
use agb_tracker::{include_xm, Track, Tracker};
2023-07-13 00:38:09 +10:00
// Found on: https://modarchive.org/index.php?request=view_by_moduleid&query=36662
2023-07-24 05:54:24 +10:00
const DB_TOFFE: Track = include_xm!("examples/algar_-_ninja_on_speed.xm");
2023-07-13 00:38:09 +10:00
#[agb::entry]
fn main(mut gba: Gba) -> ! {
let vblank_provider = agb::interrupt::VBlank::get();
let mut mixer = gba.mixer.mixer(Frequency::Hz18157);
mixer.enable();
2023-07-13 08:41:30 +10:00
let mut tracker = Tracker::new(&DB_TOFFE);
2023-07-13 02:36:41 +10:00
2023-07-13 00:38:09 +10:00
loop {
2023-07-13 02:36:41 +10:00
tracker.step(&mut mixer);
2023-07-13 00:38:09 +10:00
mixer.frame();
2023-07-13 00:38:09 +10:00
vblank_provider.wait_for_vblank();
}
}