diff options
author | Max Horn | 2006-03-19 14:11:32 +0000 |
---|---|---|
committer | Max Horn | 2006-03-19 14:11:32 +0000 |
commit | f7d16b000048cc50fa7922e64b55a2c2febb1f19 (patch) | |
tree | 11b01e5cb25ae00c54672f8c4810e4d5ac5367e3 | |
parent | 4e6d8844f3e52646c7e99db512443ed8df984aa7 (diff) | |
download | scummvm-rg350-f7d16b000048cc50fa7922e64b55a2c2febb1f19.tar.gz scummvm-rg350-f7d16b000048cc50fa7922e64b55a2c2febb1f19.tar.bz2 scummvm-rg350-f7d16b000048cc50fa7922e64b55a2c2febb1f19.zip |
Updated/added some comments on VOC/WAVE functions
svn-id: r21384
-rw-r--r-- | sound/voc.h | 14 | ||||
-rw-r--r-- | sound/wave.cpp | 5 | ||||
-rw-r--r-- | sound/wave.h | 16 |
3 files changed, 28 insertions, 7 deletions
diff --git a/sound/voc.h b/sound/voc.h index a62b785e3b..59ddc305ec 100644 --- a/sound/voc.h +++ b/sound/voc.h @@ -64,9 +64,21 @@ struct VocBlockHeader { */ extern int getSampleRateFromVOCRate(int vocSR); -//extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate, int &loops, int &begin_loop, int &end_loop); +/** + * Try to load a VOC from the given seekable stream. Returns a pointer to memory + * containing the PCM sample data (allocated with malloc). It is the callers + * responsibility to dellocate that data again later on! Currently this + * function only supports uncompressed raw PCM data. + */ extern byte *loadVOCFromStream(Common::ReadStream &stream, int &size, int &rate); +/** + * Try to load a VOC from the given seekable stream and create an AudioStream + * from that data. Currently this function only supports uncompressed raw PCM + * data. Looping is not supported. + * + * This function uses loadVOCFromStream() internally. + */ AudioStream *makeVOCStream(Common::ReadStream &stream); #endif diff --git a/sound/wave.cpp b/sound/wave.cpp index fdb358a1a9..264e4ae7bb 100644 --- a/sound/wave.cpp +++ b/sound/wave.cpp @@ -164,8 +164,6 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) { if (!loadWAVFromStream(stream, size, rate, flags, &type)) return 0; - flags |= Audio::Mixer::FLAG_AUTOFREE; - if (type == 17) // IMA ADPCM return makeADPCMStream(&stream, size, kADPCMIma, (flags & Audio::Mixer::FLAG_STEREO) ? 2 : 1); @@ -173,5 +171,8 @@ AudioStream *makeWAVStream(Common::SeekableReadStream &stream) { assert(data); stream.read(data, size); + // Since we allocated our own buffer for the data, we must set the autofree flag. + flags |= Audio::Mixer::FLAG_AUTOFREE; + return makeLinearInputStream(rate, flags, data, size, 0, 0); } diff --git a/sound/wave.h b/sound/wave.h index cc18852362..f0aca0c9fc 100644 --- a/sound/wave.h +++ b/sound/wave.h @@ -30,13 +30,21 @@ class AudioStream; namespace Common { class SeekableReadStream; } /** - * Try to load a WAVE from the given seekable stream. Returns true if successful; in that case, - * the stream will point at the start of the audio data, and size, rate and flags contain - * all information about the data necessary for playback. - * Currently this only support uncompressed raw PCM data. + * Try to load a WAVE from the given seekable stream. Returns true if + * successful. In that case, the stream's seek position will be set to the + * start of the audio data, and size, rate and flags contain information + * necessary for playback. Currently this function only supports uncompressed + * raw PCM data as well as IMA ADPCM. */ extern bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate, byte &flags, uint16 *wavType = 0, int *blockAlign = 0); +/** + * Try to load a WAVE from the given seekable stream and create an AudioStream + * from that data. Currently this function only supports uncompressed raw PCM + * data as well as IMA ADPCM. + * + * This function uses loadWAVFromStream() internally. + */ AudioStream *makeWAVStream(Common::SeekableReadStream &stream); #endif |