From 3fd7c9f1994c02c04be1c76f604e76502f5d7dd0 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 22 Feb 2025 10:14:04 +1000 Subject: [PATCH] Fix a bug when no data callback is specified in the device config. Public issue https://github.com/mackron/miniaudio/issues/893 --- miniaudio.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index eb5df6bd..e1d2a13c 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -18949,6 +18949,11 @@ static void ma_device__handle_data_callback(ma_device* pDevice, void* pFramesOut } } ma_device_restore_denormals(pDevice, prevDenormalState); + } else { + /* No data callback. Just silence the output. */ + if (pFramesOut != NULL) { + ma_silence_pcm_frames(pFramesOut, frameCount, pDevice->playback.format, pDevice->playback.channels); + } } }