Get monitor refresh rate

Hi,
Searched a bit but couldn’t find, Is it possible somehow to know the current refresh rate of a monitor?

I’m afraid this isn’t possible using the JUCE API.

While you can’t do it with JUCE, you might achieve what you want using native APIs. We added support to query the nominal display refresh rate when using OpenGL in our in-house JUCE fork.

On Windows we use EnumDisplaySettingsA. This call is not OpenGL specific.

On macOS we use CVDisplayLinkGetNominalOutputVideoRefreshPeriod. This call needs the CVDisplayLink instance used for the display you are working with. We query it from the underlying cached image instance used by the OpenGL context implementation JUCE uses on macOS.

This works great for us. Maybe these hints help you implementing something like that yourself @FX23, it only took me a few hours of work getting this implemented, most of it was research. If the JUCE team is interested, I can also share some implementation code.

Ok cool, thanks for hints and answers, will investigate this direction

Would you be willing to share code for this, along with any downsides you have encountered out in the wild, if any?