I'd like to get full name of all connected microphones. I was googling to find out an answer but there was no answer that satisfies me.
Let me show some examples:
1.
ManagementObjectSearcher mo = new ManagementObjectSearcher("select * from Win32_SoundDevice");
foreach (ManagementObject soundDevice in mo.Get())
{
MessageBox.Show(soundDevice.GetPropertyValue("Caption").ToString());
// or
MessageBox.Show(soundDevice.GetPropertyValue("Description").ToString());
//or
MessageBox.Show(soundDevice.GetPropertyValue("Manufacturer").ToString());
//or
MessageBox.Show(soundDevice.GetPropertyValue("Name").ToString());
//or
MessageBox.Show(soundDevice.GetPropertyValue("ProductName").ToString());
}
All of these getters shows: "Device Audio USB" or "Device compatible with High Definition standard".
2.
WaveInCapabilities[] devices = GetAvailableDevices();
foreach(device in devices)
{
MessageBox.Show(device.ProductName);
}
The same answer: "Device Audio USB" or "Device compatible with High Definition standard".
I want to get the full name. I mean, something like: "Sennheiser microphone USB". Is it even possible? I found: Get the full name of a waveIn device but a link in it is broken and I don't see any dsound.lib for c# (to use DirectSoundCaptureEnumerate). Am I missing anything? Or is there any other option?
@AnkurTripathi answer is correct but it returns a name that contains up to 32 characters. If anyone doesn't want this restriction then the best idea is to use an enumarator:
using NAudio.CoreAudioApi;
MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
var devices = enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active);
foreach (var device in devices)
MessageBox.Show(device.friendlyName);
It works perfect for me.
Try Naudio https://naudio.codeplex.com/
for (int n = 0; n < WaveIn.DeviceCount; n++)
{
this.recordingDevices.Add(WaveIn.GetCapabilities(n).ProductName);
comboBoxAudio.Items.Add(WaveIn.GetCapabilities(n).ProductName);
}
for get Full Name(FriendlyName):
MMDeviceEnumerator enumerator = new MMDeviceEnumerator();
foreach (MMDevice device in enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
{
this.recordingDevices.Add(device.FriendlyName);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With