EasyRPG / Player

RPG Maker 2000/2003 and EasyRPG games interpreter
https://easyrpg.org/player/
GNU General Public License v3.0
1.01k stars 190 forks source link

Control Variables MIDI ticks does not work correctly on wav and mp3 files + Maniac behaviours for ogg files #3047

Open Mimigris opened 1 year ago

Mimigris commented 1 year ago

Player platform:

Windows, 64 bits continuous build of the Player.

Describe the issue in detail and how to reproduce it:

When the command Control Variables: MIDI tick rate is used on a wav file, the number of seconds passed is tracked instead of the progression of the track, so it does not work correctly. This break the autoplay feature of the Sound Room of Yume 2kki (how surprising I know) that uses the value 0 of the midi tick command to know if a wav file has been looped. On a similar thing, an mp3 file will allow more possible values toward the end of the track unlike the original RPG_RT, likely due to the loop issue with these files in the original engine.

Maniac behaviour for ogg files (this would probably need to be changed to this set of behaviour when a game is recognised as a maniac game):

Ghabry commented 1 year ago

When the command Control Variables: MIDI tick rate is used on a wav file, the number of seconds passed is tracked instead of the progression of the track

We return how many seconds of the track have been played. When the track is made faster using pitch then our second counter also moves faster. Does RPG_RT ignore the pitch?

If yes this will be almost impossible to fix with the currect audio decoder design as the audio format decoders are not aware of the resampler. When the pitch is higher the resampler simply requests more bytes from the format decoder and these format decoders count how many bytes were decoded by now to calculate the seconds. Same for MP3 and OGG.

Ghabry commented 1 year ago

Also something like ticks makes no sense for OGG files. They don't have ticks. That raises the question what these ticks are and why BingShan thought it makes sense to be inconsistent here compared to WAV and MP3. -_-

Mimigris commented 1 year ago

We return how many seconds of the track have been played. When the track is made faster using pitch then our second counter also moves faster. Does RPG_RT ignore the pitch?

It seems that the Player works as intended on this side like on the RPG_RT: when the speed of the track is altered, the value obtained will take more or less time to be updated (1 second of the track can be slower or faster if the pitch is altered for example). The issue here for wav file is that it is not the progression of the track that it tracked, but rather for how long the track has been playing including the pitch (e.g. a 2 seconds track playing for 5 seconds will return something like 1 in the RPG_RT due to the fact that the track looped while the Player will report 5 seconds).

Ghabry commented 1 year ago

Ah now I get it. Okay this is simple to fix. Forgot to reset the sample count variable. (Most libraries we use do not support "tell me the progress", I simply count the samples instead and calculate it)