6

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 :-)

kr4sh
  • 161
  • 2
  • This is definitely either an apple bug or a bug with the mic hardware. I can reproduce the issue where the mic stops working by only using the osx Sound app. Steps to repro: 1. Select the camera mic as the default input device, 2. move the slider all the way to the left to mute the camera mic, 3. change the default input device to the built in mic, 4. change the default input device back to the camera mic + move the slider to the right to unmute. Now it won't pick up sound anymore and requires you to pull usb & reinsert to get it working again. – kr4sh Dec 12 '13 at 18:34
  • Leaning more towards an apple bug since pulling USB sometimes needs to be done several times before it starts working again. If it was a hardware bug you would think a single power cycle would fix the issue. – kr4sh Dec 12 '13 at 18:56
  • Leaving this here to save others the time I spent investigating this: Make sure you enable "Audio input" for your app in the Sandbox settings for your macOS project!!! – FD_ Aug 10 '23 at 18:23

1 Answers1

3

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:

  1. Adjust input volume in system audio panel to 0
  2. Adjust input volume using kAudioDevicePropertyVolumeScalar to 100
  3. Look at the db indicator, it stay at zero but the slider is in 100. No sound from microphone can be captured. Use kAudioDevicePropertyMute to get mute value, we can get mute = 1

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.

yicheng
  • 31
  • 3