From f3143d1b151bcf3c17e4487d5bf269b9af8ed8e6 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 16 Jun 2007 10:13:28 +0000 Subject: [PATCH] Fixed access violation when audio is closed and reopened. SDL_mixer does not allow this :-( --- src/gui/qt/mainwindow/mainwindowimpl.cpp | 1 - src/gui/qt/sound/sdlplayer.cpp | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gui/qt/mainwindow/mainwindowimpl.cpp b/src/gui/qt/mainwindow/mainwindowimpl.cpp index ef040cf4..f7497e0b 100755 --- a/src/gui/qt/mainwindow/mainwindowimpl.cpp +++ b/src/gui/qt/mainwindow/mainwindowimpl.cpp @@ -839,7 +839,6 @@ void mainWindowImpl::callSettingsDialog() { } } // Re-init audio. - mySDLPlayer->closeAudio(); mySDLPlayer->initAudio(); } } diff --git a/src/gui/qt/sound/sdlplayer.cpp b/src/gui/qt/sound/sdlplayer.cpp index ef6b1dcd..f3aa15e2 100644 --- a/src/gui/qt/sound/sdlplayer.cpp +++ b/src/gui/qt/sound/sdlplayer.cpp @@ -31,7 +31,7 @@ SDLPlayer::~SDLPlayer() void SDLPlayer::initAudio() { - if (myConfig->readConfigInt("PlaySoundEffects")) + if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) { audio_rate = 44100; audio_format = AUDIO_S16; /* 16-bit stereo */ @@ -48,7 +48,7 @@ void SDLPlayer::initAudio() { void SDLPlayer::playSound(string audioString, int playerID) { - if(audioEnabled) { + if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) { QFile myFile(":sounds/resources/sounds/"+QString::fromStdString(audioString)+".wav");