mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-15 19:33:36 +00:00
fading in and erect track loading
This commit is contained in:
parent
1b6febf01c
commit
f2a06ad37b
|
@ -347,10 +347,11 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var pathsFunction = params.pathsFunction ?? MUSIC;
|
var pathsFunction = params.pathsFunction ?? MUSIC;
|
||||||
|
var suffix = params.suffix ?? '';
|
||||||
var pathToUse = switch (pathsFunction)
|
var pathToUse = switch (pathsFunction)
|
||||||
{
|
{
|
||||||
case MUSIC: Paths.music('$key/$key');
|
case MUSIC: Paths.music('$key/$key');
|
||||||
case INST: Paths.inst('$key');
|
case INST: Paths.inst('$key', suffix);
|
||||||
default: Paths.music('$key/$key');
|
default: Paths.music('$key/$key');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +360,7 @@ class FunkinSound extends FlxSound implements ICloneable<FunkinSound>
|
||||||
if (shouldLoadPartial)
|
if (shouldLoadPartial)
|
||||||
{
|
{
|
||||||
var music = FunkinSound.loadPartial(pathToUse, params.partialParams?.start ?? 0, params.partialParams?.end ?? 1, params?.startingVolume ?? 1.0,
|
var music = FunkinSound.loadPartial(pathToUse, params.partialParams?.start ?? 0, params.partialParams?.end ?? 1, params?.startingVolume ?? 1.0,
|
||||||
params.loop ?? true, false, true);
|
params.loop ?? true, false, true, params.onComplete, params.onLoad);
|
||||||
|
|
||||||
if (music != null)
|
if (music != null)
|
||||||
{
|
{
|
||||||
|
@ -541,6 +542,12 @@ typedef FunkinSoundPlayMusicParams =
|
||||||
*/
|
*/
|
||||||
var ?startingVolume:Float;
|
var ?startingVolume:Float;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The suffix of the music file to play. Usually for "-erect" tracks when loading an INST file
|
||||||
|
* @default ``
|
||||||
|
*/
|
||||||
|
var ?suffix:String;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to override music if a different track is already playing.
|
* Whether to override music if a different track is already playing.
|
||||||
* @default `false`
|
* @default `false`
|
||||||
|
@ -572,6 +579,9 @@ typedef FunkinSoundPlayMusicParams =
|
||||||
var ?pathsFunction:PathsFunction;
|
var ?pathsFunction:PathsFunction;
|
||||||
|
|
||||||
var ?partialParams:PartialSoundParams;
|
var ?partialParams:PartialSoundParams;
|
||||||
|
|
||||||
|
var ?onComplete:Void->Void;
|
||||||
|
var ?onLoad:Void->Void;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef PartialSoundParams =
|
typedef PartialSoundParams =
|
||||||
|
|
|
@ -1243,18 +1243,23 @@ class FreeplayState extends MusicBeatSubState
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var potentiallyErect:String = (currentDifficulty == "erect") || (currentDifficulty == "nightmare") ? "-erect" : "";
|
||||||
// TODO: Stream the instrumental of the selected song?
|
// TODO: Stream the instrumental of the selected song?
|
||||||
FunkinSound.playMusic(daSongCapsule.songData.songId,
|
FunkinSound.playMusic(daSongCapsule.songData.songId,
|
||||||
{
|
{
|
||||||
startingVolume: 0.5,
|
startingVolume: 0.0,
|
||||||
overrideExisting: true,
|
overrideExisting: true,
|
||||||
restartTrack: false,
|
restartTrack: false,
|
||||||
pathsFunction: INST,
|
pathsFunction: INST,
|
||||||
|
suffix: potentiallyErect,
|
||||||
partialParams:
|
partialParams:
|
||||||
{
|
{
|
||||||
loadPartial: true,
|
loadPartial: true,
|
||||||
start: 0,
|
start: 0,
|
||||||
end: 0.1
|
end: 0.1
|
||||||
|
},
|
||||||
|
onLoad: function() {
|
||||||
|
FlxG.sound.music.fadeIn(2, 0, 0.4);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue