cpal icon indicating copy to clipboard operation
cpal copied to clipboard

ASIO: fix for FL Studio ASIO quirk

Open Sin-tel opened this issue 3 weeks ago • 0 comments

It seems like some drivers (notably "FL Studio ASIO") do not use the ASIO double buffering mechanism, and always pass a buffer_index of 0, instead of the usual 0 - 1 swapping.

This means we can not rely on buffer_index to check when to silence the buffer.

src/host/asio/stream.rs:326

let silence = current_buffer_index.load(Ordering::Acquire) != callback_info.buffer_index;

This check always fails, so the buffer never gets cleared. Output will only get added, stacking up forever.

I replaced it with a similar check, using a global counter instead that gets incremented once in the buffer_switch.

Sin-tel avatar Dec 14 '25 16:12 Sin-tel