MADS: Fix stopping digital audio, music, and palette cycling when animation ends

This commit is contained in:
Paul Gilbert
2014-10-16 21:53:21 -04:00
parent fa5c223931
commit dee4fd193d
3 changed files with 13 additions and 1 deletions
+4
View File
@@ -129,4 +129,8 @@ void AudioPlayer::playSound(int soundIndex, bool loop) {
*/
}
void AudioPlayer::stop() {
_mixer->stopHandle(_handle);
}
} // End of namespace M4
+1
View File
@@ -46,6 +46,7 @@ public:
void setSoundGroup(const Common::String &filename);
void setDefaultSoundGroup();
void playSound(int soundIndex, bool loop = false);
void stop();
void setVolume(int volume);
bool isPlaying() const;
+8 -1
View File
@@ -475,6 +475,13 @@ AnimationView::AnimationView(MADSEngine *vm) : MenuView(vm) {
}
AnimationView::~AnimationView() {
// Turn off palette cycling as well as any playing sound
Scene &scene = _vm->_game->_scene;
scene._cyclingActive = false;
_vm->_sound->stop();
_vm->_audio->stop();
// Delete data
delete _currentAnimation;
delete _sceneInfo;
}
@@ -505,7 +512,7 @@ void AnimationView::display() {
bool AnimationView::onEvent(Common::Event &event) {
// Wait for the Escape key or a mouse press
if (((event.type == Common::EVENT_KEYDOWN) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) ||
(event.type == Common::EVENT_RBUTTONUP)) {
(event.type == Common::EVENT_LBUTTONUP)) {
scriptDone();
return true;
}