1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

WASAPI: Fix issue where current buffer size could be misreported in non-low-latency non-exclusive mode

In shared mode (i.e. non-low-latency, non-exclusive) the driver has sole
responsibility for setting the wakeup period, and this cannot be changed
by the application. This change ensures that the audio device always
uses the buffer size reported by the audio hardware, even when that
differs from the buffer size that was requested by the program.
This commit is contained in:
reuk 2025-11-27 17:10:22 +00:00
parent 95eef1995a
commit 83e3cd8be9
No known key found for this signature in database

View file

@ -1375,8 +1375,21 @@ public:
return lastError;
}
currentBufferSizeSamples = bufferSizeSamples <= 0 ? defaultBufferSize : jmax (bufferSizeSamples, minBufferSize);
currentSampleRate = sampleRate > 0 ? sampleRate : defaultSampleRate;
currentSampleRate = sampleRate > 0 ? sampleRate : defaultSampleRate;
currentBufferSizeSamples = std::invoke ([&]
{
if (bufferSizeSamples <= 0)
return defaultBufferSize;
if (deviceMode == WASAPIDeviceMode::shared)
{
// In shared mode, the wakeup period is decided by the driver, frequently around 10ms
return defaultBufferSize;
}
return jmax (bufferSizeSamples, minBufferSize);
});
lastKnownInputChannels = inputChannels;
lastKnownOutputChannels = outputChannels;