How to enumerate audio out devices in c#

后端 未结 5 1926
小蘑菇
小蘑菇 2020-11-30 11:56

I would like to know how to get a list of the installed audio out devices (waveOut) on a machine

OS: Windows (XP, Vista, 7) Framework: .Net 3.5 Language: c#

5条回答
  •  借酒劲吻你
    2020-11-30 12:01

    In Windows Vista and above you can use IMMDeviceEnumerator which is wrapped for you by NAudio in order to enumerate audio endpoint devices. For example:

    var enumerator = new MMDeviceEnumerator();
    foreach (var endpoint in 
             enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active))
    {
        Console.WriteLine(endpoint.FriendlyName);
    }
    

提交回复
热议问题