Get list of audio devices and select one using c#

后端 未结 2 1303
北恋
北恋 2020-12-17 06:33

Hi I am creating a desktop based application in windows using C#.

I have to show list of all available audio & video devices in 2 different combo boxes. Selectin

相关标签:
2条回答
  • 2020-12-17 06:46
    1. There is no documented mechanism for changing the default audio device.
    2. That's because you're enumerating the physical audio devices, not the audio endpoints.
    3. You want to use the IMMDeviceEnumerator API to enumerate the audio endpoints (speakers, etc).

    Unfortunately there is no managed interop published by Microsoft for the IMMDeviceEnumerator API, you'll need to define your own (there are several definitions available on the internet).

    0 讨论(0)
  • 2020-12-17 06:59

    I am answering too late to this question.. but it may be helpful for others.

    Lync 2013 SDK provides DeviceManager class which list all the audio and video devices in collections

    LyncClient.GetClient().DeviceManager.AudioDevices enumerates all the audio devices on the system

    LyncClient.GetClient().DeviceManager.VideoDevices enumerates all the video devices on the system

    So, one can set the device as:

    LyncClient client = LyncClient.GetClient();
    DeviceManager dm = client.DeviceManager;
    
    dm.ActiveAudioDevice = (AudioDevice)dm.AudioDevices[0]; //or any other found after foreach
    dm.ActiveVideoDevice = (VideoDevice)dm.VideoDevices[0]; //or any other found after foreach
    

    HTH.

    0 讨论(0)
提交回复
热议问题