diff --git a/hmm.json b/hmm.json index 7e17f105c..4b2885a87 100644 --- a/hmm.json +++ b/hmm.json @@ -54,14 +54,14 @@ "name": "haxeui-core", "type": "git", "dir": null, - "ref": "bb904f8b4b205755a310c23ff25219f9dcd62711", + "ref": "5b2d5b8e7e470cf637953e1369c80a1f42016a75", "url": "https://github.com/haxeui/haxeui-core" }, { "name": "haxeui-flixel", "type": "git", "dir": null, - "ref": "1ec470c297afd7758a90dc9399aa1e3a4ea6ca0b", + "ref": "e9f880522e27134b29df4067f82df7d7e5237b70", "url": "https://github.com/haxeui/haxeui-flixel" }, { diff --git a/source/funkin/audio/visualize/PolygonVisGroup.hx b/source/funkin/audio/visualize/PolygonVisGroup.hx index 2903eaccd..cc68f4ae0 100644 --- a/source/funkin/audio/visualize/PolygonVisGroup.hx +++ b/source/funkin/audio/visualize/PolygonVisGroup.hx @@ -8,8 +8,7 @@ class PolygonVisGroup extends FlxTypedGroup { 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 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. diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index 089eb6c92..0434607f3 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -235,6 +235,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry Vocal Volume` label. + * The `Audio -> Player Volume` label. */ - var menubarLabelVolumeVocals:Label; + var menubarLabelVolumeVocalsPlayer:Label; /** - * The `Audio -> Vocal Volume` slider. + * The `Audio -> Enemy Volume` label. */ - var menubarItemVolumeVocals:Slider; + var menubarLabelVolumeVocalsOpponent:Label; + + /** + * The `Audio -> Player Volume` slider. + */ + var menubarItemVolumeVocalsPlayer:Slider; + + /** + * The `Audio -> Enemy Volume` slider. + */ + var menubarItemVolumeVocalsOpponent:Slider; /** * The `Audio -> Playback Speed` label. @@ -2601,37 +2639,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState performCommand(new SetItemSelectionCommand([], currentSongChartEventData)); } } - - function setupSideSlider(x, y):VerticalSlider - { - var slider = new VerticalSlider(); - slider.allowFocus = false; - slider.x = x; - slider.y = y; - slider.width = NOTE_SELECT_BUTTON_HEIGHT; - slider.height = GRID_SIZE * 4; - slider.pos = slider.max; - slider.tooltip = "Slide to set the volume of sounds on this side."; - slider.zIndex = 110; - slider.styleNames = "sideSlider"; - add(slider); - - return slider; - } - - var sliderY = GRID_INITIAL_Y_POS + 34; - sliderVolumeOpponent = setupSideSlider(GRID_X_POS - 64, sliderY); - sliderVolumePlayer = setupSideSlider(buttonSelectEvent.x + buttonSelectEvent.width, sliderY); - - sliderVolumePlayer.onChange = event -> { - var volume:Float = event.value.toFloat() / 100.0; - soundMultiplierPlayer = volume; - } - - sliderVolumeOpponent.onChange = event -> { - var volume:Float = event.value.toFloat() / 100.0; - soundMultiplierOpponent = volume; - } } /** @@ -2870,18 +2877,20 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState menubarLabelVolumeInstrumental.text = 'Instrumental - ${Std.int(event.value)}%'; }; - menubarItemVolumeVocals.onChange = event -> { + menubarItemVolumeVocalsPlayer.onChange = event -> { var volume:Float = event.value.toFloat() / 100.0; - if (audioVocalTrackGroup != null) - { - audioVocalTrackGroup.playerVolume = volume * soundMultiplierPlayer; - audioVocalTrackGroup.opponentVolume = volume * soundMultiplierOpponent; - } - menubarLabelVolumeVocals.text = 'Voices - ${Std.int(event.value)}%'; - } + if (audioVocalTrackGroup != null) audioVocalTrackGroup.playerVolume = volume; + menubarLabelVolumeVocalsPlayer.text = 'Player - ${Std.int(event.value)}%'; + }; + + menubarItemVolumeVocalsOpponent.onChange = event -> { + var volume:Float = event.value.toFloat() / 100.0; + if (audioVocalTrackGroup != null) audioVocalTrackGroup.opponentVolume = volume; + menubarLabelVolumeVocalsOpponent.text = 'Enemy - ${Std.int(event.value)}%'; + }; menubarItemPlaybackSpeed.onChange = event -> { - var pitch:Float = (event.value * 2.0) / 100.0; + var pitch:Float = (event.value.toFloat() * 2.0) / 100.0; pitch = Math.floor(pitch / 0.25) * 0.25; // Round to nearest 0.25. #if FLX_PITCH if (audioInstTrack != null) audioInstTrack.pitch = pitch; @@ -5734,7 +5743,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Reapply the volume. var instTargetVolume:Float = menubarItemVolumeInstrumental.value ?? 1.0; - var vocalTargetVolume:Float = menubarItemVolumeVocals.value ?? 1.0; + var vocalPlayerTargetVolume:Float = menubarItemVolumeVocalsPlayer.value ?? 1.0; + var vocalOpponentTargetVolume:Float = menubarItemVolumeVocalsOpponent.value ?? 1.0; if (audioInstTrack != null) { @@ -5743,8 +5753,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } if (audioVocalTrackGroup != null) { - audioVocalTrackGroup.playerVolume = vocalTargetVolume * soundMultiplierPlayer; - audioVocalTrackGroup.opponentVolume = vocalTargetVolume * soundMultiplierOpponent; + audioVocalTrackGroup.playerVolume = vocalPlayerTargetVolume; + audioVocalTrackGroup.opponentVolume = vocalOpponentTargetVolume; } } @@ -5861,9 +5871,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState switch (noteData.getStrumlineIndex()) { case 0: // Player - if (hitsoundsEnabledPlayer) this.playSound(Paths.sound('chartingSounds/hitNotePlayer'), hitsoundVolume * soundMultiplierPlayer); + if (hitsoundsEnabledPlayer) this.playSound(Paths.sound('chartingSounds/hitNotePlayer'), hitsoundVolume); case 1: // Opponent - if (hitsoundsEnabledOpponent) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolume * soundMultiplierOpponent); + if (hitsoundsEnabledOpponent) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolume); } } } diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx index d7fbd42c2..e1fcd1cb0 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx @@ -190,7 +190,7 @@ class ChartEditorAudioHandler state.audioVisGroup.playerVis.detail = 1; state.audioVisGroup.playerVis.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD); - state.audioVocalTrackGroup.playerVoicesOffset = state.currentSongOffsets.getVocalOffset(charId); + state.audioVocalTrackGroup.playerVoicesOffset = state.currentVocalOffset; return true; case DAD: state.audioVocalTrackGroup.addOpponentVoice(vocalTrack); @@ -202,7 +202,7 @@ class ChartEditorAudioHandler state.audioVisGroup.opponentVis.detail = 1; state.audioVisGroup.opponentVis.y = Math.max(state.gridTiledSprite?.y ?? 0.0, ChartEditorState.GRID_INITIAL_Y_POS - ChartEditorState.GRID_TOP_PAD); - state.audioVocalTrackGroup.opponentVoicesOffset = state.currentSongOffsets.getVocalOffset(charId); + state.audioVocalTrackGroup.opponentVoicesOffset = state.currentVocalOffset; return true; case OTHER: @@ -223,6 +223,10 @@ class ChartEditorAudioHandler { state.audioVocalTrackGroup.clear(); } + if (state.audioVisGroup != null) + { + state.audioVisGroup.clearAllVis(); + } } /** diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx index 06b20ed7c..46c2b19aa 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx @@ -150,7 +150,12 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox inputOffsetVocal.onChange = function(event:UIEvent) { if (event.value == null) return; - chartEditorState.currentSongMetadata.offsets.setVocalOffset(chartEditorState.currentSongMetadata.playData.characters.player, event.value); + chartEditorState.currentVocalOffset = event.value; + if (chartEditorState.audioVocalTrackGroup != null) + { + chartEditorState.audioVocalTrackGroup.playerVoicesOffset = event.value; + chartEditorState.audioVocalTrackGroup.opponentVoicesOffset = event.value; + } }; inputScrollSpeed.onChange = function(event:UIEvent) { var valid:Bool = event.target.value != null && event.target.value > 0; @@ -191,6 +196,8 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox inputStage.value = chartEditorState.currentSongMetadata.playData.stage; inputNoteStyle.value = chartEditorState.currentSongMetadata.playData.noteStyle; inputBPM.value = chartEditorState.currentSongMetadata.timeChanges[0].bpm; + inputOffsetInst.value = chartEditorState.currentSongMetadata.offsets.getInstrumentalOffset(); + inputOffsetVocal.value = chartEditorState.currentSongMetadata.offsets.getVocalOffset(chartEditorState.currentSongMetadata.playData.characters.player); inputScrollSpeed.value = chartEditorState.currentSongChartScrollSpeed; labelScrollSpeed.text = 'Scroll Speed: ${chartEditorState.currentSongChartScrollSpeed}x'; frameVariation.text = 'Variation: ${chartEditorState.selectedVariation.toTitleCase()}';