[Scummvm-cvs-logs] SF.net SVN: scummvm:[47471] scummvm/trunk/sound/raw.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sat Jan 23 14:33:45 CET 2010
Revision: 47471
http://scummvm.svn.sourceforge.net/scummvm/?rev=47471&view=rev
Author: fingolfin
Date: 2010-01-23 13:33:45 +0000 (Sat, 23 Jan 2010)
Log Message:
-----------
Cleanup raw looping code
Modified Paths:
--------------
scummvm/trunk/sound/raw.cpp
Modified: scummvm/trunk/sound/raw.cpp
===================================================================
--- scummvm/trunk/sound/raw.cpp 2010-01-23 13:33:27 UTC (rev 47470)
+++ scummvm/trunk/sound/raw.cpp 2010-01-23 13:33:45 UTC (rev 47471)
@@ -365,25 +365,20 @@
uint loopStart, uint loopEnd) {
SeekableAudioStream *s = makeRawMemoryStream(ptr, len, autoFree, rate, flags);
- const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
- const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
- const bool isLooping = (flags & Audio::FLAG_LOOP) != 0;
+ if ((flags & Audio::FLAG_LOOP) != 0) {
+ const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
+ const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
- if (isLooping) {
- uint loopOffset = 0, loopLen = 0;
if (loopEnd == 0)
loopEnd = len;
assert(loopStart <= loopEnd);
assert(loopEnd <= len);
- loopOffset = loopStart;
- loopLen = loopEnd - loopStart;
-
// Verify the buffer sizes are sane
if (is16Bit && isStereo)
- assert((loopLen & 3) == 0 && (loopStart & 3) == 0 && (loopEnd & 3) == 0);
+ assert((loopStart & 3) == 0 && (loopEnd & 3) == 0);
else if (is16Bit || isStereo)
- assert((loopLen & 1) == 0 && (loopStart & 1) == 0 && (loopEnd & 1) == 0);
+ assert((loopStart & 1) == 0 && (loopEnd & 1) == 0);
const uint32 extRate = s->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1);
@@ -431,27 +426,22 @@
int numBlocks, int rate, byte flags, DisposeAfterUse::Flag disposeStream, uint loopStart, uint loopEnd) {
SeekableAudioStream *s = makeRawDiskStream(stream, block, numBlocks, rate, flags, disposeStream);
- const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
- const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
- const bool isLooping = (flags & Audio::FLAG_LOOP) != 0;
+ if ((flags & Audio::FLAG_LOOP) != 0) {
+ const bool isStereo = (flags & Audio::FLAG_STEREO) != 0;
+ const bool is16Bit = (flags & Audio::FLAG_16BITS) != 0;
- if (isLooping) {
const uint len = s->getLength().totalNumberOfFrames() / (is16Bit ? 2 : 1) / (isStereo ? 2 : 1);
- uint loopOffset = 0, loopLen = 0;
if (loopEnd == 0)
loopEnd = len;
assert(loopStart <= loopEnd);
assert(loopEnd <= len);
- loopOffset = loopStart;
- loopLen = loopEnd - loopStart;
-
// Verify the buffer sizes are sane
if (is16Bit && isStereo)
- assert((loopLen & 3) == 0 && (loopStart & 3) == 0 && (loopEnd & 3) == 0);
+ assert((loopStart & 3) == 0 && (loopEnd & 3) == 0);
else if (is16Bit || isStereo)
- assert((loopLen & 1) == 0 && (loopStart & 1) == 0 && (loopEnd & 3) == 0);
+ assert((loopStart & 1) == 0 && (loopEnd & 1) == 0);
const uint32 extRate = s->getRate() * (is16Bit ? 2 : 1) * (isStereo ? 2 : 1);
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