I’m using the latest stable Juce version (1.53) and I’ve been having problems with the Juce’s Timers.
I use them for a kind of debouncing system (want to prevent an action from being repeated really too fast). On each action trigger, startTimer is called, and then any incoming action request is blocked till it reaches the timerCallback (where stopTimer is called).
Here’s my problem:
The timerCallback is very often processed really earlier than expected. For instance, with a 20ms timer, it gets called after only 3ms (or even 1, this time varies a lot).
Note I use getMillisecondsHiRes to compute the delay between the startTimer and the timerCallback.
I obviously expect the Timer not to be very precise (as written in the Timer comments) but can’t figure out how, nor why, the time can be so different and short!
Last but not least, by adding some debug output in Timers’ code (in startTimer and callTimers), i noticed that for any Timer running in Juce, the first callback is often called very early, but that’s less annoying when you want an action to be repeated and not only one callback.
I mainly have this issue using PCs running Win7, haven’t tested on Mac or Linux yet.
Thank you in advance for you help!