diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index d7bb29854..cb5cad5a7 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -6044,6 +6044,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState stopWelcomeMusic(); stopAudioPlayback(); + // Force pauses audio preview from OffsetsToolbox, if it exists. + cast(this.getToolbox(CHART_EDITOR_TOOLBOX_OFFSETS_LAYOUT), ChartEditorOffsetsToolbox)?.pauseAudioPreview(); + var startTimestamp:Float = 0; if (playtestStartTime) startTimestamp = scrollPositionInMs + playheadPositionInMs; @@ -6228,6 +6231,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { // Don't allow the audio to be played while we're dragging any of the playheads if (playbarHeadDragging || gridPlayheadScrollAreaPressed || notePreviewPlayHeadDragging) return; + cast(this.getToolbox(CHART_EDITOR_TOOLBOX_OFFSETS_LAYOUT), ChartEditorOffsetsToolbox)?.pauseAudioPreview(); audioInstTrack.play(false, audioInstTrack.time); audioVocalTrackGroup.play(false, audioInstTrack.time); } @@ -6796,14 +6800,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState return note != null && curStackedNotes.contains(note); } - public override function openSubState(subState:FlxSubState):Void - { - // Force stops audio preview from OffsetsToolbox, if it exists. - cast(this.getToolbox(CHART_EDITOR_TOOLBOX_OFFSETS_LAYOUT), ChartEditorOffsetsToolbox)?.stopAudioPreview(); - - super.openSubState(subState); - } - override function destroy():Void { super.destroy(); diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx index 8a731b16e..18e4a5caf 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx @@ -103,6 +103,7 @@ class ChartEditorOffsetsToolbox extends ChartEditorBaseToolbox function onClose(event:UIEvent) { + stopAudioPreview(); // Pause it instead, maybe? chartEditorState.menubarItemToggleToolboxOffsets.selected = false; } @@ -458,6 +459,7 @@ class ChartEditorOffsetsToolbox extends ChartEditorBaseToolbox public function playAudioPreview():Void { + chartEditorState.stopAudioPlayback(); audioPreviewTracks.play(false, audioPreviewTracks.time); }