mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-07-29 15:30:10 -04:00
Funkin sound restarting music fix
This commit is contained in:
parent
edb270d15e
commit
260f4f6132
1 changed files with 12 additions and 11 deletions
|
@ -313,13 +313,22 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
{
|
||||
if (!(params.overrideExisting ?? false) && (FlxG.sound.music?.exists ?? false) && FlxG.sound.music.playing) return false;
|
||||
|
||||
var pathsFunction = params.pathsFunction ?? MUSIC;
|
||||
var suffix = params.suffix ?? '';
|
||||
var pathToUse = switch (pathsFunction)
|
||||
{
|
||||
case MUSIC: Paths.music('$key/$key');
|
||||
case INST: Paths.inst('$key', suffix);
|
||||
default: Paths.music('$key/$key');
|
||||
}
|
||||
|
||||
if (!(params.restartTrack ?? false) && FlxG.sound.music?.playing)
|
||||
{
|
||||
if (FlxG.sound.music != null && Std.isOfType(FlxG.sound.music, FunkinSound))
|
||||
{
|
||||
var existingSound:FunkinSound = cast FlxG.sound.music;
|
||||
// Stop here if we would play a matching music track.
|
||||
if (existingSound._label == Paths.music('$key/$key'))
|
||||
if (existingSound._label == pathToUse)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -348,15 +357,6 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
FlxG.log.warn('Tried and failed to find music metadata for $key');
|
||||
}
|
||||
}
|
||||
var pathsFunction = params.pathsFunction ?? MUSIC;
|
||||
var suffix = params.suffix ?? '';
|
||||
var pathToUse = switch (pathsFunction)
|
||||
{
|
||||
case MUSIC: Paths.music('$key/$key');
|
||||
case INST: Paths.inst('$key', suffix);
|
||||
default: Paths.music('$key/$key');
|
||||
}
|
||||
|
||||
var shouldLoadPartial = params.partialParams?.loadPartial ?? false;
|
||||
|
||||
// even if we arent' trying to partial load a song, we want to error out any songs in progress,
|
||||
|
@ -514,7 +514,8 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
|||
});
|
||||
|
||||
soundRequest.future.onComplete(function(partialSound) {
|
||||
var snd = FunkinSound.load(partialSound, volume, looped, autoDestroy, autoPlay, false, onComplete, onLoad);
|
||||
var snd:Null<FunkinSound> = FunkinSound.load(partialSound, volume, looped, autoDestroy, autoPlay, false, onComplete, onLoad);
|
||||
if (snd != null) snd._label = path;
|
||||
promise.complete(snd);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue