From cd66d5848ca52e4a0e734d6ee229c4bd076d8842 Mon Sep 17 00:00:00 2001 From: David Reid Date: Fri, 14 Feb 2020 19:59:14 +1000 Subject: [PATCH] WebAudio: Add a clarification comment concerning draining. --- miniaudio.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index 37bd703f..50dde652 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -27475,6 +27475,16 @@ static ma_result ma_device_stop__webaudio(ma_device* pDevice) { MA_ASSERT(pDevice != NULL); + /* + From the WebAudio API documentation for AudioContext.suspend(): + + Suspends the progression of AudioContext's currentTime, allows any current context processing blocks that are already processed to be played to the + destination, and then allows the system to release its claim on audio hardware. + + I read this to mean that "any current context processing blocks" are processed by suspend() - i.e. They they are drained. We therefore shouldn't need to + do any kind of explicit draining. + */ + if (pDevice->type == ma_device_type_capture || pDevice->type == ma_device_type_duplex) { EM_ASM({ miniaudio.get_device_by_index($0).webaudio.suspend();