Skip to content

Add 5.1 surround sound and 3D headphones binaural audio output - #576

Closed
jfpaardoo wants to merge 1 commit into
Revivedx:testfrom
jfpaardoo:feat/surround-sound
Closed

jfpaardoo wants to merge 1 commit into
Revivedx:testfrom
jfpaardoo:feat/surround-sound

Conversation

@jfpaardoo

@jfpaardoo jfpaardoo commented Nov 8, 2026 •

Copy link
Copy Markdown

What this changes

  • Adds a configurable Audio output option under Options > Audio (in both the standalone Launcher and in-game menu), settings.ini, and the control socket (audio_output = stereo | surround_51 | headphones_3d):
    • Stereo (default): standard ITU 5.1-to-2.0 downmix (audio_output = stereo / 0), keeping default behavior untouched.
    • Surround 5.1: native 6-channel discrete surround sound (FL, FR, FC, LFE, BL, BR) passed directly to SDL3 (audio_output = surround_51 / 1).
    • 3D Headphones: binaural virtual-speaker spatializer (audio_output = headphones_3d / 2) implementing interaural time difference (ITD) delay lines, head-shadow low-pass filtering, rear pinna high-shelf filtering, center-channel early reflection, LFE ~120 Hz low-pass filtering, and a soft-knee limiter.
  • Updates IAudioDevice::GetActiveChannelCount (cmd 5) and GetActiveChannelCountAuto (cmd 13) in runtime/services/audio.c to report 6 active channels when Surround 5.1 or 3D Headphones is selected, so the game's nn::audio engine renders discrete 6-channel audio.
  • Signals IAudioDevice system events (cmd 4, 11, 12) on runtime mode changes and dynamically re-opens the SDL audio output stream when switching between 2-channel and 6-channel modes.
  • Includes menu translations across all 13 runtime/ui/i18n/*.inc files and synthetic unit tests in tests/test_audio_mix.c.

Fixes #573

How it was tested

  • Unit / synthetic tests:
    • make test-audio-mix: PASS (verifies channel counts, ITU 5.1 downmixing, 5.1 pass-through channel ordering, 3D binaural ITD delays, head-shadow filter, LFE low-pass filter, and soft limiter).
    • make test-pc-controls: PASS (verifies audio_output settings persistence and clamping).
    • python3 tools/i18n_check.py: PASS (0 missing, 0 unused across all 13 locales).
    • git diff --check: clean (no whitespace or formatting errors).
  • Build:
    • make -j8 on Windows (MSYS2 UCRT64, clang): builds cleanly with zero warnings.

Checklist

  • Based on the latest test and opened against test
  • Built and run locally, and checked in the game
  • No game files, keys, firmware, generated game code or save files in the changes

Copilot AI balanced review requested due to automatic review settings November 8, 2026 12:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@jfpaardoo jfpaardoo mentioned this pull request Nov 8, 2026
Revivedx added a commit that referenced this pull request Nov 8, 2026
New:
- Audio > Audio output: Stereo, Surround 5.1 or 3D Headphones. Stereo stays the default (#576).
- Audio > Shrine sensor volume, 0% to 100%, from the next start (#571, fixes #449). The sound is changed in memory
  only; the game files are not touched.
- Controls > HUD button layout: where A, B, X and Y sit on the HUD's diamond, from the next start. Automatic follows
  the controller bindings (#574, #321).

Tested by playing on Windows with headphones (Stereo and 3D Headphones), and with a hidden start, warp and teleport
run: no crash and no errors in the log. Surround 5.1 has not been tested on real 5.1 speakers, and the option says so.

Co-authored-by: jfpaardoo <juaparpar@alum.us.es>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Revivedx

Revivedx commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Thanks, this is in test as a04bafd. We tested Stereo and 3D Headphones with headphones. We have no 5.1 speakers here, so the option's description says Surround 5.1 is untested on real speakers; a report from a real 5.1 setup would let us remove that note. Closing since test gets one clean commit per batch; you are credited as co-author.

@Revivedx Revivedx closed this Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants