Hi Jules,
i think your description (http://www.juce.com/api/classHighResolutionTimer.html#a9d3709eee45c33f0d2095ab80121a965) is wrong. The timer does not change the interval if I call startTimer(X) again (i hope i understand this right).
I have changed the code in juce_posix_SharedCode.h from:
void timerThread() { Clock clock (periodMs); while (! shouldStop) { clock.wait(); owner.hiResTimerCallback(); } periodMs = 0; thread = 0; }
to:
void timerThread() { int tmpPeriod = periodMs; Clock clock (tmp_period); while (! shouldStop) { if( tmpPeriod != periodMs) { tmpPeriod = periodMs; // reset the clock clock = Clock(tmpPeriod); } clock.wait(); owner.hiResTimerCallback(); } periodMs = 0; thread = 0; }
Otherwise no interval changes will be made.
But I'm not familiar with the setThreadToRealtime things and have no idea if it is a problem for the accuracy.
Completely stopping and restarting the timer burns the CPU very much and on iOS it crash if you do it in very short intervals.
Windows I don't have checked yet.