aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2006-08-03 11:12:05 +0000
committerTorbjörn Andersson2006-08-03 11:12:05 +0000
commit6a40e7f789403ff1a679c1770aa560a914747c3b (patch)
tree7850ad353fe7af3e5fa8884c6825deb4db4f3726
parent15f9a3ce33883b6b48a18d74ffaf77e9d0cbf2d5 (diff)
downloadscummvm-rg350-6a40e7f789403ff1a679c1770aa560a914747c3b.tar.gz
scummvm-rg350-6a40e7f789403ff1a679c1770aa560a914747c3b.tar.bz2
scummvm-rg350-6a40e7f789403ff1a679c1770aa560a914747c3b.zip
This is a grossly over-simplified, yet hopefully sufficient for Kyrandia, way
of handling XMIDI loops. If anyone feels like doing it properly in midiparser_xmidi.cpp, the Exult project probably has one of the better reference implementations. For now, though, I don't see any real need to, and this change is clearly flagged as a hack. svn-id: r23656
-rw-r--r--engines/kyra/sound.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/engines/kyra/sound.cpp b/engines/kyra/sound.cpp
index 988a3f8d81..c2c85df950 100644
--- a/engines/kyra/sound.cpp
+++ b/engines/kyra/sound.cpp
@@ -168,6 +168,21 @@ void SoundMidiPC::close() {
}
void SoundMidiPC::send(uint32 b) {
+ // HACK: For Kyrandia, we make the simplifying assumption that a song
+ // either loops in its entirety, or not at all. So if we see a FOR_LOOP
+ // controller event, we turn on looping even if there isn't any
+ // corresponding NEXT_BREAK event.
+ //
+ // This is a gross over-simplification of how XMIDI handles loops. If
+ // anyone feels like doing a proper implementation, please refer to
+ // the Exult project, and do it in midiparser_xmidi.cpp
+
+ if ((b & 0xFFF0) == 0x74B0) {
+ debugC(9, kDebugLevelMain | kDebugLevelSound, "SoundMidiPC: Looping song");
+ _parser->property(MidiParser::mpAutoLoop, true);
+ return;
+ }
+
if (_passThrough) {
if ((b & 0xFFF0) == 0x007BB0)
return;
@@ -264,7 +279,6 @@ void SoundMidiPC::playMusic(uint8 *data, uint32 size) {
_parser->setMidiDriver(this);
_parser->setTimerRate(getBaseTempo());
_parser->setTempo(0);
- _parser->property(MidiParser::mpAutoLoop, true);
}
void SoundMidiPC::loadSoundEffectFile(const char *file) {
@@ -385,6 +399,7 @@ void SoundMidiPC::playTrack(uint8 track) {
_parser->setTrack(track);
_parser->jumpToTick(0);
_parser->setTempo(1);
+ _parser->property(MidiParser::mpAutoLoop, false);
}
}