コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 private void SetDeviceConfiguration(string deviceId)
 {
     if (deviceConfiguration != null)
     {
         deviceConfiguration.ConfigurationChanged -= DeviceConfiguration_ConfigurationChanged;
     }
     deviceConfiguration = SpatialAudioDeviceConfiguration.GetForDeviceId(deviceId);
     deviceConfiguration.ConfigurationChanged += DeviceConfiguration_ConfigurationChanged;
 }
コード例 #4
0
 private void DeviceConfiguration_ConfigurationChanged(SpatialAudioDeviceConfiguration sender, object args)
 {
     OnPropertyChanged();
 }