Fixed access violation when audio is closed and reopened. SDL_mixer does not allow this :-(

This commit is contained in:
lotodore
2007-06-16 10:13:28 +00:00
parent 6b5a754e7b
commit f3143d1b15
2 changed files with 2 additions and 3 deletions
-1
View File
@@ -839,7 +839,6 @@ void mainWindowImpl::callSettingsDialog() {
}
}
// Re-init audio.
mySDLPlayer->closeAudio();
mySDLPlayer->initAudio();
}
}
+2 -2
View File
@@ -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");