From 8eb7d55eca5aaf1acb005654c28b88b1e14111b2 Mon Sep 17 00:00:00 2001 From: Henry Bush Date: Thu, 8 Jan 2009 23:01:34 +0000 Subject: T7G: Reset midi volume to 100 on starting a track, cleanup svn-id: r35792 --- engines/groovie/music.cpp | 15 +++++++++++---- engines/groovie/music.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 2fe9b42c67..8c4d846b65 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -174,6 +174,14 @@ void MusicPlayer::setGameVolume(uint16 volume, uint16 time) { _fadingEndVolume = 100; } +void MusicPlayer::endTrack() { + debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: End of song"); + unload(); + if (_backgroundFileRef) { + play(_backgroundFileRef, true); + } +} + void MusicPlayer::applyFading() { Common::StackLock lock(_mutex); @@ -182,6 +190,7 @@ void MusicPlayer::applyFading() { if (time >= _fadingDuration) { // If we were fading to 0, stop the playback and restore the volume if (_fadingEndVolume == 0) { + debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Faded to zero: end of song"); unload(); _fadingEndVolume = 100; } @@ -221,6 +230,7 @@ bool MusicPlayer::play(uint16 fileref, bool loop) { // Set the looping option _midiParser->property(MidiParser::mpAutoLoop, loop); + _gameVolume = 100; // Load the new file return load(fileref); @@ -334,10 +344,7 @@ void MusicPlayer::metaEvent(byte type, byte *data, uint16 length) { switch (type) { case 0x2F: // End of Track, play the background song - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: End of song"); - if (_backgroundFileRef) { - play(_backgroundFileRef, true); - } + endTrack(); break; default: _driver->metaEvent(type, data, length); diff --git a/engines/groovie/music.h b/engines/groovie/music.h index 43d020b198..0883e7814b 100644 --- a/engines/groovie/music.h +++ b/engines/groovie/music.h @@ -56,6 +56,7 @@ private: uint16 _fadingStartVolume; uint16 _fadingEndVolume; uint16 _fadingDuration; + void endTrack(); void applyFading(); // Song volumes -- cgit v1.2.3