public override CoreAudioDevice GetDefaultDevice(DeviceType deviceType, Role role) { var acquiredLock = _lock.AcquireReadLockNonReEntrant(); try { IMMDevice dev; _innerEnumerator.GetDefaultAudioEndpoint(deviceType.AsEDataFlow(), role.AsERole(), out dev); if (dev == null) { return(null); } string devId; dev.GetId(out devId); if (String.IsNullOrEmpty(devId)) { return(null); } return(_deviceCache.FirstOrDefault(x => x.RealId == devId)); } finally { if (acquiredLock) { _lock.ExitReadLock(); } } }
public string GetDefaultDeviceId(DeviceType deviceType, Role role) { IMultimediaDevice dev; InnerEnumerator.GetDefaultAudioEndpoint(deviceType.AsEDataFlow(), role.AsERole(), out dev); if (dev == null) { return(null); } string devId; dev.GetId(out devId); return(devId); }