Ejemplo n.º 1
0
        public static void ChangeDefaultApplicationDevice(AudioInterface audioInterface, ObservableProcess process)
        {
            if (audioInterface == null)
            {
                throw new ArgumentNullException(nameof(audioInterface));
            }
            if (process == null)
            {
                throw new ArgumentNullException(nameof(process));
            }

            EarTrumpet.DataModel.WindowsAudio.Internal.AudioPolicyConfig audioPolicyConfig = new EarTrumpet.DataModel.WindowsAudio.Internal.AudioPolicyConfig(audioInterface.DataFlow);
            audioPolicyConfig.SetDefaultEndPoint(audioInterface.ID, process.Id);
            Instance.RemoveOldApplicationDevicePreference(process, audioInterface);
            Instance.AddDeviceApplicationPreference(audioInterface, process);
            Instance.AddApplicationDevicePreference(process, audioInterface);
        }