example/
example.rs

1use fmod::*;
2
3#[allow(unused_macros)]
4macro_rules! show {
5  ($e:expr) => { println!("{}: {:?}", stringify!($e), $e); }
6}
7
8#[allow(unused_macros)]
9macro_rules! hex {
10  ($e:expr) => { println!("{}: {:x}", stringify!($e), $e); }
11}
12
13
14fn main() {
15  println!("fmod example main...");
16
17  let mut system     = System::default().unwrap();
18  hex!(fmod::FMOD_VERSION);
19  hex!(system.get_version().unwrap());
20
21  let sound_filename = "bite.wav";
22  println!("  opening {:?}", sound_filename);
23  let mut sound      = system.create_sound_from_file_default (sound_filename)
24    .unwrap();
25  println!("  playing {:?}", sound_filename);
26  let channel        = sound.play (None, false).unwrap();
27  while channel.is_playing().unwrap() {
28    std::thread::sleep (std::time::Duration::from_millis (100));
29  }
30  println!("...fmod example main");
31}