19 lines
654 B
Rust
19 lines
654 B
Rust
|
use ears::{AudioController, Sound};
|
||
|
use log::error;
|
||
|
|
||
|
pub const MARKET_ORDER_PLACED_PATH: &str = "sounds/smas-smb3_goal.wav";
|
||
|
pub const LOSS_TO_BREAK_EVEN_PATH: &str = "sounds/smw2_boing.wav";
|
||
|
pub const MIN_PROFIT_SOUND_PATH: &str = "sounds/smw_1-up.wav";
|
||
|
pub const GOOD_PROFIT_SOUND_PATH: &str = "sounds/smw_power-up.wav";
|
||
|
|
||
|
pub fn play_sound(sound_path: &'static str) {
|
||
|
std::thread::spawn(move || {
|
||
|
match Sound::new(sound_path) {
|
||
|
Ok(mut sound) => {
|
||
|
sound.play();
|
||
|
while sound.is_playing() {}
|
||
|
}
|
||
|
Err(e) => { error!("Could not play {}: {}", sound_path, e); }
|
||
|
}
|
||
|
});
|
||
|
}
|