I’m trying to convert an oF app from Mac to PC that needs precise timing. The timer code is running in audioRequested, which on the Mac is running in nice 3ms intervals, but on Windows the timing is all over the place.
I’ve tried the optional ‘precise timing’ flag (forgot the exact name now) but that resulted in a whole bunch of compile errors here (code::blocks on PC)
I’ve read a few articles on using Multimedia timers but couldn’t get them compiled, compiler didn’t like the inline asm…
I’ve also tried using a thread with a sleeping timer but even that is highly unprecise, I’ve read other threads on the forum about timing and tried a lot but to no avail.
Did someone manage to solve this on Windows? or have any ideas, or an example on how to get a multimedia timer working?
the best thing to do in this case is to run a thread that repeatedly sleep for a short period of time, until you’re ready to run. for example, to sleep 3ms you should set a high performance timer (i think that’s what they’re called on windows) called start to ‘now’ then make a while loop:
// sleep for 3ms
start = 'now';
if ( 'now'-start > 3ms )