Skip to content

feat(audio): put LibTrueHD and LibDTSX behind package traits - #777

Merged
superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
williamliu0516:feat/truehd-trait
Oct 15, 2026
Merged

superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
williamliu0516:feat/truehd-trait

Conversation

@williamliu0516

Copy link
Copy Markdown
Contributor

What

LibTrueHD and LibDTSX are now optional, behind two package traits: TrueHDObjectAudio and
DTSXObjectAudio. Both are on by default, so nothing changes for existing hosts.

Why

Both libraries only serve objectAudioRendering, yet they are always linked, and some apps can't ship
them. With a trait off, the library is neither linked nor fetched, and that codec uses the channel bridge:

.package(url: "https://github.com/superuser404notfound/AetherEngine", from: "x.y.z", traits: [])

Traits need swift-tools-version 6.1. Xcode 27 applies them only to remote package references.

Test plan

Mac Studio, macOS 27, Xcode 27.0:

  • Builds and swift test pass with and without the traits (one LAN test fails the same way on unmodified
    main here).
  • TrueHD 7.1 Atmos with --atmos-bed 7.1.4: traits on, APAC as before; off, the channel bridge.
  • An app with traits: [] fetches and links neither library, and plays the same file through the E-AC-3
    bridge.
  • Not tested: DTS:X with its trait off (no sample here).

Each object-audio decoder library is now behind a trait of its own, TrueHDObjectAudio and
DTSXObjectAudio, both on by default, so a host that does nothing keeps today's build. A host that
cannot ship one of them turns its trait off: the library is then neither linked nor resolved, and
its codec keeps the channel bridge whatever objectAudioRendering asks, with the reason in the
session log. The manifest moves to swift-tools-version 6.1, which traits need; CI also builds with
both traits off.
@superuser404notfound
superuser404notfound merged commit 962fd0a into superuser404notfound:main Oct 15, 2026
superuser404notfound pushed a commit that referenced this pull request Oct 15, 2026
…for (#777)

With a trait off, TrueHD Atmos or DTS:X still won the automatic pick within
its language, and then played through the channel bridge like any other
track. The pick now ranks a codec only when its decoder is linked. The
ranking tests run only with their trait, plus one that runs without.

Also: the README trait example names 7.37.0 (7.36.0 has no traits), and CI
builds the tests with the traits off, not just the library.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound

Copy link
Copy Markdown
Owner

Thanks for this, William. Clean change, and the test plan covered exactly the cases that matter. Merged as 962fd0a.

Verified on the merge with main (Xcode 27, macOS 27): the full suite passes with the default traits, and swift build --disable-default-traits --build-tests plus the audio tests pass with both traits off. That build also never fetched LibTrueHD or LibDTSX.

Three small things followed in fec79e1:

  • The automatic audio pick. With a trait off, TrueHD Atmos or DTS:X still won the pick within its language and then played through the channel bridge like any other track. The pick now ranks a codec only when its decoder is linked (linksTrueHDObjectDecoder / linksDTSXObjectDecoder). The ranking tests run only with their trait, and one new test covers a build without them.
  • README example. It now says from: "7.37.0". 7.36.0 has no traits, so a host that passes traits: against it would fail to resolve.
  • CI. The traits-off step builds the tests too (--build-tests), so a test that uses the gated types without the guard fails in CI.

This goes out with the next release.

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.

2 participants