mozilla / cubeb-coreaudio-rs

The audio backend of Firefox on Mac OS X.
ISC License
25 stars 10 forks source link

Use different scopes on the output bus depending on AudioUnit type #233

Closed Pehrsons closed 2 months ago

Pehrsons commented 2 months ago

As the inline comment says it seems a HAL unit for a device with >2 output channels reports only 2 channels on the input scope of the output bus. Not sure what these 2 reflect but let's differentiate VPIO (where input scope reports 1 which we want, and output scope reflects hw) and HAL units when selecting scope as they're the only types we use.

Pehrsons commented 2 months ago

The new commit updates output_dev_desc so we configure the device correctly for 2 channels when deciding to skip the mixer. With my Studio Display that has 8 channels I get an error with the stereo variant of test_tone though: AudioConverter.cpp:748 Failed to created a new in process converter -> from 2 ch, 48000 Hz, lpcm (0x00000009) 32-bit little-endian float, packed in 16 bytes low-aligned to 8 ch, 48000 Hz, Float32, interleaved, with status 1718449215 Note 1718449215 is the fourcc for fmt?, i.e. kAudioConverterErr_FormatNotSupported.

Pehrsons commented 2 months ago

Ah my bug, fixed now. With this stack playing something >2ch should work on a device with >2ch.