diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 952fdaca..c07c1820 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -80,6 +80,7 @@ class Charter extends UIState { public var metronome:FlxSound; public var vocals:FlxSound; + public var voicesMuted:Bool = false; public var quant:Int = 16; public var quants:Array = [4, 8, 12, 16, 20, 24, 32, 48, 64, 192]; // different quants @@ -1812,9 +1813,9 @@ class Charter extends UIState { t.icon = 1 - Std.int(Math.ceil(FlxG.sound.music.volume)); } function _song_mutevoices(t) { - vocals.volume = vocals.volume > 0 ? 0 : 1; - for (strumLine in strumLines.members) strumLine.vocals.volume = strumLine.vocals.volume > 0 ? 0 : 1; - t.icon = 1 - Std.int(Math.ceil(vocals.volume)); + vocals.volume = (voicesMuted = !voicesMuted) ? 0 : 1; + for (strumLine in strumLines.members) strumLine.updateVoicesVolume(); + t.icon = voicesMuted ? 1 : 0; } function _playback_back(_) { if (FlxG.sound.music.playing) return; diff --git a/source/funkin/editors/charter/CharterStrumline.hx b/source/funkin/editors/charter/CharterStrumline.hx index aea5b679..b22bddd0 100644 --- a/source/funkin/editors/charter/CharterStrumline.hx +++ b/source/funkin/editors/charter/CharterStrumline.hx @@ -22,6 +22,7 @@ class CharterStrumline extends UISprite { public var curMenu:UIContextMenu = null; public var vocals:FlxSound; + public var voicesMuted:Bool = false; public var keyCount:Int = 4; public var startingID(get, null):Int; @@ -147,6 +148,10 @@ class CharterStrumline extends UISprite { } vocals.group = FlxG.sound.defaultMusicGroup; } + + public function updateVoicesVolume() { + vocals.volume = (voicesMuted || (Charter.instance?.voicesMuted ?? false)) ? 0 : 1; + } } class CharterStrumlineOptions extends UITopMenuButton { @@ -176,9 +181,10 @@ class CharterStrumlineOptions extends UITopMenuButton { { label: TU.translate("charter.strumLine.muteVocals"), onSelect: function(_) { - strLine.vocals.volume = strLine.vocals.volume > 0 ? 0 : 1; + strLine.voicesMuted = !strLine.voicesMuted; + strLine.updateVoicesVolume(); }, - icon: strLine.vocals.volume > 0 ? 0 : 1 + icon: strLine.voicesMuted ? 1 : 0 }, null, {