From 967bd4cf0120c94dbbfa4da79cbd0e0f7a5f3d52 Mon Sep 17 00:00:00 2001 From: Ralty <78720179+Raltyro@users.noreply.github.com> Date: Thu, 7 Aug 2025 22:23:45 +0700 Subject: [PATCH] An attempt to fix stutters for low-end computers --- source/funkin/game/PlayState.hx | 6 +++--- source/lime/_internal/backend/native/NativeAudioSource.hx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index a8a9be16..1f972220 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -552,7 +552,7 @@ class PlayState extends MusicBeatState @:noCompletion @:dox(hide) private var _endSongCalled:Bool = false; @:dox(hide) - var __vocalSyncTimer:Float = 0; + var __vocalSyncTimer:Float = 1; private function get_accuracy():Float { if (accuracyPressedNotes <= 0) return -1; @@ -1385,10 +1385,10 @@ class PlayState extends MusicBeatState __vocalSyncTimer = 1; var instTime = FlxG.sound.music.getActualTime(); - var isOffsync:Bool = vocals.loaded && Math.abs(instTime - vocals.getActualTime()) > 30; + var isOffsync:Bool = vocals.loaded && Math.abs(instTime - vocals.getActualTime()) > 100; if (!isOffsync) { for (strumLine in strumLines.members) { - if ((isOffsync = strumLine.vocals.loaded && Math.abs(instTime - strumLine.vocals.getActualTime()) > 30)) break; + if ((isOffsync = strumLine.vocals.loaded && Math.abs(instTime - strumLine.vocals.getActualTime()) > 100)) break; } } diff --git a/source/lime/_internal/backend/native/NativeAudioSource.hx b/source/lime/_internal/backend/native/NativeAudioSource.hx index 33e886b0..894f6274 100644 --- a/source/lime/_internal/backend/native/NativeAudioSource.hx +++ b/source/lime/_internal/backend/native/NativeAudioSource.hx @@ -25,10 +25,10 @@ import lime.utils.ArrayBufferView; @:access(lime.media.AudioBuffer) @:access(lime.utils.ArrayBufferView) class NativeAudioSource { - private static var STREAM_BUFFER_SAMPLES:Int = 0x1000; - private static var STREAM_MAX_BUFFERS:Int = 32; + private static var STREAM_BUFFER_SAMPLES:Int = 0x4000; + private static var STREAM_MAX_BUFFERS:Int = 8; private static var STREAM_TIMER_FREQUENCY:Int = 100; - private static var STREAM_BUFFER_FREQUENCY:Int = 6; + private static var STREAM_BUFFER_FREQUENCY:Int = 3; private var parent:AudioSource; private var disposed:Bool;