1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-09-04 04:38:09 +00:00

Compare commits

...

4 commits

Author SHA1 Message Date
Lasercar def77c5b0f
Merge 73a1376f2e into 1dba74c704 2025-05-18 23:19:50 -06:00
Lasercar 73a1376f2e whoops 2025-02-15 21:44:05 +10:00
Lasercar ccca786b87 Small fix 2025-02-15 21:42:46 +10:00
Lasercar 760bdc9cfb Welcome back welcome music 2025-02-15 21:38:23 +10:00
2 changed files with 104 additions and 24 deletions

View file

@ -173,7 +173,9 @@ class Save
metronomeVolume: 1.0,
hitsoundVolumePlayer: 1.0,
hitsoundVolumeOpponent: 1.0,
themeMusic: true
themeMusic: true,
themeMusicFadeInDelay: 30.0,
themeMusicFadeInDuration: 10.0,
},
optionsStageEditor:
@ -181,7 +183,7 @@ class Save
previousFiles: [],
moveStep: "1px",
angleStep: 5,
theme: StageEditorTheme.Light
theme: StageEditorTheme.Light,
}
};
}
@ -424,6 +426,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
@ -1646,6 +1682,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`

View file

@ -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.
*/
@ -1832,6 +1837,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.
*/
@ -2287,7 +2302,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;
@ -2316,7 +2334,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;
@ -2377,15 +2398,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);
@ -3029,10 +3049,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;
@ -4031,7 +4063,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;
@ -5852,6 +5884,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
{
if (audioInstTrack != null)
{
stopWelcomeMusic();
audioInstTrack.play(false, audioInstTrack.time);
audioVocalTrackGroup.play(false, audioInstTrack.time);
}
@ -6142,7 +6175,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;
@ -6285,6 +6318,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
{
if (audioInstTrack != null) audioInstTrack.pause();
audioVocalTrackGroup.pause();
fadeInWelcomeMusic(welcomeMusicFadeInDelay, welcomeMusicFadeInDuration);
playbarPlay.text = '>';
}
@ -6299,13 +6333,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();
}
}