[hatari-devel] Higher precision when generating samples -> use nanosleep

David Savinkoff dsavnkff at telus.net
Wed Jan 26 19:22:36 CET 2011


> On Jan 26, 2011, Nicolas Pomarède <npomarede at corp.free.fr> wrote: 
>
> With nanosleep, we could get a much better granularity.
>
> We could define our own "FineSleep" function and uses the best possible 
> alternatives depending on the OS / compilation flags (1st nanosleep, 
> then SDL_Delay, active wait on SDL_GetTicks, etc.).
>
> I think it would fix the VBL precision problem with very few changes to 
> Hatari. Any opinion on this ?

Hi,

I would like to see Hatari have the right amount of samples per VBL
for recording sound/video syncronization. This much should be done
without touching emulated-time/actual-time syncronization because
my patch takes care of this. Nanosleep makes the timing better but
still not exact because 'exact' is 'not possible'. My patch continuously
corrects the timing similar to driving a car (or helicopter) in a straight
line; you drive straight with 0 units of steering until you need to
correct with maybe -20 units of steering, then continue with 0 units,
then maybe 20 units, then 0, ... Note that this works so good that
it will prevent some potential hidden bugs from presenting symptoms.
Also, my patch will work with any timer precision on any computer.

David



More information about the hatari-devel mailing list