aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-30 15:19:15 +0000
committerJohannes Schickel2010-01-30 15:19:15 +0000
commit8e3646e062528d1604d28676fa2faec5c5ac878b (patch)
tree68769735690ce17f0da01e525508184d0dd5b7c5 /sound
parent523181d7193d829c86e5b255b47c35a4c28bca14 (diff)
downloadscummvm-rg350-8e3646e062528d1604d28676fa2faec5c5ac878b.tar.gz
scummvm-rg350-8e3646e062528d1604d28676fa2faec5c5ac878b.tar.bz2
scummvm-rg350-8e3646e062528d1604d28676fa2faec5c5ac878b.zip
Get rid of Audio::makeRawMemoryStream_OLD.
svn-id: r47715
Diffstat (limited to 'sound')
-rw-r--r--sound/decoders/raw.cpp31
-rw-r--r--sound/decoders/raw.h18
-rw-r--r--sound/decoders/voc.cpp24
3 files changed, 23 insertions, 50 deletions
diff --git a/sound/decoders/raw.cpp b/sound/decoders/raw.cpp
index 18abfdcb35..df3d178c7e 100644
--- a/sound/decoders/raw.cpp
+++ b/sound/decoders/raw.cpp
@@ -339,37 +339,6 @@ SeekableAudioStream *makeRawMemoryStream(const byte *ptr, uint32 len,
}
}
-
-AudioStream *makeRawMemoryStream_OLD(const byte *ptr, uint32 len,
- int rate, byte flags,
- uint loopStart, uint loopEnd,
- DisposeAfterUse::Flag autoFree
- ) {
- SeekableAudioStream *s = makeRawMemoryStream(ptr, len, rate, flags, autoFree);
-
- if (loopStart != loopEnd) {
- const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
- const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
-
- if (loopEnd == 0)
- loopEnd = len;
- assert(loopStart <= loopEnd);
- assert(loopEnd <= len);
-
- // Verify the buffer sizes are sane
- if (is16Bit && isStereo)
- assert((loopStart & 3) == 0 && (loopEnd & 3) == 0);
- else if (is16Bit || isStereo)
- assert((loopStart & 1) == 0 && (loopEnd & 1) == 0);
-
- const uint32 extRate = s->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1);
-
- return new SubLoopingAudioStream(s, 0, Timestamp(0, loopStart, extRate), Timestamp(0, loopEnd, extRate));
- } else {
- return s;
- }
-}
-
#define MAKE_LINEAR_DISK(STEREO, UNSIGNED) \
if (is16Bit) { \
if (isLE) \
diff --git a/sound/decoders/raw.h b/sound/decoders/raw.h
index e6fe0d6abf..92add95131 100644
--- a/sound/decoders/raw.h
+++ b/sound/decoders/raw.h
@@ -86,24 +86,6 @@ SeekableAudioStream *makeRawMemoryStream(const byte *ptr, uint32 len,
);
/**
- * NOTE:
- * This API is considered deprecated.
- *
- * 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 *makeRawMemoryStream_OLD(const byte *ptr, uint32 len,
- int rate, byte flags,
- uint loopStart, uint loopEnd,
- DisposeAfterUse::Flag autofreeBuffer = DisposeAfterUse::YES
- );
-
-
-/**
* Struct used to define the audio data to be played by a RawDiskStream.
*/
struct RawDiskStreamAudioBlock {
diff --git a/sound/decoders/voc.cpp b/sound/decoders/voc.cpp
index 23accb010c..9cb59db85f 100644
--- a/sound/decoders/voc.cpp
+++ b/sound/decoders/voc.cpp
@@ -353,7 +353,29 @@ AudioStream *makeVOCStream(Common::SeekableReadStream &stream, byte flags, uint
if (!data)
return 0;
- return makeRawMemoryStream_OLD(data, size, rate, flags, loopStart, loopEnd);
+ SeekableAudioStream *s = Audio::makeRawStream(data, size, rate, flags);
+
+ if (loopStart != loopEnd) {
+ const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
+ const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
+
+ if (loopEnd == 0)
+ loopEnd = size;
+ assert(loopStart <= loopEnd);
+ assert(loopEnd <= (uint)size);
+
+ // Verify the buffer sizes are sane
+ if (is16Bit && isStereo)
+ assert((loopStart & 3) == 0 && (loopEnd & 3) == 0);
+ else if (is16Bit || isStereo)
+ assert((loopStart & 1) == 0 && (loopEnd & 1) == 0);
+
+ const uint32 extRate = s->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1);
+
+ return new SubLoopingAudioStream(s, 0, Timestamp(0, loopStart, extRate), Timestamp(0, loopEnd, extRate));
+ } else {
+ return s;
+ }
#endif
}