diff options
author | Max Horn | 2010-01-19 00:52:41 +0000 |
---|---|---|
committer | Max Horn | 2010-01-19 00:52:41 +0000 |
commit | 349fcd1d715091c1b1816ff610910531d5dd8544 (patch) | |
tree | 3f29ede9510a88d5ce521466c22f63481b4c3d5a /sound | |
parent | 8ff407e80aac35f1fc62a74881bc123aa3c93d07 (diff) | |
download | scummvm-rg350-349fcd1d715091c1b1816ff610910531d5dd8544.tar.gz scummvm-rg350-349fcd1d715091c1b1816ff610910531d5dd8544.tar.bz2 scummvm-rg350-349fcd1d715091c1b1816ff610910531d5dd8544.zip |
Rename 'Linear' audio streams to 'raw'
svn-id: r47367
Diffstat (limited to 'sound')
-rw-r--r-- | sound/aiff.cpp | 2 | ||||
-rw-r--r-- | sound/audiostream.cpp | 60 | ||||
-rw-r--r-- | sound/audiostream.h | 26 | ||||
-rw-r--r-- | sound/iff_sound.cpp | 2 | ||||
-rw-r--r-- | sound/mixer.cpp | 2 | ||||
-rw-r--r-- | sound/mixer.h | 4 | ||||
-rw-r--r-- | sound/shorten.cpp | 2 | ||||
-rw-r--r-- | sound/voc.cpp | 14 | ||||
-rw-r--r-- | sound/wave.cpp | 2 |
9 files changed, 57 insertions, 57 deletions
diff --git a/sound/aiff.cpp b/sound/aiff.cpp index 6ac9a45372..884a2382b6 100644 --- a/sound/aiff.cpp +++ b/sound/aiff.cpp @@ -174,7 +174,7 @@ SeekableAudioStream *makeAIFFStream(Common::SeekableReadStream &stream) { // Since we allocated our own buffer for the data, we must set the autofree flag. flags |= Audio::Mixer::FLAG_AUTOFREE; - return makeLinearInputStream(data, size, rate, flags); + return makeRawMemoryStream(data, size, rate, flags); } } // End of namespace Audio diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index d4e98b4885..578a4a78c0 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -256,7 +256,7 @@ bool SubSeekableAudioStream::seek(const Timestamp &where) { } #pragma mark - -#pragma mark --- LinearMemoryStream --- +#pragma mark --- RawMemoryStream --- #pragma mark - uint32 calculateSampleOffset(const Timestamp &where, int rate) { @@ -274,7 +274,7 @@ uint32 calculateSampleOffset(const Timestamp &where, int rate) { * case. This results in a total of 12 versions of the code being generated. */ template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -class LinearMemoryStream : public SeekableAudioStream { +class RawMemoryStream : public SeekableAudioStream { protected: const byte *_ptr; const byte *_end; @@ -284,13 +284,13 @@ protected: const Timestamp _playtime; public: - LinearMemoryStream(int rate, const byte *ptr, uint len, DisposeAfterUse::Flag autoFreeMemory) + RawMemoryStream(int rate, const byte *ptr, uint len, DisposeAfterUse::Flag autoFreeMemory) : _ptr(ptr), _end(ptr+len), _rate(rate), _origPtr(ptr), _disposeAfterUse(autoFreeMemory), _playtime(0, len / (is16Bit ? 2 : 1) / (stereo ? 2 : 1), rate) { } - virtual ~LinearMemoryStream() { + virtual ~RawMemoryStream() { if (_disposeAfterUse == DisposeAfterUse::YES) free(const_cast<byte *>(_origPtr)); } @@ -306,7 +306,7 @@ public: }; template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -int LinearMemoryStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, const int numSamples) { +int RawMemoryStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, const int numSamples) { int samples = numSamples; while (samples > 0 && _ptr < _end) { int len = MIN(samples, (int)(_end - _ptr) / (is16Bit ? 2 : 1)); @@ -320,7 +320,7 @@ int LinearMemoryStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buf } template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -bool LinearMemoryStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) { +bool RawMemoryStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) { const uint8 *ptr = _origPtr + calculateSampleOffset(where, getRate()) * (is16Bit ? 2 : 1) * (stereo ? 2 : 1); if (ptr > _end) { _ptr = _end; @@ -335,18 +335,18 @@ bool LinearMemoryStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp } #pragma mark - -#pragma mark --- LinearDiskStream --- +#pragma mark --- RawDiskStream --- #pragma mark - /** - * LinearDiskStream. This can stream linear (PCM) audio from disk. The - * function takes an pointer to an array of LinearDiskStreamAudioBlock which defines the + * 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. */ template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -class LinearDiskStream : public SeekableAudioStream { +class RawDiskStream : public SeekableAudioStream { // Allow backends to override buffer size #ifdef CUSTOM_AUDIO_BUFFER_SIZE @@ -365,13 +365,13 @@ 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 LinearDiskStream is destructed + const DisposeAfterUse::Flag _disposeAfterUse; ///< Indicates whether the stream object should be deleted when this RawDiskStream is destructed - LinearDiskStreamAudioBlock *_audioBlock; ///< Audio block list + RawDiskStreamAudioBlock *_audioBlock; ///< Audio block list const int _audioBlockCount; ///< Number of blocks in _audioBlock int _currentBlock; ///< Current audio block number public: - LinearDiskStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, uint numBlocks) + RawDiskStream(int rate, DisposeAfterUse::Flag disposeStream, Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, uint numBlocks) : _rate(rate), _playtime(0, rate), _stream(stream), _disposeAfterUse(disposeStream), _audioBlockCount(numBlocks) { @@ -390,8 +390,8 @@ public: // Copy audio block data to our buffer // TODO: Replace this with a Common::Array or Common::List to // make it a little friendlier. - _audioBlock = new LinearDiskStreamAudioBlock[numBlocks]; - memcpy(_audioBlock, block, numBlocks * sizeof(LinearDiskStreamAudioBlock)); + _audioBlock = new RawDiskStreamAudioBlock[numBlocks]; + memcpy(_audioBlock, block, numBlocks * sizeof(RawDiskStreamAudioBlock)); // Set current buffer state, playing first block _currentBlock = 0; @@ -407,7 +407,7 @@ public: } - virtual ~LinearDiskStream() { + virtual ~RawDiskStream() { if (_disposeAfterUse == DisposeAfterUse::YES) { delete _stream; } @@ -427,7 +427,7 @@ public: }; template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -int LinearDiskStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, const int numSamples) { +int RawDiskStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffer, const int numSamples) { int oldPos = _stream->pos(); bool restoreFilePosition = false; @@ -485,7 +485,7 @@ int LinearDiskStream<stereo, is16Bit, isUnsigned, isLE>::readBuffer(int16 *buffe } template<bool stereo, bool is16Bit, bool isUnsigned, bool isLE> -bool LinearDiskStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) { +bool RawDiskStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp &where) { const uint32 seekSample = calculateSampleOffset(where, getRate()) * (stereo ? 2 : 1); uint32 curSample = 0; @@ -533,13 +533,13 @@ bool LinearDiskStream<stereo, is16Bit, isUnsigned, isLE>::seek(const Timestamp & #define MAKE_LINEAR(STEREO, UNSIGNED) \ if (is16Bit) { \ if (isLE) \ - return new LinearMemoryStream<STEREO, true, UNSIGNED, true>(rate, ptr, len, autoFree); \ + return new RawMemoryStream<STEREO, true, UNSIGNED, true>(rate, ptr, len, autoFree); \ else \ - return new LinearMemoryStream<STEREO, true, UNSIGNED, false>(rate, ptr, len, autoFree); \ + return new RawMemoryStream<STEREO, true, UNSIGNED, false>(rate, ptr, len, autoFree); \ } else \ - return new LinearMemoryStream<STEREO, false, UNSIGNED, false>(rate, ptr, len, autoFree) + return new RawMemoryStream<STEREO, false, UNSIGNED, false>(rate, ptr, len, autoFree) -SeekableAudioStream *makeLinearInputStream(const byte *ptr, uint32 len, int rate, byte flags) { +SeekableAudioStream *makeRawMemoryStream(const byte *ptr, uint32 len, int rate, byte flags) { const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0; const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0; const bool isUnsigned = (flags & Mixer::FLAG_UNSIGNED) != 0; @@ -569,9 +569,9 @@ SeekableAudioStream *makeLinearInputStream(const byte *ptr, uint32 len, int rate } -AudioStream *makeLinearInputStream(const byte *ptr, uint32 len, int rate, +AudioStream *makeRawMemoryStream(const byte *ptr, uint32 len, int rate, byte flags, uint loopStart, uint loopEnd) { - SeekableAudioStream *stream = makeLinearInputStream(ptr, len, rate, flags); + SeekableAudioStream *stream = makeRawMemoryStream(ptr, len, rate, flags); const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0; const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0; @@ -606,14 +606,14 @@ AudioStream *makeLinearInputStream(const byte *ptr, uint32 len, int rate, #define MAKE_LINEAR_DISK(STEREO, UNSIGNED) \ if (is16Bit) { \ if (isLE) \ - return new LinearDiskStream<STEREO, true, UNSIGNED, true>(rate, disposeStream, stream, block, numBlocks); \ + return new RawDiskStream<STEREO, true, UNSIGNED, true>(rate, disposeStream, stream, block, numBlocks); \ else \ - return new LinearDiskStream<STEREO, true, UNSIGNED, false>(rate, disposeStream, stream, block, numBlocks); \ + return new RawDiskStream<STEREO, true, UNSIGNED, false>(rate, disposeStream, stream, block, numBlocks); \ } else \ - return new LinearDiskStream<STEREO, false, UNSIGNED, false>(rate, disposeStream, stream, block, numBlocks) + return new RawDiskStream<STEREO, false, UNSIGNED, false>(rate, disposeStream, stream, block, numBlocks) -SeekableAudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, int numBlocks, +SeekableAudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream) { const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0; const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0; @@ -635,9 +635,9 @@ SeekableAudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, Li } } -AudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, +AudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream, uint loopStart, uint loopEnd) { - SeekableAudioStream *s = makeLinearDiskStream(stream, block, numBlocks, rate, flags, disposeStream); + SeekableAudioStream *s = makeRawDiskStream(stream, block, numBlocks, rate, flags, disposeStream); const bool isStereo = (flags & Mixer::FLAG_STEREO) != 0; const bool is16Bit = (flags & Mixer::FLAG_16BITS) != 0; diff --git a/sound/audiostream.h b/sound/audiostream.h index 4174fe017d..e04ed265ab 100644 --- a/sound/audiostream.h +++ b/sound/audiostream.h @@ -307,27 +307,27 @@ private: * @see Mixer::RawFlags * @return The new SeekableAudioStream (or 0 on failure). */ -SeekableAudioStream *makeLinearInputStream(const byte *ptr, uint32 len, int rate, byte flags); +SeekableAudioStream *makeRawMemoryStream(const byte *ptr, uint32 len, int rate, byte flags); /** * NOTE: * This API is considered deprecated. * - * Factory function for a raw linear AudioStream, which will simply treat all + * Factory function for a raw PCM AudioStream, which will simply treat all * data in the buffer described by ptr and len as raw sample data in the * specified format. It will then simply pass this data directly to the mixer, * after converting it to the sample format used by the mixer (i.e. 16 bit * signed native endian). Optionally supports (infinite) looping of a portion * of the data. */ -AudioStream *makeLinearInputStream(const byte *ptr, uint32 len, int rate, +AudioStream *makeRawMemoryStream(const byte *ptr, uint32 len, int rate, byte flags, uint loopStart, uint loopEnd); /** - * Struct used to define the audio data to be played by a LinearDiskStream. + * Struct used to define the audio data to be played by a RawDiskStream. */ -struct LinearDiskStreamAudioBlock { +struct RawDiskStreamAudioBlock { int32 pos; ///< Position in stream of the block int32 len; ///< Length of the block (in samples) }; @@ -336,8 +336,8 @@ struct LinearDiskStreamAudioBlock { * Creates a audio stream, which plays from given stream. * * @param stream Stream to play from - * @param block Pointer to an LinearDiskStreamAudioBlock array - * @see LinearDiskStreamAudioBlock + * @param block Pointer to an RawDiskStreamAudioBlock array + * @see RawDiskStreamAudioBlock * @param numBlocks Number of blocks. * @param rate The rate * @param len Length of the data (in bytes!) @@ -346,19 +346,19 @@ struct LinearDiskStreamAudioBlock { * @param disposeStream Whether the "stream" object should be destroyed after playback. * @return The new SeekableAudioStream (or 0 on failure). */ -SeekableAudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, +SeekableAudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream); /** * NOTE: * This API is considered deprecated. * - * Factory function for a Linear Disk Stream. This can stream linear (PCM) - * audio from disk. The function takes an pointer to an array of - * LinearDiskStreamAudioBlock which defines the start position and length of + * Factory function for a Raw Disk Stream. 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. */ -AudioStream *makeLinearDiskStream(Common::SeekableReadStream *stream, LinearDiskStreamAudioBlock *block, +AudioStream *makeRawDiskStream(Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream, uint loopStart, uint loopEnd); class QueuingAudioStream : public Audio::AudioStream { @@ -381,7 +381,7 @@ public: * with new[], not with malloc). */ void queueBuffer(byte *data, uint32 size, byte flags) { - AudioStream *stream = makeLinearInputStream(data, size, getRate(), flags, 0, 0); + AudioStream *stream = makeRawMemoryStream(data, size, getRate(), flags, 0, 0); queueAudioStream(stream, DisposeAfterUse::YES); } diff --git a/sound/iff_sound.cpp b/sound/iff_sound.cpp index 60a1486ed5..d0e96fa9ee 100644 --- a/sound/iff_sound.cpp +++ b/sound/iff_sound.cpp @@ -100,7 +100,7 @@ AudioStream *make8SVXStream(Common::ReadStream &input, bool loop) { flags |= Audio::Mixer::FLAG_AUTOFREE; - return Audio::makeLinearInputStream((byte *)loader._data, loader._dataSize, loader._header.samplesPerSec, flags, loopStart, loopEnd); + return Audio::makeRawMemoryStream((byte *)loader._data, loader._dataSize, loader._header.samplesPerSec, flags, loopStart, loopEnd); } } diff --git a/sound/mixer.cpp b/sound/mixer.cpp index 7a09715c62..40af73b3c5 100644 --- a/sound/mixer.cpp +++ b/sound/mixer.cpp @@ -225,7 +225,7 @@ void MixerImpl::playRaw( uint32 loopStart, uint32 loopEnd) { // Create the input stream - AudioStream *input = makeLinearInputStream((byte *)sound, size, rate, flags, loopStart, loopEnd); + AudioStream *input = makeRawMemoryStream((byte *)sound, size, rate, flags, loopStart, loopEnd); // Play it playInputStream(type, handle, input, id, volume, balance, DisposeAfterUse::YES, false, ((flags & Mixer::FLAG_REVERSE_STEREO) != 0)); diff --git a/sound/mixer.h b/sound/mixer.h index b13e8606e9..23ad29082d 100644 --- a/sound/mixer.h +++ b/sound/mixer.h @@ -65,7 +65,7 @@ class Mixer { public: /** * Various flags which can be bit-ORed and then passed to - * Mixer::playRaw resp. makeLinearInputStream to control their + * Mixer::playRaw resp. makeRawMemoryStream to control their * behavior. * * Engine authors are advised not to rely on a certain value or @@ -131,7 +131,7 @@ public: /** * Start playing the given raw sound data. * Internally, this simply creates an audio input stream wrapping the data - * (using the makeLinearInputStream factory function), which is then + * (using the makeRawMemoryStream factory function), which is then * passed on to playInputStream. */ virtual void playRaw( diff --git a/sound/shorten.cpp b/sound/shorten.cpp index 8f5f8456f7..5f4fcab5b4 100644 --- a/sound/shorten.cpp +++ b/sound/shorten.cpp @@ -525,7 +525,7 @@ AudioStream *makeShortenStream(Common::SeekableReadStream &stream) { // Since we allocated our own buffer for the data, we must set the autofree flag. flags |= Audio::Mixer::FLAG_AUTOFREE; - return makeLinearInputStream(data, size, rate, flags, 0, 0); + return makeRawMemoryStream(data, size, rate, flags, 0, 0); } } // End of namespace Audio diff --git a/sound/voc.cpp b/sound/voc.cpp index 9247d5276e..9eae18b5dd 100644 --- a/sound/voc.cpp +++ b/sound/voc.cpp @@ -179,7 +179,7 @@ byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate) { #ifdef STREAM_AUDIO_FROM_DISK -int parseVOCFormat(Common::SeekableReadStream& stream, LinearDiskStreamAudioBlock* block, int &rate, int &loops, int &begin_loop, int &end_loop) { +int parseVOCFormat(Common::SeekableReadStream& stream, RawDiskStreamAudioBlock* block, int &rate, int &loops, int &begin_loop, int &end_loop) { VocFileHeader fileHeader; int currentBlock = 0; int size = 0; @@ -301,7 +301,7 @@ int parseVOCFormat(Common::SeekableReadStream& stream, LinearDiskStreamAudioBloc AudioStream *makeVOCDiskStream(Common::SeekableReadStream &stream, byte flags, DisposeAfterUse::Flag takeOwnership) { const int MAX_AUDIO_BLOCKS = 256; - LinearDiskStreamAudioBlock *block = new LinearDiskStreamAudioBlock[MAX_AUDIO_BLOCKS]; + RawDiskStreamAudioBlock *block = new RawDiskStreamAudioBlock[MAX_AUDIO_BLOCKS]; int rate, loops, begin_loop, end_loop; int numBlocks = parseVOCFormat(stream, block, rate, loops, begin_loop, end_loop); @@ -311,7 +311,7 @@ AudioStream *makeVOCDiskStream(Common::SeekableReadStream &stream, byte flags, D // Create an audiostream from the data. Note the numBlocks may be 0, // e.g. when invalid data is encountered. See bug #2890038. if (numBlocks) - audioStream = makeLinearDiskStream(&stream, block, numBlocks, rate, flags, takeOwnership, begin_loop, end_loop); + audioStream = makeRawDiskStream(&stream, block, numBlocks, rate, flags, takeOwnership, begin_loop, end_loop); delete[] block; @@ -321,7 +321,7 @@ AudioStream *makeVOCDiskStream(Common::SeekableReadStream &stream, byte flags, D SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream &stream, byte flags, DisposeAfterUse::Flag takeOwnership) { const int MAX_AUDIO_BLOCKS = 256; - LinearDiskStreamAudioBlock *block = new LinearDiskStreamAudioBlock[MAX_AUDIO_BLOCKS]; + RawDiskStreamAudioBlock *block = new RawDiskStreamAudioBlock[MAX_AUDIO_BLOCKS]; int rate, loops, begin_loop, end_loop; int numBlocks = parseVOCFormat(stream, block, rate, loops, begin_loop, end_loop); @@ -331,7 +331,7 @@ SeekableAudioStream *makeVOCDiskStreamNoLoop(Common::SeekableReadStream &stream, // Create an audiostream from the data. Note the numBlocks may be 0, // e.g. when invalid data is encountered. See bug #2890038. if (numBlocks) - audioStream = makeLinearDiskStream(&stream, block, numBlocks, rate, flags, takeOwnership); + audioStream = makeRawDiskStream(&stream, block, numBlocks, rate, flags, takeOwnership); delete[] block; @@ -352,7 +352,7 @@ AudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags, uint if (!data) return 0; - return makeLinearInputStream(data, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, loopStart, loopEnd); + return makeRawMemoryStream(data, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE, loopStart, loopEnd); #endif } @@ -367,7 +367,7 @@ SeekableAudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flag if (!data) return 0; - return makeLinearInputStream(data, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE); + return makeRawMemoryStream(data, size, rate, flags | Audio::Mixer::FLAG_AUTOFREE); #endif } diff --git a/sound/wave.cpp b/sound/wave.cpp index 83a880dada..673467628c 100644 --- a/sound/wave.cpp +++ b/sound/wave.cpp @@ -190,7 +190,7 @@ RewindableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, Dispose // Since we allocated our own buffer for the data, we must set the autofree flag. flags |= Audio::Mixer::FLAG_AUTOFREE; - return makeLinearInputStream(data, size, rate, flags); + return makeRawMemoryStream(data, size, rate, flags); } } // End of namespace Audio |