projectM-visualizer / projectm

projectM - Cross-platform Music Visualization Library. Open-source and Milkdrop-compatible.
https://discord.gg/mMrxAqaa3W
GNU Lesser General Public License v2.1
3.22k stars 365 forks source link

Add external timing API #817

Closed kblaschke closed 1 week ago

kblaschke commented 3 weeks ago

Allow apps to set the time before each frame, allowing for non-realtime rendering with fixed or dynamic framerates. Setting the frame time to any value equal to or greater than zero will use this value for the next frame, while setting it to a negative value will make projectM use the system time instead.

The value defaults to -1.0, so if the projectm_set_frame_time() method is not called, projectM will just behave as in previous versions.

Also added another function to retrieve the time of the last rendered frame.

Closes #740