[PR #4686] [CLOSED] Replace CPAL with OpenAL Soft #5779

Closed
opened 2026-11-03 05:14:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4686
Author: @nytrrcx
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: fix/openal-default


📝 Commits (2)

  • 2421487 Replace CPAL with OpenAL Soft
  • 34496e8 Fix OpenAL review findings

📊 Changes

26 files changed (+2334 additions, -829 deletions)

View changed files

📝 .github/workflows/ci.yml (+6 -3)
📝 .github/workflows/game-build.yml (+21 -5)
📝 AGENTS.md (+4 -1)
📝 CONTRIBUTING.md (+3 -0)
📝 Cargo.lock (+24 -258)
📝 Cargo.toml (+1 -0)
📝 README.md (+4 -0)
📝 THIRD_PARTY_NOTICES.md (+11 -0)
📝 crates/horizon-client-render/Cargo.toml (+3 -3)
📝 crates/horizon-client-render/src/audio.rs (+174 -490)
➕ crates/horizon-client-render/src/audio/decoder.rs (+82 -0)
➕ crates/horizon-client-render/src/audio/output.rs (+444 -0)
📝 crates/horizon-client/Cargo.toml (+2 -2)
📝 crates/horizon-client/src/game.rs (+5 -2)
📝 crates/horizon-dualsense/Cargo.toml (+1 -1)
📝 crates/horizon-dualsense/src/haptics.rs (+40 -39)
📝 crates/horizon-dualsense/src/haptics_stub.rs (+1 -1)
➕ crates/horizon-openal/Cargo.toml (+14 -0)
➕ crates/horizon-openal/src/lib.rs (+1243 -0)
📝 docs/controllers.md (+2 -2)

...and 6 more files

📄 Description

🤖 Code prepared with OpenAI Codex; PR submitted by nytrrcx.

What and why

Replace CPAL with OpenAL Soft for game audio and DualSense haptics. Individual sounds use native OpenAL sources with listener position, gain, pitch, attenuation and looping. Release archives bundle a replaceable OpenAL Soft library.

On Void Linux/PipeWire, sound effects had about 100 ms of audible delay. In a local XWayland play test, the delay was no longer noticeable. This is a subjective result, not a measured physical latency.

Following review:

  • OpenAL operations run on a dedicated output thread.
  • Music uses bounded incremental Ogg decoding and recycled queued buffers.
  • Static sounds share cached native buffers.
  • Cold decodes wake the output worker without waiting for a client tick.
  • Device changes stop old sounds instead of restarting them.
  • Obsolete device selections fall back to the default and are normalized in settings.
  • Packaging includes a CMake preflight, Windows AVRT import support and updated third-party notices.
  • The merge of main preserves its device watcher and Intel Mac release support.

Fixes #4683

Kind

  • [ ] parity
  • [ ] bug
  • [x] perf
  • [ ] feature
  • [ ] extra
  • [ ] tooling
  • [ ] docs

Vanilla reference

Follows the responsibilities of SoundEngine.reload, SoundEngine.shouldChangeDevice, SoundEngineExecutor, ChannelAccess.executeOnChannels, SoundBufferLibrary.getCompleteBuffer/getStream and LoopingAudioStream.read: an audio output thread, native sources, cached static buffers, queued streaming and stop-all device reloads.

Mappings are updated in tools/port_map/rest-005.tsv. Native OpenAL and render-audio tests cover buffer sharing, streaming, device changes and playback without client ticks. Complete vanilla audio parity is not claimed.

Self-check

  • Python: 501 passed, 4 skipped.
  • Formatting, workspace/server Clippy, launcher Clippy and public-tree checks passed.
  • Workspace: 3292 tests passed; content-root: 7 passed.
  • Separate renderer run: 693 passed, 25 ignored.
  • OpenAL native tests: 11 passed with both the system and freshly built bundled library.
  • Render audio: 7 passed, including ignored regressions and a real-Ogg streaming probe.
  • DualSense software tests: 19 passed; xtask: 3 passed.
  • Launcher tests: 307 passed, 3 ignored.
  • Optimized client build, OpenAL bundling and Linux native dependency checks passed.

An isolated XWayland game on the server thread played a note block and streamed music through the freshly built OpenAL library's wave driver. The capture contained nonzero PCM and the process exited cleanly.

The optimized music + 64-source probe measured 8.6 us stream dispatch, 2.16 ms until the first block was queued, and 1.72 us maximum game-side update time in that run. These are local CPU timings, not physical audio latency.

The full pre-commit pr_ready.py run exhausted /tmp while building launcher tests. After freeing generated test artifacts, the launcher check passed separately.

The raw report below predates the merge commit, so its scope includes upstream changes. The merge and fixes were subsequently committed and pushed as 34496e8c2; the PR diff against the main revision merged into this branch is 26 files. <details> <summary>Raw pre-commit pr_ready output</summary>

pr_ready (tools/pr_ready.py --quick on void, against origin/main at a83ac6ac1, 12 min 27 s)

Check Result
Scope ⚠️ 618 files, +75519 −6078; 78025 lines of code: over 500, split it if it can ship in parts; mixes CI, game, launcher
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ✅ 501 passed (40 s)
rustfmt ✅ (7 s)
clippy ✅ (2 min 19 s)
tests: workspace ✅ 3292 passed (4 min 4 s)
doc tests ✅ 0 passed (4 s)
content root tests ✅ 7 passed (54 s)
tokens.css up to date ✅ (1 s)
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (2 min 36 s)
launcher tests ❌ failed (1 min 42 s)
Parity ➖ 359 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 347 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

</details>

Windows/macOS release builds, affected vanilla parity harnesses, port-ledger verification and physical DualSense routing remain unverified locally.

🤖 Generated with OpenAI Codex.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/4686 **Author:** [@nytrrcx](https://github.com/nytrrcx) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/openal-default` --- ### 📝 Commits (2) - [`2421487`](https://github.com/horizon-rust/horizon/commit/24214871607d8d038739410d8966b526069fd636) Replace CPAL with OpenAL Soft - [`34496e8`](https://github.com/horizon-rust/horizon/commit/34496e8c2c4654b91dad5cf2b1dcf505774fef02) Fix OpenAL review findings ### 📊 Changes **26 files changed** (+2334 additions, -829 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+6 -3) 📝 `.github/workflows/game-build.yml` (+21 -5) 📝 `AGENTS.md` (+4 -1) 📝 `CONTRIBUTING.md` (+3 -0) 📝 `Cargo.lock` (+24 -258) 📝 `Cargo.toml` (+1 -0) 📝 `README.md` (+4 -0) 📝 `THIRD_PARTY_NOTICES.md` (+11 -0) 📝 `crates/horizon-client-render/Cargo.toml` (+3 -3) 📝 `crates/horizon-client-render/src/audio.rs` (+174 -490) ➕ `crates/horizon-client-render/src/audio/decoder.rs` (+82 -0) ➕ `crates/horizon-client-render/src/audio/output.rs` (+444 -0) 📝 `crates/horizon-client/Cargo.toml` (+2 -2) 📝 `crates/horizon-client/src/game.rs` (+5 -2) 📝 `crates/horizon-dualsense/Cargo.toml` (+1 -1) 📝 `crates/horizon-dualsense/src/haptics.rs` (+40 -39) 📝 `crates/horizon-dualsense/src/haptics_stub.rs` (+1 -1) ➕ `crates/horizon-openal/Cargo.toml` (+14 -0) ➕ `crates/horizon-openal/src/lib.rs` (+1243 -0) 📝 `docs/controllers.md` (+2 -2) _...and 6 more files_ </details> ### 📄 Description <blockquote> <p>🤖 Code prepared with OpenAI Codex; PR submitted by nytrrcx.</p> </blockquote> <h2>What and why</h2> <p>Replace CPAL with OpenAL Soft for game audio and DualSense haptics. Individual sounds use native OpenAL sources with listener position, gain, pitch, attenuation and looping. Release archives bundle a replaceable OpenAL Soft library.</p> <p>On Void Linux/PipeWire, sound effects had about 100 ms of audible delay. In a local XWayland play test, the delay was no longer noticeable. This is a subjective result, not a measured physical latency.</p> <p>Following review:</p> <ul> <li>OpenAL operations run on a dedicated output thread.</li> <li>Music uses bounded incremental Ogg decoding and recycled queued buffers.</li> <li>Static sounds share cached native buffers.</li> <li>Cold decodes wake the output worker without waiting for a client tick.</li> <li>Device changes stop old sounds instead of restarting them.</li> <li>Obsolete device selections fall back to the default and are normalized in settings.</li> <li>Packaging includes a CMake preflight, Windows AVRT import support and updated third-party notices.</li> <li>The merge of main preserves its device watcher and Intel Mac release support.</li> </ul> <p>Fixes #4683</p> <h2>Kind</h2> <ul> <li>[ ] parity</li> <li>[ ] bug</li> <li>[x] perf</li> <li>[ ] feature</li> <li>[ ] extra</li> <li>[ ] tooling</li> <li>[ ] docs</li> </ul> <h2>Vanilla reference</h2> <p>Follows the responsibilities of <code>SoundEngine.reload</code>, <code>SoundEngine.shouldChangeDevice</code>, <code>SoundEngineExecutor</code>, <code>ChannelAccess.executeOnChannels</code>, <code>SoundBufferLibrary.getCompleteBuffer/getStream</code> and <code>LoopingAudioStream.read</code>: an audio output thread, native sources, cached static buffers, queued streaming and stop-all device reloads.</p> <p>Mappings are updated in <code>tools/port_map/rest-005.tsv</code>. Native OpenAL and render-audio tests cover buffer sharing, streaming, device changes and playback without client ticks. Complete vanilla audio parity is not claimed.</p> <h2>Self-check</h2> <ul> <li>Python: 501 passed, 4 skipped.</li> <li>Formatting, workspace/server Clippy, launcher Clippy and public-tree checks passed.</li> <li>Workspace: 3292 tests passed; content-root: 7 passed.</li> <li>Separate renderer run: 693 passed, 25 ignored.</li> <li>OpenAL native tests: 11 passed with both the system and freshly built bundled library.</li> <li>Render audio: 7 passed, including ignored regressions and a real-Ogg streaming probe.</li> <li>DualSense software tests: 19 passed; xtask: 3 passed.</li> <li>Launcher tests: 307 passed, 3 ignored.</li> <li>Optimized client build, OpenAL bundling and Linux native dependency checks passed.</li> </ul> <p>An isolated XWayland game on the server thread played a note block and streamed music through the freshly built OpenAL library's wave driver. The capture contained nonzero PCM and the process exited cleanly.</p> <p>The optimized music + 64-source probe measured 8.6 us stream dispatch, 2.16 ms until the first block was queued, and 1.72 us maximum game-side update time in that run. These are local CPU timings, not physical audio latency.</p> <p>The full pre-commit <code>pr_ready.py</code> run exhausted <code>/tmp</code> while building launcher tests. After freeing generated test artifacts, the launcher check passed separately.</p> <p>The raw report below predates the merge commit, so its scope includes upstream changes. The merge and fixes were subsequently committed and pushed as <code>34496e8c2</code>; the PR diff against the main revision merged into this branch is 26 files. &lt;details&gt; &lt;summary&gt;Raw pre-commit pr_ready output&lt;/summary&gt;</p> <p><strong>pr_ready</strong> (<code>tools/pr_ready.py --quick</code> on void, against origin/main at a83ac6ac1, 12 min 27 s)</p> Check | Result -- | -- Scope | ⚠️ 618 files, +75519 −6078; 78025 lines of code: over 500, split it if it can ship in parts; mixes CI, game, launcher Cargo.lock | ✅ changes with a Cargo.toml Public tree | ✅ Python tests | ✅ 501 passed (40 s) rustfmt | ✅ (7 s) clippy | ✅ (2 min 19 s) tests: workspace | ✅ 3292 passed (4 min 4 s) doc tests | ✅ 0 passed (4 s) content root tests | ✅ 7 passed (54 s) tokens.css up to date | ✅ (1 s) launcher rustfmt | ✅ (1 s) launcher clippy | ✅ (2 min 36 s) launcher tests | ❌ failed (1 min 42 s) Parity | ➖ 359 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 347 more Label | player-facing: feature if players get something new, no label for a fix (release-now if urgent) <p>&lt;/details&gt;</p> <p>Windows/macOS release builds, affected vanilla parity harnesses, port-ledger verification and physical DualSense routing remain unverified locally.</p> <p>🤖 Generated with OpenAI Codex.</p> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:14:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#5779
No description provided.