aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-01-12 15:31:50 +0000
committerFilippos Karapetis2009-01-12 15:31:50 +0000
commit1a7aeec4d9e1221ee3557767589c9d572ff622b9 (patch)
tree6f38362d4e9812dbdd8b7560d8cf4fccac45ec50
parent8911d345426fc250c12bf7a5d63dd69c584e7730 (diff)
downloadscummvm-rg350-1a7aeec4d9e1221ee3557767589c9d572ff622b9.tar.gz
scummvm-rg350-1a7aeec4d9e1221ee3557767589c9d572ff622b9.tar.bz2
scummvm-rg350-1a7aeec4d9e1221ee3557767589c9d572ff622b9.zip
Imitate the way the original game is playing MIDI tracks when playing enhanced ones
svn-id: r35837
-rw-r--r--engines/tinsel/music.cpp55
1 files changed, 30 insertions, 25 deletions
diff --git a/engines/tinsel/music.cpp b/engines/tinsel/music.cpp
index 4b5505e51d..39517b7413 100644
--- a/engines/tinsel/music.cpp
+++ b/engines/tinsel/music.cpp
@@ -181,29 +181,6 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
if (volMusic != 0) {
SetMidiVolume(volMusic);
-
- // Support for external music from the music enhancement project
- if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
- AudioCD.stop();
-
- int trackNumber = GetTrackNumber(dwFileOffset);
- if (trackNumber >= 0) {
- int track = 0;
- if (_vm->getFeatures() & GF_SCNFILES)
- track = enhancedAudioSCNVersion[trackNumber];
- else
- track = enhancedAudioGRAVersion[trackNumber];
-
- if (track > 0)
- AudioCD.play(track, -1, 0, 0);
- } else {
- warning("Unknown MIDI offset %d", dwFileOffset);
- }
-
- if (AudioCD.isPlaying())
- return true;
- }
-
}
// set file offset for this sequence
@@ -211,13 +188,41 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
// the index and length of the last tune loaded
static uint32 dwLastMidiIndex;
- static uint32 dwLastSeqLen;
+ //static uint32 dwLastSeqLen;
uint32 dwSeqLen = 0; // length of the sequence
if (dwMidiIndex == 0)
return true;
+ // Support for external music from the music enhancement project
+ if (_vm->getFeatures() & GF_ENHANCED_AUDIO_SUPPORT) {
+ int trackNumber = GetTrackNumber(dwFileOffset);
+ int track = 0;
+ if (trackNumber >= 0) {
+ if (_vm->getFeatures() & GF_SCNFILES)
+ track = enhancedAudioSCNVersion[trackNumber];
+ else
+ track = enhancedAudioGRAVersion[trackNumber];
+
+ if (track > 0) {
+ StopMidi();
+
+ AudioCD.play(track, bLoop ? -1 : 0, 0, 0);
+
+ // Check if an enhanced audio track is being played.
+ // If it is, stop here and don't load a MIDI track
+ if (AudioCD.isPlaying()) {
+ // allow another sequence to play
+ dwMidiIndex = 0;
+ return true;
+ }
+ }
+ } else {
+ warning("Unknown MIDI offset %d", dwFileOffset);
+ }
+ }
+
if (dwMidiIndex != dwLastMidiIndex) {
Common::File midiStream;
@@ -249,7 +254,7 @@ bool PlayMidiSequence(uint32 dwFileOffset, bool bLoop) {
_vm->_midiMusic->playXMIDI(midiBuffer.pDat, dwSeqLen, bLoop);
// Store the length
- dwLastSeqLen = dwSeqLen;
+ //dwLastSeqLen = dwSeqLen;
} else {
// dwMidiIndex == dwLastMidiIndex
_vm->_midiMusic->stop();