diff --git a/modules/juce_core/native/juce_win32_SystemStats.cpp b/modules/juce_core/native/juce_win32_SystemStats.cpp index 44065cdb8f..901bc761fe 100644 --- a/modules/juce_core/native/juce_win32_SystemStats.cpp +++ b/modules/juce_core/native/juce_win32_SystemStats.cpp @@ -253,9 +253,23 @@ public: HiResCounterHandler() : hiResTicksOffset (0) { - const MMRESULT res = timeBeginPeriod (1); + // This macro allows you to override the default timer-period + // used on Windows. By default this is set to 1, because that has + // always been the value used in JUCE apps, and changing it could + // affect the behaviour of existing code, but you may wish to make + // it larger (or set it to 0 to use the system default) to make your + // app less demanding on the CPU. + // For more info, see win32 documentation about the timeBeginPeriod + // function. + #ifndef JUCE_WIN32_TIMER_PERIOD + #define JUCE_WIN32_TIMER_PERIOD 1 + #endif + + #if JUCE_WIN32_TIMER_PERIOD > 0 + const MMRESULT res = timeBeginPeriod (JUCE_WIN32_TIMER_PERIOD); (void) res; jassert (res == TIMERR_NOERROR); + #endif LARGE_INTEGER f; QueryPerformanceFrequency (&f);