public void DrawFilterCurve( Rect r, float[] coeffs, bool lowGain, bool midGain, bool highGain, Color color, bool useLogScale, bool filled, double masterGain, double samplerate, double magScale) { double wm = -2.0f * 3.1415926 / samplerate; ComplexD one = new ComplexD(1.0f, 0.0f); AudioCurveRendering.AudioCurveEvaluator d = delegate(float x) { ComplexD w = ComplexD.Exp(wm * GUIHelpers.MapNormalizedFrequency((double)x, samplerate, useLogScale, true)); ComplexD hl = (!lowGain) ? one : (w * (w * coeffs[0] + coeffs[1]) + coeffs[2]) / (w * (w * coeffs[3] + coeffs[4]) + 1.0f); ComplexD hp = (!midGain) ? one : (w * (w * coeffs[5] + coeffs[6]) + coeffs[7]) / (w * (w * coeffs[8] + coeffs[9]) + 1.0f); ComplexD hh = (!highGain) ? one : (w * (w * coeffs[10] + coeffs[11]) + coeffs[12]) / (w * (w * coeffs[13] + coeffs[14]) + 1.0f); ComplexD h = hh * hp * hl; double mag = masterGain + 10.0 * Math.Log10(h.Mag2()); return((float)(mag * magScale)); }; if (filled) { AudioCurveRendering.DrawFilledCurve(r, d, color); } else { AudioCurveRendering.DrawCurve(r, d, color); } }
private void DrawFilterCurve( Rect r, float[] coeffs, float lowGain, float midGain, float highGain, Color color, bool filled, double samplerate, double magScale) { double wm = -2.0 * 3.1415926 / samplerate; AudioCurveRendering.AudioCurveEvaluator d = delegate(float x) { MathHelpers.ComplexD w = MathHelpers.ComplexD.Exp(wm * GUIHelpers.MapNormalizedFrequency((double)x, samplerate, useLogScale, true)); MathHelpers.ComplexD lpf = MathHelpers.ComplexD.Pow((w * (w * coeffs[0] + coeffs[1]) + coeffs[2]) / (w * (w * coeffs[3] + coeffs[4]) + 1.0f), filterOrder); MathHelpers.ComplexD bpf1 = MathHelpers.ComplexD.Pow((w * (w * coeffs[5] + coeffs[6]) + coeffs[7]) / (w * (w * coeffs[8] + coeffs[9]) + 1.0f), filterOrder); MathHelpers.ComplexD bpf2 = MathHelpers.ComplexD.Pow((w * (w * coeffs[10] + coeffs[11]) + coeffs[12]) / (w * (w * coeffs[13] + coeffs[14]) + 1.0f), filterOrder); MathHelpers.ComplexD hpf = MathHelpers.ComplexD.Pow((w * (w * coeffs[15] + coeffs[16]) + coeffs[17]) / (w * (w * coeffs[18] + coeffs[19]) + 1.0f), filterOrder); double h = (lpf * lowGain).Mag2() + (bpf1 * bpf2 * midGain).Mag2() + (hpf * highGain).Mag2(); double mag = masterGain + 10.0 * Math.Log10(h); return((float)(mag * magScale)); }; if (filled) { AudioCurveRendering.DrawFilledCurve(r, d, color); } else { AudioCurveRendering.DrawCurve(r, d, color); } }
public static void DrawFilledCurve(Rect r, AudioCurveRendering.AudioCurveEvaluator eval, Color curveColor) { AudioCurveRendering.DrawFilledCurve(r, delegate(float x, out Color color) { color = curveColor; return(eval(x)); }); }
public static void DrawFilledCurve(Rect r, AudioCurveRendering.AudioCurveEvaluator eval, Color curveColor) { // ISSUE: object of a compiler-generated type is created // ISSUE: reference to a compiler-generated method AudioCurveRendering.DrawFilledCurve(r, new AudioCurveRendering.AudioCurveAndColorEvaluator(new AudioCurveRendering.\u003CDrawFilledCurve\u003Ec__AnonStorey5B() { curveColor = curveColor, eval = eval }.\u003C\u003Em__9C)); }
public static void DrawCurve(Rect r, AudioCurveRendering.AudioCurveEvaluator eval, Color curveColor) { if (Event.current.type == EventType.Repaint) { HandleUtility.ApplyWireMaterial(); int num = (int)Mathf.Ceil(r.width); float num2 = r.height * 0.5f; float num3 = 1f / (float)(num - 1); Vector3[] pointCache = AudioCurveRendering.GetPointCache(num); for (int i = 0; i < num; i++) { pointCache[i].x = (float)i + r.x; pointCache[i].y = num2 - num2 * eval((float)i * num3) + r.y; pointCache[i].z = 0f; } GUI.BeginClip(r); Handles.color = curveColor; Handles.DrawAAPolyLine(3f, num, pointCache); GUI.EndClip(); } }
public void DrawFilterCurve( Rect r, float[] coeffs, Color color, int numModes, bool useLogScale, bool filled, double samplerate, double magScale) { var wm = (-2.0f * 3.1415926) / samplerate; var zero = new ComplexD(0.0f, 0.0f); var one = new ComplexD(1.0f, 0.0f); AudioCurveRendering.AudioCurveEvaluator d = delegate(float x) { var w = ComplexD.Exp(wm * GUIHelpers.MapNormalizedFrequency(x, samplerate, useLogScale, true)); var h = zero; var num = numModes * 3; for (var n = 0; n < num; n += 3) { h += (coeffs[n] * (one - (w * w))) / ((w * ((w * coeffs[n + 2]) + coeffs[n + 1])) + 1.0); } var mag = 10.0 * Math.Log10(h.Mag2()); return((float)(mag * magScale)); }; if (filled) { AudioCurveRendering.DrawFilledCurve(r, d, color); } else { AudioCurveRendering.DrawCurve(r, d, color); } }