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:
parent
95eef1995a
commit
83e3cd8be9
1 changed files with 15 additions and 2 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue