ValleyBell / libvgm

A more modular rewrite of most components from VGMPlay. will include sub-libraries for audio output, sound emulation and VGM playback
irc://irc.digibase.ca/#vgmrips
136 stars 33 forks source link

Speed-invariant time measurements #112

Open mmontag opened 1 year ago

mmontag commented 1 year ago

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?

mmontag commented 1 year ago

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

ValleyBell commented 1 year ago

The eventual play is to have a separate "flags" parameter that allows the user to switch between various time formats.

Use cases:

ValleyBell commented 6 months ago

Does 77909e3f0d14500f8bc7b7a4aeb781d91decdc66 add all the options you need?