diff options
author | Max Horn | 2007-02-28 14:48:26 +0000 |
---|---|---|
committer | Max Horn | 2007-02-28 14:48:26 +0000 |
commit | 8c8abca6f80fc63b5c11fa43319cdf56b4845660 (patch) | |
tree | ec031a874e67c92d3640824c2ee9816b5b6cab90 /engines/scumm/smush/smush_mixer.cpp | |
parent | dea688d0f5303e552bff8ff22798719d92ed53c1 (diff) | |
download | scummvm-rg350-8c8abca6f80fc63b5c11fa43319cdf56b4845660.tar.gz scummvm-rg350-8c8abca6f80fc63b5c11fa43319cdf56b4845660.tar.bz2 scummvm-rg350-8c8abca6f80fc63b5c11fa43319cdf56b4845660.zip |
Changed the AppendableAudioStream code to use a queue of buffers, instead of a fixed size wrap-around memory buffer (this reduces memory usage in some cases by 500-700k, while actually being more flexible)
svn-id: r25909
Diffstat (limited to 'engines/scumm/smush/smush_mixer.cpp')
-rw-r--r-- | engines/scumm/smush/smush_mixer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/engines/scumm/smush/smush_mixer.cpp b/engines/scumm/smush/smush_mixer.cpp index 9e6631a365..e29a921224 100644 --- a/engines/scumm/smush/smush_mixer.cpp +++ b/engines/scumm/smush/smush_mixer.cpp @@ -105,6 +105,7 @@ bool SmushMixer::handleFrame() { _channels[i].chan->getParameters(stereo, is_16bit, vol, pan); + // Grab the audio data from the channel int32 size = _channels[i].chan->getAvailableSoundDataSize(); byte *data = _channels[i].chan->getSoundData(); @@ -116,15 +117,16 @@ bool SmushMixer::handleFrame() { } if (_mixer->isReady()) { + // Stream the data if (!_channels[i].stream) { - _channels[i].stream = Audio::makeAppendableAudioStream(_channels[i].chan->getRate(), flags, 500000); + _channels[i].stream = Audio::makeAppendableAudioStream(_channels[i].chan->getRate(), flags); _mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_channels[i].handle, _channels[i].stream); } _mixer->setChannelVolume(_channels[i].handle, vol); _mixer->setChannelBalance(_channels[i].handle, pan); - _channels[i].stream->append(data, size); - } - delete[] data; + _channels[i].stream->queueBuffer(data, size); // The stream will free the buffer for us + } else + delete[] data; } } } |