aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-06-01 19:32:36 +0000
committerPaweł Kołodziejski2004-06-01 19:32:36 +0000
commit136c7593d2dfaebb8110fbd5107be239bd6857dd (patch)
treed4c6434b3194d4e0057edcae052eb5555ac6ce5e /scumm
parent60954319feada480d81dfce61e57028c56dba524 (diff)
downloadscummvm-rg350-136c7593d2dfaebb8110fbd5107be239bd6857dd.tar.gz
scummvm-rg350-136c7593d2dfaebb8110fbd5107be239bd6857dd.tar.bz2
scummvm-rg350-136c7593d2dfaebb8110fbd5107be239bd6857dd.zip
fix for imuse digi bug 952775
svn-id: r13917
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse_digi/dimuse.cpp3
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.cpp39
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.h7
-rw-r--r--scumm/imuse_digi/dimuse_track.cpp3
4 files changed, 31 insertions, 21 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp
index 27bbedc8d0..f6880b7fa2 100644
--- a/scumm/imuse_digi/dimuse.cpp
+++ b/scumm/imuse_digi/dimuse.cpp
@@ -140,7 +140,8 @@ void IMuseDigital::saveOrLoad(Serializer *ser) {
track->soundHandle = _sound->openSound(track->soundId,
track->soundName, track->soundType,
- track->volGroupId);
+ track->volGroupId, -1);
+ assert(track->soundHandle);
int32 streamBufferSize = track->iteration;
int freq = _sound->getFreq(track->soundHandle);
track->stream2 = NULL;
diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp
index 3b4228121a..f0e423e955 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -219,7 +219,7 @@ int ImuseDigiSndMgr::allocSlot() {
return -1;
}
-bool ImuseDigiSndMgr::openMusicBundle(int slot) {
+bool ImuseDigiSndMgr::openMusicBundle(int slot, int disk) {
bool result = false;
_sounds[slot].bundle = new BundleMgr(_cacheBundleDir);
@@ -228,13 +228,16 @@ bool ImuseDigiSndMgr::openMusicBundle(int slot) {
result = _sounds[slot].bundle->openFile("music.bun", _vm->getGameDataPath());
} else {
char musicfile[20];
- sprintf(musicfile, "musdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
- if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) {
+ if (disk == -1)
+ sprintf(musicfile, "musdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
+ else
+ sprintf(musicfile, "musdisk%d.bun", disk);
+// if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) {
// _vm->_imuseDigital->parseScriptCmds(0x1000, 0, 0, 0, 0, 0, 0, 0);
// _vm->_imuseDigital->parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
// _vm->_imuseDigital->stopAllSounds();
- _sounds[slot].bundle->closeFile();
- }
+// _sounds[slot].bundle->closeFile();
+// }
result = _sounds[slot].bundle->openFile(musicfile, _vm->getGameDataPath());
@@ -250,7 +253,7 @@ bool ImuseDigiSndMgr::openMusicBundle(int slot) {
return result;
}
-bool ImuseDigiSndMgr::openVoiceBundle(int slot) {
+bool ImuseDigiSndMgr::openVoiceBundle(int slot, int disk) {
bool result = false;
_sounds[slot].bundle = new BundleMgr(_cacheBundleDir);
@@ -259,13 +262,16 @@ bool ImuseDigiSndMgr::openVoiceBundle(int slot) {
result = _sounds[slot].bundle->openFile("voice.bun", _vm->getGameDataPath());
} else {
char voxfile[20];
- sprintf(voxfile, "voxdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
- if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) {
+ if (disk == -1)
+ sprintf(voxfile, "voxdisk%d.bun", _vm->VAR(_vm->VAR_CURRENTDISK));
+ else
+ sprintf(voxfile, "voxdisk%d.bun", disk);
+// if (_disk != _vm->VAR(_vm->VAR_CURRENTDISK)) {
// _vm->_imuseDigital->parseScriptCmds(0x1000, 0, 0, 0, 0, 0, 0, 0);
// _vm->_imuseDigital->parseScriptCmds(0x2000, 0, 0, 0, 0, 0, 0, 0);
// _vm->_imuseDigital->stopAllSounds();
- _sounds[slot].bundle->closeFile();
- }
+// _sounds[slot].bundle->closeFile();
+// }
result = _sounds[slot].bundle->openFile(voxfile, _vm->getGameDataPath());
@@ -281,7 +287,7 @@ bool ImuseDigiSndMgr::openVoiceBundle(int slot) {
return result;
}
-ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const char *soundName, int soundType, int volGroupId) {
+ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const char *soundName, int soundType, int volGroupId, int disk) {
assert(soundId >= 0);
assert(soundType);
@@ -309,9 +315,9 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
} else if (soundType == IMUSE_BUNDLE) {
bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO));
if (volGroupId == IMUSE_VOLGRP_VOICE)
- result = openVoiceBundle(slot);
+ result = openVoiceBundle(slot, disk);
else if (volGroupId == IMUSE_VOLGRP_MUSIC)
- result = openMusicBundle(slot);
+ result = openMusicBundle(slot, disk);
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
if (!result) {
@@ -329,9 +335,9 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
if (soundType == IMUSE_BUNDLE) {
bool header_outside = ((_vm->_gameId == GID_CMI) && !(_vm->_features & GF_DEMO));
if (volGroupId == IMUSE_VOLGRP_VOICE)
- result = openVoiceBundle(slot);
+ result = openVoiceBundle(slot, disk);
else if (volGroupId == IMUSE_VOLGRP_MUSIC)
- result = openMusicBundle(slot);
+ result = openMusicBundle(slot, disk);
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
if (!result) {
@@ -353,6 +359,7 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
closeSound(&_sounds[slot]);
return NULL;
}
+ _sounds[slot].disk = _disk;
prepareSound(ptr, slot);
return &_sounds[slot];
}
@@ -378,7 +385,7 @@ void ImuseDigiSndMgr::closeSound(soundStruct *soundHandle) {
ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::cloneSound(soundStruct *soundHandle) {
assert(soundHandle && checkForProperHandle(soundHandle));
- return openSound(soundHandle->soundId, soundHandle->name, soundHandle->type, soundHandle->volGroupId);
+ return openSound(soundHandle->soundId, soundHandle->name, soundHandle->type, soundHandle->volGroupId, soundHandle->disk);
}
bool ImuseDigiSndMgr::checkForProperHandle(soundStruct *soundHandle) {
diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h
index ba9f28b852..e95f0b22c5 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.h
+++ b/scumm/imuse_digi/dimuse_sndmgr.h
@@ -83,6 +83,7 @@ public:
BundleMgr *bundle;
int type;
int volGroupId;
+ int disk;
};
private:
@@ -97,8 +98,8 @@ private:
byte _disk;
BundleDirCache *_cacheBundleDir;
- bool openMusicBundle(int slot);
- bool openVoiceBundle(int slot);
+ bool openMusicBundle(int slot, int disk);
+ bool openVoiceBundle(int slot, int disk);
void countElements(byte *ptr, int &numRegions, int &numJumps, int &numSyncs);
@@ -107,7 +108,7 @@ public:
ImuseDigiSndMgr(ScummEngine *scumm);
~ImuseDigiSndMgr();
- soundStruct *openSound(int32 soundId, const char *soundName, int soundType, int volGroupId);
+ soundStruct *openSound(int32 soundId, const char *soundName, int soundType, int volGroupId, int disk);
void closeSound(soundStruct *soundHandle);
soundStruct *cloneSound(soundStruct *soundHandle);
diff --git a/scumm/imuse_digi/dimuse_track.cpp b/scumm/imuse_digi/dimuse_track.cpp
index df9cd74c63..ae580d706e 100644
--- a/scumm/imuse_digi/dimuse_track.cpp
+++ b/scumm/imuse_digi/dimuse_track.cpp
@@ -115,7 +115,7 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
} else {
track->souStream = false;
strcpy(track->soundName, soundName);
- track->soundHandle = _sound->openSound(soundId, soundName, soundType, volGroupId);
+ track->soundHandle = _sound->openSound(soundId, soundName, soundType, volGroupId, -1);
if (track->soundHandle == NULL)
return;
@@ -297,6 +297,7 @@ int IMuseDigital::cloneToFadeOutTrack(int trackId, int fadeDelay) {
strcpy(fadeTrack->soundName, track->soundName);
fadeTrack->soundType = track->soundType;
fadeTrack->soundHandle = _sound->cloneSound(track->soundHandle);
+ assert(fadeTrack->soundHandle);
}
fadeTrack->volFadeDelay = fadeDelay;