Trying to understand how to open a Wasapi device if I already know the friendly name or device id
How would I go about setting a Wasapi device based on its Device ID?
For example my device id for a specific audio device is {0.0.1.00000000}.{bddbb7cc-a684-4668-ac06-23c2a059ed03}
In the snippet of code below I’m able to activate the default microphone. Any idea how would I adjust this code to force the device above?
MMDevice defaultMicrophone;
DeviceId = deviceId;
using (var deviceEnumerator = new MMDeviceEnumerator())
{
defaultMicrophone = deviceEnumerator.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Communications);
}
_wasapiCapture = new WasapiCapture();
_wasapiCapture.Device = defaultMicrophone;
Read more here: Source link