diff options
author | Johannes Schickel | 2010-01-30 15:29:48 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-01-30 15:29:48 +0000 |
commit | 75ba7ee0f84d83175ea105de4ffc53256c5025be (patch) | |
tree | 27b75dfd2511c0eb4f90a84b3bc27047f95b23e0 /sound/decoders | |
parent | 3cc0ef6c1cf5574168456e74736baf8f4e231af6 (diff) | |
download | scummvm-rg350-75ba7ee0f84d83175ea105de4ffc53256c5025be.tar.gz scummvm-rg350-75ba7ee0f84d83175ea105de4ffc53256c5025be.tar.bz2 scummvm-rg350-75ba7ee0f84d83175ea105de4ffc53256c5025be.zip |
Rename RawDiskStream to RawAudioStream.
svn-id: r47718
Diffstat (limited to 'sound/decoders')
-rw-r--r-- | sound/decoders/raw.cpp | 29 | ||||
-rw-r--r-- | sound/decoders/raw.h | 14 |
2 files changed, 21 insertions, 22 deletions
diff --git a/sound/decoders/raw.cpp b/sound/decoders/raw.cpp index e7bbb9b630..29ca3a8813 100644 --- a/sound/decoders/raw.cpp +++ b/sound/decoders/raw.cpp @@ -42,16 +42,15 @@ namespace Audio { #pragma mark - -#pragma mark --- RawDiskStream --- +#pragma mark --- RawAudioStream --- #pragma mark - /** - * RawDiskStream. This can stream raw PCM audio data from disk. The - * function takes an pointer to an array of RawDiskStreamAudioBlock which defines the - * start position and length of each block of uncompressed audio in the stream. + * This is a stream, which allows for playing raw PCM data from a stream. + * It also features playback of multiple blocks from a given stream. */ template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -class RawDiskStream : public SeekableAudioStream { +class RawAudioStream : public SeekableAudioStream { // Allow backends to override buffer size #ifdef CUSTOM_AUDIO_BUFFER_SIZE @@ -70,12 +69,12 @@ protected: int32 _filePos; ///< Current position in stream int32 _diskLeft; ///< Samples left in stream in current block not yet read to buffer int32 _bufferLeft; ///< Samples left in buffer in current block - const DisposeAfterUse::Flag _disposeAfterUse; ///< Indicates whether the stream object should be deleted when this RawDiskStream is destructed + const DisposeAfterUse::Flag _disposeAfterUse; ///< Indicates whether the stream object should be deleted when this RawAudioStream is destructed const RawStreamBlockList _blocks; ///< Audio block list RawStreamBlockList::const_iterator _curBlock; ///< Current audio block number public: - RawDiskStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, const RawStreamBlockList &blocks) + RawAudioStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, const RawStreamBlockList &blocks) : _rate(rate), _playtime(0, rate), _stream(stream), _disposeAfterUse(disposeStream), _blocks(blocks), _curBlock(_blocks.begin()) { assert(_blocks.size() > 0); @@ -101,7 +100,7 @@ public: } - virtual ~RawDiskStream() { + virtual ~RawAudioStream() { if (_disposeAfterUse == DisposeAfterUse::YES) delete _stream; @@ -120,7 +119,7 @@ public: }; template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -int RawDiskStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, const int numSamples) { +int RawAudioStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, const int numSamples) { int oldPos = _stream->pos(); bool restoreFilePosition = false; @@ -179,7 +178,7 @@ int RawDiskStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, } template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -bool RawDiskStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) { +bool RawAudioStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) { const uint32 seekSample = convertTimeToStreamPos(where, getRate(), isStereo()).totalNumberOfFrames(); uint32 curSample = 0; @@ -225,11 +224,11 @@ bool RawDiskStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &whe #define MAKE_LINEAR_DISK(STEREO, UNSIGNED) \ if (is16Bit) { \ if (isLE) \ - return new RawDiskStream<STEREO, true, UNSIGNED, true>(rate, disposeAfterUse, stream, blockList); \ + return new RawAudioStream<STEREO, true, UNSIGNED, true>(rate, disposeAfterUse, stream, blockList); \ else \ - return new RawDiskStream<STEREO, true, UNSIGNED, false>(rate, disposeAfterUse, stream, blockList); \ + return new RawAudioStream<STEREO, true, UNSIGNED, false>(rate, disposeAfterUse, stream, blockList); \ } else \ - return new RawDiskStream<STEREO, false, UNSIGNED, false>(rate, disposeAfterUse, stream, blockList) + return new RawAudioStream<STEREO, false, UNSIGNED, false>(rate, disposeAfterUse, stream, blockList) SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream, const RawStreamBlockList &blockList, @@ -267,7 +266,7 @@ SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream, int rate, byte flags, DisposeAfterUse::Flag disposeAfterUse) { RawStreamBlockList blocks; - RawDiskStreamAudioBlock block; + RawAudioStreamBlock block; block.pos = 0; const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0; @@ -284,7 +283,7 @@ SeekableAudioStream *makeRawStream(const byte *buffer, uint32 size, return makeRawStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, flags, DisposeAfterUse::YES); } -SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, int numBlocks, +SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream, RawAudioStreamBlock *block, int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream) { assert(numBlocks > 0); RawStreamBlockList blocks; diff --git a/sound/decoders/raw.h b/sound/decoders/raw.h index c81884dc00..5ef3204392 100644 --- a/sound/decoders/raw.h +++ b/sound/decoders/raw.h @@ -65,18 +65,18 @@ enum RawFlags { /** - * Struct used to define the audio data to be played by a RawDiskStream. + * Struct used to define the audio data to be played by a RawAudioStream. */ -struct RawDiskStreamAudioBlock { +struct RawAudioStreamBlock { int32 pos; ///< Position in stream of the block (in bytes of course!) int32 len; ///< Length of the block (in sample (pairs)) }; /** * List containing all blocks of a raw stream. - * @see RawDiskStreamAudioBlock + * @see RawAudioStreamBlock */ -typedef Common::List<RawDiskStreamAudioBlock> RawStreamBlockList; +typedef Common::List<RawAudioStreamBlock> RawStreamBlockList; /** * Creates an audio stream, which plays from the given buffer. @@ -133,8 +133,8 @@ SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream, * Creates a audio stream, which plays from given stream. * * @param stream Stream to play from - * @param block Pointer to an RawDiskStreamAudioBlock array - * @see RawDiskStreamAudioBlock + * @param block Pointer to an RawAudioStreamBlock array + * @see RawAudioStreamBlock * @param numBlocks Number of blocks. * @param rate The rate * @param flags Flags combination. @@ -143,7 +143,7 @@ SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream, * @return The new SeekableAudioStream (or 0 on failure). */ SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream, - RawDiskStreamAudioBlock *block, int numBlocks, + RawAudioStreamBlock *block, int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream); |