public static Dictionary <string, string> FindDefaultDevice(Dictionary <string, string> allDevices)
        {
            Dictionary <string, string> defaultDevices = new Dictionary <string, string>();
            string defaultID = MediaDevice.GetDefaultAudioRenderId(AudioDeviceRole.Default);

            SpatialAudioConfiguration = SpatialAudioDeviceConfiguration.GetForDeviceId(defaultID);
            string defaultSupportedCodec = SpatialAudioConfiguration.DefaultSpatialAudioFormat;
            string defaultName           = "";

            if (allDevices.TryGetValue(defaultID, out defaultName))
            {
                defaultDevices.Add("ID", defaultID);
                defaultDevices.Add("Name", defaultName);

                if (defaultSupportedCodec == WindowsSonic)
                {
                    defaultDevices.Add("Codec", "Supported");
                }
                else if (defaultSupportedCodec == DolbyAtmosForHeadphones)
                {
                    defaultDevices.Add("Codec", "Supported");
                }
                else
                {
                    defaultDevices.Add("Codec", "Supported");
                }
            }
            return(defaultDevices);
        }
        private static string FindSupportedCodec(string IdDevices)
        {
            string supportedCodec = "";

            SpatialAudioConfiguration = SpatialAudioDeviceConfiguration.GetForDeviceId(IdDevices);
            if (SpatialAudioConfiguration.IsSpatialAudioSupported)
            {
                string activeCodec = SpatialAudioConfiguration.ActiveSpatialAudioFormat;
                if (activeCodec == WindowsSonic)
                {
                    supportedCodec = "Windows Sonic for Headphones";
                }
                else if (activeCodec == DolbyAtmosForHeadphones)
                {
                    supportedCodec = "Dolby Atmos for Headphones";
                }
                else
                {
                    supportedCodec = "Supported";
                }
            }
            else
            {
                supportedCodec = "Not supported";
            }
            return(supportedCodec);
        }
Ejemplo n.º 3
0
 private void SetDeviceConfiguration(string deviceId)
 {
     if (deviceConfiguration != null)
     {
         deviceConfiguration.ConfigurationChanged -= DeviceConfiguration_ConfigurationChanged;
     }
     deviceConfiguration = SpatialAudioDeviceConfiguration.GetForDeviceId(deviceId);
     deviceConfiguration.ConfigurationChanged += DeviceConfiguration_ConfigurationChanged;
 }