mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-13 05:00:55 +00:00
WASAPI: Exit the audio thread the recommended way to avoid pops and clicks
This commit is contained in:
parent
0493d8154a
commit
5f30bba5c9
@ -382,7 +382,7 @@ int WASAPIAudioBackend::RunThread() {
|
|||||||
|
|
||||||
hresult = pAudioInterface->Start();
|
hresult = pAudioInterface->Start();
|
||||||
|
|
||||||
while (!threadData_) {
|
while (flags != AUDCLNT_BUFFERFLAGS_SILENT) {
|
||||||
Sleep((DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2));
|
Sleep((DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2));
|
||||||
|
|
||||||
hresult = pAudioInterface->GetCurrentPadding(&pNumPaddingFrames);
|
hresult = pAudioInterface->GetCurrentPadding(&pNumPaddingFrames);
|
||||||
@ -417,12 +417,19 @@ int WASAPIAudioBackend::RunThread() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (threadData_ != 0) {
|
||||||
|
flags = AUDCLNT_BUFFERFLAGS_SILENT;
|
||||||
|
}
|
||||||
|
|
||||||
hresult = pAudioRenderClient->ReleaseBuffer(pNumAvFrames, flags);
|
hresult = pAudioRenderClient->ReleaseBuffer(pNumAvFrames, flags);
|
||||||
if (FAILED(hresult)) {
|
if (FAILED(hresult)) {
|
||||||
// Not much to do here either...
|
// Not much to do here either...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait for last data in buffer to play before stopping.
|
||||||
|
Sleep((DWORD)(hnsActualDuration / REFTIMES_PER_MILLISEC / 2));
|
||||||
|
|
||||||
delete[] shortBuf;
|
delete[] shortBuf;
|
||||||
hresult = pAudioInterface->Stop();
|
hresult = pAudioInterface->Stop();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user