I'm attempting to mute the mic on my Logitech C920 webcam (OSX 10.8.5), but both implementations that I have tried do not work 100%. I would really appreciate it if someone who has experience with Apple's CoreAudio could take a look.
Here is what I have tried:
Setting mute via AudioObjectSetPropertyData() using:
address.mScope = kAudioDevicePropertyScopeInput;
address.mElement = kAudioObjectPropertyElementMaster;
address.mSelector = kAudioDevicePropertyMute;
This works, I can successfully mute/unmute but eventually I am able to get into a state where the mic is no longer receiving audio. It seems to be triggered by switching the default input to the internal mic while the C920 is in the muted state and switching back to the C920 mic. The only way that I have found to get the C920 mic back into a good state is to pull the USB cable and plug it back in.
Setting the volume to 0.0f via AudioObjectSetPropertyData() using:
address.mScope = kAudioDevicePropertyScopeInput;
address.mElement = kAudioObjectPropertyElementMaster;
address.mSelector = kAudioDevicePropertyVolumeScalar;
This almost works. The OSX UI input volume slider moves all the way to the left, but the mic is still picking up a little bit of audio. Uhhhhggg so close!
Opening the "Audio MIDI setup" app shows the C920 mic. When the volume value is set to zero, the dB value is 20. When the volume value is set to 1, the db value is set to 50. This is different from the built in mic that looks like it has a dB range of -12 to 12. Not sure if this matters.
When setting mute or the volume, I've tried fetching the individual channels and setting them as well. Doesn't seem to have an impact. I think with both input devices setting the Master channel is working fine.
I was wondering if maybe this is a hardware issue. I should note that the Logitech C920 isn't officially supported on the Mac (although a ton of people use it). I'm able to control the internal mic without any issues. Hopefully I'm just overlooking something :-)
When setting volume kAudioDevicePropertyVolumeScalar to zero. You should also set mute to true using kAudioDevicePropertyMute. When adjusting volume of inputs, be careful to check the mute status.
For example:
Conclusion:
There is a "Mute" status for the input in the system, but no shown in the audio setting panel. System will auto set mute to true when adjust volume to zero and disable mute when set volume larger than zero.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With