diff -ur ScummVM-cvs20040617/scumm/imuse_digi/dimuse.h ScummVM-cvs20040617+hack/scumm/imuse_digi/dimuse.h
old
|
new
|
|
159 | 159 | void refreshScripts(); |
160 | 160 | void flushTracks(); |
161 | 161 | int getSoundStatus(int sound) const; |
| 162 | bool isSoundInUse(int sound) const; |
162 | 163 | int32 getCurMusicPosInMs(); |
163 | 164 | int32 getCurVoiceLipSyncWidth(); |
164 | 165 | int32 getCurVoiceLipSyncHeight(); |
diff -ur ScummVM-cvs20040617/scumm/imuse_digi/dimuse_script.cpp ScummVM-cvs20040617+hack/scumm/imuse_digi/dimuse_script.cpp
old
|
new
|
|
274 | 274 | return 0; |
275 | 275 | } |
276 | 276 | |
| 277 | bool IMuseDigital::isSoundInUse(int sound) const { |
| 278 | Common::StackLock lock(_mutex, "IMuseDigital::isSoundInUse()"); |
| 279 | |
| 280 | for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { |
| 281 | Track *track = _track[l]; |
| 282 | if (track->soundId == sound) |
| 283 | return true; |
| 284 | } |
| 285 | return false; |
| 286 | } |
| 287 | |
277 | 288 | void IMuseDigital::stopSound(int soundId) { |
278 | 289 | debug(5, "IMuseDigital::stopSound(%d)", soundId); |
279 | 290 | for (int l = 0; l < MAX_DIGITAL_TRACKS; l++) { |
diff -ur ScummVM-cvs20040617/scumm/imuse_digi/dimuse_sndmgr.cpp ScummVM-cvs20040617+hack/scumm/imuse_digi/dimuse_sndmgr.cpp
old
|
new
|
|
302 | 302 | _sounds[slot].name[0] = 0; |
303 | 303 | if ((soundType == IMUSE_RESOURCE)) { |
304 | 304 | _vm->ensureResourceLoaded(rtSound, soundId); |
305 | | _vm->lock(rtSound, soundId); |
306 | 305 | ptr = _vm->getResourceAddress(rtSound, soundId); |
307 | 306 | if (ptr == NULL) { |
308 | 307 | closeSound(&_sounds[slot]); |
… |
… |
|
371 | 370 | void ImuseDigiSndMgr::closeSound(soundStruct *soundHandle) { |
372 | 371 | assert(soundHandle && checkForProperHandle(soundHandle)); |
373 | 372 | |
374 | | if (soundHandle->resPtr) |
375 | | _vm->unlock(rtSound, soundHandle->soundId); |
376 | | |
377 | 373 | delete soundHandle->bundle; |
378 | 374 | for (int r = 0; r < soundHandle->numSyncs; r++) |
379 | 375 | free(soundHandle->sync[r].ptr); |
diff -ur ScummVM-cvs20040617/scumm/sound.cpp ScummVM-cvs20040617+hack/scumm/sound.cpp
old
|
new
|
|
679 | 679 | * are being faded out: get_sound_active() returns true even when the |
680 | 680 | * sound is being faded out, while getSoundStatus() returns false in |
681 | 681 | * that case. |
| 682 | * In addition, it calls isSoundInUse() instead of getSoundStatus() in |
| 683 | * IMuseDigital. The difference between these two is that the isSoundInUse() |
| 684 | * doesn't require that the mixer is playing the sound at the moment. |
682 | 685 | */ |
683 | 686 | bool Sound::isSoundInUse(int sound) const { |
684 | 687 | |
685 | 688 | if (_vm->_imuseDigital) |
686 | | return (_vm->_imuseDigital->getSoundStatus(sound) != 0); |
| 689 | return _vm->_imuseDigital->isSoundInUse(sound); |
687 | 690 | |
688 | 691 | if (sound == _currentCDSound) |
689 | 692 | return pollCD() != 0; |