aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sound/drivers/midi.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2010-11-25 14:22:09 +0000
committerFilippos Karapetis2010-11-25 14:22:09 +0000
commit2c2f3a97e69184c23342fe77185cc37e87ed7813 (patch)
tree0e7bfeb030e5e30408572e028fa55d146f6168ce /engines/sci/sound/drivers/midi.cpp
parent394daa57044dc83e971041bcd62fbd12ee6b3174 (diff)
downloadscummvm-rg350-2c2f3a97e69184c23342fe77185cc37e87ed7813.tar.gz
scummvm-rg350-2c2f3a97e69184c23342fe77185cc37e87ed7813.tar.bz2
scummvm-rg350-2c2f3a97e69184c23342fe77185cc37e87ed7813.zip
SCI: Added support for the alternate Windows MIDI soundtracks of the CD versions of EcoQuest, Jones, KQ5 and SQ4
svn-id: r54476
Diffstat (limited to 'engines/sci/sound/drivers/midi.cpp')
-rw-r--r--engines/sci/sound/drivers/midi.cpp49
1 files changed, 32 insertions, 17 deletions
diff --git a/engines/sci/sound/drivers/midi.cpp b/engines/sci/sound/drivers/midi.cpp
index 7cc4e1922c..2b72310ad5 100644
--- a/engines/sci/sound/drivers/midi.cpp
+++ b/engines/sci/sound/drivers/midi.cpp
@@ -33,6 +33,7 @@
#include "sound/softsynth/emumidi.h"
#include "sci/resource.h"
+#include "sci/engine/features.h"
#include "sci/sound/drivers/gm_names.h"
#include "sci/sound/drivers/mididriver.h"
#include "sci/sound/drivers/map-mt32-to-gm.h"
@@ -58,7 +59,12 @@ public:
void sysEx(const byte *msg, uint16 length);
bool hasRhythmChannel() const { return true; }
byte getPlayId() const;
- int getPolyphony() const { return kVoices; }
+ int getPolyphony() const {
+ if (g_sci && g_sci->_features->useAltWinGMSound())
+ return 16;
+ else
+ return kVoices;
+ }
int getFirstChannel() const;
int getLastChannel() const;
void setVolume(byte volume);
@@ -840,14 +846,18 @@ int MidiPlayer_Midi::open(ResourceManager *resMan) {
_percussionVelocityScale[i] = 127;
}
- // Don't do any mapping for the Windows version of KQ5CD
- if (g_sci && g_sci->getGameId() == GID_KQ5 && g_sci->getPlatform() == Common::kPlatformWindows) {
- _useMT32Track = false;
- return 0;
- }
-
Resource *res = NULL;
+ if (g_sci && g_sci->_features->useAltWinGMSound()) {
+ res = resMan->findResource(ResourceId(kResourceTypePatch, 4), 0);
+ if (!(res && isMt32GmPatch(res->data, res->size))) {
+ // Don't do any mapping when a Windows alternative track is selected
+ // and no MIDI patch is available
+ _useMT32Track = false;
+ return 0;
+ }
+ }
+
if (_isMt32) {
// MT-32
resetMt32();
@@ -872,17 +882,22 @@ int MidiPlayer_Midi::open(ResourceManager *resMan) {
// There is a GM patch
readMt32GmPatch(res->data, res->size);
- // Detect the format of patch 1, so that we know what play mask to use
- res = resMan->findResource(ResourceId(kResourceTypePatch, 1), 0);
- if (!res)
+ if (g_sci && g_sci->_features->useAltWinGMSound()) {
+ // Always use the GM track if an alternative GM Windows soundtrack is selected
_useMT32Track = false;
- else
- _useMT32Track = !isMt32GmPatch(res->data, res->size);
-
- // Check if the songs themselves have a GM track
- if (!_useMT32Track) {
- if (!resMan->isGMTrackIncluded())
- _useMT32Track = true;
+ } else {
+ // Detect the format of patch 1, so that we know what play mask to use
+ res = resMan->findResource(ResourceId(kResourceTypePatch, 1), 0);
+ if (!res)
+ _useMT32Track = false;
+ else
+ _useMT32Track = !isMt32GmPatch(res->data, res->size);
+
+ // Check if the songs themselves have a GM track
+ if (!_useMT32Track) {
+ if (!resMan->isGMTrackIncluded())
+ _useMT32Track = true;
+ }
}
} else {
// No GM patch found, map instruments using MT-32 patch