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

Firefox 127 not playing audio out Channels assigned in Audio MIDI setup #232

Closed
ChunMinChang opened this issue Aug 6, 2024 · 6 comments
Closed

Comments

@ChunMinChang
Copy link
Member

ChunMinChang commented Aug 6, 2024

This issue is mirrored from BMO 1904734, as detailed in comments #6 and #7.

On my Cubilux Surround Sound Card (CA7), the channel layout is set to [BackLeft, BackRight, FrontCenter, LowFrequency, FrontLeft, FrontRight]. However, audio only comes out of the first two channels when tested in Firefox and with test_tone. With a 2-channel input and a 6-channel output, a Mixer should be created to upmix the audio.

I am not sure what kAudioUnitProperty_AudioChannelLayout setting is supposed to do, but it doesn't seem to change my Cubilux device setting. Instead, it sets maybe_need_mixer to false, preventing the mixer from being created.

Commenting out the kAudioUnitProperty_AudioChannelLayout setting doesn't solve the problem, as the output_dev_desc's mChannelsPerFrame still reports 2. This leads to creating a 2-channel output mixer, even though the device_layout correctly reflects the channel layout.

The channels of output_dev_desc are defined by output_hw_desc.mChannelsPerFrame, which is expected to reflect the hardware information. However, it also reports 2 in this case. The output_hw_desc is queried from the kAudioUnitProperty_StreamFormat property. Changing the query scope from kAudioUnitScope_Input to kAudioUnitScope_Output makes output_hw_desc report the expected mChannelsPerFrame value of 6, resulting in an output_dev_desc setting that allows the creation of a 6-channel output mixer.

In summary, commenting out the kAudioUnitProperty_AudioChannelLayout setting and changing the query scope for kAudioUnitProperty_StreamFormat fixes the issue. These changes were introduced in PR #220 and PR #222. However, there were no comments or explanations detailing the issues they were meant to address. Without this context, I am unsure if reverting these changes is the right approach or if it might lead to other regressions.

@Pehrsons, @padenot, do you remember what those settings do? I'd like to leave some discussion here or on the bug for future reference. Feel free to comment with your thoughts about the right approach.

@ChunMinChang
Copy link
Member Author

ChunMinChang commented Aug 7, 2024

According to BMO 1904734 comment #10, it seems kAudioUnitProperty_AudioChannelLayout setting should be applied if only FrontLeft and FrontRight are meaningful in the channel layout, e.g, [ .., Discrete, ...., FrontLeft, ..., FrontRight, ..., Silence, ...]. We could probably add a device_layout inspection in the if conditions for maybe_need_mixer.

@ChunMinChang
Copy link
Member Author

Currently, #233 partially addresses the issue. Other commits/patches are required to fix the problem.

@padenot
Copy link
Collaborator

padenot commented Aug 8, 2024

When playing stereo, audio should come out of the stereo pair, is that not what you're expecting?

@Pehrsons
Copy link
Contributor

Pehrsons commented Aug 8, 2024

Testing with Blackhole16ch, having set Front Left to ch7 and Front Right to ch8 and playing stereo audio with test_tone I get the left channel playing through ch7 and the right through ch8 as expected. Mono got downmixed (half volume or so) to ch7 and ch8. With #233 I got Mono at full volume to ch3 instead (Center).

I guess this is the difference in mixer behavior when outputting 8ch (with a Center channel) vs 2ch (without Center).

@ChunMinChang
Copy link
Member Author

Here is the brief of the offline discussion:

@ChunMinChang
Copy link
Member Author

I am going to close this since #233 solves the channel count issue and leads to addressing the needs above.

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

No branches or pull requests

3 participants