diff options
author | Paweł Kołodziejski | 2004-04-24 20:41:30 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2004-04-24 20:41:30 +0000 |
commit | bcb5005c31ae5aa82342a7f2aebfb02856f1eeba (patch) | |
tree | dc56530ef6679a3c92e50d1f2dea3d42cc24e2bd /scumm | |
parent | be28bc0403251f4f13e6ef9db7f5ff17e16a4e87 (diff) | |
download | scummvm-rg350-bcb5005c31ae5aa82342a7f2aebfb02856f1eeba.tar.gz scummvm-rg350-bcb5005c31ae5aa82342a7f2aebfb02856f1eeba.tar.bz2 scummvm-rg350-bcb5005c31ae5aa82342a7f2aebfb02856f1eeba.zip |
few corrections, more debug
svn-id: r13618
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/imuse_digi/dimuse.cpp | 36 | ||||
-rw-r--r-- | scumm/imuse_digi/dimuse_sndmgr.cpp | 6 |
2 files changed, 30 insertions, 12 deletions
diff --git a/scumm/imuse_digi/dimuse.cpp b/scumm/imuse_digi/dimuse.cpp index cee881727a..83c1688bf4 100644 --- a/scumm/imuse_digi/dimuse.cpp +++ b/scumm/imuse_digi/dimuse.cpp @@ -87,8 +87,18 @@ int IMuseDigital::pullProcCallback(void *refCon, CustomProcInputStream *stream, int IMuseDigital::pullProc(CustomProcInputStream *stream, byte *mixerBuffer, int pullSize) { Common::StackLock lock(_mutex, "IMuseDigital::pullProc()"); + debug(5, "pullProc() pullSize:%d", pullSize); for (int l = 0; l < MAX_DIGITAL_TRACKS + MAX_DIGITAL_FADETRACKS; l++) { if ((_track[l]->used) && (_track[l]->stream == stream)) { + if (_track[l]->toBeRemoved) { + debug(5, "IMuseDigital::pullProc() stopped sound: %d", _track[l]->soundId); + _track[l]->stream->finish(); + _track[l]->stream = NULL; + _sound->closeSound(_track[l]->soundHandle); + _track[l]->soundHandle = NULL; + _track[l]->used = false; + return 0; + } _vm->_mixer->setChannelVolume(_track[l]->handle, _track[l]->mixerVol); _vm->_mixer->setChannelBalance(_track[l]->handle, _track[l]->mixerPan); int32 mixer_size = pullSize; @@ -97,11 +107,19 @@ int IMuseDigital::pullProc(CustomProcInputStream *stream, byte *mixerBuffer, int if (_track[l]->curRegion == -1) { switchToNextRegion(l); - if (_track[l]->toBeRemoved) - continue; + if (_track[l]->toBeRemoved) { + return 0; + } } int bits = _sound->getBits(_track[l]->soundHandle); + int channels = _sound->getChannels(_track[l]->soundHandle); + + if ((bits == 16) && (channels == 2)) + assert((pullSize & 3) == 0); + else if ((bits == 16) || (channels == 2)) + assert((pullSize & 1) == 0); + do { if (bits == 12) { byte *ptr = NULL; @@ -175,16 +193,6 @@ void IMuseDigital::callback() { _track[l]->used = false; continue; } - } else if (_track[l]->stream) { - if (_track[l]->toBeRemoved) { - debug(5, "IMuseDigital::callback() B: stopped sound: %d", _track[l]->soundId); - _track[l]->stream->finish(); - _track[l]->stream = NULL; - _sound->closeSound(_track[l]->soundHandle); - _track[l]->soundHandle = NULL; - _track[l]->used = false; - continue; - } } if (_track[l]->volFadeUsed) { @@ -390,8 +398,11 @@ void IMuseDigital::callback() { #endif void IMuseDigital::switchToNextRegion(int track) { + debug(5, "switchToNextRegion(track:%d)", track); + if (track >= MAX_DIGITAL_TRACKS) { _track[track]->toBeRemoved = true; + debug(5, "exit (fadetrack can't go next region) switchToNextRegion(track:%d)", track); return; } @@ -399,6 +410,7 @@ void IMuseDigital::switchToNextRegion(int track) { if (++_track[track]->curRegion == num_regions) { _track[track]->toBeRemoved = true; + debug(5, "exit (end of regions) switchToNextRegion(track:%d)", track); return; } diff --git a/scumm/imuse_digi/dimuse_sndmgr.cpp b/scumm/imuse_digi/dimuse_sndmgr.cpp index 14945070d6..1f6e343586 100644 --- a/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -411,12 +411,14 @@ int ImuseDigiSndMgr::getNumJumps(soundStruct *soundHandle) { } int ImuseDigiSndMgr::getRegionOffset(soundStruct *soundHandle, int region) { + debug(5, "getRegionOffset() region:%d"); assert(soundHandle && checkForProperHandle(soundHandle)); assert(region >= 0 && region < soundHandle->numRegions); return soundHandle->region[region].offset; } int ImuseDigiSndMgr::getJumpIdByRegionAndHookId(soundStruct *soundHandle, int region, int hookId) { + debug(5, "getJumpIdByRegionAndHookId() region:%d, hookId:%d", region, hookId); assert(soundHandle && checkForProperHandle(soundHandle)); assert(region >= 0 && region < soundHandle->numRegions); for (int l = 0; l < soundHandle->numJumps; l++) { @@ -442,6 +444,7 @@ void ImuseDigiSndMgr::getSyncSizeAndPtrById(soundStruct *soundHandle, int number } int ImuseDigiSndMgr::getRegionIdByJumpId(soundStruct *soundHandle, int jumpId) { + debug(5, "getRegionIdByJumpId() jumpId:%d", jumpId); assert(soundHandle && checkForProperHandle(soundHandle)); assert(jumpId >= 0 && jumpId < soundHandle->numJumps); for (int l = 0; l < soundHandle->numRegions; l++) { @@ -454,18 +457,21 @@ int ImuseDigiSndMgr::getRegionIdByJumpId(soundStruct *soundHandle, int jumpId) { } int ImuseDigiSndMgr::getJumpHookId(soundStruct *soundHandle, int number) { + debug(5, "getJumpHookId() number:%d", number); assert(soundHandle && checkForProperHandle(soundHandle)); assert(number >= 0 && number < soundHandle->numJumps); return soundHandle->jump[number].hookId; } int ImuseDigiSndMgr::getJumpFade(soundStruct *soundHandle, int number) { + debug(5, "getJumpFade() number:%d", number); assert(soundHandle && checkForProperHandle(soundHandle)); assert(number >= 0 && number < soundHandle->numJumps); return soundHandle->jump[number].fadeDelay; } int32 ImuseDigiSndMgr::getDataFromRegion(soundStruct *soundHandle, int region, byte **buf, int32 offset, int32 size) { + debug(5, "getDataFromRegion() region:%d, offset:%d, size:%d, numRegions:%d", region, offset, size, soundHandle->numRegions); assert(soundHandle && checkForProperHandle(soundHandle)); assert(buf && offset >= 0 && size >= 0); assert(region >= 0 && region < soundHandle->numRegions); |