From c51b1266c07d3fbd1d5236a6e5d1dbc1a685203b Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 27 Nov 2004 17:09:05 +0000 Subject: Removed the (highly SCUMM specific) 'appendable stream' API from SoundMixer; SCUMM now uses the appendable stream directly svn-id: r15919 --- scumm/smush/smush_mixer.cpp | 14 +++++++++----- scumm/smush/smush_mixer.h | 2 ++ scumm/smush/smush_player.cpp | 9 ++++++--- scumm/smush/smush_player.h | 3 +++ 4 files changed, 20 insertions(+), 8 deletions(-) (limited to 'scumm') diff --git a/scumm/smush/smush_mixer.cpp b/scumm/smush/smush_mixer.cpp index 3c0471e178..f7309cb87e 100644 --- a/scumm/smush/smush_mixer.cpp +++ b/scumm/smush/smush_mixer.cpp @@ -93,7 +93,8 @@ bool SmushMixer::handleFrame() { delete _channels[i].chan; _channels[i].id = -1; _channels[i].chan = NULL; - _mixer->endStream(_channels[i].handle); + _channels[i].stream->finish(); + _channels[i].stream = 0; } else { int32 rate, vol, pan; bool stereo, is_16bit; @@ -119,11 +120,13 @@ bool SmushMixer::handleFrame() { } if (_mixer->isReady()) { - if (!_channels[i].handle.isActive()) - _mixer->newStream(&_channels[i].handle, rate, flags, 500000); + if (!_channels[i].handle.isActive()) { + _channels[i].stream = makeAppendableAudioStream(rate, flags, 500000); + _mixer->playInputStream(&_channels[i].handle, _channels[i].stream, false); + } _mixer->setChannelVolume(_channels[i].handle, vol); _mixer->setChannelBalance(_channels[i].handle, pan); - _mixer->appendStream(_channels[i].handle, data, size); + _channels[i].stream->append((byte *)data, size); } free(data); } @@ -139,7 +142,8 @@ bool SmushMixer::stop() { delete _channels[i].chan; _channels[i].id = -1; _channels[i].chan = NULL; - _mixer->endStream(_channels[i].handle); + _channels[i].stream->finish(); + _channels[i].stream = 0; } } return true; diff --git a/scumm/smush/smush_mixer.h b/scumm/smush/smush_mixer.h index da6b4be6f7..73f83ae578 100644 --- a/scumm/smush/smush_mixer.h +++ b/scumm/smush/smush_mixer.h @@ -23,6 +23,7 @@ #define SMUSH_MIXER_H #include "stdafx.h" +#include "sound/audiostream.h" #include "sound/mixer.h" namespace Scumm { @@ -40,6 +41,7 @@ private: int id; SmushChannel *chan; PlayingSoundHandle handle; + AppendableAudioStream *stream; } _channels[NUM_CHANNELS]; int _soundFrequency; diff --git a/scumm/smush/smush_player.cpp b/scumm/smush/smush_player.cpp index 5d6d764bf7..3852ebbb59 100644 --- a/scumm/smush/smush_player.cpp +++ b/scumm/smush/smush_player.cpp @@ -314,6 +314,7 @@ void SmushPlayer::release() { _vm->_mixer->stopHandle(_compressedFileSoundHandle); _vm->_mixer->stopHandle(_IACTchannel); + _IACTstream = 0; _vm->_fullRedraw = true; @@ -494,9 +495,11 @@ void SmushPlayer::handleIACT(Chunk &b) { } } while (--count); - if (!_IACTchannel.isActive()) - _vm->_mixer->newStream(&_IACTchannel, 22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); - _vm->_mixer->appendStream(_IACTchannel, output_data, 0x1000); + if (!_IACTchannel.isActive()) { + _IACTstream = makeAppendableAudioStream(22050, SoundMixer::FLAG_STEREO | SoundMixer::FLAG_16BITS, 400000); + _vm->_mixer->playInputStream(&_IACTchannel, _IACTstream, false); + } + _IACTstream->append(output_data, 0x1000); bsize -= len; d_src += len; diff --git a/scumm/smush/smush_player.h b/scumm/smush/smush_player.h index b9c0b5c7de..d0ce75da41 100644 --- a/scumm/smush/smush_player.h +++ b/scumm/smush/smush_player.h @@ -26,6 +26,7 @@ #include "scumm/smush/chunk.h" #include "scumm/smush/codec37.h" #include "scumm/smush/codec47.h" +#include "sound/audiostream.h" #include "sound/mixer.h" namespace Scumm { @@ -57,6 +58,8 @@ private: int32 _frame; PlayingSoundHandle _IACTchannel; + AppendableAudioStream *_IACTstream; + PlayingSoundHandle _compressedFileSoundHandle; bool _compressedFileMode; File _compressedFile; -- cgit v1.2.3