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

Function bloom_load_sound

native/linux/src/lib.rs:912–923  ·  view source on GitHub ↗
(path_ptr: *const u8)

Source from the content-addressed store, hash-verified

910
911#[no_mangle]
912pub extern "C" fn bloom_load_sound(path_ptr: *const u8) -> f64 {
913 let path = str_from_header(path_ptr);
914 match std::fs::read(path) {
915 Ok(data) => {
916 if let Some(s) = parse_wav(&data) { engine().audio.load_sound(s) }
917 else if let Some(s) = parse_ogg(&data) { engine().audio.load_sound(s) }
918 else if let Some(s) = parse_mp3(&data) { engine().audio.load_sound(s) }
919 else { 0.0 }
920 }
921 Err(_) => 0.0,
922 }
923}
924
925#[no_mangle]
926pub extern "C" fn bloom_play_sound(handle: f64) { engine().audio.play_sound(handle); }

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected