/// <summary> /// Switch the default audio device to the one given /// </summary> /// <param name="deviceId"></param> /// <param name="role"></param> public void SwitchTo(string deviceId, ERole role) { if (role != ERole.ERole_enum_count) { ComThread.Invoke((() => { if (_enumerator.IsDefault(deviceId, EDataFlow.eRender, role) || _enumerator.IsDefault(deviceId, EDataFlow.eCapture, role)) { Trace.WriteLine($"Default endpoint already {deviceId}"); return; } _policyClient.SetDefaultEndpoint(deviceId, role); })); return; } SwitchTo(deviceId, ERole.eConsole); SwitchTo(deviceId, ERole.eMultimedia); SwitchTo(deviceId, ERole.eCommunications); }
public bool IsDefault(string deviceId, EDataFlow flow, ERole role) { return(ComThread.Invoke(() => EnumeratorClient.IsDefault(deviceId, flow, role))); }