From e7d94638cf8da43bfc7690dd35e7405bd66f4cb2 Mon Sep 17 00:00:00 2001 From: David Reid Date: Thu, 15 Jan 2026 11:31:53 +1000 Subject: [PATCH] Wake up the backend when uninitializing. --- miniaudio.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index 76bbe049..b50f7655 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -45677,6 +45677,15 @@ MA_API void ma_device_uninit(ma_device* pDevice) #ifndef MA_NO_THREADING if (pDevice->hasAudioThread) { ma_device_op_queue_push(&pDevice->opQueue, MA_DEVICE_OP_UNINIT, NULL, NULL); + + /* + Before waiting on the result, we need to make sure we try waking up the backend first in case it + needs a prod. + */ + if (pDevice->pContext->pVTable->onDeviceWakeup != NULL) { + pDevice->pContext->pVTable->onDeviceWakeup(pDevice); + } + ma_thread_wait(&pDevice->audioThread); } else #endif