soloud-rs
soloud-rs copied to clipboard
Random floating point exception
Describe the bug I am using soloud to play an mp3 file. It works most of the time. But every now and then the app crashes with the reason as Floating point exception: 8. It appears to originate from soloud.
To Reproduce This is hard to do, since the problem occurs randomly. This is code snippet:
const BEEP_INTERVAL: u64 = 1000; //milliseconds
const POLL_INTERVAL: u64 = 100;
for _ in 0..5 {
thread::spawn(|| {
let mut sl = Soloud::default().unwrap();
sl.set_global_volume(3.0);
let mut wav = audio::Wav::default();
wav.load_mem(include_bytes!("beep.mp3")).unwrap();
sl.play(&wav);
while sl.voice_count() > 0 {
std::thread::sleep(std::time::Duration::from_millis(POLL_INTERVAL));
}
});
std::thread::sleep(std::time::Duration::from_millis(BEEP_INTERVAL));
}
Expected behavior Code should never crash.
Desktop:
Additional context Using this crate in a Tauri application
Rename beep.txt to beep.mp3
Hi I’ll look into it deeper this weekend. Looking at the log, it seems like an upstream issue.
I tried running the provided code with different configurations/modifications/feature flags (namely coreaudio on macos), and I can't seem to hit the exception. I've also run with sanitizers.
I'm using macos 12.6.6 on an intel x64 cpu. Using the latest version of soloud-rs. What arch are you building then running the app? Also what's in your Cargo.toml. I can't help but think it might be an architecture issue, or some other dependency conflict.
May be take a look at https://github.com/kargirwar/break-timer-tauri/tree/wrappingvec/src-tauri/src.