[Scummvm-devel] a tiny patch for sfx interpolation
Sebastian Kienzl
zap at riot.org
Sun Mar 24 05:22:04 CET 2002
hi!
scummvm is nice work! you might wanna use this little patch, it resamples
sfx-playback.
yours,
seb
-------------- next part --------------
*** sound.cpp Thu Mar 21 17:12:01 2002
--- d:\code\scummvm\sound.cpp Sun Mar 24 14:10:42 2002
***************
*** 438,444 ****
return;
}
! data = (byte*) malloc(size);
if (data==NULL) {
error("startSfxSound: out of memory");
return;
--- 438,445 ----
return;
}
! data = (byte*) malloc(size+1);
! data[size] = 0; // an extra-byte for interpolation
if (data==NULL) {
error("startSfxSound: out of memory");
return;
***************
*** 673,680 ****
fp_speed = sound_data.standard._sfx_fp_speed;
do {
fp_pos += fp_speed;
- *data++ += (*s<<6);
s += fp_pos >> 16;
fp_pos &= 0x0000FFFF;
} while (--len);
--- 674,681 ----
fp_speed = sound_data.standard._sfx_fp_speed;
do {
+ *data++ += (*s<<6) + ( int16 )( ( ( int32 )(*(s+1) - *s) * (fp_pos & 0xffff) ) >> 10 );
fp_pos += fp_speed;
s += fp_pos >> 16;
fp_pos &= 0x0000FFFF;
} while (--len);
More information about the Scummvm-devel
mailing list