var enumerator = new MMDeviceEnumerator();
var endpoints = enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active)
.ToList();
var soundCard = endpoints.FirstOrDefault(ep => ep.FriendlyName == "Sound Blaster"); // getting an arbitrary device by name - this is an example
var watch = Stopwatch.StartNew();
var conn = soundCard.AudioClient;
var elapsed = watch.ElapsedMilliseconds;
watch.Stop();
I have observed that it may take as few as 5 ms and as many as 4000+ ms to "get" the AudioClient depending on which sound card I am initializing.
I wonder what may be the underlying cause for the delays?
PS I don't have this exact code in my app - there, I'm initializing WasapiOut and it's there where I observed the delays first. This is the place where I was able to pinpoint the source of the delay.
I have the following test code:
I have observed that it may take as few as 5 ms and as many as 4000+ ms to "get" the AudioClient depending on which sound card I am initializing.
I wonder what may be the underlying cause for the delays?
PS I don't have this exact code in my app - there, I'm initializing
WasapiOut
and it's there where I observed the delays first. This is the place where I was able to pinpoint the source of the delay.