From dcf0bf1c2a4984dbdbbf99cc6042cb188cd27331 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 2 Jun 2025 16:11:08 +0100 Subject: [PATCH] WASAPI: Fix bug where attempting to clear output buffers had no effect --- .../juce_audio_devices/native/juce_WASAPI_windows.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/juce_audio_devices/native/juce_WASAPI_windows.cpp b/modules/juce_audio_devices/native/juce_WASAPI_windows.cpp index 0b603e0914..3c815cbc04 100644 --- a/modules/juce_audio_devices/native/juce_WASAPI_windows.cpp +++ b/modules/juce_audio_devices/native/juce_WASAPI_windows.cpp @@ -1529,8 +1529,6 @@ public: AudioBuffer ins (jmax (1, numInputBuffers), bufferSize + 32); AudioBuffer outs (jmax (1, numOutputBuffers), bufferSize + 32); - auto inputBuffers = ins.getArrayOfWritePointers(); - auto outputBuffers = outs.getArrayOfWritePointers(); ins.clear(); outs.clear(); @@ -1569,7 +1567,7 @@ public: inputDevice->handleDeviceBuffer(); } - inputDevice->copyBuffersFromReservoir (inputBuffers, numInputBuffers, bufferSize); + inputDevice->copyBuffersFromReservoir (ins.getArrayOfWritePointers(), numInputBuffers, bufferSize); if (inputDevice->sampleRateHasChanged) { @@ -1585,9 +1583,9 @@ public: if (sl.isLocked() && (flags & flagStarted) != 0) { - callback->audioDeviceIOCallbackWithContext (inputBuffers, + callback->audioDeviceIOCallbackWithContext (ins.getArrayOfReadPointers(), numInputBuffers, - outputBuffers, + outs.getArrayOfWritePointers(), numOutputBuffers, bufferSize, {}); @@ -1602,7 +1600,7 @@ public: { // Note that this function is handed the input device so it can check for the event and make sure // the input reservoir is filled up correctly even when bufferSize > device actualBufferSize - outputDevice->copyBuffers (outputBuffers, numOutputBuffers, bufferSize, inputDevice.get(), *this); + outputDevice->copyBuffers (outs.getArrayOfReadPointers(), numOutputBuffers, bufferSize, inputDevice.get(), *this); if (outputDevice->sampleRateHasChanged) {