From 64923a3e07317fc36db9e539b546c72d64275653 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 26 Jul 2024 04:42:06 +0200 Subject: [PATCH] Istfg why didnt we fix this months ago --- source/funkin/editors/charter/Charter.hx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 1071763a..9e03c5a6 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -607,20 +607,29 @@ 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 (PlayState.SONG.meta.needsVoices != false) + 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 }); + trace(wavesToGenerate, @:privateAccess vocals._sound, @:privateAccess vocals._sound?.length); + var oldWaveformList:Array = waveformHandler.waveformList; var newWaveformList:Array = [for (data in wavesToGenerate) data.name];