[Scummvm-cvs-logs] SF.net SVN: scummvm:[42707] scummvm/trunk/graphics/video/coktelvideo
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Fri Jul 24 23:32:46 CEST 2009
Revision: 42707
http://scummvm.svn.sourceforge.net/scummvm/?rev=42707&view=rev
Author: drmccoy
Date: 2009-07-24 21:32:45 +0000 (Fri, 24 Jul 2009)
Log Message:
-----------
Calculating the number of data bytes per initial sound slice, because relying on the standard amount doesn't work for some videos
Modified Paths:
--------------
scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp
scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h
Modified: scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp 2009-07-24 21:31:58 UTC (rev 42706)
+++ scummvm/trunk/graphics/video/coktelvideo/coktelvideo.cpp 2009-07-24 21:32:45 UTC (rev 42707)
@@ -1904,18 +1904,47 @@
_audioStream->queueBuffer(sound, size);
}
-void Vmd::filledSoundSlices(uint32 size, uint32 mask) {
- int n = MIN<int>(_soundSlicesCount - 1, 31);
- for (int i = 0; i < n; i++) {
+uint8 Vmd::evaluateMask(uint32 mask, bool *fillInfo, uint8 &max) {
+ max = MIN<int>(_soundSlicesCount - 1, 31);
- if (mask & 1)
- emptySoundSlice(_soundDataSize * _soundBytesPerSample);
- else
- filledSoundSlice(_soundDataSize + _soundHeaderSize);
+ uint8 n = 0;
+ for (int i = 0; i < max; i++) {
+ if (!(mask & 1)) {
+ n++;
+ *fillInfo++ = true;
+ } else
+ *fillInfo++ = false;
+
mask >>= 1;
}
+
+ return n;
+}
+
+void Vmd::filledSoundSlices(uint32 size, uint32 mask) {
+ bool fillInfo[32];
+
+ uint8 max;
+ uint8 n = evaluateMask(mask, fillInfo, max);
+
+ int32 extraSize;
+
+ extraSize = size - n * _soundDataSize;
+
if (_soundSlicesCount > 32)
+ extraSize -= (_soundSlicesCount - 32) * _soundDataSize;
+
+ if (n > 0)
+ extraSize /= n;
+
+ for (uint8 i = 0; i < max; i++)
+ if (fillInfo[i])
+ filledSoundSlice(_soundDataSize + extraSize);
+ else
+ emptySoundSlice(_soundDataSize * _soundBytesPerSample);
+
+ if (_soundSlicesCount > 32)
filledSoundSlice((_soundSlicesCount - 32) * _soundDataSize + _soundHeaderSize);
}
Modified: scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h
===================================================================
--- scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h 2009-07-24 21:31:58 UTC (rev 42706)
+++ scummvm/trunk/graphics/video/coktelvideo/coktelvideo.h 2009-07-24 21:32:45 UTC (rev 42707)
@@ -433,6 +433,7 @@
byte *sound16bitDPCM(uint32 &size);
byte *sound16bitADPCM(uint32 &size);
+ uint8 evaluateMask(uint32 mask, bool *fillInfo, uint8 &max);
void emptySoundSlice(uint32 size);
void filledSoundSlice(uint32 size);
void filledSoundSlices(uint32 size, uint32 mask);
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