Fix a bug where removing audio tracks wouldn't remove their visualizers.

This commit is contained in:
EliteMasterEric 2024-01-18 22:28:25 -05:00
parent 583eb81de5
commit d215152aaf
2 changed files with 42 additions and 2 deletions

View file

@ -8,8 +8,7 @@ class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram>
{
public var playerVis:PolygonSpectogram;
public var opponentVis:PolygonSpectogram;
var instVis:PolygonSpectogram;
public var instVis:PolygonSpectogram;
public function new()
{
@ -51,6 +50,43 @@ class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram>
instVis = vis;
}
public function clearPlayerVis():Void
{
if (playerVis != null)
{
remove(playerVis);
playerVis.destroy();
playerVis = null;
}
}
public function clearOpponentVis():Void
{
if (opponentVis != null)
{
remove(opponentVis);
opponentVis.destroy();
opponentVis = null;
}
}
public function clearInstVis():Void
{
if (instVis != null)
{
remove(instVis);
instVis.destroy();
instVis = null;
}
}
public function clearAllVis():Void
{
clearPlayerVis();
clearOpponentVis();
clearInstVis();
}
/**
* Overrides the add function to add a visualizer to the group.
* @param vis The visualizer to add.

View file

@ -223,6 +223,10 @@ class ChartEditorAudioHandler
{
state.audioVocalTrackGroup.clear();
}
if (state.audioVisGroup != null)
{
state.audioVisGroup.clearAllVis();
}
}
/**