Skip to content

Disable the automatic stereo-forcing heuristic for multichannel ALSA ... - #558

Draft
diamondsea11 wants to merge 1 commit into
rerdavies:mainfrom
diamondsea11:upstream-pr/alsa-multichannel-detection
Draft

Disable the automatic stereo-forcing heuristic for multichannel ALSA ...#558
diamondsea11 wants to merge 1 commit into
rerdavies:mainfrom
diamondsea11:upstream-pr/alsa-multichannel-detection

Conversation

@diamondsea11

@diamondsea11 diamondsea11 commented Aug 6, 2026

Copy link
Copy Markdown

Extracted from the diamondsea11/pipedal fork as one self-contained change, per your request in #555 to review fork work one topic at a time rather than as a single large diff.

What this does

ShouldForceStereoChannels() inspects a device's ALSA channel map and collapses it to stereo when the map looks like a legacy or surround configuration. On genuinely multichannel interfaces (more than 2 real channels, not a legacy driver reporting a bogus count) that heuristic misfires and forces the device down to 2 channels it does not need collapsing to.

This adds an unconditional early return for channelsMax > 2, disabling the heuristic rather than trying to refine it.

Diff is one line. The original channel-map logic is deliberately left in place below the new return, not deleted, so the conditions it was trying to detect stay visible for whoever decides its long-term fate. The channelsMax <= 2 fast path above is untouched.

Your own comment on that function already reads:

This is high-risk code, because it attempts to anticipate hypothetical device configurations with no actual testing.

so this may be a change you'd rather make differently — happy to follow your lead on that.

Test status

There is no isolated unit test for this function, and I have not added one. Writing a meaningful test needs either real device channel-map fixtures or refactoring the function to accept mock channel-map data instead of live snd_pcm_t/hw_params handles. Flagging that rather than implying coverage that doesn't exist.

Verified in practice only on the hardware I have here (RME Babyface Pro FS, 4 in / 4 out), where the heuristic was the thing preventing all four channels from being available.

Provenance

As discussed in #555: I'm not a developer, and this code is AI-implemented from my descriptions. Please review it as such. I've kept the change as small as I could specifically so that reviewing it is cheap.

Targeting main since that's what the branch is based on — happy to retarget to dev if you'd prefer.

…devices

ShouldForceStereoChannels() collapses a device to stereo based on inspecting
its ALSA channel map -- the function's own comment already describes it as
"high-risk code, because it attempts to anticipate hypothetical device
configurations with no actual testing." On genuinely multichannel interfaces
(more than 2 real channels, not a legacy device reporting a bogus channel
count) this heuristic misfires and forces the device down to 2 channels it
does not actually need collapsing.

This disables the heuristic unconditionally for channelsMax > 2, rather than
attempting to refine it. The original channel-map-inspection logic is left in
place below the new early return -- intentionally not deleted, so the exact
conditions it was trying to detect remain visible for whoever decides its
long-term fate. The channelsMax <= 2 fast path above is untouched.

Test status, stated plainly rather than implied: there is no isolated unit
test for this function, and writing one that means anything would need either
real device channel-map fixtures or refactoring the function to take mock
channel-map data instead of live snd_pcm_t/hw_params handles. Flagging this
rather than claiming coverage that does not exist.

Extracted as a single, minimal change from the diamondsea11/pipedal fork
(feature/multipath-v1) for independent review, per the maintainer's request in
rerdavies#555 to evaluate fork changes
one topic at a time rather than as one combined diff.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@diamondsea11
diamondsea11 marked this pull request as draft August 6, 2026 11:53
diamondsea11 pushed a commit to diamondsea11/pipedal that referenced this pull request Aug 6, 2026
All four extracted branches are now open as drafts against rerdavies/pipedal:
rerdavies#558 ALSA multichannel, rerdavies#559 S24_LE scaling, rerdavies#560 JUCE sidechain group
fallback, rerdavies#561 LV2 category patching. All target main, which is what the
branches were cut from; retargeting to dev is offered in each PR body.

rerdavies#558 already existed as a non-draft and was converted, with its
auto-populated commit-message body replaced by one written for review.

Each PR body states the provenance Robin asked about in rerdavies#555 (not a
developer, AI-implemented from descriptions) so he can calibrate review
effort, and states verification honestly per PR -- only rerdavies#561 has actually
been compiled.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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