Corrected seeking function for Neill's emulators, most of which have a maximum number of samples they'll render per call; the seeking function also breaks out the instant that any of those cores return an error status

CQTexperiment
Chris Moeller 2013-10-20 22:02:59 -07:00
parent 4764c5eacd
commit 761ea97e0e
1 changed files with 31 additions and 12 deletions

View File

@ -1309,16 +1309,24 @@ static int twosf_info(void * context, const char * name, const char * value)
} }
if ( type == 1 || type == 2 ) if ( type == 1 || type == 2 )
{
do
{ {
uint32_t howmany = (uint32_t)(frame - framesRead); uint32_t howmany = (uint32_t)(frame - framesRead);
psx_execute( emulatorCore, 0x7fffffff, 0, &howmany, 0 ); if ( psx_execute( emulatorCore, 0x7fffffff, 0, &howmany, 0 ) < 0 ) break;
frame = (long)(howmany + framesRead); framesRead += howmany;
}
while (framesRead < frame);
} }
else if ( type == 0x11 || type == 0x12 ) else if ( type == 0x11 || type == 0x12 )
{
do
{ {
uint32_t howmany = (uint32_t)(frame - framesRead); uint32_t howmany = (uint32_t)(frame - framesRead);
sega_execute( emulatorCore, 0x7fffffff, 0, &howmany ); if ( sega_execute( emulatorCore, 0x7fffffff, 0, &howmany ) < 0 ) break;
frame = (long)(howmany + framesRead); framesRead += howmany;
}
while (framesRead < frame);
} }
else if ( type == 0x22 ) else if ( type == 0x22 )
{ {
@ -1342,8 +1350,13 @@ static int twosf_info(void * context, const char * name, const char * value)
} }
if ( frames_to_run ) if ( frames_to_run )
{
CPULoop( system, 250000 ); CPULoop( system, 250000 );
if ( !sound_out->samples_written ) break;
}
} while ( frames_to_run ); } while ( frames_to_run );
framesRead = frame;
} }
else if ( type == 0x24 ) else if ( type == 0x24 )
{ {
@ -1362,6 +1375,8 @@ static int twosf_info(void * context, const char * name, const char * value)
frames_to_run -= frames_this_run; frames_to_run -= frames_this_run;
} }
framesRead = frame;
} }
else if ( type == 0x25 ) else if ( type == 0x25 )
{ {
@ -1381,17 +1396,21 @@ static int twosf_info(void * context, const char * name, const char * value)
frames_to_run -= frames_to_render; frames_to_run -= frames_to_render;
} }
framesRead = frame;
} }
else if ( type == 0x41 ) else if ( type == 0x41 )
{
do
{ {
uint32_t howmany = (uint32_t)(frame - framesRead); uint32_t howmany = (uint32_t)(frame - framesRead);
qsound_execute( emulatorCore, 0x7fffffff, 0, &howmany ); if ( qsound_execute( emulatorCore, 0x7fffffff, 0, &howmany ) < 0 ) break;
frame = (long)(howmany + framesRead); framesRead += howmany;
}
while ( framesRead < frame );
} }
framesRead = frame; return framesRead;
return frame;
} }
- (NSDictionary *)properties - (NSDictionary *)properties