use oml_audio::Audio;
use oml_audio::Music;
use oml_audio::SoundBank;
use oml_audio::fileloader::FileLoaderDisk;
pub fn main() {
println!("oml-audio !");
let mut fileloader = FileLoaderDisk::new( "./data" );
fileloader.enable_debug();
let mut audio = Audio::new();
audio.load_music( &mut fileloader, "test.mp3" );
audio.play_music();
audio.load_sound_bank( &mut fileloader, "test.omsb" );
let done = false;
let mut coin_timer = 0.0;
let COIN_REPEAT = 0.5;
let mut powerup_timer = 0.0;
let POWERUP_REPEAT = 3.1;
while !done {
let timestep =audio.update();
coin_timer += timestep;
while coin_timer > COIN_REPEAT {
coin_timer -= COIN_REPEAT;
audio.play_sound( "PICKUP_COIN" );
}
powerup_timer += timestep;
while powerup_timer > POWERUP_REPEAT {
powerup_timer -= POWERUP_REPEAT;
audio.play_sound( "POWERUP" );
}
std::thread::sleep( std::time::Duration::from_millis( 1000/60 ) );
}
}