diff options
author | Joost Peters | 2004-01-19 23:54:50 +0000 |
---|---|---|
committer | Joost Peters | 2004-01-19 23:54:50 +0000 |
commit | 698eefae58b5ff065fc777b28530a3d77e5f9933 (patch) | |
tree | 5c216cee86d2c0b8d3145076391a58ec0c57374c /queen/music.cpp | |
parent | 2f7198a3acabe4db57a001817686abe397c96e3f (diff) | |
download | scummvm-rg350-698eefae58b5ff065fc777b28530a3d77e5f9933.tar.gz scummvm-rg350-698eefae58b5ff065fc777b28530a3d77e5f9933.tar.bz2 scummvm-rg350-698eefae58b5ff065fc777b28530a3d77e5f9933.zip |
- Enable music queueing (I don't really like the levels of indirection, but it'll do for now)
- Handle special music type '2000' (restart previously queued music)
svn-id: r12529
Diffstat (limited to 'queen/music.cpp')
-rw-r--r-- | queen/music.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/queen/music.cpp b/queen/music.cpp index 82a108cb24..d4f839ea3d 100644 --- a/queen/music.cpp +++ b/queen/music.cpp @@ -30,6 +30,7 @@ namespace Queen { MusicPlayer::MusicPlayer(MidiDriver *driver, byte *data, uint32 size) : _driver(driver), _isPlaying(false), _looping(false), _volume(255), _queuePos(0), _musicData(data), _musicDataSize(size) { queueClear(); + _lastSong = 0; _parser = MidiParser::createParser_SMF(); _parser->setMidiDriver(this); _parser->setTimerRate(_driver->getBaseTempo()); @@ -59,6 +60,7 @@ namespace Queen { } void MusicPlayer::queueClear() { + _lastSong = _songQueue[0]; _queuePos = 0; memset(_songQueue, 0, sizeof(_songQueue)); } @@ -130,6 +132,15 @@ namespace Queen { } uint16 songNum = _songQueue[_queuePos]; + + //Special type + //2000: (songNum + 1) - repeat music from previous queue + if (songNum == 1999) { + songNum = _lastSong; + queueClear(); + queueSong(songNum); + } + _parser->loadMusic(_musicData + songOffset(songNum), songLength(songNum)); _parser->setTrack(0); //debug(0, "Playing song %d [queue position: %d]", songNum, _queuePos); @@ -178,6 +189,15 @@ namespace Queen { delete[] _musicData; } + bool Music::queueSong(uint16 songNum) { + // Work around bug in Roland music, note that these numbers are 'one-off' + // from the original code + if (/*isRoland && */ songNum == 88 || songNum == 89) + songNum = 62; + + return _player->queueSong(songNum); + } + void Music::playSong(uint16 songNum) { _player->queueClear(); _player->queueSong(songNum); |