From a3370173df24cd6880e3e3845ddbbc7c090b7aed Mon Sep 17 00:00:00 2001 From: sudden6 Date: Sat, 5 May 2018 14:24:52 +0200 Subject: [PATCH] fix(audio): close the audio device after playing a sound This bug was uncovered by 65896e45017f8f748bc5b9db10a4400d7fd418dc because this sound now happens after the call is closed, but doesn't close the audio device. --- src/audio/backend/openal.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/audio/backend/openal.cpp b/src/audio/backend/openal.cpp index 17cffe153..b6a46703c 100644 --- a/src/audio/backend/openal.cpp +++ b/src/audio/backend/openal.cpp @@ -521,6 +521,10 @@ void OpenAL::playMono16SoundCleanup() alSourcei(alMainSource, AL_BUFFER, AL_NONE); alDeleteBuffers(1, &alMainBuffer); alMainBuffer = 0; + // close the audio device if no other sources active + if (peerSources.isEmpty()) { + cleanupOutput(); + } } else { // the audio didn't finish, try again later playMono16Timer.start(10);