WebAudio: Try to fix a startup noise

This commit is contained in:
François Hautier
2026-01-05 09:59:29 +01:00
committed by David Reid
parent 88797e9dee
commit 8c3b213a7c
+8 -1
View File
@@ -41766,7 +41766,10 @@ static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const
if (outputCount > 0) {
/* If it's a capture-only device, we'll need to output silence. */
if (pDevice->type == ma_device_type_capture) {
MA_ZERO_MEMORY(pOutputs[0].data, frameCount * pDevice->playback.internalChannels * sizeof(float));
/* Ensure all output buffers are filled with zero */
for (int i = 0; i < outputCount; i += 1) {
MA_ZERO_MEMORY(pOutputs[i].data, pOutputs[i].numberOfChannels * frameCount * sizeof(float));
}
} else {
ma_device_process_pcm_frames_playback__webaudio(pDevice, frameCount, pDevice->webaudio.pIntermediaryBuffer);
@@ -41776,6 +41779,10 @@ static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const
pOutputs[0].data[frameCount*iChannel + iFrame] = pDevice->webaudio.pIntermediaryBuffer[iFrame*pDevice->playback.internalChannels + iChannel];
}
}
/* Ensure all output buffers are filled with zero */
for (int i = 1; i < outputCount; i += 1) {
MA_ZERO_MEMORY(pOutputs[i].data, pOutputs[i].numberOfChannels * frameCount * sizeof(float));
}
}
}