From 4ead10e4d5352e2fd0311ee09a5a99195d5fd97e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sun, 22 Jun 2003 11:47:03 +0000 Subject: Change names of the stream API in the mixer; added endStream method (stop() halts stream immediately; endStream() lets it first finish playing) svn-id: r8603 --- scumm/imuse_digi.cpp | 6 +++--- scumm/smush/smush_mixer.cpp | 6 ++++-- scumm/smush/smush_player.cpp | 11 ++++++++--- scumm/sound.cpp | 6 +++--- 4 files changed, 18 insertions(+), 11 deletions(-) (limited to 'scumm') diff --git a/scumm/imuse_digi.cpp b/scumm/imuse_digi.cpp index f31db2272b..fdfcc73eff 100644 --- a/scumm/imuse_digi.cpp +++ b/scumm/imuse_digi.cpp @@ -715,7 +715,7 @@ void IMuseDigital::handler() { if (_channel[l]._used) { if (_channel[l]._toBeRemoved == true) { if (_channel[l]._mixerChannel != -1) { - _scumm->_mixer->stop(_channel[l]._mixerChannel); + _scumm->_mixer->endStream(_channel[l]._mixerChannel); _channel[l]._mixerChannel = -1; } if (_scumm->_mixer->_channels[l] == NULL) { @@ -824,10 +824,10 @@ void IMuseDigital::handler() { if (_scumm->_silentDigitalImuse == false) { if (_channel[l]._mixerChannel == -1) { - _channel[l]._mixerChannel = _scumm->_mixer->playStream(buf, mixer_size, + _channel[l]._mixerChannel = _scumm->_mixer->newStream(buf, mixer_size, _channel[l]._freq, _channel[l]._mixerFlags, 100000); } else { - _scumm->_mixer->append(_channel[l]._mixerChannel, buf, mixer_size); + _scumm->_mixer->appendStream(_channel[l]._mixerChannel, buf, mixer_size); } } free(buf); diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index 9f74b5252d..3de25e95d1 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -109,6 +109,8 @@ bool SmushMixer::handleFrame() { delete _channels[i].chan; _channels[i].id = -1; _channels[i].chan = NULL; + if (_channels[i].mixer_index != -1) + _mixer->endStream(_channels[i].mixer_index); } else { int32 rate; bool stereo, is_short; @@ -135,9 +137,9 @@ bool SmushMixer::handleFrame() { if (_silentMixer == false) { if (_channels[i].mixer_index == -1) { - _channels[i].mixer_index = _mixer->playStream(data, size, rate, flags, 2000000); + _channels[i].mixer_index = _mixer->newStream(data, size, rate, flags, 2000000); } else { - _mixer->append(_channels[i].mixer_index, data, size); + _mixer->appendStream(_channels[i].mixer_index, data, size); } } free(data); diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index d27a92f1c6..c3e9c829c7 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -223,7 +223,7 @@ SmushPlayer::SmushPlayer(Scumm *scumm, int speed, bool subtitles) { _storeFrame = false; _width = 0; _height = 0; - _IACTchannel = -1, + _IACTchannel = -1; _IACTpos = 0; _soundFrequency = 22050; _speed = speed; @@ -283,6 +283,11 @@ void SmushPlayer::deinit() { delete _base; _base = NULL; } + + if (_IACTchannel != -1) { + _scumm->_mixer->stop(_IACTchannel); + _IACTchannel = -1; + } _scumm->_insaneState = false; _scumm->abortCutscene(); @@ -451,10 +456,10 @@ void SmushPlayer::handleImuseAction(Chunk &b) { } while (--count); if (_IACTchannel == -1) { - _IACTchannel = _scumm->_mixer->playStream(output_data, 0x1000, 22050, + _IACTchannel = _scumm->_mixer->newStream(output_data, 0x1000, 22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 200000); } else { - _scumm->_mixer->append(_IACTchannel, output_data, 0x1000); + _scumm->_mixer->appendStream(_IACTchannel, output_data, 0x1000); } bsize -= len; diff --git a/scumm/sound.cpp b/scumm/sound.cpp index 5eaf0beedc..3d6ea2a222 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -1170,16 +1170,16 @@ void Sound::bundleMusicHandler(Scumm *scumm) { final_size = _outputMixerSize; memcpy(buffer, ptr, _outputMixerSize); } else { - warning("Sound::bundleMusicHandler TODO: more playStream options..."); + warning("Sound::bundleMusicHandler TODO: more newStream options..."); return; } _bundleMusicPosition += final_size; if (_bundleMusicTrack == -1) { - _bundleMusicTrack = _scumm->_mixer->playStream(buffer, final_size, rate, + _bundleMusicTrack = _scumm->_mixer->newStream(buffer, final_size, rate, SoundMixer::FLAG_16BITS | SoundMixer::FLAG_STEREO, 300000); } else { - _scumm->_mixer->append(_bundleMusicTrack, buffer, final_size); + _scumm->_mixer->appendStream(_bundleMusicTrack, buffer, final_size); } free(buffer); } -- cgit v1.2.3