Esempio n. 1
0
        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();
        }
Esempio n. 2
0
    // Use this for initialization
    void Awake()
    {
        MonoBehaviour[] components;

        for (var x = 0; x < audialComponents.Length; x++)
        {
            audialComponents[x] = new List <MonoBehaviour>();
        }

        drums      = GameObject.Find("Drums");
        components = drums.GetComponents <MonoBehaviour>();
        for (var d = 0; d < components.Length; d++)
        {
            if (components[d].GetType().Namespace == "Audial")
            {
                if (components[d].GetType().Name == "Fader")
                {
                    faders[0] = (Audial.Fader)components[d];
                }
                else
                {
                    audialComponents[0].Add(components[d]);
                    components[d].enabled = false;
                }
            }
        }

        bass       = GameObject.Find("Bass");
        components = bass.GetComponents <MonoBehaviour>();
        for (var b = 0; b < components.Length; b++)
        {
            if (components[b].GetType().Namespace == "Audial")
            {
                if (components[b].GetType().Name == "Fader")
                {
                    faders[1] = (Audial.Fader)components[b];
                }
                else
                {
                    audialComponents[1].Add(components[b]);
                    components[b].enabled = false;
                }
            }
        }

        piano      = GameObject.Find("Piano");
        components = piano.GetComponents <MonoBehaviour>();
        for (var p = 0; p < components.Length; p++)
        {
            if (components[p].GetType().Namespace == "Audial")
            {
                if (components[p].GetType().Name == "Fader")
                {
                    faders[2] = (Audial.Fader)components[p];
                }
                else
                {
                    audialComponents[2].Add(components[p]);
                    components[p].enabled = false;
                }
            }
        }

        subbass    = GameObject.Find("Subbass");
        components = subbass.GetComponents <MonoBehaviour>();
        for (var s = 0; s < components.Length; s++)
        {
            if (components[s].GetType().Namespace == "Audial")
            {
                if (components[s].GetType().Name == "Fader")
                {
                    faders[3] = (Audial.Fader)components[s];
                }
                else
                {
                    audialComponents[3].Add(components[s]);
                    components[s].enabled = false;
                }
            }
        }

        master     = GameObject.Find("AudioListener");
        components = master.GetComponents <MonoBehaviour>();
        for (var m = 0; m < components.Length; m++)
        {
            if (components[m].GetType().Namespace == "Audial")
            {
                if (components[m].GetType().Name.ToString() == "Crusher")
                {
                    masterCrusher = (Audial.Crusher)components[m];
                }
                else
                {
                    audialComponents[4].Add(components[m]);
                    components[m].enabled = false;
                }
            }
        }
    }