AudioObjectSetPropertyData with bluetooth devices on macOS Monterey (12.0.1)

In previous versions of macOS (Catalina & Big Sur) I used the following code in my app to mute the system Input device (assuming a good inputDeviceId):

let inputDeviceId = input.id
            
var address = AudioObjectPropertyAddress(
    mSelector: AudioObjectPropertySelector(kAudioDevicePropertyMute),
    mScope: AudioObjectPropertyScope(kAudioDevicePropertyScopeInput),
    mElement: AudioObjectPropertyElement(kAudioObjectPropertyElementMaster))

let size = UInt32(MemoryLayout<UInt32>.size)
var mute: UInt32 = muted ? 1 : 0

AudioObjectSetPropertyData(inputDeviceId, &address, 0, nil, size, &mute)

This worked great in both previous operating systems across all input devices I tested.

However, in macOS 12.0.1 this no longer works specifically for bluetooth devices. And, beyond that, it instead mutes the Output volume of these bluetooth devices. On the system microphone or via a line-in, this still works as expected.

I'm trying to determined what changed in Monterey that caused bluetooth devices to start behaving the opposite as they were before with respect to this API? Is there a new recommended approach for muting microphone input from Bluetooth devices?

Any help, guidance, or context here is appreciated.

Enabling/disabling mute in bluetooth input in Monterey Audio MIDI Setup app enables/disables mute in the output, so looks like this is new behaviour. Whether it's intentional or not is another matter. Log a bug I guess.

I’m seeing the same behavior. Apparently when AirPods or another Bluetooth headset is connected and being used as input, the output volume control becomes unavailable and the input mute controls both. Filed as FB9778272.

@Apple, please fix this very annoying bug!

Same result when using AppleScript set volume input volume 0, which works fine without Airpods. Very annoying for WFH meetings.

This was fixed in MacOS 12.4

AudioObjectSetPropertyData with bluetooth devices on macOS Monterey (12.0.1)
 
 
Q