public override bool OnGUI(IAudioEffectPlugin plugin)
        {
            float blend = plugin.IsPluginEditableAndEnabled() ? 1.0f : 0.5f;

            float threshold, ratio, makeupGain, attackTime, releaseTime, knee;

            plugin.GetFloatParameter(kThresholdName, out threshold);
            plugin.GetFloatParameter(kRatioName, out ratio);
            plugin.GetFloatParameter(kMakeupGainName, out makeupGain);
            plugin.GetFloatParameter(kAttackTimeName, out attackTime);
            plugin.GetFloatParameter(kReleaseTimeName, out releaseTime);
            plugin.GetFloatParameter(kKneeName, out knee);

            float[] metering; plugin.GetFloatBuffer("Metering", out metering, 2);

            GUILayout.Space(5f);
            Rect r = GUILayoutUtility.GetRect(200, 160, GUILayout.ExpandWidth(true));

            if (CurveDisplay(plugin, r, ref threshold, ref ratio, ref makeupGain, ref attackTime, ref releaseTime, ref knee, metering[0], metering[1], blend))
            {
                plugin.SetFloatParameter(kThresholdName, threshold);
                plugin.SetFloatParameter(kRatioName, ratio);
                plugin.SetFloatParameter(kMakeupGainName, makeupGain);
                plugin.SetFloatParameter(kAttackTimeName, attackTime);
                plugin.SetFloatParameter(kReleaseTimeName, releaseTime);
                plugin.SetFloatParameter(kKneeName, knee);
            }

            return(true);
        }
Example #2
0
        public override bool OnGUI(IAudioEffectPlugin plugin)
        {
            float blend = (!plugin.IsPluginEditableAndEnabled()) ? 0.5f : 1f;
            float value;

            plugin.GetFloatParameter(ParamEqGUI.kCenterFreqName, out value);
            float value2;

            plugin.GetFloatParameter(ParamEqGUI.kOctaveRangeName, out value2);
            float value3;

            plugin.GetFloatParameter(ParamEqGUI.kFrequencyGainName, out value3);
            GUILayout.Space(5f);
            Rect rect = GUILayoutUtility.GetRect(200f, 100f, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true)
            });

            if (ParamEqGUI.ParamEqualizerCurveEditor(plugin, rect, ref value, ref value2, ref value3, blend))
            {
                plugin.SetFloatParameter(ParamEqGUI.kCenterFreqName, value);
                plugin.SetFloatParameter(ParamEqGUI.kOctaveRangeName, value2);
                plugin.SetFloatParameter(ParamEqGUI.kFrequencyGainName, value3);
            }
            return(true);
        }
Example #3
0
        public override bool OnGUI(IAudioEffectPlugin plugin)
        {
            float blend = !plugin.IsPluginEditableAndEnabled() ? 0.5f : 1f;
            float centerFreq;

            plugin.GetFloatParameter(ParamEqGUI.kCenterFreqName, out centerFreq);
            float bandwidth;

            plugin.GetFloatParameter(ParamEqGUI.kOctaveRangeName, out bandwidth);
            float gain;

            plugin.GetFloatParameter(ParamEqGUI.kFrequencyGainName, out gain);
            GUILayout.Space(5f);
            Rect rect = GUILayoutUtility.GetRect(200f, 100f, new GUILayoutOption[1]
            {
                GUILayout.ExpandWidth(true)
            });

            if (ParamEqGUI.ParamEqualizerCurveEditor(plugin, rect, ref centerFreq, ref bandwidth, ref gain, blend))
            {
                plugin.SetFloatParameter(ParamEqGUI.kCenterFreqName, centerFreq);
                plugin.SetFloatParameter(ParamEqGUI.kOctaveRangeName, bandwidth);
                plugin.SetFloatParameter(ParamEqGUI.kFrequencyGainName, gain);
            }
            return(true);
        }
Example #4
0
 private static bool ParamEqualizerCurveEditor(IAudioEffectPlugin plugin, Rect r, ref float centerFreq, ref float bandwidth, ref float gain, float blend)
 {
     float num2;
     float num3;
     float num4;
     float num5;
     float num6;
     float num7;
     float num8;
     float num9;
     float num10;
    public override bool OnGUI(IAudioEffectPlugin plugin)
    {
		float fval = 0.0f;
		bool  bval = false;

		Separator();
		Label ("Global Scale (Range: 0.00001 - 10000.0f)");
		plugin.GetFloatParameter("GScale", out fval);
		plugin.SetFloatParameter("GScale", EditorGUILayout.FloatField(" ", Mathf.Clamp (fval, 0.00001f, 10000.0f)));

		Separator();

		// Treat these floats as bools in the inspector
		plugin.GetFloatParameter("E.Rflt On", out fval);
		bval = (fval == 0.0f) ? false : true;
		bval = EditorGUILayout.Toggle("Early Refl. On", bval);
		plugin.SetFloatParameter("E.Rflt On", (bval == false) ? 0.0f : 1.0f);

		plugin.GetFloatParameter("E.Rflt Rev On", out fval);
		bval = (fval == 0.0f) ? false : true;
		bval = EditorGUILayout.Toggle("Reverb On", bval);
		plugin.SetFloatParameter("E.Rflt Rev On", (bval == false) ? 0.0f : 1.0f);

		Separator();
		Label("ROOM DIMENSIONS (meters)");
		Label("");
		plugin.GetFloatParameter("Room X", out fval);
		plugin.SetFloatParameter("Room X", EditorGUILayout.Slider("Room Size X", fval, 1.0f, 200.0f));
		plugin.GetFloatParameter("Room Y", out fval);
		plugin.SetFloatParameter("Room Y", EditorGUILayout.Slider("Room Size Y", fval, 1.0f, 200.0f));
		plugin.GetFloatParameter("Room Z", out fval);
		plugin.SetFloatParameter("Room Z", EditorGUILayout.Slider("Room Size Z", fval, 1.0f, 200.0f));

		Separator();
		Label("WALL REFLECTION VALUES (0-0.97)");
		Label("");

		plugin.GetFloatParameter("Left", out fval);
		plugin.SetFloatParameter("Left", EditorGUILayout.Slider("Left", fval, 0.0f, 0.97f));
		plugin.GetFloatParameter("Right", out fval);
		plugin.SetFloatParameter("Right", EditorGUILayout.Slider("Right", fval, 0.0f, 0.97f));
		plugin.GetFloatParameter("Up", out fval);
		plugin.SetFloatParameter("Up", EditorGUILayout.Slider("Up", fval, 0.0f, 0.97f));
		plugin.GetFloatParameter("Down", out fval);
		plugin.SetFloatParameter("Down", EditorGUILayout.Slider("Down", fval, 0.0f, 0.97f));
		plugin.GetFloatParameter("Behind", out fval);
		plugin.SetFloatParameter("Behind", EditorGUILayout.Slider("Behind", fval, 0.0f, 0.97f));
		plugin.GetFloatParameter("Front", out fval);
		plugin.SetFloatParameter("Front", EditorGUILayout.Slider("Front", fval, 0.0f, 0.97f));

		// We will override the controls with our own, so return false
		return false;
    }
 private static bool CurveDisplay(IAudioEffectPlugin plugin, Rect r0, ref float threshold, ref float ratio, ref float makeupGain, ref float attackTime, ref float releaseTime, ref float knee, float sidechainLevel, float outputLevel, float blend)
 {
     float num3;
     float num4;
     float num5;
     float num6;
     float num7;
     float num8;
     float num9;
     float num10;
     float num11;
     float num12;
     float num13;
     float num14;
Example #7
0
        public override bool OnGUI(IAudioEffectPlugin plugin)
        {
            var blend = plugin.IsPluginEditableAndEnabled() ? 1.0f : 0.5f;

            plugin.GetFloatParameter(kCenterFreqName, out var centerFreq);
            plugin.GetFloatParameter(kOctaveRangeName, out var octaveRange);
            plugin.GetFloatParameter(kFrequencyGainName, out var frequencyGain);

            GUILayout.Space(5f);

            var r = GUILayoutUtility.GetRect(200, 100, GUILayout.ExpandWidth(true));

            if (ParamEqualizerCurveEditor(plugin, r, ref centerFreq, ref octaveRange, ref frequencyGain, blend))
            {
                plugin.SetFloatParameter(kCenterFreqName, centerFreq);
                plugin.SetFloatParameter(kOctaveRangeName, octaveRange);
                plugin.SetFloatParameter(kFrequencyGainName, frequencyGain);
            }

            return(true);
        }
Example #8
0
        public override bool OnGUI(IAudioEffectPlugin plugin)
        {
            float blend = !plugin.IsPluginEditableAndEnabled() ? 0.5f : 1f;
            float threshold;

            plugin.GetFloatParameter(DuckVolumeGUI.kThresholdName, out threshold);
            float ratio;

            plugin.GetFloatParameter(DuckVolumeGUI.kRatioName, out ratio);
            float makeupGain;

            plugin.GetFloatParameter(DuckVolumeGUI.kMakeupGainName, out makeupGain);
            float attackTime;

            plugin.GetFloatParameter(DuckVolumeGUI.kAttackTimeName, out attackTime);
            float releaseTime;

            plugin.GetFloatParameter(DuckVolumeGUI.kReleaseTimeName, out releaseTime);
            float knee;

            plugin.GetFloatParameter(DuckVolumeGUI.kKneeName, out knee);
            float[] data;
            plugin.GetFloatBuffer("Metering", out data, 2);
            GUILayout.Space(5f);
            Rect rect = GUILayoutUtility.GetRect(200f, 160f, new GUILayoutOption[1]
            {
                GUILayout.ExpandWidth(true)
            });

            if (DuckVolumeGUI.CurveDisplay(plugin, rect, ref threshold, ref ratio, ref makeupGain, ref attackTime, ref releaseTime, ref knee, data[0], data[1], blend))
            {
                plugin.SetFloatParameter(DuckVolumeGUI.kThresholdName, threshold);
                plugin.SetFloatParameter(DuckVolumeGUI.kRatioName, ratio);
                plugin.SetFloatParameter(DuckVolumeGUI.kMakeupGainName, makeupGain);
                plugin.SetFloatParameter(DuckVolumeGUI.kAttackTimeName, attackTime);
                plugin.SetFloatParameter(DuckVolumeGUI.kReleaseTimeName, releaseTime);
                plugin.SetFloatParameter(DuckVolumeGUI.kKneeName, knee);
            }
            return(true);
        }
Example #9
0
        public override bool OnGUI(IAudioEffectPlugin plugin)
        {
            float blend = (!plugin.IsPluginEditableAndEnabled()) ? 0.5f : 1f;
            float value;

            plugin.GetFloatParameter(DuckVolumeGUI.kThresholdName, out value);
            float value2;

            plugin.GetFloatParameter(DuckVolumeGUI.kRatioName, out value2);
            float value3;

            plugin.GetFloatParameter(DuckVolumeGUI.kMakeupGainName, out value3);
            float value4;

            plugin.GetFloatParameter(DuckVolumeGUI.kAttackTimeName, out value4);
            float value5;

            plugin.GetFloatParameter(DuckVolumeGUI.kReleaseTimeName, out value5);
            float value6;

            plugin.GetFloatParameter(DuckVolumeGUI.kKneeName, out value6);
            float[] array;
            plugin.GetFloatBuffer("Metering", out array, 2);
            GUILayout.Space(5f);
            Rect rect = GUILayoutUtility.GetRect(200f, 160f, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(true)
            });

            if (DuckVolumeGUI.CurveDisplay(plugin, rect, ref value, ref value2, ref value3, ref value4, ref value5, ref value6, array[0], array[1], blend))
            {
                plugin.SetFloatParameter(DuckVolumeGUI.kThresholdName, value);
                plugin.SetFloatParameter(DuckVolumeGUI.kRatioName, value2);
                plugin.SetFloatParameter(DuckVolumeGUI.kMakeupGainName, value3);
                plugin.SetFloatParameter(DuckVolumeGUI.kAttackTimeName, value4);
                plugin.SetFloatParameter(DuckVolumeGUI.kReleaseTimeName, value5);
                plugin.SetFloatParameter(DuckVolumeGUI.kKneeName, value6);
            }
            return(true);
        }
Example #10
0
        public override bool OnGUI(IAudioEffectPlugin plugin)
        {
            float num2;
            float num3;
            float num4;
            float blend = !plugin.IsPluginEditableAndEnabled() ? 0.5f : 1f;

            plugin.GetFloatParameter(kCenterFreqName, out num2);
            plugin.GetFloatParameter(kOctaveRangeName, out num3);
            plugin.GetFloatParameter(kFrequencyGainName, out num4);
            GUILayout.Space(5f);
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(true) };
            Rect r = GUILayoutUtility.GetRect((float)200f, (float)100f, options);

            if (ParamEqualizerCurveEditor(plugin, r, ref num2, ref num3, ref num4, blend))
            {
                plugin.SetFloatParameter(kCenterFreqName, num2);
                plugin.SetFloatParameter(kOctaveRangeName, num3);
                plugin.SetFloatParameter(kFrequencyGainName, num4);
            }
            return(true);
        }
Example #11
0
        private static bool CurveDisplay(IAudioEffectPlugin plugin, Rect r0, ref float threshold, ref float ratio, ref float makeupGain, ref float attackTime, ref float releaseTime, ref float knee, float sidechainLevel, float outputLevel, float blend)
        {
            Event current   = Event.current;
            int   controlID = GUIUtility.GetControlID(FocusType.Passive);
            Rect  r         = AudioCurveRendering.BeginCurveFrame(r0);
            float num       = 10f;
            float min;
            float max;
            float num2;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kThresholdName, out min, out max, out num2);
            float min2;
            float max2;
            float num3;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kRatioName, out min2, out max2, out num3);
            float min3;
            float max3;
            float num4;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kMakeupGainName, out min3, out max3, out num4);
            float min4;
            float max4;
            float num5;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kKneeName, out min4, out max4, out num5);
            float dbRange = 100f;
            float dbMin   = -80f;
            float num6    = r.width * (threshold - dbMin) / dbRange;
            bool  result  = false;

            switch (current.GetTypeForControl(controlID))
            {
            case EventType.MouseDown:
                if (r.Contains(Event.current.mousePosition) && current.button == 0)
                {
                    DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.None;
                    GUIUtility.hotControl  = controlID;
                    EditorGUIUtility.SetWantsMouseJumping(1);
                    current.Use();
                    if (Mathf.Abs(r.x + num6 - current.mousePosition.x) >= 10f)
                    {
                        DuckVolumeGUI.dragtype = ((current.mousePosition.x >= r.x + num6) ? DuckVolumeGUI.DragType.Ratio : DuckVolumeGUI.DragType.MakeupGain);
                    }
                    else
                    {
                        DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.ThresholdAndKnee;
                    }
                }
                break;

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

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    float num7 = (!current.alt) ? 1f : 0.25f;
                    if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
                    {
                        bool flag = Mathf.Abs(current.delta.x) < Mathf.Abs(current.delta.y);
                        if (flag)
                        {
                            knee = Mathf.Clamp(knee + current.delta.y * 0.5f * num7, min4, max4);
                        }
                        else
                        {
                            threshold = Mathf.Clamp(threshold + current.delta.x * 0.1f * num7, min, max);
                        }
                    }
                    else
                    {
                        if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
                        {
                            ratio = Mathf.Clamp(ratio + current.delta.y * ((ratio <= 1f) ? 0.003f : 0.05f) * num7, min2, max2);
                        }
                        else
                        {
                            if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
                            {
                                makeupGain = Mathf.Clamp(makeupGain - current.delta.y * 0.5f * num7, min3, max3);
                            }
                            else
                            {
                                Debug.LogError("Drag: Unhandled enum");
                            }
                        }
                    }
                    result = true;
                    current.Use();
                }
                break;
            }
            if (current.type == EventType.Repaint)
            {
                HandleUtility.ApplyWireMaterial();
                float num8               = r.height * (1f - (threshold - dbMin + makeupGain) / dbRange);
                Color col2               = new Color(0.7f, 0.7f, 0.7f);
                Color black              = Color.black;
                float duckGradient       = 1f / ratio;
                float duckThreshold      = threshold;
                float duckSidechainLevel = sidechainLevel;
                float duckMakeupGain     = makeupGain;
                float duckKnee           = knee;
                float duckKneeC1         = (knee <= 0f) ? 0f : ((duckGradient - 1f) / (4f * knee));
                float duckKneeC2         = duckThreshold - knee;
                AudioCurveRendering.DrawFilledCurve(r, delegate(float x, out Color col)
                {
                    float num16 = x * dbRange + dbMin;
                    float num17 = num16;
                    float num18 = num16 - duckThreshold;
                    col         = DuckVolumeGUI.ScaleAlpha((duckSidechainLevel <= num16) ? Color.grey : AudioCurveRendering.kAudioOrange, blend);
                    if (num18 > -duckKnee && num18 < duckKnee)
                    {
                        num18 += duckKnee;
                        num17  = num18 * (duckKneeC1 * num18 + 1f) + duckKneeC2;
                        if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
                        {
                            col = new Color(col.r * 1.2f, col.g * 1.2f, col.b * 1.2f);
                        }
                    }
                    else
                    {
                        if (num18 > 0f)
                        {
                            num17 = duckThreshold + duckGradient * num18;
                        }
                    }
                    return(2f * (num17 + duckMakeupGain - dbMin) / dbRange - 1f);
                });
                if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
                {
                    AudioCurveRendering.DrawCurve(r, delegate(float x)
                    {
                        float num16 = x * dbRange + dbMin;
                        float num17 = num16;
                        float num18 = num16 - duckThreshold;
                        if (num18 > -duckKnee && num18 < duckKnee)
                        {
                            num18 += duckKnee;
                            num17  = num18 * (duckKneeC1 * num18 + 1f) + duckKneeC2;
                        }
                        else
                        {
                            if (num18 > 0f)
                            {
                                num17 = duckThreshold + duckGradient * num18;
                            }
                        }
                        return(2f * (num17 + duckMakeupGain - dbMin) / dbRange - 1f);
                    }, Color.white);
                }
                DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(col2, blend);
                EditorGUI.DrawRect(new Rect(r.x + num6, r.y, 1f, r.height), DuckVolumeGUI.textStyle10.normal.textColor);
                DuckVolumeGUI.DrawText(r.x + num6 + 4f, r.y + 6f, string.Format("Threshold: {0:F1} dB", threshold));
                DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(black, blend);
                DuckVolumeGUI.DrawText(r.x + 4f, r.y + r.height - 10f, (sidechainLevel >= -80f) ? string.Format("Input: {0:F1} dB", sidechainLevel) : "Input: None");
                if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
                {
                    float num9 = r.height / r.width;
                    Handles.DrawAAPolyLine(2f, new Color[]
                    {
                        Color.black,
                        Color.black
                    }, new Vector3[]
                    {
                        new Vector3(r.x + num6 + r.width, r.y + num8 - num9 * r.width, 0f),
                        new Vector3(r.x + num6 - r.width, r.y + num8 + num9 * r.width, 0f)
                    });
                    Handles.DrawAAPolyLine(3f, new Color[]
                    {
                        Color.white,
                        Color.white
                    }, new Vector3[]
                    {
                        new Vector3(r.x + num6 + r.width, r.y + num8 - num9 * duckGradient * r.width, 0f),
                        new Vector3(r.x + num6 - r.width, r.y + num8 + num9 * duckGradient * r.width, 0f)
                    });
                }
                else
                {
                    if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
                    {
                        float num10 = (threshold - knee - dbMin) / dbRange;
                        float num11 = (threshold + knee - dbMin) / dbRange;
                        float num12 = DuckVolumeGUI.EvaluateDuckingVolume(num10, ratio, threshold, makeupGain, knee, dbRange, dbMin);
                        float num13 = DuckVolumeGUI.EvaluateDuckingVolume(num11, ratio, threshold, makeupGain, knee, dbRange, dbMin);
                        float num14 = r.yMax - (num12 + 1f) * 0.5f * r.height;
                        float num15 = r.yMax - (num13 + 1f) * 0.5f * r.height;
                        EditorGUI.DrawRect(new Rect(r.x + num10 * r.width, num14, 1f, r.height - num14), new Color(0f, 0f, 0f, 0.5f));
                        EditorGUI.DrawRect(new Rect(r.x + num11 * r.width - 1f, num15, 1f, r.height - num15), new Color(0f, 0f, 0f, 0.5f));
                        EditorGUI.DrawRect(new Rect(r.x + num6 - 1f, r.y, 3f, r.height), Color.white);
                    }
                }
                outputLevel = (Mathf.Clamp(outputLevel - makeupGain, dbMin, dbMin + dbRange) - dbMin) / dbRange;
                if (EditorApplication.isPlaying)
                {
                    Rect r2 = new Rect(r.x + r.width - num + 2f, r.y + 2f, num - 4f, r.height - 4f);
                    DuckVolumeGUI.DrawVU(r2, outputLevel, blend, true);
                }
            }
            AudioCurveRendering.EndCurveFrame();
            return(result);
        }
		public abstract bool OnGUI(IAudioEffectPlugin plugin);
Example #13
0
        static bool ParamEqualizerCurveEditor(IAudioEffectPlugin plugin, Rect r, ref float centerFreq, ref float bandwidth, ref float gain, float blend)
        {
            Event evt       = Event.current;
            int   controlID = GUIUtility.GetControlID(FocusType.Passive);

            r = AudioCurveRendering.BeginCurveFrame(r);

            float minCenterFreq, maxCenterFreq, defCenterFreq; plugin.GetFloatParameterInfo(kCenterFreqName, out minCenterFreq, out maxCenterFreq, out defCenterFreq);
            float minOctaveRange, maxOctaveRange, defOctaveRange; plugin.GetFloatParameterInfo(kOctaveRangeName, out minOctaveRange, out maxOctaveRange, out defOctaveRange);
            float minGain, maxGain, defGain; plugin.GetFloatParameterInfo(kFrequencyGainName, out minGain, out maxGain, out defGain);

            bool modifiedValue = false;

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

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

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    float dragAcceleration = Event.current.alt ? .25f : 1f;
                    centerFreq = Mathf.Clamp((float)MapNormalizedFrequency(MapNormalizedFrequency(centerFreq, plugin.GetSampleRate(), useLogScale, false) + evt.delta.x / r.width, plugin.GetSampleRate(), useLogScale, true), minCenterFreq, maxCenterFreq);
                    if (Event.current.shift)
                    {
                        bandwidth = Mathf.Clamp(bandwidth - evt.delta.y * 0.02f * dragAcceleration, minOctaveRange, maxOctaveRange);
                    }
                    else
                    {
                        gain = Mathf.Clamp(gain - evt.delta.y * 0.01f * dragAcceleration, minGain, maxGain);
                    }
                    modifiedValue = true;
                    evt.Use();
                }
                break;
            }

            if (Event.current.type == EventType.Repaint)
            {
                // Mark CenterFreq with a vertical line
                float c = (float)MapNormalizedFrequency(centerFreq, plugin.GetSampleRate(), useLogScale, false);
                EditorGUI.DrawRect(new Rect(c * r.width + r.x, r.y, 1f, r.height), GUIUtility.hotControl == controlID ? new Color(0.6f, 0.6f, 0.6f) : new Color(0.4f, 0.4f, 0.4f));

                // Curve
                HandleUtility.ApplyWireMaterial();
                double kPI   = 3.1415926;
                double wm    = -2.0f * kPI / plugin.GetSampleRate();
                double w0    = 2.0 * kPI * centerFreq / plugin.GetSampleRate();
                double Q     = 1.0 / bandwidth;
                double A     = gain;
                double alpha = Math.Sin(w0) / (2.0 * Q);
                double b0    = 1.0 + alpha * A;
                double b1    = -2.0 * Math.Cos(w0);
                double b2    = 1.0 - alpha * A;
                double a0    = 1.0 + alpha / A;
                double a1    = -2.0 * Math.Cos(w0);
                double a2    = 1.0 - alpha / A;
                AudioCurveRendering.DrawCurve(
                    r,
                    delegate(float x)
                {
                    double f   = MapNormalizedFrequency((double)x, plugin.GetSampleRate(), useLogScale, true);
                    ComplexD w = ComplexD.Exp(wm * f);
                    ComplexD n = w * (w * b2 + b1) + b0;
                    ComplexD d = w * (w * a2 + a1) + a0;
                    ComplexD h = n / d;
                    double mag = Math.Log10(h.Mag2());
                    return((float)(0.5 * mag));    // 20 dB range
                },
                    ScaleAlpha(AudioCurveRendering.kAudioOrange, blend)
                    );
            }

            DrawFrequencyTickMarks(r, plugin.GetSampleRate(), useLogScale, new Color(1.0f, 1.0f, 1.0f, 0.3f * blend));

            AudioCurveRendering.EndCurveFrame();

            return(modifiedValue);
        }
 public abstract bool OnGUI(IAudioEffectPlugin plugin);
Example #15
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;
		}
Example #16
0
		public override bool OnGUI(IAudioEffectPlugin plugin)
		{
			float blend = (!plugin.IsPluginEditableAndEnabled()) ? 0.5f : 1f;
			float value;
			plugin.GetFloatParameter(ParamEqGUI.kCenterFreqName, out value);
			float value2;
			plugin.GetFloatParameter(ParamEqGUI.kOctaveRangeName, out value2);
			float value3;
			plugin.GetFloatParameter(ParamEqGUI.kFrequencyGainName, out value3);
			GUILayout.Space(5f);
			Rect rect = GUILayoutUtility.GetRect(200f, 100f, new GUILayoutOption[]
			{
				GUILayout.ExpandWidth(true)
			});
			if (ParamEqGUI.ParamEqualizerCurveEditor(plugin, rect, ref value, ref value2, ref value3, blend))
			{
				plugin.SetFloatParameter(ParamEqGUI.kCenterFreqName, value);
				plugin.SetFloatParameter(ParamEqGUI.kOctaveRangeName, value2);
				plugin.SetFloatParameter(ParamEqGUI.kFrequencyGainName, value3);
			}
			return true;
		}
 public override bool OnGUI(IAudioEffectPlugin plugin)
 {
   float blend = !plugin.IsPluginEditableAndEnabled() ? 0.5f : 1f;
   float threshold;
   plugin.GetFloatParameter(DuckVolumeGUI.kThresholdName, out threshold);
   float ratio;
   plugin.GetFloatParameter(DuckVolumeGUI.kRatioName, out ratio);
   float makeupGain;
   plugin.GetFloatParameter(DuckVolumeGUI.kMakeupGainName, out makeupGain);
   float attackTime;
   plugin.GetFloatParameter(DuckVolumeGUI.kAttackTimeName, out attackTime);
   float releaseTime;
   plugin.GetFloatParameter(DuckVolumeGUI.kReleaseTimeName, out releaseTime);
   float knee;
   plugin.GetFloatParameter(DuckVolumeGUI.kKneeName, out knee);
   float[] data;
   plugin.GetFloatBuffer("Metering", out data, 2);
   GUILayout.Space(5f);
   Rect rect = GUILayoutUtility.GetRect(200f, 160f, new GUILayoutOption[1]
   {
     GUILayout.ExpandWidth(true)
   });
   if (DuckVolumeGUI.CurveDisplay(plugin, rect, ref threshold, ref ratio, ref makeupGain, ref attackTime, ref releaseTime, ref knee, data[0], data[1], blend))
   {
     plugin.SetFloatParameter(DuckVolumeGUI.kThresholdName, threshold);
     plugin.SetFloatParameter(DuckVolumeGUI.kRatioName, ratio);
     plugin.SetFloatParameter(DuckVolumeGUI.kMakeupGainName, makeupGain);
     plugin.SetFloatParameter(DuckVolumeGUI.kAttackTimeName, attackTime);
     plugin.SetFloatParameter(DuckVolumeGUI.kReleaseTimeName, releaseTime);
     plugin.SetFloatParameter(DuckVolumeGUI.kKneeName, knee);
   }
   return true;
 }
 public override bool OnGUI(IAudioEffectPlugin plugin)
 {
   float blend = !plugin.IsPluginEditableAndEnabled() ? 0.5f : 1f;
   float centerFreq;
   plugin.GetFloatParameter(ParamEqGUI.kCenterFreqName, out centerFreq);
   float bandwidth;
   plugin.GetFloatParameter(ParamEqGUI.kOctaveRangeName, out bandwidth);
   float gain;
   plugin.GetFloatParameter(ParamEqGUI.kFrequencyGainName, out gain);
   GUILayout.Space(5f);
   Rect rect = GUILayoutUtility.GetRect(200f, 100f, new GUILayoutOption[1]
   {
     GUILayout.ExpandWidth(true)
   });
   if (ParamEqGUI.ParamEqualizerCurveEditor(plugin, rect, ref centerFreq, ref bandwidth, ref gain, blend))
   {
     plugin.SetFloatParameter(ParamEqGUI.kCenterFreqName, centerFreq);
     plugin.SetFloatParameter(ParamEqGUI.kOctaveRangeName, bandwidth);
     plugin.SetFloatParameter(ParamEqGUI.kFrequencyGainName, gain);
   }
   return true;
 }
 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;
 }
		private static bool CurveDisplay(IAudioEffectPlugin plugin, Rect r0, ref float threshold, ref float ratio, ref float makeupGain, ref float attackTime, ref float releaseTime, ref float knee, float sidechainLevel, float outputLevel, float blend)
		{
			Event current = Event.current;
			int controlID = GUIUtility.GetControlID(FocusType.Passive);
			Rect r = AudioCurveRendering.BeginCurveFrame(r0);
			float num = 10f;
			float min;
			float max;
			float num2;
			plugin.GetFloatParameterInfo(DuckVolumeGUI.kThresholdName, out min, out max, out num2);
			float min2;
			float max2;
			float num3;
			plugin.GetFloatParameterInfo(DuckVolumeGUI.kRatioName, out min2, out max2, out num3);
			float min3;
			float max3;
			float num4;
			plugin.GetFloatParameterInfo(DuckVolumeGUI.kMakeupGainName, out min3, out max3, out num4);
			float min4;
			float max4;
			float num5;
			plugin.GetFloatParameterInfo(DuckVolumeGUI.kKneeName, out min4, out max4, out num5);
			float dbRange = 100f;
			float dbMin = -80f;
			float num6 = r.width * (threshold - dbMin) / dbRange;
			bool result = false;
			switch (current.GetTypeForControl(controlID))
			{
			case EventType.MouseDown:
				if (r.Contains(Event.current.mousePosition) && current.button == 0)
				{
					DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.None;
					GUIUtility.hotControl = controlID;
					EditorGUIUtility.SetWantsMouseJumping(1);
					current.Use();
					if (Mathf.Abs(r.x + num6 - current.mousePosition.x) >= 10f)
					{
						DuckVolumeGUI.dragtype = ((current.mousePosition.x >= r.x + num6) ? DuckVolumeGUI.DragType.Ratio : DuckVolumeGUI.DragType.MakeupGain);
					}
					else
					{
						DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.ThresholdAndKnee;
					}
				}
				break;
			case EventType.MouseUp:
				if (GUIUtility.hotControl == controlID && current.button == 0)
				{
					DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.None;
					GUIUtility.hotControl = 0;
					EditorGUIUtility.SetWantsMouseJumping(0);
					current.Use();
				}
				break;
			case EventType.MouseDrag:
				if (GUIUtility.hotControl == controlID)
				{
					float num7 = (!current.alt) ? 1f : 0.25f;
					if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
					{
						bool flag = Mathf.Abs(current.delta.x) < Mathf.Abs(current.delta.y);
						if (flag)
						{
							knee = Mathf.Clamp(knee + current.delta.y * 0.5f * num7, min4, max4);
						}
						else
						{
							threshold = Mathf.Clamp(threshold + current.delta.x * 0.1f * num7, min, max);
						}
					}
					else
					{
						if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
						{
							ratio = Mathf.Clamp(ratio + current.delta.y * ((ratio <= 1f) ? 0.003f : 0.05f) * num7, min2, max2);
						}
						else
						{
							if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
							{
								makeupGain = Mathf.Clamp(makeupGain - current.delta.y * 0.5f * num7, min3, max3);
							}
							else
							{
								Debug.LogError("Drag: Unhandled enum");
							}
						}
					}
					result = true;
					current.Use();
				}
				break;
			}
			if (current.type == EventType.Repaint)
			{
				HandleUtility.ApplyWireMaterial();
				float num8 = r.height * (1f - (threshold - dbMin + makeupGain) / dbRange);
				Color col2 = new Color(0.7f, 0.7f, 0.7f);
				Color black = Color.black;
				float duckGradient = 1f / ratio;
				float duckThreshold = threshold;
				float duckSidechainLevel = sidechainLevel;
				float duckMakeupGain = makeupGain;
				float duckKnee = knee;
				float duckKneeC1 = (knee <= 0f) ? 0f : ((duckGradient - 1f) / (4f * knee));
				float duckKneeC2 = duckThreshold - knee;
				AudioCurveRendering.DrawFilledCurve(r, delegate(float x, out Color col)
				{
					float num16 = x * dbRange + dbMin;
					float num17 = num16;
					float num18 = num16 - duckThreshold;
					col = DuckVolumeGUI.ScaleAlpha((duckSidechainLevel <= num16) ? Color.grey : AudioCurveRendering.kAudioOrange, blend);
					if (num18 > -duckKnee && num18 < duckKnee)
					{
						num18 += duckKnee;
						num17 = num18 * (duckKneeC1 * num18 + 1f) + duckKneeC2;
						if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
						{
							col = new Color(col.r * 1.2f, col.g * 1.2f, col.b * 1.2f);
						}
					}
					else
					{
						if (num18 > 0f)
						{
							num17 = duckThreshold + duckGradient * num18;
						}
					}
					return 2f * (num17 + duckMakeupGain - dbMin) / dbRange - 1f;
				});
				if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
				{
					AudioCurveRendering.DrawCurve(r, delegate(float x)
					{
						float num16 = x * dbRange + dbMin;
						float num17 = num16;
						float num18 = num16 - duckThreshold;
						if (num18 > -duckKnee && num18 < duckKnee)
						{
							num18 += duckKnee;
							num17 = num18 * (duckKneeC1 * num18 + 1f) + duckKneeC2;
						}
						else
						{
							if (num18 > 0f)
							{
								num17 = duckThreshold + duckGradient * num18;
							}
						}
						return 2f * (num17 + duckMakeupGain - dbMin) / dbRange - 1f;
					}, Color.white);
				}
				DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(col2, blend);
				EditorGUI.DrawRect(new Rect(r.x + num6, r.y, 1f, r.height), DuckVolumeGUI.textStyle10.normal.textColor);
				DuckVolumeGUI.DrawText(r.x + num6 + 4f, r.y + 6f, string.Format("Threshold: {0:F1} dB", threshold));
				DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(black, blend);
				DuckVolumeGUI.DrawText(r.x + 4f, r.y + r.height - 10f, (sidechainLevel >= -80f) ? string.Format("Input: {0:F1} dB", sidechainLevel) : "Input: None");
				if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
				{
					float num9 = r.height / r.width;
					Handles.DrawAAPolyLine(2f, new Color[]
					{
						Color.black,
						Color.black
					}, new Vector3[]
					{
						new Vector3(r.x + num6 + r.width, r.y + num8 - num9 * r.width, 0f),
						new Vector3(r.x + num6 - r.width, r.y + num8 + num9 * r.width, 0f)
					});
					Handles.DrawAAPolyLine(3f, new Color[]
					{
						Color.white,
						Color.white
					}, new Vector3[]
					{
						new Vector3(r.x + num6 + r.width, r.y + num8 - num9 * duckGradient * r.width, 0f),
						new Vector3(r.x + num6 - r.width, r.y + num8 + num9 * duckGradient * r.width, 0f)
					});
				}
				else
				{
					if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
					{
						float num10 = (threshold - knee - dbMin) / dbRange;
						float num11 = (threshold + knee - dbMin) / dbRange;
						float num12 = DuckVolumeGUI.EvaluateDuckingVolume(num10, ratio, threshold, makeupGain, knee, dbRange, dbMin);
						float num13 = DuckVolumeGUI.EvaluateDuckingVolume(num11, ratio, threshold, makeupGain, knee, dbRange, dbMin);
						float num14 = r.yMax - (num12 + 1f) * 0.5f * r.height;
						float num15 = r.yMax - (num13 + 1f) * 0.5f * r.height;
						EditorGUI.DrawRect(new Rect(r.x + num10 * r.width, num14, 1f, r.height - num14), new Color(0f, 0f, 0f, 0.5f));
						EditorGUI.DrawRect(new Rect(r.x + num11 * r.width - 1f, num15, 1f, r.height - num15), new Color(0f, 0f, 0f, 0.5f));
						EditorGUI.DrawRect(new Rect(r.x + num6 - 1f, r.y, 3f, r.height), Color.white);
					}
				}
				outputLevel = (Mathf.Clamp(outputLevel - makeupGain, dbMin, dbMin + dbRange) - dbMin) / dbRange;
				if (EditorApplication.isPlaying)
				{
					Rect r2 = new Rect(r.x + r.width - num + 2f, r.y + 2f, num - 4f, r.height - 4f);
					DuckVolumeGUI.DrawVU(r2, outputLevel, blend, true);
				}
			}
			AudioCurveRendering.EndCurveFrame();
			return result;
		}
Example #21
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);
        }
    public override bool OnGUI(IAudioEffectPlugin plugin)
    {
        float fval = 0.0f;
        bool  bval = false;

        Separator();
        Label ("GLOBAL SCALE (0.00001 - 10000.0)");
        plugin.GetFloatParameter("GScale", out fval);
        plugin.SetFloatParameter("GScale", EditorGUILayout.FloatField(" ", Mathf.Clamp (fval, 0.00001f, 10000.0f)));

        Separator();

        // Treat these floats as bools in the inspector
        plugin.GetFloatParameter("E.Rflt On", out fval);
        bval = (fval == 0.0f) ? false : true;
        bval = EditorGUILayout.Toggle("Reflections Engine On", bval);
        plugin.SetFloatParameter("E.Rflt On", (bval == false) ? 0.0f : 1.0f);

        plugin.GetFloatParameter("E.Rflt Rev On", out fval);
        bval = (fval == 0.0f) ? false : true;
        bval = EditorGUILayout.Toggle("Late Reverberation", bval);
        plugin.SetFloatParameter("E.Rflt Rev On", (bval == false) ? 0.0f : 1.0f);

        Separator();
        Label("ROOM DIMENSIONS (meters)");
        Label("");
        plugin.GetFloatParameter("Room X", out fval);
        plugin.SetFloatParameter("Room X", EditorGUILayout.Slider("Width", fval, 1.0f, 200.0f));
        plugin.GetFloatParameter("Room Y", out fval);
        plugin.SetFloatParameter("Room Y", EditorGUILayout.Slider("Height", fval, 1.0f, 200.0f));
        plugin.GetFloatParameter("Room Z", out fval);
        plugin.SetFloatParameter("Room Z", EditorGUILayout.Slider("Length", fval, 1.0f, 200.0f));

        Separator();
        Label("WALL REFLECTION COEFFICIENTS (0.0 - 0.97)");
        Label("");

        plugin.GetFloatParameter("Left", out fval);
        plugin.SetFloatParameter("Left", EditorGUILayout.Slider("Left", fval, 0.0f, 0.97f));
        plugin.GetFloatParameter("Right", out fval);
        plugin.SetFloatParameter("Right", EditorGUILayout.Slider("Right", fval, 0.0f, 0.97f));
        plugin.GetFloatParameter("Up", out fval);
        plugin.SetFloatParameter("Up", EditorGUILayout.Slider("Up", fval, 0.0f, 0.97f));
        plugin.GetFloatParameter("Down", out fval);
        plugin.SetFloatParameter("Down", EditorGUILayout.Slider("Down", fval, 0.0f, 0.97f));
        plugin.GetFloatParameter("Behind", out fval);
        plugin.SetFloatParameter("Behind", EditorGUILayout.Slider("Back", fval, 0.0f, 0.97f));
        plugin.GetFloatParameter("Front", out fval);
        plugin.SetFloatParameter("Front", EditorGUILayout.Slider("Front", fval, 0.0f, 0.97f));

        Separator();
        Label("SHARED REVERB ATTENUATION RANGE (1.0 - 10000.0 meters)");
        Label("");
        plugin.GetFloatParameter("Shared Rev Min", out fval);
        plugin.SetFloatParameter("Shared Rev Min", EditorGUILayout.Slider("Minimum", fval, 1.0f, 10000.0f));
        plugin.GetFloatParameter("Shared Rev Max", out fval);
        plugin.SetFloatParameter("Shared Rev Max", EditorGUILayout.Slider("Maximum", fval, 1.0f, 10000.0f));

        // We will override the controls with our own, so return false
        return false;
    }
Example #23
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);
        }
Example #24
0
        private static bool CurveDisplay(IAudioEffectPlugin plugin, Rect r0, ref float threshold, ref float ratio, ref float makeupGain, ref float attackTime, ref float releaseTime, ref float knee, float sidechainLevel, float outputLevel, float blend)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5C displayCAnonStorey5C = new DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5C();
            // ISSUE: reference to a compiler-generated field
            displayCAnonStorey5C.blend = blend;
            Event current   = Event.current;
            int   controlId = GUIUtility.GetControlID(FocusType.Passive);
            Rect  r         = AudioCurveRendering.BeginCurveFrame(r0);
            float num1      = 10f;
            float minRange1;
            float maxRange1;
            float defaultValue1;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kThresholdName, out minRange1, out maxRange1, out defaultValue1);
            float minRange2;
            float maxRange2;
            float defaultValue2;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kRatioName, out minRange2, out maxRange2, out defaultValue2);
            float minRange3;
            float maxRange3;
            float defaultValue3;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kMakeupGainName, out minRange3, out maxRange3, out defaultValue3);
            float minRange4;
            float maxRange4;
            float defaultValue4;

            plugin.GetFloatParameterInfo(DuckVolumeGUI.kKneeName, out minRange4, out maxRange4, out defaultValue4);
            // ISSUE: reference to a compiler-generated field
            displayCAnonStorey5C.dbRange = 100f;
            // ISSUE: reference to a compiler-generated field
            displayCAnonStorey5C.dbMin = -80f;
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            float num2 = r.width * (threshold - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
            bool  flag = false;

            switch (current.GetTypeForControl(controlId))
            {
            case EventType.MouseDown:
                if (r.Contains(Event.current.mousePosition) && current.button == 0)
                {
                    DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.None;
                    GUIUtility.hotControl  = controlId;
                    EditorGUIUtility.SetWantsMouseJumping(1);
                    current.Use();
                    DuckVolumeGUI.dragtype = (double)Mathf.Abs(r.x + num2 - current.mousePosition.x) < 10.0 ? DuckVolumeGUI.DragType.ThresholdAndKnee : ((double)current.mousePosition.x >= (double)r.x + (double)num2 ? DuckVolumeGUI.DragType.Ratio : DuckVolumeGUI.DragType.MakeupGain);
                    break;
                }
                break;

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

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlId)
                {
                    float num3 = !current.alt ? 1f : 0.25f;
                    if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
                    {
                        if ((double)Mathf.Abs(current.delta.x) < (double)Mathf.Abs(current.delta.y))
                        {
                            knee = Mathf.Clamp(knee + current.delta.y * 0.5f * num3, minRange4, maxRange4);
                        }
                        else
                        {
                            threshold = Mathf.Clamp(threshold + current.delta.x * 0.1f * num3, minRange1, maxRange1);
                        }
                    }
                    else if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
                    {
                        ratio = Mathf.Clamp(ratio + current.delta.y * ((double)ratio <= 1.0 ? 3f / 1000f : 0.05f) * num3, minRange2, maxRange2);
                    }
                    else if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
                    {
                        makeupGain = Mathf.Clamp(makeupGain - current.delta.y * 0.5f * num3, minRange3, maxRange3);
                    }
                    else
                    {
                        Debug.LogError((object)"Drag: Unhandled enum");
                    }
                    flag = true;
                    current.Use();
                    break;
                }
                break;
            }
            if (current.type == EventType.Repaint)
            {
                // ISSUE: object of a compiler-generated type is created
                // ISSUE: variable of a compiler-generated type
                DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5D displayCAnonStorey5D = new DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5D();
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.\u003C\u003Ef__ref\u002492 = displayCAnonStorey5C;
                HandleUtility.ApplyWireMaterial();
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                float num3  = r.height * (float)(1.0 - ((double)threshold - (double)displayCAnonStorey5C.dbMin + (double)makeupGain) / (double)displayCAnonStorey5C.dbRange);
                Color col   = new Color(0.7f, 0.7f, 0.7f);
                Color black = Color.black;
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.duckGradient = 1f / ratio;
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.duckThreshold = threshold;
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.duckSidechainLevel = sidechainLevel;
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.duckMakeupGain = makeupGain;
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.duckKnee = knee;
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.duckKneeC1 = (double)knee <= 0.0 ? 0.0f : (float)(((double)displayCAnonStorey5D.duckGradient - 1.0) / (4.0 * (double)knee));
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                displayCAnonStorey5D.duckKneeC2 = displayCAnonStorey5D.duckThreshold - knee;
                // ISSUE: reference to a compiler-generated method
                AudioCurveRendering.DrawFilledCurve(r, new AudioCurveRendering.AudioCurveAndColorEvaluator(displayCAnonStorey5D.\u003C\u003Em__9D));
                if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
                {
                    // ISSUE: reference to a compiler-generated method
                    AudioCurveRendering.DrawCurve(r, new AudioCurveRendering.AudioCurveEvaluator(displayCAnonStorey5D.\u003C\u003Em__9E), Color.white);
                }
                // ISSUE: reference to a compiler-generated field
                DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(col, displayCAnonStorey5C.blend);
                EditorGUI.DrawRect(new Rect(r.x + num2, r.y, 1f, r.height), DuckVolumeGUI.textStyle10.normal.textColor);
                DuckVolumeGUI.DrawText((float)((double)r.x + (double)num2 + 4.0), r.y + 6f, string.Format("Threshold: {0:F1} dB", (object)threshold));
                // ISSUE: reference to a compiler-generated field
                DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(black, displayCAnonStorey5C.blend);
                DuckVolumeGUI.DrawText(r.x + 4f, (float)((double)r.y + (double)r.height - 10.0), (double)sidechainLevel >= -80.0 ? string.Format("Input: {0:F1} dB", (object)sidechainLevel) : "Input: None");
                if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
                {
                    float num4 = r.height / r.width;
                    Handles.DrawAAPolyLine(2f, new Color[2]
                    {
                        Color.black,
                        Color.black
                    }, new Vector3[2]
                    {
                        new Vector3(r.x + num2 + r.width, (float)((double)r.y + (double)num3 - (double)num4 * (double)r.width), 0.0f),
                        new Vector3(r.x + num2 - r.width, (float)((double)r.y + (double)num3 + (double)num4 * (double)r.width), 0.0f)
                    });
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    Handles.DrawAAPolyLine(3f, new Color[2]
                    {
                        Color.white,
                        Color.white
                    }, new Vector3[2]
                    {
                        new Vector3(r.x + num2 + r.width, (float)((double)r.y + (double)num3 - (double)num4 * (double)displayCAnonStorey5D.duckGradient * (double)r.width), 0.0f),
                        new Vector3(r.x + num2 - r.width, (float)((double)r.y + (double)num3 + (double)num4 * (double)displayCAnonStorey5D.duckGradient * (double)r.width), 0.0f)
                    });
                }
                else if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
                {
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    float x1 = (threshold - knee - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    float x2 = (threshold + knee - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    float duckingVolume1 = DuckVolumeGUI.EvaluateDuckingVolume(x1, ratio, threshold, makeupGain, knee, displayCAnonStorey5C.dbRange, displayCAnonStorey5C.dbMin);
                    // ISSUE: reference to a compiler-generated field
                    // ISSUE: reference to a compiler-generated field
                    float duckingVolume2 = DuckVolumeGUI.EvaluateDuckingVolume(x2, ratio, threshold, makeupGain, knee, displayCAnonStorey5C.dbRange, displayCAnonStorey5C.dbMin);
                    float y1             = r.yMax - (float)(((double)duckingVolume1 + 1.0) * 0.5) * r.height;
                    float y2             = r.yMax - (float)(((double)duckingVolume2 + 1.0) * 0.5) * r.height;
                    EditorGUI.DrawRect(new Rect(r.x + x1 * r.width, y1, 1f, r.height - y1), new Color(0.0f, 0.0f, 0.0f, 0.5f));
                    EditorGUI.DrawRect(new Rect((float)((double)r.x + (double)x2 * (double)r.width - 1.0), y2, 1f, r.height - y2), new Color(0.0f, 0.0f, 0.0f, 0.5f));
                    EditorGUI.DrawRect(new Rect((float)((double)r.x + (double)num2 - 1.0), r.y, 3f, r.height), Color.white);
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                outputLevel = (Mathf.Clamp(outputLevel - makeupGain, displayCAnonStorey5C.dbMin, displayCAnonStorey5C.dbMin + displayCAnonStorey5C.dbRange) - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
                if (EditorApplication.isPlaying)
                {
                    // ISSUE: reference to a compiler-generated field
                    DuckVolumeGUI.DrawVU(new Rect((float)((double)r.x + (double)r.width - (double)num1 + 2.0), r.y + 2f, num1 - 4f, r.height - 4f), outputLevel, displayCAnonStorey5C.blend, true);
                }
            }
            AudioCurveRendering.EndCurveFrame();
            return(flag);
        }
 private static bool CurveDisplay(IAudioEffectPlugin plugin, Rect r0, ref float threshold, ref float ratio, ref float makeupGain, ref float attackTime, ref float releaseTime, ref float knee, float sidechainLevel, float outputLevel, float blend)
 {
   // ISSUE: object of a compiler-generated type is created
   // ISSUE: variable of a compiler-generated type
   DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5C displayCAnonStorey5C = new DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5C();
   // ISSUE: reference to a compiler-generated field
   displayCAnonStorey5C.blend = blend;
   Event current = Event.current;
   int controlId = GUIUtility.GetControlID(FocusType.Passive);
   Rect r = AudioCurveRendering.BeginCurveFrame(r0);
   float num1 = 10f;
   float minRange1;
   float maxRange1;
   float defaultValue1;
   plugin.GetFloatParameterInfo(DuckVolumeGUI.kThresholdName, out minRange1, out maxRange1, out defaultValue1);
   float minRange2;
   float maxRange2;
   float defaultValue2;
   plugin.GetFloatParameterInfo(DuckVolumeGUI.kRatioName, out minRange2, out maxRange2, out defaultValue2);
   float minRange3;
   float maxRange3;
   float defaultValue3;
   plugin.GetFloatParameterInfo(DuckVolumeGUI.kMakeupGainName, out minRange3, out maxRange3, out defaultValue3);
   float minRange4;
   float maxRange4;
   float defaultValue4;
   plugin.GetFloatParameterInfo(DuckVolumeGUI.kKneeName, out minRange4, out maxRange4, out defaultValue4);
   // ISSUE: reference to a compiler-generated field
   displayCAnonStorey5C.dbRange = 100f;
   // ISSUE: reference to a compiler-generated field
   displayCAnonStorey5C.dbMin = -80f;
   // ISSUE: reference to a compiler-generated field
   // ISSUE: reference to a compiler-generated field
   float num2 = r.width * (threshold - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
   bool flag = false;
   switch (current.GetTypeForControl(controlId))
   {
     case EventType.MouseDown:
       if (r.Contains(Event.current.mousePosition) && current.button == 0)
       {
         DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.None;
         GUIUtility.hotControl = controlId;
         EditorGUIUtility.SetWantsMouseJumping(1);
         current.Use();
         DuckVolumeGUI.dragtype = (double) Mathf.Abs(r.x + num2 - current.mousePosition.x) < 10.0 ? DuckVolumeGUI.DragType.ThresholdAndKnee : ((double) current.mousePosition.x >= (double) r.x + (double) num2 ? DuckVolumeGUI.DragType.Ratio : DuckVolumeGUI.DragType.MakeupGain);
         break;
       }
       break;
     case EventType.MouseUp:
       if (GUIUtility.hotControl == controlId && current.button == 0)
       {
         DuckVolumeGUI.dragtype = DuckVolumeGUI.DragType.None;
         GUIUtility.hotControl = 0;
         EditorGUIUtility.SetWantsMouseJumping(0);
         current.Use();
         break;
       }
       break;
     case EventType.MouseDrag:
       if (GUIUtility.hotControl == controlId)
       {
         float num3 = !current.alt ? 1f : 0.25f;
         if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
         {
           if ((double) Mathf.Abs(current.delta.x) < (double) Mathf.Abs(current.delta.y))
             knee = Mathf.Clamp(knee + current.delta.y * 0.5f * num3, minRange4, maxRange4);
           else
             threshold = Mathf.Clamp(threshold + current.delta.x * 0.1f * num3, minRange1, maxRange1);
         }
         else if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
           ratio = Mathf.Clamp(ratio + current.delta.y * ((double) ratio <= 1.0 ? 3f / 1000f : 0.05f) * num3, minRange2, maxRange2);
         else if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
           makeupGain = Mathf.Clamp(makeupGain - current.delta.y * 0.5f * num3, minRange3, maxRange3);
         else
           Debug.LogError((object) "Drag: Unhandled enum");
         flag = true;
         current.Use();
         break;
       }
       break;
   }
   if (current.type == EventType.Repaint)
   {
     // ISSUE: object of a compiler-generated type is created
     // ISSUE: variable of a compiler-generated type
     DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5D displayCAnonStorey5D = new DuckVolumeGUI.\u003CCurveDisplay\u003Ec__AnonStorey5D();
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.\u003C\u003Ef__ref\u002492 = displayCAnonStorey5C;
     HandleUtility.ApplyWireMaterial();
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     float num3 = r.height * (float) (1.0 - ((double) threshold - (double) displayCAnonStorey5C.dbMin + (double) makeupGain) / (double) displayCAnonStorey5C.dbRange);
     Color col = new Color(0.7f, 0.7f, 0.7f);
     Color black = Color.black;
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.duckGradient = 1f / ratio;
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.duckThreshold = threshold;
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.duckSidechainLevel = sidechainLevel;
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.duckMakeupGain = makeupGain;
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.duckKnee = knee;
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.duckKneeC1 = (double) knee <= 0.0 ? 0.0f : (float) (((double) displayCAnonStorey5D.duckGradient - 1.0) / (4.0 * (double) knee));
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     displayCAnonStorey5D.duckKneeC2 = displayCAnonStorey5D.duckThreshold - knee;
     // ISSUE: reference to a compiler-generated method
     AudioCurveRendering.DrawFilledCurve(r, new AudioCurveRendering.AudioCurveAndColorEvaluator(displayCAnonStorey5D.\u003C\u003Em__9D));
     if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.MakeupGain)
     {
       // ISSUE: reference to a compiler-generated method
       AudioCurveRendering.DrawCurve(r, new AudioCurveRendering.AudioCurveEvaluator(displayCAnonStorey5D.\u003C\u003Em__9E), Color.white);
     }
     // ISSUE: reference to a compiler-generated field
     DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(col, displayCAnonStorey5C.blend);
     EditorGUI.DrawRect(new Rect(r.x + num2, r.y, 1f, r.height), DuckVolumeGUI.textStyle10.normal.textColor);
     DuckVolumeGUI.DrawText((float) ((double) r.x + (double) num2 + 4.0), r.y + 6f, string.Format("Threshold: {0:F1} dB", (object) threshold));
     // ISSUE: reference to a compiler-generated field
     DuckVolumeGUI.textStyle10.normal.textColor = DuckVolumeGUI.ScaleAlpha(black, displayCAnonStorey5C.blend);
     DuckVolumeGUI.DrawText(r.x + 4f, (float) ((double) r.y + (double) r.height - 10.0), (double) sidechainLevel >= -80.0 ? string.Format("Input: {0:F1} dB", (object) sidechainLevel) : "Input: None");
     if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.Ratio)
     {
       float num4 = r.height / r.width;
       Handles.DrawAAPolyLine(2f, new Color[2]
       {
         Color.black,
         Color.black
       }, new Vector3[2]
       {
         new Vector3(r.x + num2 + r.width, (float) ((double) r.y + (double) num3 - (double) num4 * (double) r.width), 0.0f),
         new Vector3(r.x + num2 - r.width, (float) ((double) r.y + (double) num3 + (double) num4 * (double) r.width), 0.0f)
       });
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated field
       Handles.DrawAAPolyLine(3f, new Color[2]
       {
         Color.white,
         Color.white
       }, new Vector3[2]
       {
         new Vector3(r.x + num2 + r.width, (float) ((double) r.y + (double) num3 - (double) num4 * (double) displayCAnonStorey5D.duckGradient * (double) r.width), 0.0f),
         new Vector3(r.x + num2 - r.width, (float) ((double) r.y + (double) num3 + (double) num4 * (double) displayCAnonStorey5D.duckGradient * (double) r.width), 0.0f)
       });
     }
     else if (DuckVolumeGUI.dragtype == DuckVolumeGUI.DragType.ThresholdAndKnee)
     {
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated field
       float x1 = (threshold - knee - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated field
       float x2 = (threshold + knee - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated field
       float duckingVolume1 = DuckVolumeGUI.EvaluateDuckingVolume(x1, ratio, threshold, makeupGain, knee, displayCAnonStorey5C.dbRange, displayCAnonStorey5C.dbMin);
       // ISSUE: reference to a compiler-generated field
       // ISSUE: reference to a compiler-generated field
       float duckingVolume2 = DuckVolumeGUI.EvaluateDuckingVolume(x2, ratio, threshold, makeupGain, knee, displayCAnonStorey5C.dbRange, displayCAnonStorey5C.dbMin);
       float y1 = r.yMax - (float) (((double) duckingVolume1 + 1.0) * 0.5) * r.height;
       float y2 = r.yMax - (float) (((double) duckingVolume2 + 1.0) * 0.5) * r.height;
       EditorGUI.DrawRect(new Rect(r.x + x1 * r.width, y1, 1f, r.height - y1), new Color(0.0f, 0.0f, 0.0f, 0.5f));
       EditorGUI.DrawRect(new Rect((float) ((double) r.x + (double) x2 * (double) r.width - 1.0), y2, 1f, r.height - y2), new Color(0.0f, 0.0f, 0.0f, 0.5f));
       EditorGUI.DrawRect(new Rect((float) ((double) r.x + (double) num2 - 1.0), r.y, 3f, r.height), Color.white);
     }
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     // ISSUE: reference to a compiler-generated field
     outputLevel = (Mathf.Clamp(outputLevel - makeupGain, displayCAnonStorey5C.dbMin, displayCAnonStorey5C.dbMin + displayCAnonStorey5C.dbRange) - displayCAnonStorey5C.dbMin) / displayCAnonStorey5C.dbRange;
     if (EditorApplication.isPlaying)
     {
       // ISSUE: reference to a compiler-generated field
       DuckVolumeGUI.DrawVU(new Rect((float) ((double) r.x + (double) r.width - (double) num1 + 2.0), r.y + 2f, num1 - 4f, r.height - 4f), outputLevel, displayCAnonStorey5C.blend, true);
     }
   }
   AudioCurveRendering.EndCurveFrame();
   return flag;
 }
        static bool CurveDisplay(IAudioEffectPlugin plugin, Rect r0, ref float threshold, ref float ratio, ref float makeupGain, ref float attackTime, ref float releaseTime, ref float knee, float sidechainLevel, float outputLevel, float blend)
        {
            Event evt       = Event.current;
            int   controlID = GUIUtility.GetControlID(FocusType.Passive);

            Rect r = AudioCurveRendering.BeginCurveFrame(r0);

            const float thresholdActiveWidth = 10f;
            float       vuWidth = 10f;

            float minThreshold, maxThreshold, defThreshold; plugin.GetFloatParameterInfo(kThresholdName, out minThreshold, out maxThreshold, out defThreshold);
            float minRatio, maxRatio, defRatio; plugin.GetFloatParameterInfo(kRatioName, out minRatio, out maxRatio, out defRatio);
            float minMakeupGain, maxMakeupGain, defMakeupGain; plugin.GetFloatParameterInfo(kMakeupGainName, out minMakeupGain, out maxMakeupGain, out defMakeupGain);
            float minKnee, maxKnee, defKnee; plugin.GetFloatParameterInfo(kKneeName, out minKnee, out maxKnee, out defKnee);

            float dbRange = 100.0f, dbMin = -80.0f;
            float thresholdPosX = r.width * (threshold - dbMin) / dbRange;

            bool modifiedValue = false;

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

                    // Ensure visible state change on mousedown to make it clear that interaction is possible
                    if ((Mathf.Abs(r.x + thresholdPosX - evt.mousePosition.x) >= thresholdActiveWidth))
                    {
                        dragtype = (evt.mousePosition.x < r.x + thresholdPosX) ? DragType.MakeupGain : DragType.Ratio;
                    }
                    else
                    {
                        dragtype = DragType.ThresholdAndKnee;
                    }
                }
                break;

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

            case EventType.MouseDrag:
                if (GUIUtility.hotControl == controlID)
                {
                    float dragAcceleration = evt.alt ? .25f : 1f;
                    if (dragtype == DragType.ThresholdAndKnee)
                    {
                        bool dragKnee = Mathf.Abs(evt.delta.x) < Mathf.Abs(evt.delta.y);
                        if (dragKnee)
                        {
                            knee = Mathf.Clamp(knee + evt.delta.y * 0.5f * dragAcceleration, minKnee, maxKnee);
                        }
                        else
                        {
                            threshold = Mathf.Clamp(threshold + evt.delta.x * 0.1f * dragAcceleration, minThreshold, maxThreshold);
                        }
                    }
                    else if (dragtype == DragType.Ratio)
                    {
                        ratio = Mathf.Clamp(ratio + evt.delta.y * (ratio > 1.0f ? 0.05f : 0.003f) * dragAcceleration, minRatio, maxRatio);
                    }
                    else if (dragtype == DragType.MakeupGain)
                    {
                        makeupGain = Mathf.Clamp(makeupGain - evt.delta.y * 0.5f * dragAcceleration, minMakeupGain, maxMakeupGain);
                    }
                    else
                    {
                        Debug.LogError("Drag: Unhandled enum");
                    }

                    modifiedValue = true;
                    evt.Use();
                }
                break;
            }

            if (evt.type == EventType.Repaint)
            {
                // Curve
                HandleUtility.ApplyWireMaterial();

                //float sidechainPosX = r.width * (sidechainLevel - dbMin) / dbRange;
                float thresholdPosY  = r.height * (1.0f - ((threshold - dbMin + makeupGain) / dbRange));
                Color thresholdColor = new Color(0.7f, 0.7f, 0.7f);
                Color sidechainColor = Color.black;


                float duckGradient       = 1.0f / ratio;
                float duckThreshold      = threshold;
                float duckSidechainLevel = sidechainLevel;
                float duckMakeupGain     = makeupGain;
                float duckKnee           = knee;
                float duckKneeC1         = (knee > 0.0f) ? ((duckGradient - 1.0f) / (4.0f * knee)) : 0.0f;
                float duckKneeC2         = duckThreshold - knee;

                // Main filled curve
                AudioCurveRendering.DrawFilledCurve(
                    r,
                    delegate(float x, out Color col)
                {
                    float level = x * dbRange + dbMin;
                    float gain  = level;
                    float t     = level - duckThreshold;
                    col         = ScaleAlpha(duckSidechainLevel > level ? AudioCurveRendering.kAudioOrange : Color.grey, blend);
                    if (t > -duckKnee && t < duckKnee)
                    {
                        t   += duckKnee;
                        gain = t * (duckKneeC1 * t + 1.0f) + duckKneeC2;

                        if (dragtype == DragType.ThresholdAndKnee)
                        {
                            const float mult = 1.2f;
                            col = new Color(col.r * mult, col.g * mult, col.b * mult);
                        }
                    }
                    else if (t > 0.0f)
                    {
                        gain = duckThreshold + duckGradient * t;
                    }
                    return((2.0f * (gain + duckMakeupGain - dbMin) / dbRange) - 1.0f);
                }
                    );

                // Curve shown when modifying MakeupGain
                if (dragtype == DragType.MakeupGain)
                {
                    AudioCurveRendering.DrawCurve(
                        r,
                        delegate(float x)
                    {
                        float level = x * dbRange + dbMin;
                        float gain  = level;
                        float t     = level - duckThreshold;
                        if (t > -duckKnee && t < duckKnee)
                        {
                            t   += duckKnee;
                            gain = t * (duckKneeC1 * t + 1.0f) + duckKneeC2;
                        }
                        else if (t > 0.0f)
                        {
                            gain = duckThreshold + duckGradient * t;
                        }
                        return((2.0f * (gain + duckMakeupGain - dbMin) / dbRange) - 1.0f);
                    },
                        Color.white
                        );
                }


                // Threshold text and line
                textStyle10.normal.textColor = ScaleAlpha(thresholdColor, blend);
                EditorGUI.DrawRect(new Rect(r.x + thresholdPosX, r.y, 1, r.height), textStyle10.normal.textColor);
                DrawText(r.x + thresholdPosX + 4, r.y + 6, string.Format(CultureInfo.InvariantCulture.NumberFormat, "Threshold: {0:F1} dB", threshold));

                // Sidechain text and line
                textStyle10.normal.textColor = ScaleAlpha(sidechainColor, blend);
                DrawText(r.x + 4, r.y + r.height - 10, sidechainLevel < -80 ? "Input: None" : string.Format(CultureInfo.InvariantCulture.NumberFormat, "Input: {0:F1} dB", sidechainLevel));

                if (dragtype == DragType.Ratio)
                {
                    float aspect = (float)r.height / (float)r.width;
                    Handles.DrawAAPolyLine(2.0f,
                                           new Color[] { Color.black, Color.black },
                                           new Vector3[]
                    {
                        new Vector3(r.x + thresholdPosX + r.width, r.y + thresholdPosY - aspect * r.width, 0.0f),
                        new Vector3(r.x + thresholdPosX - r.width, r.y + thresholdPosY + aspect * r.width, 0.0f)
                    });
                    Handles.DrawAAPolyLine(3.0f,
                                           new Color[] { Color.white, Color.white },
                                           new Vector3[]
                    {
                        new Vector3(r.x + thresholdPosX + r.width, r.y + thresholdPosY - aspect * duckGradient * r.width, 0.0f),
                        new Vector3(r.x + thresholdPosX - r.width, r.y + thresholdPosY + aspect * duckGradient * r.width, 0.0f)
                    });
                }
                else if (dragtype == DragType.ThresholdAndKnee)
                {
                    // Knee min and max lines
                    float normalizedKnee1 = (threshold - knee - dbMin) / dbRange;
                    float normalizedKnee2 = (threshold + knee - dbMin) / dbRange;
                    float y1        = EvaluateDuckingVolume(normalizedKnee1, ratio, threshold, makeupGain, knee, dbRange, dbMin);
                    float y2        = EvaluateDuckingVolume(normalizedKnee2, ratio, threshold, makeupGain, knee, dbRange, dbMin);
                    float knee1PosY = r.yMax - (y1 + 1f) * 0.5f * r.height;
                    float knee2PosY = r.yMax - (y2 + 1f) * 0.5f * r.height;
                    EditorGUI.DrawRect(new Rect(r.x + normalizedKnee1 * r.width, knee1PosY, 1, r.height - knee1PosY), new Color(0, 0, 0, 0.5f));
                    EditorGUI.DrawRect(new Rect(r.x + normalizedKnee2 * r.width - 1, knee2PosY, 1, r.height - knee2PosY), new Color(0, 0, 0, 0.5f));

                    // Enhanced threshold
                    EditorGUI.DrawRect(new Rect(r.x + thresholdPosX - 1, r.y, 3, r.height), Color.white);
                }

                outputLevel = (Mathf.Clamp(outputLevel - makeupGain, dbMin, dbMin + dbRange) - dbMin) / dbRange;
                if (EditorApplication.isPlaying)
                {
                    const int margin = 2;
                    Rect      vuRect = new Rect(r.x + r.width - vuWidth + margin, r.y + margin, vuWidth - 2 * margin, r.height - 2 * margin);
                    DrawVU(vuRect, outputLevel, blend, true);
                }
            }

            AudioCurveRendering.EndCurveFrame();

            return(modifiedValue);
        }
		public override bool OnGUI(IAudioEffectPlugin plugin)
		{
			float blend = (!plugin.IsPluginEditableAndEnabled()) ? 0.5f : 1f;
			float value;
			plugin.GetFloatParameter(DuckVolumeGUI.kThresholdName, out value);
			float value2;
			plugin.GetFloatParameter(DuckVolumeGUI.kRatioName, out value2);
			float value3;
			plugin.GetFloatParameter(DuckVolumeGUI.kMakeupGainName, out value3);
			float value4;
			plugin.GetFloatParameter(DuckVolumeGUI.kAttackTimeName, out value4);
			float value5;
			plugin.GetFloatParameter(DuckVolumeGUI.kReleaseTimeName, out value5);
			float value6;
			plugin.GetFloatParameter(DuckVolumeGUI.kKneeName, out value6);
			float[] array;
			plugin.GetFloatBuffer("Metering", out array, 2);
			GUILayout.Space(5f);
			Rect rect = GUILayoutUtility.GetRect(200f, 160f, new GUILayoutOption[]
			{
				GUILayout.ExpandWidth(true)
			});
			if (DuckVolumeGUI.CurveDisplay(plugin, rect, ref value, ref value2, ref value3, ref value4, ref value5, ref value6, array[0], array[1], blend))
			{
				plugin.SetFloatParameter(DuckVolumeGUI.kThresholdName, value);
				plugin.SetFloatParameter(DuckVolumeGUI.kRatioName, value2);
				plugin.SetFloatParameter(DuckVolumeGUI.kMakeupGainName, value3);
				plugin.SetFloatParameter(DuckVolumeGUI.kAttackTimeName, value4);
				plugin.SetFloatParameter(DuckVolumeGUI.kReleaseTimeName, value5);
				plugin.SetFloatParameter(DuckVolumeGUI.kKneeName, value6);
			}
			return true;
		}