diff --git a/src/polygon_draw.rs b/src/polygon_draw.rs index 997a9a0..3cda6cb 100644 --- a/src/polygon_draw.rs +++ b/src/polygon_draw.rs @@ -1,4 +1,3 @@ - use crate::color::color_serde; use std::f32::consts::PI; @@ -200,8 +199,13 @@ pub struct Polygon { impl Polygon { pub fn update(&mut self, path_of_project: &str) { let path = format!("{0}", &self.sound_name); - self.sound = StaticSoundData::from_file(format!("{0}/{1}", path_of_project, path)) - .expect("fail to load the sound"); + dbg!(path.clone()); + self.sound = if path == String::from("Default_Sound.ogg") { + StaticSoundData::from_file("assets/Default_Sound.ogg").expect("fail to load the sound") + } else { + StaticSoundData::from_file(format!("{0}/{1}", path_of_project, path)) + .expect("fail to load the sound") + } } pub fn sound_to_play_btw(&self, before: f32, after: f32) -> Vec<&StaticSoundData> { let mut sound_to_play: Vec<&StaticSoundData> = vec![]; @@ -369,5 +373,5 @@ impl Polygon { } } fn dummy_sound() -> StaticSoundData { - StaticSoundData::from_file("assets/tick.ogg").expect("Fail to load audio") + StaticSoundData::from_file("assets/Default_Sound.ogg").expect("Fail to load audio") }