aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/resource_audio.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2010-08-19 13:52:21 +0000
committerFilippos Karapetis2010-08-19 13:52:21 +0000
commit37d2f102061cbafdde3060bbe1d7165817ffb676 (patch)
treea63d0ecd5898891a9f81a90455d1bb3ce9ab6c34 /engines/sci/resource_audio.cpp
parent26dc4c24256472898f4388de73699a5f54f4a2cf (diff)
downloadscummvm-rg350-37d2f102061cbafdde3060bbe1d7165817ffb676.tar.gz
scummvm-rg350-37d2f102061cbafdde3060bbe1d7165817ffb676.tar.bz2
scummvm-rg350-37d2f102061cbafdde3060bbe1d7165817ffb676.zip
SCI: Added checking for the existence of a GM track, to determine if device ID 7 or 12 should be used. Fixes the GM music in the demo of QFG3, which is using an in-between version of SCI1 and SCI1.1
svn-id: r52211
Diffstat (limited to 'engines/sci/resource_audio.cpp')
-rw-r--r--engines/sci/resource_audio.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index a25505fe47..5457c1eb38 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -519,6 +519,35 @@ int ResourceManager::getAudioLanguage() const {
return (_audioMapSCI1 ? _audioMapSCI1->_volumeNumber : 0);
}
+bool ResourceManager::isGMTrackIncluded() {
+ // This check only makes sense for SCI1 and newer games
+ if (getSciVersion() < SCI_VERSION_1_EARLY)
+ return false;
+
+ // SCI2 and newer games always have GM tracks
+ if (getSciVersion() >= SCI_VERSION_2)
+ return true;
+
+ // For the leftover games, we can safely use SCI_VERSION_1_EARLY for the soundVersion
+ const SciVersion soundVersion = SCI_VERSION_1_EARLY;
+
+ // Read song 1 and check if it has a GM track
+ bool result = false;
+ SoundResource *song1 = new SoundResource(1, this, soundVersion);
+ if (!song1) {
+ warning("ResourceManager::isGMTrackIncluded: track 1 not found");
+ return false;
+ }
+
+ SoundResource::Track *gmTrack = song1->getTrackByType(0x07);
+ if (gmTrack)
+ result = true;
+
+ delete song1;
+
+ return result;
+}
+
SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVersion soundVersion) : _resMan(resMan), _soundVersion(soundVersion) {
Resource *resource = _resMan->findResource(ResourceId(kResourceTypeSound, resourceNr), true);
int trackNr, channelNr;