mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-04-21 19:31:52 -04:00
Merge 73a1376f2e
into d31ef12363
This commit is contained in:
commit
3fe7fc9e5d
2 changed files with 104 additions and 24 deletions
source/funkin
|
@ -169,7 +169,9 @@ class Save
|
|||
metronomeVolume: 1.0,
|
||||
hitsoundVolumePlayer: 1.0,
|
||||
hitsoundVolumeOpponent: 1.0,
|
||||
themeMusic: true
|
||||
themeMusic: true,
|
||||
themeMusicFadeInDelay: 30.0,
|
||||
themeMusicFadeInDuration: 10.0,
|
||||
},
|
||||
|
||||
optionsStageEditor:
|
||||
|
@ -177,7 +179,7 @@ class Save
|
|||
previousFiles: [],
|
||||
moveStep: "1px",
|
||||
angleStep: 5,
|
||||
theme: StageEditorTheme.Light
|
||||
theme: StageEditorTheme.Light,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -420,6 +422,40 @@ class Save
|
|||
return data.optionsChartEditor.themeMusic;
|
||||
}
|
||||
|
||||
public var chartEditorThemeMusicFadeInDelay(get, set):Float;
|
||||
|
||||
function get_chartEditorThemeMusicFadeInDelay():Float
|
||||
{
|
||||
if (data.optionsChartEditor.themeMusicFadeInDelay == null) data.optionsChartEditor.themeMusicFadeInDelay = 30.0;
|
||||
|
||||
return data.optionsChartEditor.themeMusicFadeInDelay;
|
||||
}
|
||||
|
||||
function set_chartEditorThemeMusicFadeInDelay(value:Float):Float
|
||||
{
|
||||
// Set and apply.
|
||||
data.optionsChartEditor.themeMusicFadeInDelay = value;
|
||||
flush();
|
||||
return data.optionsChartEditor.themeMusicFadeInDelay;
|
||||
}
|
||||
|
||||
public var chartEditorThemeMusicFadeInDuration(get, set):Float;
|
||||
|
||||
function get_chartEditorThemeMusicFadeInDuration():Float
|
||||
{
|
||||
if (data.optionsChartEditor.themeMusicFadeInDuration == null) data.optionsChartEditor.themeMusicFadeInDuration = 10.0;
|
||||
|
||||
return data.optionsChartEditor.themeMusicFadeInDuration;
|
||||
}
|
||||
|
||||
function set_chartEditorThemeMusicFadeInDuration(value:Float):Float
|
||||
{
|
||||
// Set and apply.
|
||||
data.optionsChartEditor.themeMusicFadeInDuration = value;
|
||||
flush();
|
||||
return data.optionsChartEditor.themeMusicFadeInDuration;
|
||||
}
|
||||
|
||||
public var chartEditorPlaybackSpeed(get, set):Float;
|
||||
|
||||
function get_chartEditorPlaybackSpeed():Float
|
||||
|
@ -1635,6 +1671,18 @@ typedef SaveDataChartEditorOptions =
|
|||
*/
|
||||
var ?themeMusic:Bool;
|
||||
|
||||
/**
|
||||
* Theme music fade in delay in the Chart Editor.
|
||||
* @default `30.0`
|
||||
*/
|
||||
var ?themeMusicFadeInDelay:Float;
|
||||
|
||||
/**
|
||||
* Theme music fade in duration in the Chart Editor.
|
||||
* @default `10.0`
|
||||
*/
|
||||
var ?themeMusicFadeInDuration:Float;
|
||||
|
||||
/**
|
||||
* Instrumental volume in the Chart Editor.
|
||||
* @default `1.0`
|
||||
|
|
|
@ -246,16 +246,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
*/
|
||||
public static final BASE_QUANT_INDEX:Int = 3;
|
||||
|
||||
/**
|
||||
* The duration before the welcome music starts to fade back in after the user stops playing music in the chart editor.
|
||||
*/
|
||||
public static final WELCOME_MUSIC_FADE_IN_DELAY:Float = 30.0;
|
||||
|
||||
/**
|
||||
* The duration of the welcome music fade in.
|
||||
*/
|
||||
public static final WELCOME_MUSIC_FADE_IN_DURATION:Float = 10.0;
|
||||
|
||||
/**
|
||||
* A map of the keys for every live input style.
|
||||
*/
|
||||
|
@ -699,6 +689,21 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
// Audio
|
||||
|
||||
/**
|
||||
* Play the welcome music or not.
|
||||
*/
|
||||
var isWelcomeMusic:Bool = false;
|
||||
|
||||
/**
|
||||
* The duration before the welcome music starts to fade back in after the user stops playing music in the chart editor.
|
||||
*/
|
||||
var welcomeMusicFadeInDelay:Float = 30;
|
||||
|
||||
/**
|
||||
* The duration of the welcome music fade in.
|
||||
*/
|
||||
var welcomeMusicFadeInDuration:Float = 10;
|
||||
|
||||
/**
|
||||
* Whether to play a metronome sound while the playhead is moving, and what volume.
|
||||
*/
|
||||
|
@ -1837,6 +1842,16 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
*/
|
||||
var menubarItemThemeMusic:MenuCheckBox;
|
||||
|
||||
/**
|
||||
* The `Audio -> Theme Music Fade in Delay` number stepper.
|
||||
*/
|
||||
var numberStepperItemThemeMusicFadeInDelay:NumberStepper;
|
||||
|
||||
/**
|
||||
* The `Audio -> Theme Music Fade in Duration` number stepper.
|
||||
*/
|
||||
var numberStepperItemThemeMusicFadeInDuration:NumberStepper;
|
||||
|
||||
/**
|
||||
* The `Audio -> Player Hitsound Volume` label.
|
||||
*/
|
||||
|
@ -2292,7 +2307,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
metronomeVolume = save.chartEditorMetronomeVolume;
|
||||
hitsoundVolumePlayer = save.chartEditorHitsoundVolumePlayer;
|
||||
hitsoundVolumePlayer = save.chartEditorHitsoundVolumeOpponent;
|
||||
this.welcomeMusic.active = save.chartEditorThemeMusic;
|
||||
isWelcomeMusic = save.chartEditorThemeMusic;
|
||||
|
||||
welcomeMusicFadeInDelay = save.chartEditorThemeMusicFadeInDelay;
|
||||
welcomeMusicFadeInDuration = save.chartEditorThemeMusicFadeInDuration;
|
||||
|
||||
// audioInstTrack.volume = save.chartEditorInstVolume;
|
||||
// audioInstTrack.pitch = save.chartEditorPlaybackSpeed;
|
||||
|
@ -2321,7 +2339,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
save.chartEditorMetronomeVolume = metronomeVolume;
|
||||
save.chartEditorHitsoundVolumePlayer = hitsoundVolumePlayer;
|
||||
save.chartEditorHitsoundVolumeOpponent = hitsoundVolumeOpponent;
|
||||
save.chartEditorThemeMusic = this.welcomeMusic.active;
|
||||
save.chartEditorThemeMusic = isWelcomeMusic;
|
||||
|
||||
save.chartEditorThemeMusicFadeInDelay = welcomeMusicFadeInDelay;
|
||||
save.chartEditorThemeMusicFadeInDuration = welcomeMusicFadeInDuration;
|
||||
|
||||
// save.chartEditorInstVolume = audioInstTrack.volume;
|
||||
// save.chartEditorVoicesVolume = audioVocalTrackGroup.volume;
|
||||
|
@ -2382,15 +2403,14 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
function fadeInWelcomeMusic(?extraWait:Float = 0, ?fadeInTime:Float = 5):Void
|
||||
{
|
||||
if (!this.welcomeMusic.active)
|
||||
if (!isWelcomeMusic)
|
||||
{
|
||||
stopWelcomeMusic();
|
||||
return;
|
||||
}
|
||||
|
||||
bgMusicTimer = new FlxTimer().start(extraWait, (_) -> {
|
||||
this.welcomeMusic.volume = 0;
|
||||
if (this.welcomeMusic.active)
|
||||
if (isWelcomeMusic)
|
||||
{
|
||||
this.welcomeMusic.play();
|
||||
this.welcomeMusic.fadeIn(fadeInTime, 0, 1.0);
|
||||
|
@ -3034,10 +3054,22 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
menubarItemVolumeMetronome.value = Std.int(metronomeVolume * 100);
|
||||
|
||||
menubarItemThemeMusic.onChange = event -> {
|
||||
this.welcomeMusic.active = event.value;
|
||||
fadeInWelcomeMusic(WELCOME_MUSIC_FADE_IN_DELAY, WELCOME_MUSIC_FADE_IN_DURATION);
|
||||
isWelcomeMusic = event.value;
|
||||
// Don't restart the music when the menu is opened for the first time
|
||||
if (!welcomeMusic.active || !isWelcomeMusic) fadeInWelcomeMusic(welcomeMusicFadeInDelay, welcomeMusicFadeInDuration);
|
||||
};
|
||||
menubarItemThemeMusic.selected = this.welcomeMusic.active;
|
||||
menubarItemThemeMusic.selected = isWelcomeMusic;
|
||||
|
||||
numberStepperItemThemeMusicFadeInDelay.onChange = event -> {
|
||||
welcomeMusicFadeInDelay = event.value;
|
||||
};
|
||||
numberStepperItemThemeMusicFadeInDelay.pos = welcomeMusicFadeInDelay;
|
||||
|
||||
numberStepperItemThemeMusicFadeInDuration.onChange = event -> {
|
||||
welcomeMusicFadeInDuration = event.value;
|
||||
};
|
||||
numberStepperItemThemeMusicFadeInDuration.pos = welcomeMusicFadeInDuration;
|
||||
|
||||
|
||||
menubarItemVolumeHitsoundPlayer.onChange = event -> {
|
||||
var volume:Float = event.value.toFloat() / 100.0;
|
||||
|
@ -4036,7 +4068,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
}
|
||||
|
||||
shouldEase = true;
|
||||
if (shouldPause) stopAudioPlayback();
|
||||
if (shouldPause && audioInstTrack.isPlaying) stopAudioPlayback(); // Only do this once, not every frame
|
||||
|
||||
// Resync the conductor and audio tracks.
|
||||
if (playheadAmount != 0) this.playheadPositionInPixels += playheadAmount;
|
||||
|
@ -5850,6 +5882,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
{
|
||||
if (audioInstTrack != null)
|
||||
{
|
||||
stopWelcomeMusic();
|
||||
audioInstTrack.play(false, audioInstTrack.time);
|
||||
audioVocalTrackGroup.play(false, audioInstTrack.time);
|
||||
}
|
||||
|
@ -6140,7 +6173,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
|
||||
moveSongToScrollPosition();
|
||||
|
||||
fadeInWelcomeMusic(WELCOME_MUSIC_FADE_IN_DELAY, WELCOME_MUSIC_FADE_IN_DURATION);
|
||||
fadeInWelcomeMusic(welcomeMusicFadeInDelay, welcomeMusicFadeInDuration);
|
||||
|
||||
// Reapply the volume.
|
||||
var instTargetVolume:Float = menubarItemVolumeInstrumental.value ?? 1.0;
|
||||
|
@ -6283,6 +6316,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
{
|
||||
if (audioInstTrack != null) audioInstTrack.pause();
|
||||
audioVocalTrackGroup.pause();
|
||||
fadeInWelcomeMusic(welcomeMusicFadeInDelay, welcomeMusicFadeInDuration);
|
||||
|
||||
playbarPlay.text = '>';
|
||||
}
|
||||
|
@ -6297,13 +6331,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
{
|
||||
// Pause
|
||||
stopAudioPlayback();
|
||||
fadeInWelcomeMusic(WELCOME_MUSIC_FADE_IN_DELAY, WELCOME_MUSIC_FADE_IN_DURATION);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Play
|
||||
startAudioPlayback();
|
||||
stopWelcomeMusic();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue