[Scummvm-cvs-logs] SF.net SVN: scummvm: [21384] scummvm/trunk/sound

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Mar 19 06:12:01 CET 2006


Revision: 21384
Author:   fingolfin
Date:     2006-03-19 06:11:32 -0800 (Sun, 19 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21384&view=rev

Log Message:
-----------
Updated/added some comments on VOC/WAVE functions

Modified Paths:
--------------
    scummvm/trunk/sound/voc.h
    scummvm/trunk/sound/wave.cpp
    scummvm/trunk/sound/wave.h
Modified: scummvm/trunk/sound/voc.h
===================================================================
--- scummvm/trunk/sound/voc.h	2006-03-19 13:17:47 UTC (rev 21383)
+++ scummvm/trunk/sound/voc.h	2006-03-19 14:11:32 UTC (rev 21384)
@@ -64,9 +64,21 @@
  */
 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

Modified: scummvm/trunk/sound/wave.cpp
===================================================================
--- scummvm/trunk/sound/wave.cpp	2006-03-19 13:17:47 UTC (rev 21383)
+++ scummvm/trunk/sound/wave.cpp	2006-03-19 14:11:32 UTC (rev 21384)
@@ -164,8 +164,6 @@
 	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 @@
 	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);
 }

Modified: scummvm/trunk/sound/wave.h
===================================================================
--- scummvm/trunk/sound/wave.h	2006-03-19 13:17:47 UTC (rev 21383)
+++ scummvm/trunk/sound/wave.h	2006-03-19 14:11:32 UTC (rev 21384)
@@ -30,13 +30,21 @@
 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the Scummvm-git-logs mailing list