diff options
author | Alyssa Milburn | 2011-11-05 15:59:40 +0100 |
---|---|---|
committer | Alyssa Milburn | 2011-11-05 15:59:40 +0100 |
commit | 81785c60909b4a051afdd2f8050dbfc23d071b17 (patch) | |
tree | d0ce6f4ad987a1d823fee8b5ff92b409b2ca4599 | |
parent | 0fd1058386368b06d8054e7b4a7841ea19e9f0bd (diff) | |
download | scummvm-rg350-81785c60909b4a051afdd2f8050dbfc23d071b17.tar.gz scummvm-rg350-81785c60909b4a051afdd2f8050dbfc23d071b17.tar.bz2 scummvm-rg350-81785c60909b4a051afdd2f8050dbfc23d071b17.zip |
COMPOSER: Fix non-pipe audio buffers.
-rw-r--r-- | engines/composer/graphics.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp index bd3cc3afca..42d0a20d5a 100644 --- a/engines/composer/graphics.cpp +++ b/engines/composer/graphics.cpp @@ -188,8 +188,10 @@ void ComposerEngine::playWaveForAnim(uint16 id, uint16 priority, bool bufferingO } } Common::SeekableReadStream *stream = NULL; + bool fromPipe = true; if (!bufferingOnly && hasResource(ID_WAVE, id)) { stream = getResource(ID_WAVE, id); + fromPipe = false; } else { for (Common::List<Pipe *>::iterator k = _pipes.begin(); k != _pipes.end(); k++) { Pipe *pipe = *k; @@ -201,12 +203,18 @@ void ComposerEngine::playWaveForAnim(uint16 id, uint16 priority, bool bufferingO } if (!stream) return; - // FIXME: non-pipe buffers have fixed wav header (data at +44, size at +40) - byte *buffer = (byte *)malloc(stream->size()); - stream->read(buffer, stream->size()); + + uint32 size = stream->size(); + if (!fromPipe) { + // non-pipe buffers have fixed wav header (data at +44, size at +40) + stream->skip(40); + size = stream->readUint32LE(); + } + byte *buffer = (byte *)malloc(size); + stream->read(buffer, size); if (!_audioStream) _audioStream = Audio::makeQueuingAudioStream(22050, false); - _audioStream->queueBuffer(buffer, stream->size(), DisposeAfterUse::YES, Audio::FLAG_UNSIGNED); + _audioStream->queueBuffer(buffer, size, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED); _currSoundPriority = priority; delete stream; if (!_mixer->isSoundHandleActive(_soundHandle)) |