Merge pull request #301 from FunkinCrew/feature/audio-tab-upgrade

Audio tab additions
This commit is contained in:
Cameron Taylor 2024-01-25 23:06:21 -05:00 committed by GitHub
commit d039c20eef
3 changed files with 33 additions and 117 deletions

2
assets

@ -1 +1 @@
Subproject commit 7e19c4cfa7db57178f03ed4a58a9fd4d2b93dea7 Subproject commit b2f8b6a780316959d0a79adc6dbf61f9e4ca675f

View file

@ -108,10 +108,7 @@ abstract Save(RawSaveData)
metronomeVolume: 1.0, metronomeVolume: 1.0,
hitsoundsEnabledPlayer: true, hitsoundsEnabledPlayer: true,
hitsoundsEnabledOpponent: true, hitsoundsEnabledOpponent: true,
themeMusic: true, themeMusic: true
instVolume: 1.0,
voicesVolume: 1.0,
playbackSpeed: 1.0,
}, },
}; };
} }
@ -365,40 +362,6 @@ abstract Save(RawSaveData)
return this.optionsChartEditor.themeMusic; return this.optionsChartEditor.themeMusic;
} }
public var chartEditorInstVolume(get, set):Float;
function get_chartEditorInstVolume():Float
{
if (this.optionsChartEditor.instVolume == null) this.optionsChartEditor.instVolume = 1.0;
return this.optionsChartEditor.instVolume;
}
function set_chartEditorInstVolume(value:Float):Float
{
// Set and apply.
this.optionsChartEditor.instVolume = value;
flush();
return this.optionsChartEditor.instVolume;
}
public var chartEditorVoicesVolume(get, set):Float;
function get_chartEditorVoicesVolume():Float
{
if (this.optionsChartEditor.voicesVolume == null) this.optionsChartEditor.voicesVolume = 1.0;
return this.optionsChartEditor.voicesVolume;
}
function set_chartEditorVoicesVolume(value:Float):Float
{
// Set and apply.
this.optionsChartEditor.voicesVolume = value;
flush();
return this.optionsChartEditor.voicesVolume;
}
public var chartEditorPlaybackSpeed(get, set):Float; public var chartEditorPlaybackSpeed(get, set):Float;
function get_chartEditorPlaybackSpeed():Float function get_chartEditorPlaybackSpeed():Float

View file

@ -106,7 +106,6 @@ import haxe.ui.components.Label;
import haxe.ui.components.Button; import haxe.ui.components.Button;
import haxe.ui.components.NumberStepper; import haxe.ui.components.NumberStepper;
import haxe.ui.components.Slider; import haxe.ui.components.Slider;
import haxe.ui.components.VerticalSlider;
import haxe.ui.components.TextField; import haxe.ui.components.TextField;
import haxe.ui.containers.dialogs.CollapsibleDialog; import haxe.ui.containers.dialogs.CollapsibleDialog;
import haxe.ui.containers.Frame; import haxe.ui.containers.Frame;
@ -723,34 +722,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return hitsoundsEnabledPlayer || hitsoundsEnabledOpponent; return hitsoundsEnabledPlayer || hitsoundsEnabledOpponent;
} }
/**
* Sound multiplier for vocals and hitsounds on the player's side.
*/
var soundMultiplierPlayer(default, set):Float = 1.0;
function set_soundMultiplierPlayer(value:Float):Float
{
soundMultiplierPlayer = value;
var vocalTargetVolume:Float = (menubarItemVolumeVocals.value ?? 100.0) / 100.0;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.playerVolume = vocalTargetVolume * soundMultiplierPlayer;
return soundMultiplierPlayer;
}
/**
* Sound multiplier for vocals and hitsounds on the opponent's side.
*/
var soundMultiplierOpponent(default, set):Float = 1.0;
function set_soundMultiplierOpponent(value:Float):Float
{
soundMultiplierOpponent = value;
var vocalTargetVolume:Float = (menubarItemVolumeVocals.value ?? 100.0) / 100.0;
if (audioVocalTrackGroup != null) audioVocalTrackGroup.opponentVolume = vocalTargetVolume * soundMultiplierOpponent;
return soundMultiplierOpponent;
}
// Auto-save // Auto-save
/** /**
@ -1760,14 +1731,24 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
var menubarItemVolumeInstrumental:Slider; var menubarItemVolumeInstrumental:Slider;
/** /**
* The `Audio -> 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. * The `Audio -> Playback Speed` label.
@ -2658,37 +2639,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
performCommand(new SetItemSelectionCommand([], currentSongChartEventData)); 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;
}
} }
/** /**
@ -2927,18 +2877,20 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
menubarLabelVolumeInstrumental.text = 'Instrumental - ${Std.int(event.value)}%'; menubarLabelVolumeInstrumental.text = 'Instrumental - ${Std.int(event.value)}%';
}; };
menubarItemVolumeVocals.onChange = event -> { menubarItemVolumeVocalsPlayer.onChange = event -> {
var volume:Float = event.value.toFloat() / 100.0; var volume:Float = event.value.toFloat() / 100.0;
if (audioVocalTrackGroup != null) if (audioVocalTrackGroup != null) audioVocalTrackGroup.playerVolume = volume;
{ menubarLabelVolumeVocalsPlayer.text = 'Player - ${Std.int(event.value)}%';
audioVocalTrackGroup.playerVolume = volume * soundMultiplierPlayer; };
audioVocalTrackGroup.opponentVolume = volume * soundMultiplierOpponent;
} menubarItemVolumeVocalsOpponent.onChange = event -> {
menubarLabelVolumeVocals.text = 'Voices - ${Std.int(event.value)}%'; var volume:Float = event.value.toFloat() / 100.0;
} if (audioVocalTrackGroup != null) audioVocalTrackGroup.opponentVolume = volume;
menubarLabelVolumeVocalsOpponent.text = 'Enemy - ${Std.int(event.value)}%';
};
menubarItemPlaybackSpeed.onChange = event -> { 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. pitch = Math.floor(pitch / 0.25) * 0.25; // Round to nearest 0.25.
#if FLX_PITCH #if FLX_PITCH
if (audioInstTrack != null) audioInstTrack.pitch = pitch; if (audioInstTrack != null) audioInstTrack.pitch = pitch;
@ -5791,7 +5743,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
// Reapply the volume. // Reapply the volume.
var instTargetVolume:Float = menubarItemVolumeInstrumental.value ?? 1.0; 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) if (audioInstTrack != null)
{ {
@ -5800,8 +5753,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
} }
if (audioVocalTrackGroup != null) if (audioVocalTrackGroup != null)
{ {
audioVocalTrackGroup.playerVolume = vocalTargetVolume * soundMultiplierPlayer; audioVocalTrackGroup.playerVolume = vocalPlayerTargetVolume;
audioVocalTrackGroup.opponentVolume = vocalTargetVolume * soundMultiplierOpponent; audioVocalTrackGroup.opponentVolume = vocalOpponentTargetVolume;
} }
} }
@ -5918,9 +5871,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
switch (noteData.getStrumlineIndex()) switch (noteData.getStrumlineIndex())
{ {
case 0: // Player 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 case 1: // Opponent
if (hitsoundsEnabledOpponent) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolume * soundMultiplierOpponent); if (hitsoundsEnabledOpponent) this.playSound(Paths.sound('chartingSounds/hitNoteOpponent'), hitsoundVolume);
} }
} }
} }