Is there a way to detect when the microphone of my Mac is in use? Similar to what Mikro Snitch does? Can this be done in Cocoa?
I'm working on go module that detects camera/microphone state (using cgo
) and here is my crafted Objective-C implementation for IsMicrophoneOn()
: https://github.com/antonfisher/go-media-devices-state/blob/main/pkg/microphone/microphone_darwin.mm
I used kAudioHardwarePropertyDevices
to get all audio devices (microphones + speakers) and then [AVCaptureDevice deviceWithUniqueID:uid]
to filter out only microphones by device UID.