Skip to content

The Forest Android 0.2.2

Choose a tag to compare

@zwaetschge zwaetschge released this 01 Dec 21:47
· 1 commit to main since this release

0.2.2 – Smooth Audio Pipeline (WASAPI, AAudio & Thread Priorities)

  • Zero Synthetic Silence Gaps & Larger Audio Headroom (runtime/src/wasapi.c):
    • Eliminated synthetic 0.0f silence-padding on partial reads in pump_thread (previously injected audible silence gaps whenever FMOD's 1024-frame DSP mix / 10 ms waitable timer was out of phase with the pump tick); only real audio frames produced by FMOD are forwarded to SDL3.
    • Raised the WASAPI ring buffer floor from 40 ms (1920 frames) to 80 ms (3840 frames, staying within FMOD's 4096-frame internal ring), increased the SDL3 AudioStream queue headroom from 40 ms to 120 ms (5760 frames) with a 5 ms pump cadence, and clamped sleep drift across GC/loading stalls to prevent catch-up drain bursts.
    • Added detailed 10 s telemetry (empty, sink_low, q=min..max ms).
  • Stable Android AAudio Buffering & Lifecycle (android/native/android_main.c):
    • Disabled SDL_HINT_ANDROID_LOW_LATENCY_AUDIO ("0") and requested 1024-frame device callbacks (SDL_HINT_AUDIO_DEVICE_SAMPLE_FRAMES="1024") before SDL_OpenAudioDeviceStream, eliminating AAUDIO_PERFORMANCE_MODE_LOW_LATENCY hardware underflows under heavy Unity + DXVK + Mono GC load.
    • Properly pauses & flushes the SDL3 audio stream on SDL_EVENT_WILL_ENTER_BACKGROUND and resumes cleanly on SDL_EVENT_DID_ENTER_FOREGROUND.
  • Real Win32 Thread Priorities & Non-Bursting Waitable Timers (runtime/src/k32_sync.c):
    • Implemented real Linux setpriority(PRIO_PROCESS, tid, nice) in SetThreadPriority_ (previously a no-op), giving FMOD's THREAD_PRIORITY_TIME_CRITICAL mixer/feeder threads nice -16 (ANDROID_PRIORITY_AUDIO), pump_thread nice -16, and wtimer_main nice -12 so audio outranks Unity/DXVK worker threads.
    • Clamped wtimer_main periodic next_due against wall clock to prevent wake-up bursts after pauses.

Source-only release — build the APK from your own PC copy via ./build.sh "/path/to/The Forest".