private double CalculateBellEQGain(EQ.Band band, double x) { double freq = LinExpConvert.Convert(band.Freq, band.Freq.Min, band.Freq.Max); double gain = LinExpConvert.Convert(band.Gain, band.Gain.Min, band.Gain.Max); double q = band.Q;//LinExpConvert.Convert(band.Q, band.Q.Min, band.Q.Max); return(gain * Math.Exp(-((x - freq) * (x - freq)) / (2 * (W_FACTOR / q) * (W_FACTOR / q)))); }
private double CalculateFilterEQGain(EQ.Band band, double x) { double freq = LinExpConvert.Convert(band.Freq, band.Freq.Min, band.Freq.Max); double gain = LinExpConvert.Convert(band.Gain, band.Gain.Min, band.Gain.Max); double q = band.Q;// LinExpConvert.Convert(band.Q, band.Q.Min, band.Q.Max); return(-Math.Exp(-(x - freq) / (1.5 * W_FACTOR))); }
private void Ellipse_MouseMove(object sender, MouseEventArgs e) { if (isMouseDown) { Point newMousePosition = GetMousePos(); // e.GetPosition((Ellipse)sender); This is better double dY = previousMousePosition.Y - newMousePosition.Y; //(previousMousePosition.Y - newMousePosition.Y); if (newMousePosition.Y >= System.Windows.SystemParameters.PrimaryScreenHeight - 1) { int x = (int)newMousePosition.X; int y = 0; SetCursorPos(x, y); previousMousePosition.Y = -1; } else if (newMousePosition.Y <= 1) { int x = (int)newMousePosition.X; int y = (int)System.Windows.SystemParameters.PrimaryScreenHeight; SetCursorPos(x, y); previousMousePosition.Y = System.Windows.SystemParameters.PrimaryScreenHeight + 1; } if (Math.Abs(dY) > mouseMoveThreshold) { double aval = Math.Abs(Value); //Value += Math.Sign(dY) * Step * SettingsManager.Settings.KnobSensistivity; //Conver to linear space before adding the change to create the exponential response double nVal = Value; if (Exponential) { nVal = LinExpConvert.Convert(nVal, Minimum, Maximum); } nVal += Math.Sign(dY) * Step * SettingsManager.Settings.KnobSensistivity; if (Exponential) { nVal = LinExpConvert.ConvertBack(Math.Clamp(nVal, Minimum, Maximum), Minimum, Maximum); } if (double.IsNaN(nVal)) { nVal = 0; } SetCurrentValue(ValueProperty, nVal); previousMousePosition = newMousePosition; } } }
private void Ellipse_MouseWheel(object sender, MouseWheelEventArgs e) { double d = e.Delta / 120; // Mouse wheel 1 click (120 delta) = 1 step d *= 2; //Just make it a bit more sensitive double nVal = Value; if (Exponential) { nVal = LinExpConvert.Convert(nVal, Minimum, Maximum); } nVal += Math.Sign(d) * Step * SettingsManager.Settings.KnobSensistivity; if (Exponential) { nVal = LinExpConvert.ConvertBack(Math.Clamp(nVal, Minimum, Maximum), Minimum, Maximum); } SetCurrentValue(ValueProperty, nVal); }