mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Merge branch 'dev' into dev-0.12
This commit is contained in:
+15
-2
@@ -42784,8 +42784,11 @@ static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const
|
||||
frameCount = 128;
|
||||
}
|
||||
|
||||
/*
|
||||
If this is called by the device has not yet been started we need to return early, making sure we output silence to
|
||||
the output buffer.
|
||||
*/
|
||||
if (ma_device_get_status(pDevice) != ma_device_status_started) {
|
||||
/* Fill the output buffer with zero to avoid a noise sound */
|
||||
for (int i = 0; i < outputCount; i += 1) {
|
||||
MA_ZERO_MEMORY(pOutputs[i].data, pOutputs[i].numberOfChannels * frameCount * sizeof(float));
|
||||
}
|
||||
@@ -42807,7 +42810,9 @@ 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 (deviceType == ma_device_type_capture) {
|
||||
MA_ZERO_MEMORY(pOutputs[0].data, frameCount * pDevice->playback.internalChannels * sizeof(float));
|
||||
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, pDeviceStateWebAudio->pIntermediaryBuffer);
|
||||
|
||||
@@ -42817,6 +42822,14 @@ static EM_BOOL ma_audio_worklet_process_callback__webaudio(int inputCount, const
|
||||
pOutputs[0].data[frameCount*iChannel + iFrame] = pDeviceStateWebAudio->pIntermediaryBuffer[iFrame*pDevice->playback.internalChannels + iChannel];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Just above we output data to the first output buffer. Here we just make sure we're putting silence into any
|
||||
remaining output buffers.
|
||||
*/
|
||||
for (int i = 1; i < outputCount; i += 1) { /* <-- Note that the counter starts at 1 instead of 0. */
|
||||
MA_ZERO_MEMORY(pOutputs[i].data, pOutputs[i].numberOfChannels * frameCount * sizeof(float));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user