zeromus - SF [ 2047001 ] Low speeds crash FCEUX

this was caused by a bug in the sound engine which overflowed when things got too slow.
the instability at low speeds and turboing is not in the emulation but rather in the rather clumsy resynchronization code in the sound engine. this needs work, but the badness should be harmless.
This commit is contained in:
zeromus 2008-08-14 07:34:42 +00:00
parent adb61c3586
commit f6cb29ca1c
2 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,6 @@
---version 2.0.2 released---
14-aug-2008 - zeromus - SF [ 2047001 ] Low speeds crash FCEUX
14-aug-2008 - zeromus - SF [ 2050371 ] FCM>FM2 converter should release file handle
13-aug-2008 - zeromus - restore ungzipping (and unzipping in sdl) capability which was lost when archive support was added
13-aug-2008 - zeromus - add FORBID breakpoints - regions which block breakpoints from happening if they contain the PC

View File

@ -165,16 +165,20 @@ public:
//not interpolating! someday it will!
int generate(int samples, void *buf) {
int incr = 256;
int bufferSamples = buffers.length>>1;
int64 incr = 256;
int64 bufferSamples = buffers.length>>1;
//if we're we're too far behind, playback faster
if(bufferSamples > soundrate*3/60) {
int behind = bufferSamples - soundrate/60;
int64 behind = bufferSamples - soundrate/60;
incr = behind*256*60/soundrate/2;
//we multiply our playback rate by 1/2 the number of frames we're behind
}
if(incr<256) printf("OHNO -- %d -- shouldnt be less than 256!\n",incr); //sanity check: should never be less than 256
if(incr<256)
{
//sanity check: should never be less than 256
printf("OHNO -- %d -- shouldnt be less than 256!\n",incr);
}
incr = (incr*scale)>>8; //apply scaling factor