aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie/music.cpp
diff options
context:
space:
mode:
authorHenry Bush2009-01-28 23:29:19 +0000
committerHenry Bush2009-01-28 23:29:19 +0000
commita0a82d911c77b63f2069dbc39ab26394fe4d377d (patch)
tree347c78404e52a33246b12917750eae833d5d9bf4 /engines/groovie/music.cpp
parent3f06e9c4eb9d5aadd7d00b9722ffa10d1ffa12c6 (diff)
downloadscummvm-rg350-a0a82d911c77b63f2069dbc39ab26394fe4d377d.tar.gz
scummvm-rg350-a0a82d911c77b63f2069dbc39ab26394fe4d377d.tar.bz2
scummvm-rg350-a0a82d911c77b63f2069dbc39ab26394fe4d377d.zip
T7G: start background music at start of input loop (0x0B). Should fix 2474078, but might break other things so I'm not going to backport it.
svn-id: r36125
Diffstat (limited to 'engines/groovie/music.cpp')
-rw-r--r--engines/groovie/music.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp
index 8c4d846b65..5812d0a9ba 100644
--- a/engines/groovie/music.cpp
+++ b/engines/groovie/music.cpp
@@ -33,7 +33,7 @@ namespace Groovie {
MusicPlayer::MusicPlayer(GroovieEngine *vm, const Common::String &gtlName) :
_vm(vm), _midiParser(NULL), _data(NULL), _driver(NULL),
- _backgroundFileRef(0), _gameVolume(100), _prevCDtrack(0) {
+ _backgroundFileRef(0), _gameVolume(100), _prevCDtrack(0), _isPlaying(0) {
// Create the parser
_midiParser = MidiParser::createParser_XMIDI();
@@ -174,12 +174,17 @@ void MusicPlayer::setGameVolume(uint16 volume, uint16 time) {
_fadingEndVolume = 100;
}
+void MusicPlayer::startBackground() {
+ if (!_isPlaying && _backgroundFileRef) {
+ play(_backgroundFileRef, true);
+ }
+}
+
void MusicPlayer::endTrack() {
debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: End of song");
unload();
- if (_backgroundFileRef) {
- play(_backgroundFileRef, true);
- }
+ _isPlaying = false;
+ startBackground();
}
void MusicPlayer::applyFading() {
@@ -232,6 +237,7 @@ bool MusicPlayer::play(uint16 fileref, bool loop) {
_midiParser->property(MidiParser::mpAutoLoop, loop);
_gameVolume = 100;
+ _isPlaying = true;
// Load the new file
return load(fileref);
}