• src/doors/syncretro/test_audio_bytes.c test_audio_bytes.golden src/doo

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Fri Jul 17 02:57:08 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/dde9d0eafe36516ef8e77e7f
    Added Files:
    src/doors/syncretro/test_audio_bytes.c test_audio_bytes.golden src/doors/termgfx/audio_stream.c audio_stream.h chunk.c src/doors/termgfx/test/CMakeLists.txt test_audio_stream.c
    Modified Files:
    docs/superpowers/plans/2026-07-16-syncscumm-m4.md src/doors/syncretro/CMakeLists.txt syncretro_audio.c syncretro_audio.h src/doors/termgfx/CMakeLists.txt
    Removed Files:
    src/doors/syncretro/syncretro_chunk.c syncretro_chunk.h test_chunk.c Log Message:
    termgfx: share the PCM streaming module between doors

    syncretro's audio module turned out to have no libretro in it at all: it
    never includes libretro.h, never touches a core, and reaches its door only through three output calls and five config values. It is a general answer
    to "I have one continuous mixed PCM stream and a SyncTERM channel FIFO" --
    and ScummVM's mixer asks the same question. This is the second consumer,
    which is the point at which extraction pays.

    Moves the state machine, cushion, two-strike backlog policy, silence cache, blob path and telemetry into libtermgfx behind an injected config struct
    and a put/flush/backlog vtable. The chunk accumulator moves too, into its
    own translation unit so the tests can compile it directly and link no
    library -- audio_stream.c reaches libsndfile, and the accumulator is the
    pure pointer arithmetic most worth testing. Its encoder channel count is
    now configuration rather than a hardcoded 1, so a genuinely stereo source works; syncretro keeps its mono downmix, which is lossless for cores that
    emit the same sample to both sides.

    syncretro keeps its sr_audio_* surface and becomes a ~140-line adapter: no
    call site changed.

    The guard came first, deliberately. The module had NO automated coverage -- M4_AUDIO.md described a fakecore/fakterm harness that was never built --
    and a port that quietly dropped an Update re-arm or rotated a cache name differently would sound fine on a short listen and fail on a long one. So test_audio_bytes drives a scripted session (prime, run, cached silence, an injected underrun, a sustained backlog, shutdown) and pins every emitted
    APC against a committed transcript. It is normalized per-APC rather than
    raw bytes because libsndfile stamps a random serial into every Ogg stream,
    so identical PCM never encodes identically twice. That transcript passed unchanged across the move, which is the only reason to believe this diff.

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net