Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mimigris opened this issue Jun 28, 2023 · 4 comments

Comments

@Mimigris
Copy link

Mimigris commented Jun 28, 2023

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):

  • When used on an ogg file, the current behaviour of the Player gives the number of the current second of the track while Maniac seems to give a number of ticks similar to midi tracks.
  • For BGM has completed a loop with ogg files, it seems to not work in Maniac, so this should probably be always considered as not possible in that case for maniac games.
@Mimigris Mimigris changed the title Control Variables MIDI ticks does not work correctly on wav files + Maniac behaviours for ogg files Control Variables MIDI ticks does not work correctly on wav and mp3 files + Maniac behaviours for ogg files Jun 29, 2023
@Ghabry
Copy link
Member

Ghabry commented Jun 29, 2023

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
Copy link
Member

Ghabry commented Jun 29, 2023

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
Copy link
Author

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
Copy link
Member

Ghabry commented Jun 29, 2023

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)

@Ghabry Ghabry modified the milestones: 0.8.1, 0.8.2 Jul 24, 2023
Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Jul 25, 2023
Ghabry added a commit to Ghabry/easyrpg-player that referenced this issue Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants