From: Matthias Braun Date: Wed, 11 Jan 2006 23:38:48 +0000 (+0000) Subject: fix music not playing again after disable&enabling it X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=47169962e96f73222bfdb0bc2eb815a71d180bb4;p=supertux.git fix music not playing again after disable&enabling it SVN-Revision: 2986 --- diff --git a/src/audio/sound_manager.cpp b/src/audio/sound_manager.cpp index 963ce94df..1490768c9 100644 --- a/src/audio/sound_manager.cpp +++ b/src/audio/sound_manager.cpp @@ -167,12 +167,18 @@ SoundManager::stop_music(bool fade) void SoundManager::play_music(const std::string& filename, bool fade) { - if(filename == current_music) + if(filename == current_music && music_source != NULL) return; current_music = filename; if(!music_enabled) return; + if(filename == "") { + delete music_source; + music_source = 0; + return; + } + try { std::auto_ptr newmusic (new StreamSoundSource()); alSourcef(newmusic->source, AL_ROLLOFF_FACTOR, 0);