Skip to content

Commit c0bd246

Browse files
committed
Low latency shared mode: retry default period if custom fails
1 parent 4eaadba commit c0bd246

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Source/Driver/ASIO2WASAPI.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,8 @@ IAudioClient* getAudioClient(IMMDevice* pDevice, WAVEFORMATEX* pWaveFormat, int&
381381
if (FAILED(hr)) return NULL;
382382
while (minPeriod < (defaultPeriod / 2)) minPeriod += fundamentalPeriod; //aim is about 5ms update period, 240 samples at 48kHz in ASIO terms
383383
hr = pAudioClient3->InitializeSharedAudioStream(AUDCLNT_STREAMFLAGS_EVENTCALLBACK, minPeriod, format, NULL);
384+
if (hr == AUDCLNT_E_ENGINE_PERIODICITY_LOCKED)
385+
hr = pAudioClient3->InitializeSharedAudioStream(AUDCLNT_STREAMFLAGS_EVENTCALLBACK, currentPeriod, format, NULL);
384386
CoTaskMemFree(format);
385387
if (FAILED(hr)) return NULL;
386388
}

0 commit comments

Comments
 (0)