Click here to Skip to main content
15,885,032 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
what is MMDeviceEnumerator,And what is importance of it?
In which name space we can find it?
Posted
Updated 8-May-19 15:00pm
v2

The question was regarding C#.
An example usage of MMDeviceEnumerator can be found in the C# open source project NAudio at http://naudio.codeplex.com/ with the latest source at NAUDIO Source[^].
Once you reference the project with
C#
#using NAudio.CoreAudioAPI

then you can enumerate your audio devices with the following...
C#
var deviceEnum = new MMDeviceEnumerator();
var devices = deviceEnum.EnumerateAudioEndPoints(DataFlow.All, DeviceState.Active).ToList();

The MMDeviceEnumerator is defined as follows:
C#
/// <summary>
/// implements IMMDeviceEnumerator
/// </summary>
[ComImport, Guid("BCDE0395-E52F-467C-8E3D-C4579291692E")]
class MMDeviceEnumeratorComObject
{
}

and if you look up the GUID reference in the registry, it is implemented in the file MMDevAPI.dll
 
Share this answer
 
v2
As above but the API in CoreAudioAPI is not all in capitals

using NAudio.CoreAudioApi;
 
Share this answer
 
Comments
Dave Kreskowiak 8-May-19 21:40pm    
Considering that's not part of the .NET Framework, you're going to have to tell the OP (from 5 years ago) where to get the NAudio library you're talking about.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900