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.