fix for region code

svn-id: r13501
This commit is contained in:
Paweł Kołodziejski 2004-04-08 21:13:25 +00:00
parent 5ab0ba430b
commit 83b7d7f84c
3 changed files with 13 additions and 14 deletions

View File

@ -222,21 +222,21 @@ void IMuseDigital::switchToNextRegion(int track) {
return;
}
int jumpId = _sound->getJumpIdByRegionAndHookId(_track[track].soundHandle, _track[track].curRegion, _track[track].curHookId);
int jumpId = _sound->getJumpIdByRegion(_track[track].soundHandle, _track[track].curRegion);
if (jumpId != -1) {
int region = _sound->getRegionIdByJumpId(_track[track].soundHandle, jumpId);
if (region != -1) {
int sampleHookId = _sound->getJumpHookId(_track[track].soundHandle, jumpId);
if (sampleHookId != 0) {
if (_track[track].curHookId == sampleHookId) {
_track[track].curRegion = region;
debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
_track[track].curHookId = 0;
}
} else {
assert(region != -1);
int sampleHookId = _sound->getJumpHookId(_track[track].soundHandle, jumpId);
assert(sampleHookId != -1);
if (sampleHookId != 0) {
if (_track[track].curHookId == sampleHookId) {
_track[track].curRegion = region;
debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
_track[track].curHookId = 0;
}
} else {
_track[track].curRegion = region;
debug(5, "switchToNextRegion-sound(%d) jump to %d region, curHookId: %d", _track[track].soundId, _track[track].curRegion, _track[track].curHookId);
}
}

View File

@ -395,13 +395,12 @@ int ImuseDigiSndMgr::getRegionOffset(soundStruct *soundHandle, int region) {
return soundHandle->region[region].offset;
}
int ImuseDigiSndMgr::getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId) {
int ImuseDigiSndMgr::getJumpIdByRegion(soundStruct *soundHandle, int region) {
assert(soundHandle && checkForProperHandle(soundHandle));
assert(region >= 0 && region < soundHandle->numRegions);
for (int l = 0; l < soundHandle->numJumps; l++) {
if (soundHandle->jump[l].offset == soundHandle->region[region].offset) {
if (soundHandle->jump[l].hookId == hookId)
return l;
return l;
}
}

View File

@ -115,7 +115,7 @@ public:
int getNumRegions(soundStruct *soundHandle);
int getNumJumps(soundStruct *soundHandle);
int getRegionOffset(soundStruct *soundHandle, int region);
int getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId);
int getJumpIdByRegion(soundStruct *soundHandle, int region);
int getRegionIdByJumpId(soundStruct *soundHandle, int jumpId);
int getJumpHookId(soundStruct *soundHandle, int number);
int getJumpFade(soundStruct *soundHandle, int number);