• src/xpdev/xpbeep.c

    From Deucе@1:103/705 to Git commit to main/sbbs/master on Sun May 10 15:18:55 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/412828ad24fe4868c84fa62e
    Modified Files:
    src/xpdev/xpbeep.c
    Log Message:
    xpbeep: init mixer_lock from xp_mixer_pull too, not just xp_audio_open

    mixer_lock is initialized lazily via pthread_once(&mixer_once, ...) in xp_audio_open. The pull side (push-backend device threads, pull-
    backend callbacks like the WASAPI render thread) was relying on at
    least one xp_audio_open having run first to set the mutex up. That
    held for ANSI-music / APC patches because those paths always open at
    least one xp_audio stream before producing samples, but the OOII
    enable path just calls xptone_open() with no stream, and on Win32 the
    WASAPI render thread fired before the mixer once-init had ever run.
    First xp_mixer_pull call locked an uninitialized mutex and the SEH
    exception terminated the whole process.

    POSIX is more forgiving about zero-initialized pthread_mutex_t values
    so the same call path didn't crash there, but it was still
    technically uninitialized. Calling the once-init from xp_mixer_pull
    makes the mutex safe regardless of which side runs first.

    Fixes ticket 249.

    Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)
  • From Deucе@1:103/705 to Git commit to main/sbbs/master on Mon Jun 29 22:56:10 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/830596d741d6f092be3e7aab
    Modified Files:
    src/xpdev/xpbeep.c
    Log Message:
    xpbeep: cap pathological ALSA buffer latency

    Open ALSA once with the existing minimal parameter negotiation so
    user and .asoundrc defaults remain authoritative when they produce
    a reasonable buffer.

    If the negotiated ALSA buffer exceeds 300 ms, reopen and retry with
    a CoreAudio-like 3 x 1024-frame target. If the capped retry fails,
    fall back to the original uncapped configuration rather than dropping
    ALSA entirely.

    This should kick in for whatever weird-assed distro DigitalMan uses
    where the mixer latency with the default ALSA device is allegedly
    around 30s.

    Co-Authored-By: OpenAI Codex <codex@openai.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)