libvgm
libvgm copied to clipboard
Speed-invariant time measurements
Hi, I noticed that the return values of PlayerA::GetTotalTime and PlayerA::GetCurTime change with playback speed. For example, if current/total time is 10s/30s, and you set speed to 2.0x, then current/total time becomes 5s/15s.
I find it easier to think of a song's clock duration as fixed, much like song ticks. What is the simplest way to modify this behavior in my fork so that the time is constant over change of playback speed?
Just multiplying these by current speed is the easiest fix (thanks @ValleyBell).
Now I remember I had to do a similar tweak in game_music_emu: https://github.com/mmontag/chip-player-js/commit/8e912ff97db5afbba70585b6f476e370f9b97988
The eventual play is to have a separate "flags" parameter that allows the user to switch between various time formats.
- with or without loops
- actual (playback) time or file time
Use cases:
- VGMPlay: without loops (jumps back at loop point), "file time" (progressing going slower or faster when changing playback speed)
- in_vgm: with loops (effective playing time), "actual time" (real time independent of playback speed)
Does 77909e3f0d14500f8bc7b7a4aeb781d91decdc66 add all the options you need?