Skip to content

Engine v1.11: sound follows the macOS default output (#246); Soju 1.14.57 - #250

Merged
mikey92 merged 1 commit into
mainfrom
engine-audio-follow
Dec 1, 2026
Merged

mikey92 merged 1 commit into
mainfrom
engine-audio-follow

Conversation

@mikey92

@mikey92 mikey92 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor
  • patches/engine/0008-coreaudio-follow-default-output.patch: a shared-mode render stream opened on the macOS default output moves its audio unit to the new default output when it changes (headphones connected while a game runs). SOJU_FOLLOW_DEFAULT_OUTPUT=0 turns it off.
  • Engine v1.11 (release engine-v1.11) is v1.10 with only winecoreaudio.so rebuilt from this patch; install.sh and scripts/update.sh pin it.
  • Checked on a Mac mini M4 Pro with a WASAPI test program: switching the default output between the speakers and a monitor while it plays moves the stream (v1.10 stays on the first device), no errors, playback continues.
  • Version 1.14.57; HotS rows note the fix.

…dphones connected mid-game are used (#246); Soju 1.14.57
@mikey92
mikey92 merged commit a483f7e into main Dec 1, 2026
1 check passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-01T04:18:34.279646Z 5f1422b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@mikey92
mikey92 deleted the engine-audio-follow branch December 1, 2026 04:15
@chatgpt-codex-connector

Copy link
Copy Markdown

💡 Codex Review

+ if(AudioUnitSetProperty(stream->unit, kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global, 0, &id, sizeof(id)) == noErr){
+ os_unfair_lock_lock(&stream->lock);
+ stream->dev_id = id;
+ os_unfair_lock_unlock(&stream->lock);

P2 Badge Reconfigure surround folding when moving to a stereo device

When a multichannel stream starts on a surround-capable output and the user switches the macOS default to stereo headphones, this moves the existing audio unit without reconsidering its render callback. In patches/steam-wine-audio.patch, ca_setup_fold() selects ca_fold_render_cb only during stream creation, based on the original device's channel count. Consequently, this newly supported switch leaves the stream using ca_render_cb, and Core Audio drops the center and rear channels on the headphones, losing dialogue and other audio. Reevaluate the folding configuration when changing devices rather than preserving the original device's configuration unconditionally.


+ if(stream->flow != eRender || stream->share != AUDCLNT_SHAREMODE_SHARED) return;
+ if(getenv("SOJU_FOLLOW_DEFAULT_OUTPUT") && !strcmp(getenv("SOJU_FOLLOW_DEFAULT_OUTPUT"), "0")) return;
+ if(stream->dev_id == kAudioObjectUnknown || stream->dev_id != current_default_output()) return;
+
+ block = Block_copy(^(UInt32 n, const AudioObjectPropertyAddress *addrs){ ca_follow_default_output(stream); });

P2 Badge Distinguish explicitly selected outputs from default routing

If a game explicitly selects an output that also happens to be the current macOS default, this condition registers it for automatic migration too. Comparing device IDs cannot distinguish an explicit selection from a request to follow the default, and the listener subsequently moves that stream when the system default changes. This overrides the game's selected output, contrary to the patch's stated behavior that devices chosen by name stay where they are. Carry the default-versus-explicit selection intent into registration instead of inferring it solely from the current device ID.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant