Skip to main content

run_audio_block

Function run_audio_block 

Source
pub fn run_audio_block<P>(format: &str, body: impl FnOnce()) -> bool
Expand description

Run a per-block audio-thread body under std::panic::catch_unwind.

Format wrappers call this around the cb_process body so a panic from user process() can’t unwind across the extern "C" FFI boundary into the host (UB on most toolchains; abort on others). Returns true on clean exit, false if the body panicked - the caller should zero output buffers on false so the host doesn’t keep playing whatever happened to be in those slots.

Panic logging is one short eprintln! per occurrence; the audio thread should never panic, so the I/O is rare and acceptable.