aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2011-01-01 10:51:57 +0000
committerArnaud Boutonné2011-01-01 10:51:57 +0000
commit5d6771e3df2ecba333faf98c042c3357c0e40c1c (patch)
tree8d0dd7fc29f891d4e98fbe8f0e0c8153f615c6de
parent473ddccf507989af006ddd9f99bbe6f310211ee6 (diff)
downloadscummvm-rg350-5d6771e3df2ecba333faf98c042c3357c0e40c1c.tar.gz
scummvm-rg350-5d6771e3df2ecba333faf98c042c3357c0e40c1c.tar.bz2
scummvm-rg350-5d6771e3df2ecba333faf98c042c3357c0e40c1c.zip
HUGO: Midi are no longer looping. Add handling to default playlist
svn-id: r55084
-rw-r--r--engines/hugo/hugo.cpp1
-rw-r--r--engines/hugo/sound.cpp20
-rw-r--r--engines/hugo/sound.h2
3 files changed, 22 insertions, 1 deletions
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index 0e9e4d0ca1..0dc062a0bc 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -374,6 +374,7 @@ void HugoEngine::runMachine() {
_mouse->mouseHandler(); // Mouse activity - adds to display list
_screen->drawStatusText();
_screen->displayList(D_DISPLAY); // Blit the display list to screen
+ _sound->checkMusic();
break;
case V_INVENT: // Accessing inventory
_inventory->runInventory(); // Process Inventory state machine
diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp
index 5f3ac52db6..8be6efcdca 100644
--- a/engines/hugo/sound.cpp
+++ b/engines/hugo/sound.cpp
@@ -73,7 +73,7 @@ void MidiPlayer::play(uint8 *stream, uint16 size) {
syncVolume();
_parser->loadMusic(_midiData, size);
_parser->setTrack(0);
- _isLooping = true;
+ _isLooping = false;
_isPlaying = true;
_mutex.unlock();
}
@@ -345,4 +345,22 @@ void SoundHandler::syncVolume() {
_midiPlayer->syncVolume();
}
+/**
+* Check if music is still playing.
+* If not, select the next track in the playlist and play it
+*/
+void SoundHandler::checkMusic() {
+ if (_midiPlayer->isPlaying())
+ return;
+
+ for (int i = 0; _vm->_defltTunes[i] != -1; i++) {
+ if (_vm->_defltTunes[i] == _vm->getGameStatus().song) {
+ if (_vm->_defltTunes[i + 1] != -1)
+ playMusic(_vm->_defltTunes[i + 1]);
+ else
+ playMusic(_vm->_defltTunes[0]);
+ break;
+ }
+ }
+}
} // End of namespace Hugo
diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h
index 4a7f6ac21f..91a50fe24f 100644
--- a/engines/hugo/sound.h
+++ b/engines/hugo/sound.h
@@ -59,6 +59,7 @@ public:
void syncVolume();
int getVolume() const { return _masterVolume; }
void setLooping(bool loop) { _isLooping = loop; }
+ bool isPlaying() { return _isPlaying; }
// MidiDriver interface
int open();
@@ -98,6 +99,7 @@ public:
void playSound(int16 sound, stereo_t channel, byte priority);
void initSound();
void syncVolume();
+ void checkMusic();
private:
HugoEngine *_vm;