XEEN: Stop audio if intro sequence aborted

This commit is contained in:
Paul Gilbert 2016-09-18 12:07:34 -04:00
parent 5e133cdd34
commit 94cee9dead
4 changed files with 15 additions and 5 deletions

View File

@ -212,11 +212,9 @@ void MusicDriver::playFX(uint effectId, const byte *data) {
} }
void MusicDriver::stopFX() { void MusicDriver::stopFX() {
if (_fxPlaying) { resetFX();
resetFX(); _fxPlaying = false;
_fxPlaying = false; _fxStartPtr = _fxDataPtr = nullptr;
_fxStartPtr = _fxDataPtr = nullptr;
}
} }
void MusicDriver::playSong(const byte *data) { void MusicDriver::playSong(const byte *data) {

View File

@ -61,4 +61,10 @@ bool Sound::isPlaying() const {
return _mixer->isSoundHandleActive(_soundHandle); return _mixer->isSoundHandleActive(_soundHandle);
} }
void Sound::stopAllAudio() {
stopSong();
stopFX();
stopSound();
}
} // End of namespace Xeen } // End of namespace Xeen

View File

@ -61,6 +61,11 @@ public:
* @remarks In the original, passing 0 to playSound returned play status * @remarks In the original, passing 0 to playSound returned play status
*/ */
bool isPlaying() const; bool isPlaying() const;
/**
* Stops all playing music, FX, and sound samples
*/
void stopAllAudio();
}; };
} // End of namespace Xeen } // End of namespace Xeen

View File

@ -124,6 +124,7 @@ Common::Error XeenEngine::run() {
if (shouldQuit()) if (shouldQuit())
return Common::kNoError; return Common::kNoError;
File::setCurrentArchive(GAME_ARCHIVE); File::setCurrentArchive(GAME_ARCHIVE);
_sound->stopAllAudio();
showMainMenu(); showMainMenu();
if (shouldQuit()) if (shouldQuit())