From e9070675b9d0fa6410b9a68f76b58c1438404391 Mon Sep 17 00:00:00 2001 From: Vincent-FK Date: Thu, 24 Oct 2019 18:54:25 +0200 Subject: [PATCH] deinitialize audio correctly when deinitializing SDL: add a while(Mix_Init(0)) before Mix_Quit() Signed-off-by: Vincent-FK --- RetroFE/Source/SDL.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/RetroFE/Source/SDL.cpp b/RetroFE/Source/SDL.cpp index 89e8701..3e3d1e2 100644 --- a/RetroFE/Source/SDL.cpp +++ b/RetroFE/Source/SDL.cpp @@ -234,11 +234,11 @@ bool SDL::initialize( Configuration &config ) } } - /*if ( retVal && Mix_OpenAudio( audioRate, audioFormat, audioChannels, audioBuffers ) == -1 ) + if ( retVal && Mix_OpenAudio( audioRate, audioFormat, audioChannels, audioBuffers ) == -1 ) { std::string error = Mix_GetError( ); Logger::write( Logger::ZONE_WARNING, "SDL", "Audio initialize failed: " + error ); - }*/ + } return retVal; @@ -251,8 +251,10 @@ bool SDL::deInitialize( ) std::string error = SDL_GetError( ); Logger::write( Logger::ZONE_INFO, "SDL", "DeInitializing" ); - /*Mix_CloseAudio( ); - Mix_Quit( );*/ + Mix_CloseAudio( ); + + while(Mix_Init(0)) + Mix_Quit(); if ( mutex_ ) {