Ejemplo n.º 1
0
        private static bool ParamEqualizerCurveEditor(IAudioEffectPlugin plugin, Rect r, ref float centerFreq, ref float bandwidth, ref float gain, float blend)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            ParamEqGUI.\u003CParamEqualizerCurveEditor\u003Ec__AnonStorey5E editorCAnonStorey5E = new ParamEqGUI.\u003CParamEqualizerCurveEditor\u003Ec__AnonStorey5E();
            // ISSUE: reference to a compiler-generated field
            editorCAnonStorey5E.plugin = plugin;
            Event current   = Event.current;
            int   controlId = GUIUtility.GetControlID(FocusType.Passive);

            r = AudioCurveRendering.BeginCurveFrame(r);
            float minRange1;
            float maxRange1;
            float defaultValue1;

            // ISSUE: reference to a compiler-generated field
            editorCAnonStorey5E.plugin.GetFloatParameterInfo(ParamEqGUI.kCenterFreqName, out minRange1, out maxRange1, out defaultValue1);
            float minRange2;
            float maxRange2;
            float defaultValue2;

            // ISSUE: reference to a compiler-generated field
            editorCAnonStorey5E.plugin.GetFloatParameterInfo(ParamEqGUI.kOctaveRangeName, out minRange2, out maxRange2, out defaultValue2);
            float minRange3;
            float maxRange3;
            float defaultValue3;

            // ISSUE: reference to a compiler-generated field
            editorCAnonStorey5E.plugin.GetFloatParameterInfo(ParamEqGUI.kFrequencyGainName, out minRange3, out maxRange3, out defaultValue3);
            bool flag = false;

            switch (current.GetTypeForControl(controlId))
            {
            case EventType.MouseDown:
                if (r.Contains(Event.current.mousePosition) && current.button == 0)
                {
                    GUIUtility.hotControl = controlId;
                    EditorGUIUtility.SetWantsMouseJumping(1);
                    current.Use();
                    break;
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlId && current.button == 0)
                {
                    GUIUtility.hotControl = 0;
                    EditorGUIUtility.SetWantsMouseJumping(0);
                    current.Use();
                    break;
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlId)
                {
                    float num = !Event.current.alt ? 1f : 0.25f;
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    centerFreq = Mathf.Clamp((float)ParamEqGUI.MapNormalizedFrequency(ParamEqGUI.MapNormalizedFrequency((double)centerFreq, (double)editorCAnonStorey5E.plugin.GetSampleRate(), true, false) + (double)current.delta.x / (double)r.width, (double)editorCAnonStorey5E.plugin.GetSampleRate(), true, true), minRange1, maxRange1);
                    if (Event.current.shift)
                    {
                        bandwidth = Mathf.Clamp(bandwidth - current.delta.y * 0.02f * num, minRange2, maxRange2);
                    }
                    else
                    {
                        gain = Mathf.Clamp(gain - current.delta.y * 0.01f * num, minRange3, maxRange3);
                    }
                    flag = true;
                    current.Use();
                    break;
                }
                break;
            }
            if (Event.current.type == EventType.Repaint)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                ParamEqGUI.\u003CParamEqualizerCurveEditor\u003Ec__AnonStorey5F editorCAnonStorey5F = new ParamEqGUI.\u003CParamEqualizerCurveEditor\u003Ec__AnonStorey5F();
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.\u003C\u003Ef__ref\u002494 = editorCAnonStorey5E;
                // ISSUE: reference to a compiler-generated field
                EditorGUI.DrawRect(new Rect((float)ParamEqGUI.MapNormalizedFrequency((double)centerFreq, (double)editorCAnonStorey5E.plugin.GetSampleRate(), true, false) * r.width + r.x, r.y, 1f, r.height), GUIUtility.hotControl != controlId ? new Color(0.4f, 0.4f, 0.4f) : new Color(0.6f, 0.6f, 0.6f));
                HandleUtility.ApplyWireMaterial();
                double num1 = 3.1415926;
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.wm = -2.0 * num1 / (double)editorCAnonStorey5E.plugin.GetSampleRate();
                // ISSUE: reference to a compiler-generated field
                double num2 = 2.0 * num1 * (double)centerFreq / (double)editorCAnonStorey5E.plugin.GetSampleRate();
                double num3 = 1.0 / (double)bandwidth;
                double num4 = (double)gain;
                double num5 = Math.Sin(num2) / (2.0 * num3);
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.b0 = 1.0 + num5 * num4;
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.b1 = -2.0 * Math.Cos(num2);
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.b2 = 1.0 - num5 * num4;
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.a0 = 1.0 + num5 / num4;
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.a1 = -2.0 * Math.Cos(num2);
                // ISSUE: reference to a compiler-generated field
                editorCAnonStorey5F.a2 = 1.0 - num5 / num4;
                // ISSUE: reference to a compiler-generated method
                AudioCurveRendering.DrawCurve(r, new AudioCurveRendering.AudioCurveEvaluator(editorCAnonStorey5F.\u003C\u003Em__9F), ParamEqGUI.ScaleAlpha(AudioCurveRendering.kAudioOrange, blend));
            }
            // ISSUE: reference to a compiler-generated field
            ParamEqGUI.DrawFrequencyTickMarks(r, (float)editorCAnonStorey5E.plugin.GetSampleRate(), true, new Color(1f, 1f, 1f, 0.3f * blend));
            AudioCurveRendering.EndCurveFrame();
            return(flag);
        }
Ejemplo n.º 2
0
        private static bool ParamEqualizerCurveEditor(IAudioEffectPlugin plugin, Rect r, ref float centerFreq, ref float bandwidth, ref float gain, float blend)
        {
            Event current   = Event.current;
            int   controlID = GUIUtility.GetControlID(FocusType.Passive);

            r = AudioCurveRendering.BeginCurveFrame(r);
            float min;
            float max;
            float num;

            plugin.GetFloatParameterInfo(ParamEqGUI.kCenterFreqName, out min, out max, out num);
            float min2;
            float max2;
            float num2;

            plugin.GetFloatParameterInfo(ParamEqGUI.kOctaveRangeName, out min2, out max2, out num2);
            float min3;
            float max3;
            float num3;

            plugin.GetFloatParameterInfo(ParamEqGUI.kFrequencyGainName, out min3, out max3, out num3);
            bool result = false;

            switch (current.GetTypeForControl(controlID))
            {
            case EventType.MouseDown:
                if (r.Contains(Event.current.mousePosition) && current.button == 0)
                {
                    GUIUtility.hotControl = controlID;
                    EditorGUIUtility.SetWantsMouseJumping(1);
                    current.Use();
                }
                break;

            case EventType.MouseUp:
                if (GUIUtility.hotControl == controlID && current.button == 0)
                {
                    GUIUtility.hotControl = 0;
                    EditorGUIUtility.SetWantsMouseJumping(0);
                    current.Use();
                }
                break;

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    float num4 = (!Event.current.alt) ? 1f : 0.25f;
                    centerFreq = Mathf.Clamp((float)ParamEqGUI.MapNormalizedFrequency(ParamEqGUI.MapNormalizedFrequency((double)centerFreq, (double)plugin.GetSampleRate(), true, false) + (double)(current.delta.x / r.width), (double)plugin.GetSampleRate(), true, true), min, max);
                    if (Event.current.shift)
                    {
                        bandwidth = Mathf.Clamp(bandwidth - current.delta.y * 0.02f * num4, min2, max2);
                    }
                    else
                    {
                        gain = Mathf.Clamp(gain - current.delta.y * 0.01f * num4, min3, max3);
                    }
                    result = true;
                    current.Use();
                }
                break;
            }
            if (Event.current.type == EventType.Repaint)
            {
                float num5 = (float)ParamEqGUI.MapNormalizedFrequency((double)centerFreq, (double)plugin.GetSampleRate(), true, false);
                EditorGUI.DrawRect(new Rect(num5 * r.width + r.x, r.y, 1f, r.height), (GUIUtility.hotControl != controlID) ? new Color(0.4f, 0.4f, 0.4f) : new Color(0.6f, 0.6f, 0.6f));
                HandleUtility.ApplyWireMaterial();
                double num6  = 3.1415926;
                double wm    = -2.0 * num6 / (double)plugin.GetSampleRate();
                double num7  = 2.0 * num6 * (double)centerFreq / (double)plugin.GetSampleRate();
                double num8  = 1.0 / (double)bandwidth;
                double num9  = (double)gain;
                double num10 = Math.Sin(num7) / (2.0 * num8);
                double b0    = 1.0 + num10 * num9;
                double b1    = -2.0 * Math.Cos(num7);
                double b2    = 1.0 - num10 * num9;
                double a0    = 1.0 + num10 / num9;
                double a1    = -2.0 * Math.Cos(num7);
                double a2    = 1.0 - num10 / num9;
                AudioCurveRendering.DrawCurve(r, delegate(float x)
                {
                    double num11      = ParamEqGUI.MapNormalizedFrequency((double)x, (double)plugin.GetSampleRate(), true, true);
                    ComplexD a        = ComplexD.Exp(wm * num11);
                    ComplexD a2       = a * (a * b2 + b1) + b0;
                    ComplexD b        = a * (a * a2 + a1) + a0;
                    ComplexD complexD = a2 / b;
                    double num12      = Math.Log10(complexD.Mag2());
                    return((float)(0.5 * num12));
                }, ParamEqGUI.ScaleAlpha(AudioCurveRendering.kAudioOrange, blend));
            }
            ParamEqGUI.DrawFrequencyTickMarks(r, (float)plugin.GetSampleRate(), true, new Color(1f, 1f, 1f, 0.3f * blend));
            AudioCurveRendering.EndCurveFrame();
            return(result);
        }