(path_ptr: *const u8)
| 2085 | |
| 2086 | #[no_mangle] |
| 2087 | pub extern "C" fn bloom_load_sound(path_ptr: *const u8) -> f64 { |
| 2088 | let path = str_from_header(path_ptr); |
| 2089 | match std::fs::read(path) { |
| 2090 | Ok(data) => { |
| 2091 | let sound_data = if path.ends_with(".ogg") || path.ends_with(".OGG") { |
| 2092 | parse_ogg(&data) |
| 2093 | } else if path.ends_with(".mp3") || path.ends_with(".MP3") { |
| 2094 | parse_mp3(&data) |
| 2095 | } else { |
| 2096 | parse_wav(&data) |
| 2097 | }; |
| 2098 | if let Some(sound_data) = sound_data { |
| 2099 | engine().audio.load_sound(sound_data) |
| 2100 | } else { |
| 2101 | 0.0 |
| 2102 | } |
| 2103 | } |
| 2104 | Err(_) => 0.0, |
| 2105 | } |
| 2106 | } |
| 2107 | |
| 2108 | #[no_mangle] |
| 2109 | pub extern "C" fn bloom_play_sound(handle: f64) { |
nothing calls this directly
no test coverage detected