love2d / love

LÖVE is an awesome 2D game framework for Lua.
https://love2d.org
Other
5.06k stars 400 forks source link

Tracker module audio files don't loop infinitely when streamed on Windows #1498

Closed slime73 closed 5 years ago

slime73 commented 5 years ago

Original report by Raspberry Floof (Bitbucket: Raspberryfloof, GitHub: Raspberryfloof).


Audio sources created from tracker module files (*.mod, *.it, *.xm, etc) with SourceType “stream” stop playing after a few loops when played back on Windows releases of LÖVE. Creating the source with type “static” does not exhibit any problems, nor does streaming a .mp3, .ogg, or .wav audio file. This problem dates back at least to release 0.10.0 on Windows; 0.9.2 seems to loop forever. This problem also does not seem to occur with Linux releases.

Steps to reproduce:

  1. Create a new audio source from a tracker module file, with type “stream”.
  2. Set this audio source to loop.
  3. Play the audio source.
  4. The source will stop after playing for a few loops (exactly seven, at least on my setup).

I’ve attached a very small test .love file that demonstrates this bug.

slime73 commented 5 years ago

Original comment by Gabe Stilez (Bitbucket: z0r8, ).


Personally can’t reproduce on Win7x64 with Löve v11.1.0-win64; it passed about a 100 loops and i stopped counting after that.

What i will say is that the song does pause a bit more between replays than how a real replayer (like OpenMPT) would play it back, since libmodplug apparently adds some extra silence to the end of the song, for safety, i guess.

slime73 commented 5 years ago

Original comment by Raspberry Floof (Bitbucket: Raspberryfloof, GitHub: Raspberryfloof).


Oh that’s interesting; we were testing using a nightly build of 11.3, so I didn’t notice it worked fine on 11.0 through 11.2. Sorry!

The problem does occur, though, on 0.10.0, 0.10.2, and nightly builds of 11.3, starting with 11.3.992. 11.3.991 doesn’t exhibit any problems.

slime73 commented 5 years ago

Original comment by Raspberry Floof (Bitbucket: Raspberryfloof, GitHub: Raspberryfloof).


@Gabe Stilez: We were originally using a workaround for the ending pause by manually restarting our audio files just before it was "finished" playing (according to Source:getDuration()'s length for the track). When we moved to testing on a nightly build of 11.3, that caused a different problem, where the Source would get corrupted and only ever play the first half-second of audio or so for any subsequent calls to Source:play().

I attached a file that demonstrates that problem, which only occurs in nightly 11.3.992 and onwards. Something in that build seems like it broke tracker file audio playback a bit...

slime73 commented 5 years ago

Original comment by Gabe Stilez (Bitbucket: z0r8, ).


https://bitbucket.org/rude/love/commits/dc6dfa224746cfccd03a9bb5d2ba0ff1e395daeb seems like the culprit, as the notes mention, the logic is again more like how it was with 0.10.x versions, and the reason was popping with streaming sources on iOS.

(Not gonna be available for a week though so i can’t test things further.)

slime73 commented 5 years ago

Original comment by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


Fix modplug-decoded streaming Sources when looping repeatedly, and when stop() is called on them. Resolves #1498.

slime73 commented 5 years ago

Original comment by Alex Szpakowski (Bitbucket: slime73, GitHub: slime73).


Thanks for the nice repro projects! I believe I’ve solved both issues.

slime73 commented 5 years ago

Original comment by Raspberry Floof (Bitbucket: Raspberryfloof, GitHub: Raspberryfloof).


Everything seems like it’s working again in nightly 11.3.1000. Thank you so much!