libobs, win-wasapi: Enable channel routing for Audio Input Capture#12942
libobs, win-wasapi: Enable channel routing for Audio Input Capture#12942pkviet wants to merge 3 commits intoobsproject:masterfrom
Conversation
PatTheMav
left a comment
There was a problem hiding this comment.
Looks fine to me overall, also tested this with an virtual 6-ch audio device and allowed me to map them as expected.
Haven't done in-depth checks whether the audio is correctly routed though.
b044cb4 to
0922dcc
Compare
|
Just built this pr from the current master. |
0922dcc to
1594d91
Compare
yes there was a regression but it is fixed with last push |
Because I want to avoid an uncontrolled upmix or downmix. |
RytoEX
left a comment
There was a problem hiding this comment.
cc @Warchamp7 on brace changes. If needed, we can just update all of these in the clang-format PR, but we will soon be requiring and enforcing braces for all control statements in C++.
07c9cb1 to
cb66f5a
Compare
Warchamp7
left a comment
There was a problem hiding this comment.
A couple bits of feedback and some questions.
Can we invert the checkbox?
i.e. Unchecked by default, and the label is instead "Enable custom channel routing"
When Device is set to Default the channel selection dropdowns are missing a device name and simply say channel 1, etc.
Ideally the actual device name should be used in the device channel dropdowns and not just Default.
At time of review, wasapi output devices don't appear to be working:
17:18:30.101: [win-wasapi: 'Audio Output Capture'] update settings:
17:18:30.101: device id: {0.0.0.00000000}.{825bd69f-078a-481c-831c-eda29a7002bb}
17:18:30.101: use device timing: 1
17:18:30.108: Device 'Speakers (Scarlett 2i2 4th Gen)' invalidated. Retrying (source: Audio Output Capture)
17:18:30.118: warning: Input channel layout "" is invalid or unsupported.
17:18:30.118: avresample_open failed: error code -22
17:18:30.118: WASAPI: Device 'Speakers (Realtek USB2.0 Audio)' [48000 Hz] initialized (source: Audio Output Capture)```
This can be done, but this means wasapi would not be aligned with core audio where the feature was first implemented.
Ok I will add the logic for that.
Indeed. My scope was to bring parity to wasapi with coreaudio. |
I'd like to update core audio to match that as well then. It can be a separate PR though. |
|
Update
|
This adds a function allowing to set a custom channel matrix, allowing channel rerouting. This is useful when sources provide layouts not supported by obs or to correct incorrect channel assignments. Signed-off-by: pkv <pkv@obsproject.com>
This adds a hint for the 'downmix' checkbox. It is likely unclear to users what this checkbox does or does not. When disabled, it allows channel selection; when enabled it lets obs deal with speaker layout mismatches between source and obs. Signed-off-by: pkv <pkv@obsproject.com>
This adds the capability to select input channels exposed to obs. (The same is already possible for coreaudio input sources.) Signed-off-by: pkv <pkv@obsproject.com>




Description
On libobs side, this adds the capability for the audio resampler (relying on swresampler lib) to
set a matrix for routing of channels.
On win-wasapi side, this applies the new capability to enable channel selection.
This brings parity to wasapi input capture with coreaudio input capture on macOS.
Screenshots
Motivation and Context
One motivation for that feature are devices which separate stereo inputs.
So if a mike is connected to , say, Input 1 while nothing is connected to Input 2, wasapi usually treats them as
stereo pairs and when obs audio is set to Stereo, the captured Right channel will be silent.
With channel routing capability, it is now possible to duplicate the left channel to the right and have a consistent level.
The issue was brought to my attention by @Fenrirthviti
How Has This Been Tested?
Tested on windows 11 pro 25H2 w/ a logitech webcam + USB sound board.
Disabling the downmix cehckbox enables channel routing.
Swapping between devices resets the channel selections.
Changing the channel selections updates the captured channel.
Types of changes
Checklist: