aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-30 15:18:25 +0000
committerJohannes Schickel2010-01-30 15:18:25 +0000
commit523181d7193d829c86e5b255b47c35a4c28bca14 (patch)
tree355f4337e8ff7572bf12e486498877864e5a0465 /sound
parentec3f58e626a0645c21bc76fbc7cbd2a58eeee43e (diff)
downloadscummvm-rg350-523181d7193d829c86e5b255b47c35a4c28bca14.tar.gz
scummvm-rg350-523181d7193d829c86e5b255b47c35a4c28bca14.tar.bz2
scummvm-rg350-523181d7193d829c86e5b255b47c35a4c28bca14.zip
Add a factory which plays audio from a buffer via RawDiskStream.
svn-id: r47714
Diffstat (limited to 'sound')
-rw-r--r--sound/decoders/raw.cpp6
-rw-r--r--sound/decoders/raw.h16
2 files changed, 21 insertions, 1 deletions
diff --git a/sound/decoders/raw.cpp b/sound/decoders/raw.cpp
index f726d91cc5..18abfdcb35 100644
--- a/sound/decoders/raw.cpp
+++ b/sound/decoders/raw.cpp
@@ -426,6 +426,12 @@ SeekableAudioStream *makeRawStream(Common::SeekableReadStream *stream,
return makeRawStream(stream, blocks, rate, flags, disposeAfterUse);
}
+SeekableAudioStream *makeRawStream(const byte *buffer, uint32 size,
+ int rate, byte flags,
+ DisposeAfterUse::Flag disposeAfterUse) {
+ return makeRawStream(new Common::MemoryReadStream(buffer, size, disposeAfterUse), rate, flags, DisposeAfterUse::YES);
+}
+
SeekableAudioStream *makeRawDiskStream_OLD(Common::SeekableReadStream *stream, RawDiskStreamAudioBlock *block, int numBlocks,
int rate, byte flags, DisposeAfterUse::Flag disposeStream) {
assert(numBlocks > 0);
diff --git a/sound/decoders/raw.h b/sound/decoders/raw.h
index c3be9f16a1..e6fe0d6abf 100644
--- a/sound/decoders/raw.h
+++ b/sound/decoders/raw.h
@@ -118,10 +118,24 @@ struct RawDiskStreamAudioBlock {
typedef Common::List<RawDiskStreamAudioBlock> RawStreamBlockList;
/**
+ * Creates an audio stream, which plays from the given buffer.
+ *
+ * @param buffer Buffer to play from.
+ * @param size Size of the buffer in bytes.
+ * @param rate Rate of the sound data.
+ * @param flags Audio flags combination.
+ * @see RawFlags
+ * @param disposeAfterUse Whether to free the buffer after use (with free!).
+ * @return The new SeekableAudioStream (or 0 on failure).
+ */
+SeekableAudioStream *makeRawStream(const byte *buffer, uint32 size,
+ int rate, byte flags,
+ DisposeAfterUse::Flag disposeAfterUse = DisposeAfterUse::YES);
+
+/**
* Creates an audio stream, which plays from the given stream.
*
* @param stream Stream object to play from.
- * @param size Size of the buffer.
* @param rate Rate of the sound data.
* @param flags Audio flags combination.
* @see RawFlags