mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 01:55:52 -05:00
Properly handle pausing sounds with negative startTime
This commit is contained in:
parent
5557dbf28f
commit
5d00f57bfb
1 changed files with 16 additions and 3 deletions
|
@ -172,8 +172,18 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
|
||||
public override function pause():FunkinSound
|
||||
{
|
||||
super.pause();
|
||||
this._shouldPlay = false;
|
||||
if (_shouldPlay)
|
||||
{
|
||||
// This sound will eventually play, but is still at a negative timestamp.
|
||||
// Manually set the paused flag to ensure proper focus/unfocus behavior.
|
||||
_shouldPlay = false;
|
||||
_paused = true;
|
||||
active = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
super.pause();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -211,7 +221,10 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
{
|
||||
if (this._time < 0)
|
||||
{
|
||||
this._shouldPlay = true;
|
||||
// Sound with negative timestamp, restart the timer.
|
||||
_shouldPlay = true;
|
||||
_paused = false;
|
||||
active = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue