aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorPaweł Kołodziejski2004-01-08 08:39:25 +0000
committerPaweł Kołodziejski2004-01-08 08:39:25 +0000
commit201902bfefd1b70232e863d0515f290fd47bf5b7 (patch)
tree8b0d612cd8bcf7d3719f650753b2cf141b3ec159 /scumm
parentd9e67812e8764cc0e8fac568ed9c699436a1b564 (diff)
downloadscummvm-rg350-201902bfefd1b70232e863d0515f290fd47bf5b7.tar.gz
scummvm-rg350-201902bfefd1b70232e863d0515f290fd47bf5b7.tar.bz2
scummvm-rg350-201902bfefd1b70232e863d0515f290fd47bf5b7.zip
jumps only for the same hookid and ignore jumps for music for now. added sound names for checks if some sounds are really have a lot jumps and regions(it's posssible), in bundle loop size can be 0 and after that loops should be ended
svn-id: r12236
Diffstat (limited to 'scumm')
-rw-r--r--scumm/imuse_digi/dimuse.cpp19
-rw-r--r--scumm/imuse_digi/dimuse_bndmgr.cpp4
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.cpp11
-rw-r--r--scumm/imuse_digi/dimuse_sndmgr.h2
4 files changed, 24 insertions, 12 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp
index 9944cd427f..268c675553 100644
--- a/scumm/imuse_digi/dimuse.cpp
+++ b/scumm/imuse_digi/dimuse.cpp
@@ -203,9 +203,13 @@ void IMuseDigital::switchToNextRegion(int track) {
return;
}
- int region = checkJumpByRegion(track, _track[track].curRegion);
- if (region != -1)
- _track[track].curRegion = region;
+ int hookid = _sound->getJumpIdByRegion(_track[track].soundHandle, _track[track].curRegion);
+ if (hookid == _track[track].curHookId) {
+ int region = checkJumpByRegion(track, _track[track].curRegion);
+ if ((region != -1) && (_track[track].soundGroup != IMUSE_MUSIC))
+ _track[track].curRegion = region;
+ }
+
_track[track].regionOffset = 0;
}
@@ -268,9 +272,6 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
error("IMuseDigital::startSound(): Can't handle %d bit samples", bits);
_track[l].pullSize /= 25; // We want a "frame rate" of 25 audio blocks per second
-
- if (soundGroup == IMUSE_MUSIC)
- _curMusicId = soundId;
}
if (input) {
@@ -282,6 +283,11 @@ void IMuseDigital::startSound(int soundId, const char *soundName, int soundType,
_scumm->_mixer->playInputStream(&_track[l].handle, _track[l].stream, true, _track[l].vol / 1000, _track[l].pan, -1);
}
+ if (soundGroup == IMUSE_MUSIC) {
+ stopMusic();
+ _curMusicId = soundId;
+ }
+
_track[l].used = true;
return;
}
@@ -324,6 +330,7 @@ void IMuseDigital::stopAllSounds() {
_scumm->_mixer->stopHandle(_track[l].handle);
}
}
+ _curMusicId = -1;
}
void IMuseDigital::pause(bool p) {
diff --git a/scumm/imuse_digi/dimuse_bndmgr.cpp b/scumm/imuse_digi/dimuse_bndmgr.cpp
index 300962a33b..e1ce994287 100644
--- a/scumm/imuse_digi/dimuse_bndmgr.cpp
+++ b/scumm/imuse_digi/dimuse_bndmgr.cpp
@@ -211,7 +211,6 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size,
comp_input[0x2000-1] = 0;
for (i = first_block; i <= last_block; i++) {
- assert(size);
assert(0x2000 >= _compTable[i].size + 1);
byte *curBuf;
@@ -239,6 +238,9 @@ int32 BundleMgr::decompressSampleByIndex(int32 index, int32 offset, int32 size,
final_size += output_size;
size -= output_size;
+ assert(size >= 0);
+ if (size == 0)
+ break;
skip = 0;
}
free(comp_input);
diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp
index cc313d6da2..060ccc2637 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.cpp
+++ b/scumm/imuse_digi/dimuse_sndmgr.cpp
@@ -39,7 +39,8 @@ ImuseDigiSndMgr::ImuseDigiSndMgr(ScummEngine *scumm) {
ImuseDigiSndMgr::~ImuseDigiSndMgr() {
for (int l = 0; l < MAX_IMUSE_SOUNDS; l++) {
- closeSound(&_sounds[l]);
+ if (&_sounds[l])
+ closeSound(&_sounds[l]);
}
delete _cacheBundleDir;
}
@@ -74,7 +75,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) {
case MKID_BE('TEXT'):
size = READ_BE_UINT32(ptr); ptr += 4;
if (_sounds[slot].numMarkers >= MAX_IMUSE_MARKERS) {
- warning("ImuseDigiSndMgr::prepareSound() Not enough space for Marker");
+ warning("ImuseDigiSndMgr::prepareSound(%s) Not enough space for Marker", _sounds[slot].name);
ptr += size;
break;
}
@@ -85,7 +86,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) {
case MKID_BE('REGN'):
size = READ_BE_UINT32(ptr); ptr += 4;
if (_sounds[slot].numRegions >= MAX_IMUSE_REGIONS) {
- warning("ImuseDigiSndMgr::prepareSound() Not enough space for Region");
+ warning("ImuseDigiSndMgr::prepareSound(%s) Not enough space for Region", _sounds[slot].name);
ptr += 8;
break;
}
@@ -100,7 +101,7 @@ void ImuseDigiSndMgr::prepareSound(byte *ptr, int slot) {
case MKID_BE('JUMP'):
size = READ_BE_UINT32(ptr); ptr += 4;
if (_sounds[slot].numJumps >= MAX_IMUSE_JUMPS) {
- warning("ImuseDigiSndMgr::prepareSound() Not enough space for Jump");
+ warning("ImuseDigiSndMgr::prepareSound(%s) Not enough space for Jump", _sounds[slot].name);
ptr += size;
break;
}
@@ -221,6 +222,7 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
_sounds[slot]._bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0);
+ strcpy(_sounds[slot].name, soundName);
} else {
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
}
@@ -233,6 +235,7 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
_sounds[slot]._bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr);
+ _sounds[slot].name[0] = 0;
} else {
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %s", soundName);
}
diff --git a/scumm/imuse_digi/dimuse_sndmgr.h b/scumm/imuse_digi/dimuse_sndmgr.h
index ca972d1662..9e72b7d719 100644
--- a/scumm/imuse_digi/dimuse_sndmgr.h
+++ b/scumm/imuse_digi/dimuse_sndmgr.h
@@ -30,7 +30,6 @@ namespace Scumm {
class ScummEngine;
class BundleMgr;
-class ImuseDigital;
class ImuseDigiSndMgr {
public:
@@ -78,6 +77,7 @@ public:
byte *allData;
int32 offsetData;
byte *resPtr;
+ char name[30];
bool freeResPtr;
BundleMgr *_bundle;
_region region[MAX_IMUSE_REGIONS];