[Scummvm-cvs-logs] SF.net SVN: scummvm: [27832] scummvm/trunk/engines/gob
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Jul 1 20:40:36 CEST 2007
Revision: 27832
http://scummvm.svn.sourceforge.net/scummvm/?rev=27832&view=rev
Author: fingolfin
Date: 2007-07-01 11:40:35 -0700 (Sun, 01 Jul 2007)
Log Message:
-----------
Fix for bug #1746059 (WEEN: The intro hangs, and sound is corrupted)
Modified Paths:
--------------
scummvm/trunk/engines/gob/sound.cpp
scummvm/trunk/engines/gob/sound.h
Modified: scummvm/trunk/engines/gob/sound.cpp
===================================================================
--- scummvm/trunk/engines/gob/sound.cpp 2007-07-01 18:22:25 UTC (rev 27831)
+++ scummvm/trunk/engines/gob/sound.cpp 2007-07-01 18:40:35 UTC (rev 27832)
@@ -172,6 +172,7 @@
_repCount = 0;
_offset = 0;
+ _offsetFrac = 0;
_offsetInc = 0;
_cur = 0;
@@ -320,6 +321,7 @@
_playingSound = 1;
_offset = 0;
+ _offsetFrac = 0;
_offsetInc = (_freq << FRAC_BITS) / _rate;
_last = _cur;
@@ -373,6 +375,7 @@
nextCompositionPos();
else if ((_repCount == -1) || (--_repCount > 0)) {
_offset = 0;
+ _offsetFrac = 0;
_end = false;
_playingSound = 1;
} else {
@@ -387,25 +390,25 @@
for (int i = 0; i < numSamples; i++) {
if (!_data)
return i;
- if (_end || (fracToInt(_offset) >= (int)_length))
+ if (_end || (_offset >= _length))
checkEndSample();
if (_end)
return i;
// Linear interpolation. See sound/rate.cpp
- int32 val = (_last + (((_cur - _last) * (_offset & FRAC_LO_MASK) +
+ int32 val = (_last + (((_cur - _last) * _offsetFrac +
FRAC_HALF) >> FRAC_BITS)) << 8;
*buffer++ = (val * _fadeVol) >> 16;
- int16 oldOffset = fracToInt(_offset);
+ _offsetFrac += _offsetInc;
- _offset += _offsetInc;
-
// Was there an integral change?
- if (oldOffset < fracToInt(_offset)) {
+ if (fracToInt(_offsetFrac) > 0) {
_last = _cur;
- _cur = _data[oldOffset];
+ _cur = _data[_offset];
+ _offset += fracToInt(_offsetFrac);
+ _offsetFrac &= FRAC_LO_MASK;
}
if (_fade) {
Modified: scummvm/trunk/engines/gob/sound.h
===================================================================
--- scummvm/trunk/engines/gob/sound.h 2007-07-01 18:22:25 UTC (rev 27831)
+++ scummvm/trunk/engines/gob/sound.h 2007-07-01 18:40:35 UTC (rev 27832)
@@ -175,7 +175,8 @@
int32 _freq;
int32 _repCount;
- frac_t _offset;
+ uint32 _offset;
+ frac_t _offsetFrac;
frac_t _offsetInc;
int16 _cur;
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