1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-11 16:05:02 +00:00

Merge remote-tracking branch 'origin/rewrite/master' into feature/chart-editor-offset-toolbox

This commit is contained in:
EliteMasterEric 2024-01-27 00:56:13 -05:00
commit 8085b20a67
7 changed files with 143 additions and 122 deletions

2
assets

@ -1 +1 @@
Subproject commit 685c9481c26020563333852d9401fe4c6ee10257 Subproject commit ae904d08df53712a582d5a3c26de40ef552422d1

View file

@ -8,8 +8,7 @@ class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram>
{ {
public var playerVis:PolygonSpectogram; public var playerVis:PolygonSpectogram;
public var opponentVis:PolygonSpectogram; public var opponentVis:PolygonSpectogram;
public var instVis:PolygonSpectogram;
var instVis:PolygonSpectogram;
public function new() public function new()
{ {
@ -51,6 +50,43 @@ class PolygonVisGroup extends FlxTypedGroup<PolygonSpectogram>
instVis = vis; 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. * Overrides the add function to add a visualizer to the group.
* @param vis The visualizer to add. * @param vis The visualizer to add.

View file

@ -235,6 +235,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry<SongMeta
difficulty.timeChanges = metadata.timeChanges; difficulty.timeChanges = metadata.timeChanges;
difficulty.looped = metadata.looped; difficulty.looped = metadata.looped;
difficulty.generatedBy = metadata.generatedBy; difficulty.generatedBy = metadata.generatedBy;
difficulty.offsets = metadata?.offsets ?? new SongOffsets();
difficulty.stage = metadata.playData.stage; difficulty.stage = metadata.playData.stage;
difficulty.noteStyle = metadata.playData.noteStyle; difficulty.noteStyle = metadata.playData.noteStyle;

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

@ -107,7 +107,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;
@ -720,34 +719,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
/** /**
@ -1392,6 +1363,46 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return currentSongMetadata.artist = value; return currentSongMetadata.artist = value;
} }
/**
* Convenience property to get the player charId for the current variation.
*/
var currentPlayerChar(get, set):String;
function get_currentPlayerChar():String
{
if (currentSongMetadata.playData.characters.player == null)
{
// Initialize to the default value if not set.
currentSongMetadata.playData.characters.player = Constants.DEFAULT_CHARACTER;
}
return currentSongMetadata.playData.characters.player;
}
function set_currentPlayerChar(value:String):String
{
return currentSongMetadata.playData.characters.player = value;
}
/**
* Convenience property to get the opponent charId for the current variation.
*/
var currentOpponentChar(get, set):String;
function get_currentOpponentChar():String
{
if (currentSongMetadata.playData.characters.opponent == null)
{
// Initialize to the default value if not set.
currentSongMetadata.playData.characters.opponent = Constants.DEFAULT_CHARACTER;
}
return currentSongMetadata.playData.characters.opponent;
}
function set_currentOpponentChar(value:String):String
{
return currentSongMetadata.playData.characters.opponent = value;
}
/** /**
* Convenience property to get the song offset data for the current variation. * Convenience property to get the song offset data for the current variation.
*/ */
@ -1427,6 +1438,23 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
return value; return value;
} }
var currentVocalOffset(get, set):Float;
function get_currentVocalOffset():Float
{
// Currently there's only one vocal offset, so we just grab the player's offset since both should be the same.
// Should probably make it so we can set offsets for player + opponent individually, though.
return currentSongOffsets.getVocalOffset(currentPlayerChar);
}
function set_currentVocalOffset(value:Float):Float
{
// Currently there's only one vocal offset, so we just apply it to both characters.
currentSongOffsets.setVocalOffset(currentPlayerChar, value);
currentSongOffsets.setVocalOffset(currentOpponentChar, value);
return value;
}
/** /**
* The variation ID for the difficulty which is currently being edited. * The variation ID for the difficulty which is currently being edited.
*/ */
@ -1700,14 +1728,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.
@ -2602,37 +2640,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;
}
} }
/** /**
@ -2871,18 +2878,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;
@ -5736,7 +5745,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)
{ {
@ -5745,8 +5755,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;
} }
} }
@ -5863,9 +5873,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);
} }
} }
} }

View file

@ -204,7 +204,7 @@ class ChartEditorAudioHandler
trace('[WARN] Failed to parse waveform data for vocal track.'); trace('[WARN] Failed to parse waveform data for vocal track.');
} }
state.audioVocalTrackGroup.playerVoicesOffset = state.currentSongOffsets.getVocalOffset(charId); state.audioVocalTrackGroup.playerVoicesOffset = state.currentVocalOffset;
return true; return true;
case DAD: case DAD:
state.audioVocalTrackGroup.addOpponentVoice(vocalTrack); state.audioVocalTrackGroup.addOpponentVoice(vocalTrack);
@ -227,7 +227,7 @@ class ChartEditorAudioHandler
trace('[WARN] Failed to parse waveform data for vocal track.'); trace('[WARN] Failed to parse waveform data for vocal track.');
} }
state.audioVocalTrackGroup.opponentVoicesOffset = state.currentSongOffsets.getVocalOffset(charId); state.audioVocalTrackGroup.opponentVoicesOffset = state.currentVocalOffset;
return true; return true;
case OTHER: case OTHER:
@ -248,6 +248,10 @@ class ChartEditorAudioHandler
{ {
state.audioVocalTrackGroup.clear(); state.audioVocalTrackGroup.clear();
} }
if (state.audioVisGroup != null)
{
state.audioVisGroup.clearAllVis();
}
} }
/** /**

View file

@ -150,7 +150,12 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox
inputOffsetVocal.onChange = function(event:UIEvent) { inputOffsetVocal.onChange = function(event:UIEvent) {
if (event.value == null) return; 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) { inputScrollSpeed.onChange = function(event:UIEvent) {
var valid:Bool = event.target.value != null && event.target.value > 0; 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; inputStage.value = chartEditorState.currentSongMetadata.playData.stage;
inputNoteStyle.value = chartEditorState.currentSongMetadata.playData.noteStyle; inputNoteStyle.value = chartEditorState.currentSongMetadata.playData.noteStyle;
inputBPM.value = chartEditorState.currentSongMetadata.timeChanges[0].bpm; 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; inputScrollSpeed.value = chartEditorState.currentSongChartScrollSpeed;
labelScrollSpeed.text = 'Scroll Speed: ${chartEditorState.currentSongChartScrollSpeed}x'; labelScrollSpeed.text = 'Scroll Speed: ${chartEditorState.currentSongChartScrollSpeed}x';
frameVariation.text = 'Variation: ${chartEditorState.selectedVariation.toTitleCase()}'; frameVariation.text = 'Variation: ${chartEditorState.selectedVariation.toTitleCase()}';