title: Use the Microsoft Lync API to Change the Custom Audio Device Microphone
body: <p>The LyncClient.DeviceManager.AudioDevices does not allow us to independently change the microphone or speaker of a Custom Audio Device (aka Virtual Audio Device).</p>
  
  <p>To Lync, an Audio Device must have both a mic and a speaker. This includes: </p>
  
  <ul>
  <li><p>hardware devices, such as headsets, that have both components built in. </p></li>
  <li><p>Virtual Audio Devices that are amalgams of two pieces of hardware. E.g. A webcam microphone comibined with USB speakers</p></li>
  </ul>
  
  <p>The Lync SDK does allow us to switch among Audio Devices, but it does not allow us to change the microphone nor the speakers of a Virtual Audio Device. </p>
  
  <p>What we need is this: </p>
  
  <pre><code>private void UpdateCustomAudioDevice(object targetMicrophone, object targetSpeakers)
  {
      LyncClient.GetClient().DeviceManager.ActiveAudioDevice.Microphone = targetMicrophone;
      LyncClient.GetClient().DeviceManager.ActiveAudioDevice.Speakers = targetSpeakers;
  }
  </code></pre>
  
  <p>How can we do that? Can we use C#? Can we do it with the WinApi? </p>
  
  <p><a href="http://msdn.microsoft.com/en-us/library/office/microsoft.lync.model.device.devicemanager.audiodevices_di_3_uc_ocs14mreflyncclnt%28v=office.14%29.aspx" rel="nofollow">(1) Audio Devices</a></p>