Task III - C# Companion

A project log for Multi VC Mute Button

On a daily basis I use many different VC programs. I wanted a way to mute that was software agnostic.

Colin Russell-ConwayColin Russell-Conway 07/08/2021 at 16:310 Comments

As I wanted it to be software agnostic I needed something on the computer to detect what process was active at a particular time.  The easiest way for me to do this was to through WMI and check the default sound device microphone, and if it was any if the popular VC software EXEs this was communicated to the device which glowed a particular colour depending on the software (ie blue for zoom/starleaf, purple for Teams, green for webex etc.).  I wanted a way to feed back whether it was muted or not to the device (to flash the neopixels) so I attempted to mute the VC mic and the mic in the OS level as, generally speaking, once unmuted the VC software unmuted it at an OS level but this was not always the case and proved problematic and was axed in the final version.

Coms with the device was simple enough as I've done it a few times before and the companion app waited for response from the device as it queried it from time to time to check the active software.  

Whatever program was in control of the microphone was noted (by software and process ID).  Once the mute button was detected, the companion app noted the current active window process, switched the active application to the VC, entered the mute command and switched back to the process that was previously active.  This, in most cases was seamless, however Teams is a resource hog and required a few milliseconds to switch, enter the key combo and switch back, all in about a 1.5 seconds.  Immediate enough for my requirements.

The encoder acted as the panic button in this case with a single click for mute and a double click for disabling/enabling video.