Пример #1
0
 public void VolumeConversion()
 {
     for (double x = 0d; x < 1000d; x += 0.00123d)
     {
         double result = VolumeUtil.DecibelToLinear(VolumeUtil.LinearToDecibel(x));
         Debug.WriteLine("{0}: L2D={1} -> {2}", x, VolumeUtil.LinearToDecibel(x), result);
         Assert.AreEqual(x, result, 0.000001d);
     }
 }
Пример #2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null || !(value is double))
            {
                return(double.NaN);
            }

            // linear to decibel
            return(VolumeUtil.LinearToDecibel((double)value));
        }