-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mac-capture: Add channel selection for CoreAudio input devices #9766
Conversation
Please include screenshots. |
I'd definitely be excited to see this 👍 |
34d67f3
to
a3de10f
Compare
@pkviet could you try and confirm that it fixes the issue you had with the original PR? |
@PatTheMav good and bad news We might have to reset some stuff when swapping channels, maybe ? |
Can't reproduce this - just did a recording, switching channel maps around during recording and all went fine - recording has everything coming in at the expected channels.
|
I am very interested in this feature! |
a3de10f
to
1b3794a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved for merging.
539d766
to
0263946
Compare
Really looking forward to a release of obs with this feature! It will enable me to significantly simplify my streaming solution. |
0263946
to
fb3db70
Compare
This PR just received an unexpected bigger update - as @Lain-B correctly pointed out, OBS will automatically downmix source audio to the number of channels set up for output. The changes effectively removed this convenience feature by limiting the output to the specific amount of channels, which might be desirable in some scenarios, but not all. With the recent push this change has been made optional with a new checkbox in the property window to "Enable Downmixing":
Downmixing is enabled by default to retain OBS' current default functionality, with the new ability available to users who require it. |
776032d
to
3764ee8
Compare
@RytoEX if you don't have any objections, I'd merge this soon - have tested this with several devices without issue but I guess we need to have this merged and actual "volume" of users on this to get any kinks out. |
I do not have any substantial objections. Would have liked to maybe see another macOS dev (@gxalpha ?) look over this, but it's probably fine. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tentatively approving this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tentatively approving this, for real.
3764ee8
to
9fad876
Compare
Could you please share screenshots of this menu of as it looks now? Especially one that shows the string |
See #9766 (comment) for normal operations.
|
hi there! how can i test this feature? |
Send it to me! I want to test this :D |
Description
This is an update of an older pull request (#2889) to fix the issues that were reported on the original PR.
The original PR added the ability to select and map input channels to the input channels supported by OBS Studio.
Motivation and Context
When OBS Studio is set to stereo output, it only accepts input on channels 0 and 1 of audio devices and "ignores" any output on other channels. Existing plugins cannot work around this issue, because they always access the audio data provided by
libobs
but not by the hardware.This PR uses the capability of CoreAudio output units to be configured with a channel mapping that maps arbitrary input channels to the configured output channels.
This unlocks use cases like:
All this happens before the audio is provided to
libobs
, so application can stay in "stereo mode".Important
This PR also changes the output format used by CoreAudio to provide audio to
libobs
: CoreAudio flattens audio for AUHAL units to its "canonical" format by default (32-bit float, deinterlaced/planar, PCM) which fortunately aligns with OBS' internal format. The only adjustment is made to sampling rate (the output element of the AUHAL unit is set to the sampling rate of the input element).This means that OBS will only add a resampling step if the sampling rates don't match.
The obvious benefit is that the entire CoreAudio code will assume the planar 32-bit float format to create buffers and render the input data (per Apple's documentation that this is what AUHAL units do by default). Using the "canonical" format is also suggested by Apple for any sound processing between Audio Units.
How Has This Been Tested?
Tested on macOS 13 with default macOS audio devices and external audio devices. Tested with multiple sample rate settings and channel configurations.
Types of changes
Checklist: