SDL half sec audio delay

Hi, I run NetBSD-10.1 on a Le Potato. When using SDL-1.2.15 or 2.32.10 all sound is delayed ~0.6secs. This is completely unfit for playing chocolate-doom (freedoom). It happened also with e.g. picodrive (SDL-1), stella, mplayer (-ao sdl), or my test commandline SDL2 audio program (termbin.com/248g). Other audio, e.g. audiocfg test 0, audioplay, mplayer -ao sun is instant. The SDLs were installed using pkgsrc (with options x11 or also alsa for SDL-2, and none for SDL-1), but i tried SDL-2 from git too, which is same.

Because of this, startup/close of windows is slower too, e.g. chocolate-doom takes longer to display DOS window after quitting game, picodrive takes longer to pause, stella takes longer to start a game, probly because the delayed audio’s still playing.

I tried other SDL_AUDIODRIVERs apart from “netbsd”. Compiling in oss for “dsp” didnt make a diff. Trying “alsa” also (with oss alsa plugin), except that the audio stops faster when the window closes, which is interesting.

The issue isn’t driver buffer size, e.g. for netbsd i could sysctl -w hw.audio0.blk_ms = 10 (default) or = 1 even would not make a diff. For alsa i could set e.g. period_size 512 buffer_size 2048 and same too. Enabling libsamplerate in SDL doesnt fix too (thru env var or chocolate-doom config, which has setting to use libsamplerate). Nor running chocolate-doom as root made a diff.

Also, when using alsa and setting wavSpec.samples=64; or lower in my test program that plays wav files, at first it makes a helicopter sound for a bit before turning into normal sound, during which un/pausing is instant. Like if it was actually capable of playing instant audio somehow? Not sure if matters

I also tried debugging SDL a bit. SDL_PauseAudio() is instant and there’s something in the bg rather delayed. SDL_ResampleAudio() called in the bg (when SDL_AUDIODRIVER=“netbsd”) is instant too, so resampling shouldnt be too slow.

Lastly i checked SDL_EVENT_LOGGING and SDL_LOGGING. When testing chocolate-doom, both on just print about sound (timestamps may be different, but increments of them exactly same (e.g. 2nd is +64 compared to 1st)):

INFO: SDL EVENT: SDL_AUDIODEVICEADDED (timestamp=44 which=0 iscapture=true)
INFO: SDL EVENT: SDL_AUDIODEVICEADDED (timestamp=108 which=1 iscapture=true)
INFO: SDL EVENT: SDL_AUDIODEVICEADDED (timestamp=109 which=0 iscapture=false)
INFO: SDL EVENT: SDL_AUDIODEVICEADDED (timestamp=109 which=1 iscapture=false)

When alsa is on (increments not always same, but 1st timestamp seems same):

INFO: SDL EVENT: SDL_AUDIODEVICEADDED (timestamp=11 which=0 iscapture=true)
INFO: SDL EVENT: SDL_AUDIODEVICEADDED (timestamp=12 which=0 iscapture=false)

Also, i have a USB audio adapter, dmesg:

[ 1249.679846] uaudio0 at uhub2 port 3 configuration 1 interface 0
[ 1249.679846] uaudio0: C-Media Electronics Inc. (0x0d8c) USB Audio Device (0x0014), rev 1.10/1.00, addr 3
[ 1249.679846] uaudio0: audio rev 1.00
[ 1249.679846] audio0 at uaudio0: playback, capture, full duplex, independent
[ 1249.679846] audio0: slinear_le:16 2ch 48000Hz, blk 11520 bytes (60ms) for playback
[ 1249.679846] audio0: slinear_le:16 1ch 48000Hz, blk 6000 bytes (62.5ms) for recording
[ 1249.679846] uhidev3 at uhub2 port 3 configuration 1 interface 3
[ 1249.679846] uhidev3: C-Media Electronics Inc. (0x0d8c) USB Audio Device (0x0014), rev 1.10/1.00, addr 3, iclass 3/0
[ 1249.679846] uhid4 at uhidev3: input=4, output=4, feature=0

Idk what to do to fix this. Can someone help? Thank you!