diff options
Diffstat (limited to 'audio/decoders')
-rw-r--r-- | audio/decoders/3do.cpp | 1 | ||||
-rw-r--r-- | audio/decoders/3do.h | 9 | ||||
-rw-r--r-- | audio/decoders/adpcm.cpp | 7 | ||||
-rw-r--r-- | audio/decoders/adpcm.h | 4 | ||||
-rw-r--r-- | audio/decoders/adpcm_intern.h | 6 | ||||
-rw-r--r-- | audio/decoders/aiff.cpp | 8 | ||||
-rw-r--r-- | audio/decoders/vorbis.h | 1 | ||||
-rw-r--r-- | audio/decoders/wave.cpp | 2 | ||||
-rw-r--r-- | audio/decoders/wave.h | 6 |
9 files changed, 22 insertions, 22 deletions
diff --git a/audio/decoders/3do.cpp b/audio/decoders/3do.cpp index 6d558d4c8c..60cc515fdd 100644 --- a/audio/decoders/3do.cpp +++ b/audio/decoders/3do.cpp @@ -25,7 +25,6 @@ #include "common/util.h" #include "audio/decoders/3do.h" -#include "audio/decoders/raw.h" #include "audio/decoders/adpcm_intern.h" namespace Audio { diff --git a/audio/decoders/3do.h b/audio/decoders/3do.h index 7524358543..7f617c6643 100644 --- a/audio/decoders/3do.h +++ b/audio/decoders/3do.h @@ -31,19 +31,12 @@ #include "common/scummsys.h" #include "common/types.h" -#include "common/substream.h" +#include "common/stream.h" #include "audio/audiostream.h" -#include "audio/decoders/raw.h" - -namespace Common { -class SeekableReadStream; -} namespace Audio { -class SeekableAudioStream; - // amount of bytes to be used within the decoder classes as buffers #define AUDIO_3DO_CACHE_SIZE 1024 diff --git a/audio/decoders/adpcm.cpp b/audio/decoders/adpcm.cpp index fe5eec5dcc..ffb61a49c0 100644 --- a/audio/decoders/adpcm.cpp +++ b/audio/decoders/adpcm.cpp @@ -320,10 +320,11 @@ int MS_ADPCMStream::readBuffer(int16 *buffer, const int numSamples) { _decodedSamples[_decodedSampleCount++] = decodeMS(&_status.ch[0], (data >> 4) & 0x0f); _decodedSamples[_decodedSampleCount++] = decodeMS(&_status.ch[_channels - 1], data & 0x0f); } + _decodedSampleIndex = 0; } - // (1 - (count - 1)) ensures that _decodedSamples acts as a FIFO of depth 2 - buffer[samples] = _decodedSamples[1 - (_decodedSampleCount - 1)]; + // _decodedSamples acts as a FIFO of depth 2 or 4; + buffer[samples] = _decodedSamples[_decodedSampleIndex++]; _decodedSampleCount--; } @@ -433,7 +434,7 @@ int16 Ima_ADPCMStream::decodeIMA(byte code, int channel) { return samp; } -RewindableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, ADPCMType type, int rate, int channels, uint32 blockAlign) { +SeekableAudioStream *makeADPCMStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, ADPCMType type, int rate, int channels, uint32 blockAlign) { // If size is 0, report the entire size of the stream if (!size) size = stream->size(); diff --git a/audio/decoders/adpcm.h b/audio/decoders/adpcm.h index 650bc341b3..353fd3b71d 100644 --- a/audio/decoders/adpcm.h +++ b/audio/decoders/adpcm.h @@ -45,7 +45,7 @@ class SeekableReadStream; namespace Audio { class PacketizedAudioStream; -class RewindableAudioStream; +class SeekableAudioStream; // There are several types of ADPCM encoding, only some are supported here // For all the different encodings, refer to: @@ -74,7 +74,7 @@ enum ADPCMType { * @param blockAlign block alignment ??? * @return a new RewindableAudioStream, or NULL, if an error occurred */ -RewindableAudioStream *makeADPCMStream( +SeekableAudioStream *makeADPCMStream( Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse, uint32 size, ADPCMType type, diff --git a/audio/decoders/adpcm_intern.h b/audio/decoders/adpcm_intern.h index 92be704cca..f4a708c3fc 100644 --- a/audio/decoders/adpcm_intern.h +++ b/audio/decoders/adpcm_intern.h @@ -39,7 +39,7 @@ namespace Audio { -class ADPCMStream : public RewindableAudioStream { +class ADPCMStream : public SeekableAudioStream { protected: Common::DisposablePtr<Common::SeekableReadStream> _stream; int32 _startpos; @@ -67,6 +67,8 @@ public: virtual int getRate() const { return _rate; } virtual bool rewind(); + virtual bool seek(const Timestamp &where) { return false; } + virtual Timestamp getLength() const { return -1; } /** * This table is used by some ADPCM variants (IMA and OKI) to adjust the @@ -207,6 +209,7 @@ public: error("MS_ADPCMStream(): blockAlign isn't specified for MS ADPCM"); memset(&_status, 0, sizeof(_status)); _decodedSampleCount = 0; + _decodedSampleIndex = 0; } virtual bool endOfData() const { return (_stream->eos() || _stream->pos() >= _endpos) && (_decodedSampleCount == 0); } @@ -218,6 +221,7 @@ protected: private: uint8 _decodedSampleCount; + uint8 _decodedSampleIndex; int16 _decodedSamples[4]; }; diff --git a/audio/decoders/aiff.cpp b/audio/decoders/aiff.cpp index e1949ebb07..253b36dec0 100644 --- a/audio/decoders/aiff.cpp +++ b/audio/decoders/aiff.cpp @@ -129,6 +129,8 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos foundSSND = true; /* uint32 offset = */ stream->readUint32BE(); /* uint32 blockAlign = */ stream->readUint32BE(); + if (dataStream) + delete dataStream; dataStream = new Common::SeekableSubReadStream(stream, stream->pos(), stream->pos() + length - 8, disposeAfterUse); break; case MKTAG('F', 'V', 'E', 'R'): @@ -154,7 +156,7 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos return 0; default: debug(1, "Skipping AIFF '%s' chunk", tag2str(tag)); - break; + break; } stream->seek(pos + length + (length & 1)); // ensure we're also word-aligned @@ -203,7 +205,7 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos if (codec == MKTAG('s', 'o', 'w', 't')) rawFlags |= Audio::FLAG_LITTLE_ENDIAN; - return makeRawStream(dataStream, rate, rawFlags); + return makeRawStream(dataStream, rate, rawFlags); } case MKTAG('i', 'm', 'a', '4'): // TODO: Use QT IMA ADPCM @@ -212,7 +214,7 @@ RewindableAudioStream *makeAIFFStream(Common::SeekableReadStream *stream, Dispos case MKTAG('Q', 'D', 'M', '2'): // TODO: Need to figure out how to integrate this // (But hopefully never needed) - warning("Unhandled AIFF-C QDM2 compression"); + warning("Unhandled AIFF-C QDM2 compression"); break; case MKTAG('A', 'D', 'P', '4'): // ADP4 on 3DO diff --git a/audio/decoders/vorbis.h b/audio/decoders/vorbis.h index 2b9f6c3df9..49f770269b 100644 --- a/audio/decoders/vorbis.h +++ b/audio/decoders/vorbis.h @@ -35,6 +35,7 @@ * - sword25 * - touche * - tucker + * - wintermute */ #ifndef AUDIO_VORBIS_H diff --git a/audio/decoders/wave.cpp b/audio/decoders/wave.cpp index adee749b37..cdd6412aa8 100644 --- a/audio/decoders/wave.cpp +++ b/audio/decoders/wave.cpp @@ -158,7 +158,7 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, return true; } -RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) { +SeekableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) { int size, rate; byte flags; uint16 type; diff --git a/audio/decoders/wave.h b/audio/decoders/wave.h index 6bc9f72101..a7fb76978c 100644 --- a/audio/decoders/wave.h +++ b/audio/decoders/wave.h @@ -56,7 +56,7 @@ class SeekableReadStream; namespace Audio { -class RewindableAudioStream; +class SeekableAudioStream; /** * Try to load a WAVE from the given seekable stream. Returns true if @@ -82,9 +82,9 @@ extern bool loadWAVFromStream( * * @param stream the SeekableReadStream from which to read the WAVE data * @param disposeAfterUse whether to delete the stream after use - * @return a new RewindableAudioStream, or NULL, if an error occurred + * @return a new SeekableAudioStream, or NULL, if an error occurred */ -RewindableAudioStream *makeWAVStream( +SeekableAudioStream *makeWAVStream( Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse); |