MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / bloom_load_sound

Function bloom_load_sound

native/macos/src/lib.rs:2087–2106  ·  view source on GitHub ↗
(path_ptr: *const u8)

Source from the content-addressed store, hash-verified

2085
2086#[no_mangle]
2087pub 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]
2109pub extern "C" fn bloom_play_sound(handle: f64) {

Callers

nothing calls this directly

Calls 6

str_from_headerFunction · 0.85
parse_oggFunction · 0.85
parse_mp3Function · 0.85
parse_wavFunction · 0.85
load_soundMethod · 0.80
engineFunction · 0.70

Tested by

no test coverage detected