mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
WebAudio: Try to fix a startup noise
This commit is contained in:
committed by
David Reid
parent
88797e9dee
commit
8c3b213a7c
+8
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user