hex007 / freej2me

A free J2ME emulator with libretro, awt and sdl2 frontends.
Other
501 stars 78 forks source link

Audio playback loops more times than it should #197

Open AShiningRay opened 1 year ago

AShiningRay commented 1 year ago

Not exactly a good issue to explain, but the general gist of it is as follows:

On both MIDI and Wav streams (including ADPCM, which made things even more apparent since that one is mostly used for SFX), playback always repeats twice for audio that should only play once, thrice for audio that should play only twice, and so on.

This seems to be caused by a mismatch in how J2ME and Java 8+ interpret loop counts. On J2ME a count of 1 denotes that a certain audio cue should only play a single time, whereas on Java 8 a count of 1 denotes that it should play, and then loop another time... at least that's what happens on all games i tested so far.

I got a simple fix for that, pushing soon alongside another issue i want to discuss.