other half of multiple vocals support (finished

This commit is contained in:
Frakist
2023-11-03 11:18:36 +03:00
parent 398b61a824
commit 16b9e96f12
3 changed files with 28 additions and 2 deletions
+9 -1
View File
@@ -408,6 +408,7 @@ class Charter extends UIState {
playBackSlider = new UISlider(FlxG.width - 160 - 26 - 20, (23/2) - (12/2), 160, 1, [{start: 0.25, end: 1, size: 0.5}, {start: 1, end: 2, size: 0.5}], true);
playBackSlider.onChange = function (v) {
FlxG.sound.music.pitch = vocals.pitch = v;
for (strumLine in strumLines.members) strumLine.vocals.pitch = v;
};
uiGroup.add(playBackSlider);
@@ -992,6 +993,7 @@ class Charter extends UIState {
if (Conductor.songPosition >= songLength - Conductor.songOffset) {
FlxG.sound.music.pause();
vocals.pause();
for (strumLine in strumLines.members) strumLine.vocals.pause();
}
songPosInfo.text = '${CoolUtil.timeToStr(Conductor.songPosition)} / ${CoolUtil.timeToStr(songLength)}'
@@ -1244,10 +1246,15 @@ class Charter extends UIState {
if (FlxG.sound.music.playing) {
FlxG.sound.music.pause();
vocals.pause();
for (strumLine in strumLines.members) strumLine.vocals.pause();
} else {
FlxG.sound.music.play();
vocals.play();
vocals.time = FlxG.sound.music.time = Conductor.songPosition + Conductor.songOffset * 2;
for (strumLine in strumLines.members) {
strumLine.vocals.play();
strumLine.vocals.time = vocals.time;
}
}
}
@@ -1260,6 +1267,7 @@ class Charter extends UIState {
}
function _playback_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));
}
function _playback_back(_) {
@@ -1487,7 +1495,7 @@ class CharterNoteTypeButton extends UIButton {
if (textBox != null) textBox.y = y + 4;
if (deleteButton != null) {
deleteButton.y = y + bHeight / 2 - deleteButton.bHeight / 2;
deleteIcon.x = deleteButton.x + (14/2); deleteIcon.y = deleteButton.y + 5;
deleteIcon.x = deleteButton.x + (13/2); deleteIcon.y = deleteButton.y + 5;
}
//x = alpha == 0.25 ? -50 : 10;
}
@@ -6,6 +6,7 @@ import funkin.editors.ui.UIContextMenu.UIContextMenuOption;
import funkin.editors.ui.UITopMenu.UITopMenuButton;
import funkin.game.HealthIcon;
import funkin.backend.chart.ChartData.ChartStrumLine;
import flixel.sound.FlxSound;
class CharterStrumline extends UISprite {
public var strumLine:ChartStrumLine;
@@ -20,6 +21,8 @@ class CharterStrumline extends UISprite {
public var curMenu:UIContextMenu = null;
public var vocals:FlxSound;
public function new(strumLine:ChartStrumLine) {
super();
this.strumLine = strumLine;
@@ -49,6 +52,9 @@ class CharterStrumline extends UISprite {
button = new CharterStrumlineOptions(this);
members.push(button);
vocals = strumLine.vocalsSuffix != "" ? FlxG.sound.load(Paths.voices(PlayState.SONG.meta.name, PlayState.difficulty, strumLine.vocalsSuffix)) : new FlxSound();
vocals.group = FlxG.sound.defaultMusicGroup;
}
private var __healthYOffset:Float = 0;
@@ -92,6 +98,10 @@ class CharterStrumline extends UISprite {
healthIcon.alpha = strumLine.visible ? 1 : 0.4;
members.push(healthIcon);
vocals = null;
vocals = strumLine.vocalsSuffix != "" ? FlxG.sound.load(Paths.voices(PlayState.SONG.meta.name, PlayState.difficulty, strumLine.vocalsSuffix)) : new FlxSound();
vocals.group = FlxG.sound.defaultMusicGroup;
}
}
@@ -143,6 +153,14 @@ class CharterStrumlineOptions extends UITopMenuButton {
},
color: 0xFFFF0000,
icon: 3
},
null,
{
label: "Mute Vocals",
onSelect: function(_) {
strLine.vocals.volume = strLine.vocals.volume > 0 ? 0 : 1;
},
icon: strLine.vocals.volume > 0 ? 0 : 1
}
];
super.openContextMenu();
@@ -152,7 +152,7 @@ class CharterStrumlineScreen extends UISubstateWindow {
}
vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixlist, suffixlist.indexOf(strumLine.vocalsSuffix));
vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixlist, strumLine.vocalsSuffix != "" ? suffixlist.indexOf(strumLine.vocalsSuffix) : 0);
add(vocalsSuffixDropDown);
addLabelOn(vocalsSuffixDropDown, "Vocal Suffix");
}