public override void OnInspectorGUI() { float outFloat = 0; int outInt = 0; Crusher component = (Crusher)target; GUILayout.BeginVertical("Box"); { if (InspectorUtils.IntSlider(component.BitDepth, 1, 32, "Bit Depth", "Precision of audio samples. Less precision is more distorted.", out outInt)) { InspectorUtils.RecordObject(component, inspectorName + " - Bit Depth"); component.BitDepth = outInt; EditorGUIUtility.ExitGUI(); } if (InspectorUtils.FloatSliderExponential(component.SampleRate, 0.001f, 1, "Sample Rate", "Sample rate effects the resolution of the sound. Smaller value increases grittiness.", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Sample Rate"); component.SampleRate = outFloat; EditorGUIUtility.ExitGUI(); } } GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); { if (InspectorUtils.FloatSlider(component.DryWet, 0, 1, "Dry/Wet", "Dry/Wet ratio", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Dry/Wet"); component.DryWet = outFloat; EditorGUIUtility.ExitGUI(); } } GUILayout.EndVertical(); component.runEffectInEditMode = GUILayout.Toggle(component.runEffectInEditMode, new GUIContent("Run Effect In Edit Mode (" + component.runTime.ToString() + " ms)", "Enable/disable component when the editor is not playing.\nEnable to reduce CPU usage")); Repaint(); }
public override void OnInspectorGUI() { float outFloat = 0; RingModulator component = (RingModulator)target; GUILayout.BeginVertical("Box"); { if (InspectorUtils.FloatSliderExponential(component.CarrierFrequency, 20f, 5000, "Carrier Frequency", "Speed of oscillation measured in hertz (oscillations per second)", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Rate"); component.CarrierFrequency = outFloat; EditorGUIUtility.ExitGUI(); } } GUILayout.EndVertical(); GUILayout.BeginVertical("Box"); { if (InspectorUtils.FloatSlider(component.DryWet, 0, 1, "Dry/Wet", "Dry/Wet ratio", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Dry/Wet"); component.DryWet = outFloat; EditorGUIUtility.ExitGUI(); } } GUILayout.EndVertical(); component.runEffectInEditMode = GUILayout.Toggle(component.runEffectInEditMode, new GUIContent("Run Effect In Edit Mode (" + component.runTime.ToString() + " ms)", "Enable/disable component when the editor is not playing.\nEnable to reduce CPU usage")); Repaint(); }
public override void OnInspectorGUI() { float outFloat = 0; StateVariableFilter component = (StateVariableFilter)target; GUILayout.BeginVertical("Box"); { FilterState currentFilter = component.Filter; FilterState newFilter = (FilterState)EditorGUILayout.EnumPopup(new GUIContent("Filter State", "Hi Band,low band, etc"), component.Filter); if (currentFilter != newFilter) { InspectorUtils.RecordObject(component, inspectorName + " - Filter State"); component.Filter = newFilter; EditorGUIUtility.ExitGUI(); } if (InspectorUtils.FloatSliderExponential(component.Frequency, 60, 12000, "Frequency", "Frequency of Filter", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Frequency"); component.Frequency = outFloat; EditorGUIUtility.ExitGUI(); } if (InspectorUtils.FloatSlider(component.Resonance, 0, 1, "Resonance (Q)", "Resonance (Q) of filter", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Resonance"); component.Resonance = outFloat; EditorGUIUtility.ExitGUI(); } if (InspectorUtils.FloatSlider(component.Drive, 0, 0.1f, "Drive", "Filter drive", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Drive"); component.Drive = outFloat; EditorGUIUtility.ExitGUI(); } bool isAdditive = false; switch (newFilter) { case FilterState.BandAdd: case FilterState.LowShelf: case FilterState.HighShelf: isAdditive = true; break; default: isAdditive = false; break; } if (isAdditive) { if (InspectorUtils.FloatSlider(component.AdditiveGain, -1, 1, "Additive Gain", "Amount of selected frequency band to add to original signal", out outFloat)) { InspectorUtils.RecordObject(component, inspectorName + " - Additive Gain"); component.AdditiveGain = outFloat; EditorGUIUtility.ExitGUI(); } } } GUILayout.EndVertical(); component.runEffectInEditMode = GUILayout.Toggle(component.runEffectInEditMode, new GUIContent("Run Effect In Edit Mode (" + component.runTime.ToString() + " ms)", "Enable/disable component when the editor is not playing.\nEnable to reduce CPU usage")); Repaint(); }