Fixed access violation when audio is closed and reopened. SDL_mixer does not allow this :-(
This commit is contained in:
@@ -839,7 +839,6 @@ void mainWindowImpl::callSettingsDialog() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Re-init audio.
|
// Re-init audio.
|
||||||
mySDLPlayer->closeAudio();
|
|
||||||
mySDLPlayer->initAudio();
|
mySDLPlayer->initAudio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ SDLPlayer::~SDLPlayer()
|
|||||||
|
|
||||||
void SDLPlayer::initAudio() {
|
void SDLPlayer::initAudio() {
|
||||||
|
|
||||||
if (myConfig->readConfigInt("PlaySoundEffects"))
|
if (!audioEnabled && myConfig->readConfigInt("PlaySoundEffects"))
|
||||||
{
|
{
|
||||||
audio_rate = 44100;
|
audio_rate = 44100;
|
||||||
audio_format = AUDIO_S16; /* 16-bit stereo */
|
audio_format = AUDIO_S16; /* 16-bit stereo */
|
||||||
@@ -48,7 +48,7 @@ void SDLPlayer::initAudio() {
|
|||||||
|
|
||||||
void SDLPlayer::playSound(string audioString, int playerID) {
|
void SDLPlayer::playSound(string audioString, int playerID) {
|
||||||
|
|
||||||
if(audioEnabled) {
|
if(audioEnabled && myConfig->readConfigInt("PlaySoundEffects")) {
|
||||||
|
|
||||||
QFile myFile(":sounds/resources/sounds/"+QString::fromStdString(audioString)+".wav");
|
QFile myFile(":sounds/resources/sounds/"+QString::fromStdString(audioString)+".wav");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user