Fix Voices Muted Option in Charter

This commit is contained in:
Ralty
2025-11-18 12:33:11 +07:00
parent 7fc047615f
commit 15496de225
2 changed files with 12 additions and 5 deletions
+4 -3
View File
@@ -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<Int> = [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;
@@ -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,
{