Merge remote-tracking branch 'upstream/main'

This commit is contained in:
Ne_Eo
2024-07-26 04:45:52 +02:00
3 changed files with 15 additions and 8 deletions
+13 -6
View File
@@ -598,17 +598,24 @@ class Charter extends UIState {
updateWaveforms();
}
inline function isSoundLoaded(sound:FlxSound) {
@:privateAccess
return sound != null && sound._sound != null && sound._sound.length > 0;
}
public function updateWaveforms() {
var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [
{name: "Inst.ogg", sound: FlxG.sound.music},
];
if (@:privateAccess vocals._sound != null) //for some reason Assets.exists returns true regardless if the file actually exists
var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [];
if(isSoundLoaded(FlxG.sound.music))
wavesToGenerate.push({name: "Inst.ogg", sound: FlxG.sound.music});
if (PlayState.SONG.meta.needsVoices != false && isSoundLoaded(vocals))
wavesToGenerate.push({name: "Voices.ogg", sound: vocals});
for (strumLine in strumLines)
if (strumLine.vocals != null && strumLine.strumLine.vocalsSuffix != null && strumLine.strumLine.vocalsSuffix != "")
if (strumLine.vocals != null && strumLine.strumLine.vocalsSuffix != null && strumLine.strumLine.vocalsSuffix != "" && isSoundLoaded(strumLine.vocals))
wavesToGenerate.push({
name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg',
name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg',
sound: strumLine.vocals
});