flixel icon indicating copy to clipboard operation
flixel copied to clipboard

Debug pausing does not stop music and sound

Open EliteMasterEric opened this issue 4 years ago • 3 comments

  • Haxe version: 4.1.5
  • Flixel version: 4.9.0
  • OpenFL version: 9.1.0
  • Lime version: 7.9.0
  • Affected targets: Windows

Observed behavior: Pausing the game (whether through typing in the Debug console or pausing with the VCR) will continue to play music and sound. This can cause problems with applications which check the value of the song position, and is unintuitive (is Flixel REALLY paused right now?)

Expected behavior: Music should stop completely when paused this way, and resume where it left off when resuming.

Notes: It appears this issue was touched on in #1945 but closed for some reason.

EliteMasterEric avatar Sep 14 '21 06:09 EliteMasterEric

this kind of pausing is not meant to be an end-user feature of flixel games, it's only accessible in debug mode and flixel games are usually shipped in release or final mode. If you need some debugging system that pauses the songs you'll probably need to write your own debug tools and even that seems fundamentally shaky. For instance if you trigger a breakpoint in code that won't even pause the sounds because they operate asynchronously.

Geokureli avatar Sep 15 '21 20:09 Geokureli

For additional context, I am writing mods for Friday Night Funkin', whose current codebase relies on using the FlxG.sound.music.time to track the current position in the song chart and therefore when note should be hit. This means that using VCR or breakpoints to pause still continues the music, therefore continuing the song, therefore skipping forward in the song when unpausing.

Is there a way to detect if the code is paused, or trigger a callback when pausing?

EliteMasterEric avatar Sep 15 '21 20:09 EliteMasterEric

Is there a way to detect if the code is paused, or trigger a callback when pausing?

Not that I know of, especially for breakpoints. I recommend making your own debug tool for this, you could try extending flixel.system.debug.VCR and replacing the default instance with overrides for onPause to pause the music

Geokureli avatar Sep 15 '21 21:09 Geokureli