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); } }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value == null || !(value is double)) { return(double.NaN); } // decibel to linear return(VolumeUtil.DecibelToLinear((double)value)); }