Sound is laggy/stuttering

The worst monsters in the Hearthlands warp the fabric of space and time...

Re: Sound is laggy/stuttering

Postby noindyfikator » Tue Aug 29, 2023 6:14 pm

noindyfikator wrote:I think it's time to fix laggy sound/stuttering


IT IS HAPPENING! AFTER 8 YEARS!!!

Image

Image
W3 - W10 - Hermit / small plots with spruces
W11 - The Friend Zone
W12 - KoA aka Kingdom of Ashes
W13 - Monke
W14 - Alpaca Farm aka Animal Planet
W15 - Whatever Bay - The Greatest Siege Defense Victory in Haven History - https://www.youtube.com/watch?v=KhyUveSeZ0Q
User avatar
noindyfikator
 
Posts: 827
Joined: Fri Jul 15, 2011 11:10 am

Re: Sound is laggy/stuttering

Postby Nightdawg » Tue Aug 29, 2023 7:41 pm

but loftar already fixed this, one year ago
Image
if you're reading this, you're a nerd.
Image
User avatar
Nightdawg
 
Posts: 1766
Joined: Fri Feb 28, 2020 12:31 am
Location: In your pepper farm

Re: Sound is laggy/stuttering

Postby dafels » Tue Aug 29, 2023 9:43 pm

noindyfikator wrote:I think it's time to fix laggy sound/stuttering


would be nice, but I don't see it happening until 2030 when AI will be in charge of the codebase
dafels
 
Posts: 2652
Joined: Sun Nov 14, 2010 7:49 pm

Re: Sound is laggy/stuttering

Postby Mashadar » Fri Sep 01, 2023 8:45 pm

dafels wrote:
noindyfikator wrote:I think it's time to fix laggy sound/stuttering


would be nice, but I don't see it happening until 2030 when AI will be in charge of the codebase

That may be the case since I encountered the sound issue only on Windows, while loftar develops on Linux.
One likely reason for this is that Windows uses 16ms scheduler time slices, while Linux-based systems usually use 1ms slices.
With this tick rate of 60Hz the audio buffer drains at a rate of ~735 samples per tick. That means if there are scheduling issues or another application takes away the CPU from the audio thread for even one tick the result can be fatal when the audio buffer is small.

The first step would be to make the default audio buffer at least 4096 on Windows.
Another thing that can improve the situation are the WinAPI functions timeBeginPeriod() and timeEndPeriod() from mmsystem.h that allow you to request a higher resolution of e.g. 1ms for your application.
There is probably some way to call them from a Java application.

And then there seems to be a separate issue that affects the audio when the client runs in the background at a reduced frame rate of 5 fps.
User avatar
Mashadar
 
Posts: 362
Joined: Thu Jan 20, 2011 9:34 am

Previous

Return to Bugs

Who is online

Users browsing this forum: No registered users and 48 guests