[Scummvm-cvs-logs] SF.net SVN: scummvm: [23656] scummvm/trunk/engines/kyra/sound.cpp

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Aug 3 13:12:09 CEST 2006


Revision: 23656
Author:   eriktorbjorn
Date:     2006-08-03 04:12:05 -0700 (Thu, 03 Aug 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=23656&view=rev

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/sound.cpp
Modified: scummvm/trunk/engines/kyra/sound.cpp
===================================================================
--- scummvm/trunk/engines/kyra/sound.cpp	2006-08-01 14:10:46 UTC (rev 23655)
+++ scummvm/trunk/engines/kyra/sound.cpp	2006-08-03 11:12:05 UTC (rev 23656)
@@ -168,6 +168,21 @@
 }
 
 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 @@
 	_parser->setMidiDriver(this);
 	_parser->setTimerRate(getBaseTempo());
 	_parser->setTempo(0);
-	_parser->property(MidiParser::mpAutoLoop, true);
 }
 
 void SoundMidiPC::loadSoundEffectFile(const char *file) {
@@ -385,6 +399,7 @@
 		_parser->setTrack(track);
 		_parser->jumpToTick(0);
 		_parser->setTempo(1);
+		_parser->property(MidiParser::mpAutoLoop, false);
 	}
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list