Skip to content
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

Do not send extra channels for aggregate devices. #243

Open
wants to merge 1 commit into
base: trailblazer
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3612,16 +3612,11 @@ impl<'ctx> CoreStreamData<'ctx> {
self.stm_ptr,
input_hw_desc
);
// Notice: when we are using aggregate device, the input_hw_desc.mChannelsPerFrame is
// the total of all the input channel count of the devices added in the aggregate device.
// Due to our aggregate device settings, the data captured by the output device's input
// channels will be put in the beginning of the raw data given by the input callback.
Comment on lines -3615 to -3618
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep this comment, but update it to make it accurate: the "our aggregate device settings" refers to the input device coming after the output device, for instance. Rather explain that the input device is set first on the aggregate device, so we only need to request those channels and CoreAudio will drop the rest automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay; I lost track of this and have now forgotten all context. Can you please suggest a specific phrasing, and I can update the PR?


// Always request all the input channels of the device, and only pass the correct
// channels to the audio callback.
// The input stream channel count is not necessarily the same as the
// input **device** channel count; request the latter from audiounit.
let params = unsafe {
let mut p = *self.input_stream_params.as_ptr();
p.channels = input_hw_desc.mChannelsPerFrame;
p.channels = device_channel_count;
// Input AudioUnit must be configured with device's sample rate.
// we will resample inside input callback.
p.rate = input_hw_desc.mSampleRate as _;
Expand Down
Loading