diff options
author | Paweł Kołodziejski | 2002-10-16 07:59:11 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2002-10-16 07:59:11 +0000 |
commit | 41b61adac07d3fc0cce03ef460a655d7d7cf2e20 (patch) | |
tree | 3ab1ec09e8cbf3a0a850e6d36eb8709f656e0898 | |
parent | 138aa3ce246449c6b060af7afb76e283203fff2e (diff) | |
download | scummvm-rg350-41b61adac07d3fc0cce03ef460a655d7d7cf2e20.tar.gz scummvm-rg350-41b61adac07d3fc0cce03ef460a655d7d7cf2e20.tar.bz2 scummvm-rg350-41b61adac07d3fc0cce03ef460a655d7d7cf2e20.zip |
fixes to imuse
svn-id: r5161
-rw-r--r-- | scumm/imuse.cpp | 29 | ||||
-rw-r--r-- | scumm/imuse.h | 2 | ||||
-rw-r--r-- | scumm/sound.cpp | 6 |
3 files changed, 21 insertions, 16 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp index 1da040876b..b128b950c4 100644 --- a/scumm/imuse.cpp +++ b/scumm/imuse.cpp @@ -4998,7 +4998,7 @@ IMuseDigital::IMuseDigital(Scumm *scumm) { memset(_channel, 0, sizeof(channel) * MAX_DIGITAL_CHANNELS); _scumm = scumm; for (int32 l = 0; l < MAX_DIGITAL_CHANNELS; l++) { - _channel[l]._mixerTrack = -1; + _channel[l]._initialized = false; } _scumm->_mixer->beginSlots(MAX_DIGITAL_CHANNELS + 1); _scumm->_timer->installProcedure(imus_digital_handler, 200); @@ -5411,8 +5411,12 @@ void IMuseDigital::handler() { for (l = 0; l < MAX_DIGITAL_CHANNELS;l ++) { if (_channel[l]._used) { if (_channel[l]._toBeRemoved == true) { - _channel[l]._used = false; - free(_channel[l]._data); + _scumm->_mixer->stop(l); + if (_scumm->_mixer->_channels[l] == NULL) { + free(_channel[l]._data); + _channel[l]._used = false; + _channel[l]._initialized = false; + } continue; } @@ -5457,10 +5461,9 @@ void IMuseDigital::handler() { uint32 new_size = _channel[l]._mixerSize; uint32 mixer_size = new_size; - if (_channel[l]._mixerTrack == -1) { + if (_channel[l]._initialized == false) { mixer_size *= 2; new_size *= 2; - } else { } if (_channel[l]._isJump == false) { @@ -5481,7 +5484,7 @@ void IMuseDigital::handler() { } byte *buf = (byte*)malloc(mixer_size); - + memcpy(buf, _channel[l]._data + _channel[l]._offset, new_size); if ((new_size != mixer_size) && (_channel[l]._isJump == true)) { memcpy(buf + new_size, _channel[l]._data + _channel[l]._jump[0]._dest, mixer_size - new_size); @@ -5513,12 +5516,12 @@ void IMuseDigital::handler() { } } - if (_channel[l]._mixerTrack == -1) { - _channel[l]._mixerTrack = _scumm->_mixer->playStream(NULL, l, buf, mixer_size, - _channel[l]._freq, _channel[l]._mixerFlags, -1, 800000); + if (_channel[l]._initialized == false) { + _scumm->_mixer->playStream(NULL, l, buf, mixer_size, + _channel[l]._freq, _channel[l]._mixerFlags, 3, 2000000); + _channel[l]._initialized = true; } else { - _scumm->_mixer->append(l, buf, mixer_size, - _channel[l]._freq, _channel[l]._mixerFlags); + _scumm->_mixer->append(l, buf, mixer_size, _channel[l]._freq, _channel[l]._mixerFlags); } } } @@ -5624,10 +5627,10 @@ void IMuseDigital::startSound(int sound) { if (tag == MKID_BE('DATA')) break; } - if ((sound == 123) || (sound == 122)) { +// if ((sound == 131) || (sound == 123) || (sound == 122)) { _channel[l]._isJump = false; _channel[l]._numJumps = 0; - } +// } uint32 header_size = ptr - s_ptr; _channel[l]._offsetStop -= header_size; diff --git a/scumm/imuse.h b/scumm/imuse.h index 0740d5d075..26942ba85b 100644 --- a/scumm/imuse.h +++ b/scumm/imuse.h @@ -105,7 +105,7 @@ private: uint8 _mixerFlags; bool _used; bool _toBeRemoved; - int32 _mixerTrack; + bool _initialized; } _channel[MAX_DIGITAL_CHANNELS]; Scumm * _scumm; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 2b790799d4..12db8dc8c5 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -943,7 +943,9 @@ void Sound::bundleMusicHandler(Scumm * scumm) { if (_musicBundleToBeRemoved == true) { _scumm->_timer->releaseProcedure(&music_handler); _nameBundleMusic = NULL; - _scumm->_mixer->stop(_bundleMusicTrack); + if (_bundleMusicTrack != -1) { + _scumm->_mixer->stop(_bundleMusicTrack); + } _bundleMusicTrack = -1; if (_musicBundleBufFinal) { free(_musicBundleBufFinal); @@ -1034,7 +1036,7 @@ void Sound::bundleMusicHandler(Scumm * scumm) { if (_bundleMusicTrack == -1) { _bundleMusicTrack = _scumm->_mixer->playStream(NULL, _scumm->_mixer->_beginSlots - 1, buffer, final_size, rate, - SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, -1, 800000); + SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, -1, 2000000); } else { _scumm->_mixer->append(_bundleMusicTrack, buffer, final_size, rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO); |