Repository navigation
0.2.3 – Multi-Client WASAPI Audio Mixer Fix (Eliminates Choppy Audio)
- Root Cause Found & Fixed — Dual WASAPI Clients Interleaving Silence (
runtime/src/wasapi.c,android/native/android_main.c):- The Forest opens two concurrent WASAPI render clients inside the same process: Unity 5.6's built-in FMOD (
TheForest.exe,2 ch 16-bit pcm, outputting pure silence) and FMOD Studio (fmod.dll,2 ch 32-bit float, outputting the entire game soundtrack and SFX). - Previously, each
IAudioClientspawned its ownpump_threadand calledw64_audio_sink_open, overwriting the single globalSDL_AudioStream *g_astreamso both threads pushed alternating 5–10 ms chunks of silence and real game audio sequentially into the same stream (concatenating instead of mixing!). - Replaced per-client pump threads with a single shared WASAPI master mixer engine (
master_pump_thread,nice -16) that opensg_astreamonce (guarded byg_audio_mu), sample-accurately sums all activestartedclients with clamping, keeps each client's WASAPI ring at FMOD's requested1920frames (40 ms <= 2FMOD mixer blocks so FMOD's feeder never overruns into an unmixed block), paces output at1:1real-time (240frames /5 ms, gentle480-frame fill up to a70–100 msSDL3 cushion), and reports per-client peaks and fill levels every 10 s.
- The Forest opens two concurrent WASAPI render clients inside the same process: Unity 5.6's built-in FMOD (
Source-only release — build the APK from your own PC copy via ./build.sh "/path/to/The Forest".