From d43042fd36a74d789a3e439e0ecec5d8f1a07722 Mon Sep 17 00:00:00 2001 From: Hyper_ Date: Mon, 5 Aug 2024 20:02:23 -0300 Subject: [PATCH 01/13] Fix out of bounds note selection --- source/funkin/ui/debug/charting/ChartEditorState.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index f72cca77f..98d8036e9 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -4223,8 +4223,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } else { - // Minimum of 0. - return 0; + // Minimum of -1. + return -1; } }); From 00c7767f8a82304a7b7595e041ad60dbbc8cb3ca Mon Sep 17 00:00:00 2001 From: cyn Date: Fri, 23 Aug 2024 20:17:10 -0700 Subject: [PATCH 02/13] Update FunkinSound.hx --- source/funkin/audio/FunkinSound.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index c70f195d2..7105a8735 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -543,11 +543,12 @@ class FunkinSound extends FlxSound implements ICloneable /** * Stop all sounds in the pool and allow them to be recycled. */ - public static function stopAllAudio(musicToo:Bool = false):Void + public static function stopAllAudio(musicToo:Bool = false, persistToo:Bool = false):Void { for (sound in pool) { if (sound == null) continue; + if (!persistToo && sound.persist) continue; if (!musicToo && sound == FlxG.sound.music) continue; sound.destroy(); } From 0a8719088da94f295481d17a167e1875646a4d92 Mon Sep 17 00:00:00 2001 From: Til Tjardes Date: Sat, 14 Sep 2024 15:06:03 -0600 Subject: [PATCH 03/13] techniktil coming back with another typo lets go --- source/funkin/modding/events/ScriptEvent.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/modding/events/ScriptEvent.hx b/source/funkin/modding/events/ScriptEvent.hx index dd55de23b..cc1d00b58 100644 --- a/source/funkin/modding/events/ScriptEvent.hx +++ b/source/funkin/modding/events/ScriptEvent.hx @@ -103,7 +103,7 @@ class NoteScriptEvent extends ScriptEvent public var comboCount(default, null):Int; /** - * Whether to play the record scratch sound (if this eventn type is `NOTE_MISS`). + * Whether to play the record scratch sound (if this event type is `NOTE_MISS`). */ public var playSound(default, default):Bool; From b03c8a9cf8cfe8c00d88ed64d488dceac4992378 Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Thu, 19 Sep 2024 00:02:59 -0700 Subject: [PATCH 04/13] Limit the song time to 0 and the songs max length use the new bool to tell if we should start the song add a public static bool to countdown: finished --- source/funkin/Conductor.hx | 10 +++++++--- source/funkin/play/Countdown.hx | 7 +++++++ source/funkin/play/PlayState.hx | 20 ++++++++++++++------ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx index e73b2860c..3211f31f5 100644 --- a/source/funkin/Conductor.hx +++ b/source/funkin/Conductor.hx @@ -397,9 +397,12 @@ class Conductor */ public function update(?songPos:Float, applyOffsets:Bool = true, forceDispatch:Bool = false) { + var currentTime:Float = (FlxG.sound.music != null) ? FlxG.sound.music.time : 0.0; + var currentLength:Float = (FlxG.sound.music != null) ? FlxG.sound.music.length : 0.0; + if (songPos == null) { - songPos = (FlxG.sound.music != null) ? FlxG.sound.music.time : 0.0; + songPos = currentTime; } // Take into account instrumental and file format song offsets. @@ -410,7 +413,7 @@ class Conductor var oldStep:Float = this.currentStep; // Set the song position we are at (for purposes of calculating note positions, etc). - this.songPosition = songPos; + this.songPosition = Math.min(currentLength, Math.max(0, songPos)); currentTimeChange = timeChanges[0]; if (this.songPosition > 0.0) @@ -430,7 +433,8 @@ class Conductor else if (currentTimeChange != null && this.songPosition > 0.0) { // roundDecimal prevents representing 8 as 7.9999999 - this.currentStepTime = FlxMath.roundDecimal((currentTimeChange.beatTime * Constants.STEPS_PER_BEAT) + (this.songPosition - currentTimeChange.timeStamp) / stepLengthMs, 6); + this.currentStepTime = FlxMath.roundDecimal((currentTimeChange.beatTime * Constants.STEPS_PER_BEAT) + + (this.songPosition - currentTimeChange.timeStamp) / stepLengthMs, 6); this.currentBeatTime = currentStepTime / Constants.STEPS_PER_BEAT; this.currentMeasureTime = currentStepTime / stepsPerMeasure; this.currentStep = Math.floor(currentStepTime); diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index 643883a43..c883006a0 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -29,6 +29,11 @@ class Countdown */ public static var soundSuffix:String = ''; + /** + * Whether the countdown has finished. + */ + public static var finished:Bool = false; + /** * Which alternate graphic on countdown to use. * You can set this via script. @@ -53,6 +58,7 @@ class Countdown */ public static function performCountdown():Bool { + finished = false; countdownStep = BEFORE; var cancelled:Bool = propagateCountdownEvent(countdownStep); if (cancelled) @@ -101,6 +107,7 @@ class Countdown if (countdownStep == AFTER) { + finished = true; stopCountdown(); } }, 5); // Before, 3, 2, 1, GO!, After diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 0b2b8846d..06dd5f95e 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -915,7 +915,11 @@ class PlayState extends MusicBeatSubState { // Do NOT apply offsets at this point, because they already got applied the previous frame! Conductor.instance.update(Conductor.instance.songPosition + elapsed * 1000, false); - if (Conductor.instance.songPosition >= (startTimestamp)) startSong(); + if (Conductor.instance.songPosition - Conductor.instance.instrumentalOffset >= (startTimestamp) && Countdown.finished) + { + trace("started song at " + Conductor.instance.songPosition); + startSong(); + } } } else @@ -1391,14 +1395,16 @@ class PlayState extends MusicBeatSubState // activeNotes.sort(SortUtil.byStrumtime, FlxSort.DESCENDING); } + var correctSync:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.instrumentalOffset)); + if (!startingSong && FlxG.sound.music != null - && (Math.abs(FlxG.sound.music.time - (Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)) > 100 - || Math.abs(vocals.checkSyncError(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)) > 100)) + && (Math.abs(FlxG.sound.music.time - correctSync) > 100 || Math.abs(vocals.checkSyncError(correctSync)) > 100)) { trace("VOCALS NEED RESYNC"); - if (vocals != null) trace(vocals.checkSyncError(Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)); - trace(FlxG.sound.music.time - (Conductor.instance.songPosition + Conductor.instance.instrumentalOffset)); + if (vocals != null) trace(vocals.checkSyncError(correctSync)); + trace(FlxG.sound.music.time); + trace(correctSync); resyncVocals(); } @@ -1993,7 +1999,9 @@ class PlayState extends MusicBeatSubState // Skip this if the music is paused (GameOver, Pause menu, start-of-song offset, etc.) if (!(FlxG.sound.music?.playing ?? false)) return; - var timeToPlayAt:Float = Conductor.instance.songPosition - Conductor.instance.instrumentalOffset; + + var timeToPlayAt:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.instrumentalOffset)); + trace('Resyncing vocals to ${timeToPlayAt}'); FlxG.sound.music.pause(); vocals.pause(); From 4d73e0cc475f7195261cfff3592eb01b9192aac2 Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Thu, 19 Sep 2024 01:20:16 -0700 Subject: [PATCH 05/13] fix some interesting issues with this redundant trace removal --- source/funkin/Conductor.hx | 11 ++++++++++- source/funkin/play/Countdown.hx | 7 ------- source/funkin/play/PlayState.hx | 29 +++++++++++++++++------------ 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx index 3211f31f5..bd7c7196f 100644 --- a/source/funkin/Conductor.hx +++ b/source/funkin/Conductor.hx @@ -412,8 +412,17 @@ class Conductor var oldBeat:Float = this.currentBeat; var oldStep:Float = this.currentStep; + // If the song is playing, limit the song position to the length of the song or beginning of the song. + if (FlxG.sound.music != null && FlxG.sound.music.playing) + { + this.songPosition = Math.min(currentLength, Math.max(0, songPos)); + } + else + { + this.songPosition = songPos; + } + // Set the song position we are at (for purposes of calculating note positions, etc). - this.songPosition = Math.min(currentLength, Math.max(0, songPos)); currentTimeChange = timeChanges[0]; if (this.songPosition > 0.0) diff --git a/source/funkin/play/Countdown.hx b/source/funkin/play/Countdown.hx index c883006a0..643883a43 100644 --- a/source/funkin/play/Countdown.hx +++ b/source/funkin/play/Countdown.hx @@ -29,11 +29,6 @@ class Countdown */ public static var soundSuffix:String = ''; - /** - * Whether the countdown has finished. - */ - public static var finished:Bool = false; - /** * Which alternate graphic on countdown to use. * You can set this via script. @@ -58,7 +53,6 @@ class Countdown */ public static function performCountdown():Bool { - finished = false; countdownStep = BEFORE; var cancelled:Bool = propagateCountdownEvent(countdownStep); if (cancelled) @@ -107,7 +101,6 @@ class Countdown if (countdownStep == AFTER) { - finished = true; stopCountdown(); } }, 5); // Before, 3, 2, 1, GO!, After diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 06dd5f95e..4e81d3a83 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -687,7 +687,11 @@ class PlayState extends MusicBeatSubState } Conductor.instance.mapTimeChanges(currentChart.timeChanges); - Conductor.instance.update((Conductor.instance.beatLengthMs * -5) + startTimestamp); + var pre:Float = (Conductor.instance.beatLengthMs * -5) + startTimestamp; + + trace('Attempting to start at ' + pre); + + Conductor.instance.update(pre); // The song is now loaded. We can continue to initialize the play state. initCameras(); @@ -915,7 +919,7 @@ class PlayState extends MusicBeatSubState { // Do NOT apply offsets at this point, because they already got applied the previous frame! Conductor.instance.update(Conductor.instance.songPosition + elapsed * 1000, false); - if (Conductor.instance.songPosition - Conductor.instance.instrumentalOffset >= (startTimestamp) && Countdown.finished) + if (Conductor.instance.songPosition >= (startTimestamp + Conductor.instance.instrumentalOffset)) { trace("started song at " + Conductor.instance.songPosition); startSong(); @@ -1395,17 +1399,18 @@ class PlayState extends MusicBeatSubState // activeNotes.sort(SortUtil.byStrumtime, FlxSort.DESCENDING); } - var correctSync:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.instrumentalOffset)); - - if (!startingSong - && FlxG.sound.music != null - && (Math.abs(FlxG.sound.music.time - correctSync) > 100 || Math.abs(vocals.checkSyncError(correctSync)) > 100)) + if (FlxG.sound.music != null) { - trace("VOCALS NEED RESYNC"); - if (vocals != null) trace(vocals.checkSyncError(correctSync)); - trace(FlxG.sound.music.time); - trace(correctSync); - resyncVocals(); + var correctSync:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.instrumentalOffset)); + + if (!startingSong && (Math.abs(FlxG.sound.music.time - correctSync) > 100 || Math.abs(vocals.checkSyncError(correctSync)) > 100)) + { + trace("VOCALS NEED RESYNC"); + if (vocals != null) trace(vocals.checkSyncError(correctSync)); + trace(FlxG.sound.music.time); + trace(correctSync); + resyncVocals(); + } } // Only bop camera if zoom level is below 135% From a8aeae4f7fa97d99310a327cc0f218e404662d2c Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:24:02 -0700 Subject: [PATCH 06/13] do not include offset in vocal (they're offset by inst) Fix a tiny little issue with vocal resync @ start --- source/funkin/play/PlayState.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 4e81d3a83..96bce85e5 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1979,6 +1979,7 @@ class PlayState extends MusicBeatSubState vocals.play(); vocals.volume = 1.0; vocals.pitch = playbackRate; + vocals.time = startTimestamp; resyncVocals(); #if FEATURE_DISCORD_RPC From f9186b67a7df74f81137374f9d0972114fa4b786 Mon Sep 17 00:00:00 2001 From: Kade <26305836+Kade-github@users.noreply.github.com> Date: Thu, 19 Sep 2024 17:00:52 -0700 Subject: [PATCH 07/13] less tolerance --- source/funkin/play/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 96bce85e5..e2bff164e 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1403,7 +1403,7 @@ class PlayState extends MusicBeatSubState { var correctSync:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.instrumentalOffset)); - if (!startingSong && (Math.abs(FlxG.sound.music.time - correctSync) > 100 || Math.abs(vocals.checkSyncError(correctSync)) > 100)) + if (!startingSong && (Math.abs(FlxG.sound.music.time - correctSync) > 5 || Math.abs(vocals.checkSyncError(correctSync)) > 5)) { trace("VOCALS NEED RESYNC"); if (vocals != null) trace(vocals.checkSyncError(correctSync)); From 690f3090b728a84a91e2878412eaf9049c1d8116 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 20 Sep 2024 20:11:12 -0400 Subject: [PATCH 08/13] proper audio scaling for hxcodec / desktop --- .../graphics/video/FunkinVideoSprite.hx | 32 +++++++++++++++++++ source/funkin/play/cutscene/VideoCutscene.hx | 6 ++-- source/funkin/ui/charSelect/IntroSubState.hx | 6 ++-- source/funkin/ui/title/AttractState.hx | 6 ++-- 4 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 source/funkin/graphics/video/FunkinVideoSprite.hx diff --git a/source/funkin/graphics/video/FunkinVideoSprite.hx b/source/funkin/graphics/video/FunkinVideoSprite.hx new file mode 100644 index 000000000..e0086784b --- /dev/null +++ b/source/funkin/graphics/video/FunkinVideoSprite.hx @@ -0,0 +1,32 @@ +package funkin.graphics.video; + +import hxcodec.flixel.FlxVideoSprite; + +/** + * Not to be confused with FlxVideo, this is a hxcodec based video class + * We override it simply to correct/control our volume easier. + */ +class FunkinVideoSprite extends FlxVideoSprite +{ + public var volume(default, set):Float = 1; + + public function new(x:Float = 0, y:Float = 0) + { + super(x, y); + + set_volume(1); + } + + override public function update(elapsed:Float):Void + { + super.update(elapsed); + set_volume(volume); + } + + function set_volume(value:Float):Float + { + volume = value; + bitmap.volume = Std.int((FlxG.sound.muted ? 0 : 1) * (FlxG.sound.logToLinear(FlxG.sound.volume) * 100) * volume); + return volume; + } +} diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 60454b881..b6e04004b 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -11,7 +11,7 @@ import flixel.util.FlxTimer; import funkin.graphics.video.FlxVideo; #end #if hxCodec -import hxcodec.flixel.FlxVideoSprite; +import funkin.graphics.video.FunkinVideoSprite; #end /** @@ -26,7 +26,7 @@ class VideoCutscene static var vid:FlxVideo; #end #if hxCodec - static var vid:FlxVideoSprite; + static var vid:FunkinVideoSprite; #end /** @@ -138,7 +138,7 @@ class VideoCutscene static function playVideoNative(filePath:String):Void { // Video displays OVER the FlxState. - vid = new FlxVideoSprite(0, 0); + vid = new FunkinVideoSprite(0, 0); if (vid != null) { diff --git a/source/funkin/ui/charSelect/IntroSubState.hx b/source/funkin/ui/charSelect/IntroSubState.hx index 2c2908473..e731e5e9a 100644 --- a/source/funkin/ui/charSelect/IntroSubState.hx +++ b/source/funkin/ui/charSelect/IntroSubState.hx @@ -4,7 +4,7 @@ package funkin.ui.charSelect; import funkin.graphics.video.FlxVideo; #end #if hxCodec -import hxcodec.flixel.FlxVideoSprite; +import funkin.graphics.video.FunkinVideoSprite; #end import funkin.ui.MusicBeatSubState; import funkin.audio.FunkinSound; @@ -72,12 +72,12 @@ class IntroSubState extends MusicBeatSubState #end #if hxCodec - var vid:FlxVideoSprite; + var vid:FunkinVideoSprite; function playVideoNative(filePath:String):Void { // Video displays OVER the FlxState. - vid = new FlxVideoSprite(0, 0); + vid = new FunkinVideoSprite(0, 0); vid.scrollFactor.set(); diff --git a/source/funkin/ui/title/AttractState.hx b/source/funkin/ui/title/AttractState.hx index c5a3d0504..f5f266b0d 100644 --- a/source/funkin/ui/title/AttractState.hx +++ b/source/funkin/ui/title/AttractState.hx @@ -4,7 +4,7 @@ package funkin.ui.title; import funkin.graphics.video.FlxVideo; #end #if hxCodec -import hxcodec.flixel.FlxVideoSprite; +import funkin.graphics.video.FunkinVideoSprite; #end import funkin.ui.MusicBeatState; @@ -62,12 +62,12 @@ class AttractState extends MusicBeatState #end #if hxCodec - var vid:FlxVideoSprite; + var vid:FunkinVideoSprite; function playVideoNative(filePath:String):Void { // Video displays OVER the FlxState. - vid = new FlxVideoSprite(0, 0); + vid = new FunkinVideoSprite(0, 0); if (vid != null) { From 2c73b241e8f7f6be5a4af7b4a5f180bb8444c199 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 21 Sep 2024 06:33:47 -0400 Subject: [PATCH 09/13] Rework offset+vocal sync handling to fix the "Swing Mode" bug --- source/funkin/Conductor.hx | 7 +++++++ source/funkin/play/PlayState.hx | 25 +++++++++++++++++-------- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx index bd7c7196f..ff72b1e12 100644 --- a/source/funkin/Conductor.hx +++ b/source/funkin/Conductor.hx @@ -275,6 +275,13 @@ class Conductor return Save.instance.options.audioVisualOffset; } + public var combinedOffset(get, never):Float; + + function get_combinedOffset():Float + { + return instrumentalOffset + audioVisualOffset + inputOffset; + } + /** * The number of beats in a measure. May be fractional depending on the time signature. */ diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index e2bff164e..ad52dd6e6 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -861,7 +861,7 @@ class PlayState extends MusicBeatSubState // Reset music properly. if (FlxG.sound.music != null) { - FlxG.sound.music.time = startTimestamp - Conductor.instance.instrumentalOffset; + FlxG.sound.music.time = startTimestamp - Conductor.instance.combinedOffset; FlxG.sound.music.pitch = playbackRate; FlxG.sound.music.pause(); } @@ -878,7 +878,7 @@ class PlayState extends MusicBeatSubState } } vocals.pause(); - vocals.time = 0; + vocals.time = 0 - Conductor.instance.combinedOffset; if (FlxG.sound.music != null) FlxG.sound.music.volume = 1; vocals.volume = 1; @@ -919,7 +919,7 @@ class PlayState extends MusicBeatSubState { // Do NOT apply offsets at this point, because they already got applied the previous frame! Conductor.instance.update(Conductor.instance.songPosition + elapsed * 1000, false); - if (Conductor.instance.songPosition >= (startTimestamp + Conductor.instance.instrumentalOffset)) + if (Conductor.instance.songPosition >= (startTimestamp + Conductor.instance.combinedOffset)) { trace("started song at " + Conductor.instance.songPosition); startSong(); @@ -1401,7 +1401,7 @@ class PlayState extends MusicBeatSubState if (FlxG.sound.music != null) { - var correctSync:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.instrumentalOffset)); + var correctSync:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.combinedOffset)); if (!startingSong && (Math.abs(FlxG.sound.music.time - correctSync) > 5 || Math.abs(vocals.checkSyncError(correctSync)) > 5)) { @@ -1411,6 +1411,13 @@ class PlayState extends MusicBeatSubState trace(correctSync); resyncVocals(); } + else + { + trace("NO VOCAL SYNC NEEDED"); + if (vocals != null) trace(vocals.checkSyncError(correctSync)); + trace(FlxG.sound.music.time); + trace(correctSync); + } } // Only bop camera if zoom level is below 135% @@ -1967,7 +1974,7 @@ class PlayState extends MusicBeatSubState }; // A negative instrumental offset means the song skips the first few milliseconds of the track. // This just gets added into the startTimestamp behavior so we don't need to do anything extra. - FlxG.sound.music.play(true, startTimestamp - Conductor.instance.instrumentalOffset); + FlxG.sound.music.play(true, Math.max(0, startTimestamp - Conductor.instance.combinedOffset)); FlxG.sound.music.pitch = playbackRate; // Prevent the volume from being wrong. @@ -1979,7 +1986,9 @@ class PlayState extends MusicBeatSubState vocals.play(); vocals.volume = 1.0; vocals.pitch = playbackRate; - vocals.time = startTimestamp; + vocals.time = FlxG.sound.music.time; + trace('${FlxG.sound.music.time}'); + trace('${vocals.time}'); resyncVocals(); #if FEATURE_DISCORD_RPC @@ -1989,7 +1998,7 @@ class PlayState extends MusicBeatSubState if (startTimestamp > 0) { - // FlxG.sound.music.time = startTimestamp - Conductor.instance.instrumentalOffset; + // FlxG.sound.music.time = startTimestamp - Conductor.instance.combinedOffset; handleSkippedNotes(); } @@ -2006,7 +2015,7 @@ class PlayState extends MusicBeatSubState // Skip this if the music is paused (GameOver, Pause menu, start-of-song offset, etc.) if (!(FlxG.sound.music?.playing ?? false)) return; - var timeToPlayAt:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.instrumentalOffset)); + var timeToPlayAt:Float = Math.min(FlxG.sound.music.length, Math.max(0, Conductor.instance.songPosition - Conductor.instance.combinedOffset)); trace('Resyncing vocals to ${timeToPlayAt}'); FlxG.sound.music.pause(); vocals.pause(); From 6c743b3b89b278f8250061b5110c28d1852a91b5 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 21 Sep 2024 20:33:51 -0400 Subject: [PATCH 10/13] Remove some spammy trace calls. --- source/funkin/play/PlayState.hx | 11 ++--------- source/funkin/play/components/PopUpStuff.hx | 1 - source/funkin/ui/mainmenu/MainMenuState.hx | 2 ++ 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index ad52dd6e6..9b6015b67 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1411,13 +1411,6 @@ class PlayState extends MusicBeatSubState trace(correctSync); resyncVocals(); } - else - { - trace("NO VOCAL SYNC NEEDED"); - if (vocals != null) trace(vocals.checkSyncError(correctSync)); - trace(FlxG.sound.music.time); - trace(correctSync); - } } // Only bop camera if zoom level is below 135% @@ -2396,9 +2389,9 @@ class PlayState extends MusicBeatSubState if (targetNote == null) continue; // Judge and hit the note. - trace('Hit note! ${targetNote.noteData}'); + // trace('Hit note! ${targetNote.noteData}'); goodNoteHit(targetNote, input); - trace('Score: ${songScore}'); + // trace('Score: ${songScore}'); notesInDirection.remove(targetNote); diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index a02291e4e..7ea5650f1 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -95,7 +95,6 @@ class PopUpStuff extends FlxTypedGroup if (numScore == null) continue; numScore.x = (FlxG.width * 0.507) - (36 * daLoop) - 65; - trace('numScore($daLoop) = ${numScore.x}'); numScore.y = (FlxG.camera.height * 0.44); numScore.x += offsets[0]; diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 13d68da6d..3f36dad81 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -344,6 +344,8 @@ class MainMenuState extends MusicBeatState } } + Conductor.instance.update(); + // Open the debug menu, defaults to ` / ~ // This includes stuff like the Chart Editor, so it should be present on all builds. if (controls.DEBUG_MENU) From 5548fd52f4458520935814ac241a6a079fe72beb Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 21 Sep 2024 20:33:59 -0400 Subject: [PATCH 11/13] Update default mod so it actually loads --- example_mods/introMod/_polymod_meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_mods/introMod/_polymod_meta.json b/example_mods/introMod/_polymod_meta.json index 4dc0cd804..74c4a2504 100644 --- a/example_mods/introMod/_polymod_meta.json +++ b/example_mods/introMod/_polymod_meta.json @@ -6,7 +6,7 @@ "name": "EliteMasterEric" } ], - "api_version": "0.1.0", + "api_version": "0.5.0", "mod_version": "1.0.0", "license": "Apache-2.0" } From 29a7005d8a5ca63f69531792b86d9ec457efae09 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 22 Sep 2024 00:44:57 -0400 Subject: [PATCH 12/13] Fix a bug where you can hear the game a little when setting the volume to 0 ticks --- source/funkin/ui/options/FunkinSoundTray.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/ui/options/FunkinSoundTray.hx b/source/funkin/ui/options/FunkinSoundTray.hx index 8ae53524a..eea30ae17 100644 --- a/source/funkin/ui/options/FunkinSoundTray.hx +++ b/source/funkin/ui/options/FunkinSoundTray.hx @@ -121,7 +121,7 @@ class FunkinSoundTray extends FlxSoundTray active = true; var globalVolume:Int = Math.round(FlxG.sound.logToLinear(FlxG.sound.volume) * 10); - if (FlxG.sound.muted) + if (FlxG.sound.muted || FlxG.sound.volume == 0) { globalVolume = 0; } From c7238fcfd114352924a6cca436e069523a86cced Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 22 Sep 2024 00:45:30 -0400 Subject: [PATCH 13/13] Stop the volume tray from hiding as long as the game is muted --- source/funkin/ui/options/FunkinSoundTray.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/options/FunkinSoundTray.hx b/source/funkin/ui/options/FunkinSoundTray.hx index eea30ae17..b2fb7fc04 100644 --- a/source/funkin/ui/options/FunkinSoundTray.hx +++ b/source/funkin/ui/options/FunkinSoundTray.hx @@ -79,10 +79,12 @@ class FunkinSoundTray extends FlxSoundTray y = MathUtil.coolLerp(y, lerpYPos, 0.1); alpha = MathUtil.coolLerp(alpha, alphaTarget, 0.25); + var shouldHide = (FlxG.sound.muted == false && FlxG.sound.volume > 0); + // Animate sound tray thing if (_timer > 0) { - _timer -= (MS / 1000); + if (shouldHide) _timer -= (MS / 1000); alphaTarget = 1; } else if (y >= -height)