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?
Is there a way to detect when the microphone of my Mac is in use?
Simple answer - Yes, but it's not going to be easy!
Can this be done in Cocoa?
As the documentation states: -
The Cocoa application layer is primarily responsible for the appearance of apps and their responsiveness to user actions
So this doesn't cover the microphone and if it did, it would be too high level for what you want.
A detailed answer on how to do this is complex and too broad for Stack Overflow. However, to set you off in the right direction, you need to create an IOKit kernel extension driver (KEXT) and have a good understanding of the I/O Registry