Istfg why didnt we fix this months ago

This commit is contained in:
Ne_Eo
2024-07-26 04:42:06 +02:00
parent d4a7d7eac4
commit 64923a3e07
+15 -6
View File
@@ -607,20 +607,29 @@ class Charter extends UIState {
updateWaveforms(); updateWaveforms();
} }
inline function isSoundLoaded(sound:FlxSound) {
@:privateAccess
return sound != null && sound._sound != null && sound._sound.length > 0;
}
public function updateWaveforms() { public function updateWaveforms() {
var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [ var wavesToGenerate:Array<{name:String, sound:FlxSound}> = [];
{name: "Inst.ogg", sound: FlxG.sound.music},
]; if(isSoundLoaded(FlxG.sound.music))
if (PlayState.SONG.meta.needsVoices != false) wavesToGenerate.push({name: "Inst.ogg", sound: FlxG.sound.music});
if (PlayState.SONG.meta.needsVoices != false && isSoundLoaded(vocals))
wavesToGenerate.push({name: "Voices.ogg", sound: vocals}); wavesToGenerate.push({name: "Voices.ogg", sound: vocals});
for (strumLine in strumLines) 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({ wavesToGenerate.push({
name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg', name: 'Voices${strumLine.strumLine.vocalsSuffix}.ogg',
sound: strumLine.vocals sound: strumLine.vocals
}); });
trace(wavesToGenerate, @:privateAccess vocals._sound, @:privateAccess vocals._sound?.length);
var oldWaveformList:Array<String> = waveformHandler.waveformList; var oldWaveformList:Array<String> = waveformHandler.waveformList;
var newWaveformList:Array<String> = [for (data in wavesToGenerate) data.name]; var newWaveformList:Array<String> = [for (data in wavesToGenerate) data.name];