Menu

#646 SDL audio buffer size is too small

Linux only
closed-fixed
None
4
2019-10-01
2018-09-22
Lenny
No

ALSA reports "underrun occurred" too frequently. In sdl/i_sound.c at 125 I suggest setting SAMPLECOUNT to 1024 for all systems as it's safer and the latency is still acceptable.
It could be raised to 2048 for linux or other constained systems as it saves some extra CPU.

Discussion

  • Wesley Johnson

    Wesley Johnson - 2018-09-24
    • assigned_to: Wesley Johnson
    • Priority: 5 --> 4
     
  • Wesley Johnson

    Wesley Johnson - 2018-09-24

    I will keep an eye on how that behaves on my system. I have not noticed any messages ike this, unless I was debugging. Doing anything in debugging will trigger that message.
    What is acceptable latency is rather subjective.
    Perhaps I can find a way to make it tunable, as a config setting. Maybe even a menu item.

     
  • Lenny

    Lenny - 2018-09-24

    The presence of Pulseaudio on your system is a factor as it masks the "underrun occurred" errors, but it also adds latency and a fair amount of CPU load on its own.
    Pulseaudio adds its own software FIFO, in front of the ALSA FIFO so it gives you the impression that you can lower that value more than you actually can.
    Many projects choose to make that a setting but in reality, the casual users have no idea what that means and will never change it.

    I've looked at eDuke32 for reference and it does this:

    chunksize = 512;
    if (*mixrate >= 16000) chunksize *= 2;
    if (*mixrate >= 32000) chunksize *= 2;
    Mix_OpenAudio(*mixrate, AUDIO_S16SYS, *numchannels, chunksize);
    

    Basically it sets it to 2048 on all systems.

     
  • Wesley Johnson

    Wesley Johnson - 2018-12-06

    The size of the buffer has been changed, in SVN 1413. It now uses an expression from EnternityEngine to set the buffer size, that takes into account the new sample rate vrs the vanilla doom sample rate. I think it ends up at 1024 now.
    Please advise if this is adequate for you. If not then I will probably have to put in a buffer size control.

     

    Last edit: Wesley Johnson 2018-12-06
  • Wesley Johnson

    Wesley Johnson - 2019-10-01
    • status: open --> closed-fixed
     

Log in to post a comment.

Monday.com Logo