Exemple #1
0
    public override void OnInspectorGUI()
    {
        bool isEnabled = _dsp.IsInstantiated();

        if (!isEnabled)
        {
            EditorGUILayout.LabelField("Press Play!", EditorStyles.centeredGreyMiniLabel);
        }
        // events
        GUI.enabled = isEnabled;
        EditorGUILayout.Space();
        // turnon
        if (GUILayout.Button("turnon"))
        {
            _dsp.SendEvent(Hv_waves_AudioLib.Event.Turnon);
        }

        GUILayout.EndVertical();

        // parameters
        GUI.enabled = true;
        GUILayout.BeginVertical();
        EditorGUILayout.Space();
        EditorGUI.indentLevel++;

        // volume
        GUILayout.BeginHorizontal();
        float volume    = _dsp.GetFloatParameter(Hv_waves_AudioLib.Parameter.Volume);
        float newVolume = EditorGUILayout.Slider("volume", volume, 10.0f, 100.0f);

        if (volume != newVolume)
        {
            _dsp.SetFloatParameter(Hv_waves_AudioLib.Parameter.Volume, newVolume);
        }
        GUILayout.EndHorizontal();

        // wavespeed
        GUILayout.BeginHorizontal();
        float wavespeed    = _dsp.GetFloatParameter(Hv_waves_AudioLib.Parameter.Wavespeed);
        float newWavespeed = EditorGUILayout.Slider("wavespeed", wavespeed, 10.0f, 100.0f);

        if (wavespeed != newWavespeed)
        {
            _dsp.SetFloatParameter(Hv_waves_AudioLib.Parameter.Wavespeed, newWavespeed);
        }
        GUILayout.EndHorizontal();
        EditorGUI.indentLevel--;
    }
Exemple #2
0
    public override void OnInspectorGUI()
    {
        bool isEnabled = _dsp.IsInstantiated();

        if (!isEnabled)
        {
            EditorGUILayout.LabelField("Press Play!", EditorStyles.centeredGreyMiniLabel);
        }
        GUILayout.BeginVertical();

        // PARAMETERS
        GUI.enabled = true;
        EditorGUILayout.Space();
        EditorGUI.indentLevel++;

        // frequency
        GUILayout.BeginHorizontal();
        float frequency    = _dsp.GetFloatParameter(Hv_waves_AudioLib.Parameter.Frequency);
        float newFrequency = EditorGUILayout.Slider("frequency", frequency, 50.0f, 4000.0f);

        if (frequency != newFrequency)
        {
            _dsp.SetFloatParameter(Hv_waves_AudioLib.Parameter.Frequency, newFrequency);
        }
        GUILayout.EndHorizontal();

        // gain
        GUILayout.BeginHorizontal();
        float gain    = _dsp.GetFloatParameter(Hv_waves_AudioLib.Parameter.Gain);
        float newGain = EditorGUILayout.Slider("gain", gain, 0.0f, 1.0f);

        if (gain != newGain)
        {
            _dsp.SetFloatParameter(Hv_waves_AudioLib.Parameter.Gain, newGain);
        }
        GUILayout.EndHorizontal();

        EditorGUI.indentLevel--;



        GUILayout.EndVertical();
    }