public void TriggerNote(int osc) { switch (osc) { case 1: synth.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc1_trigger); //Debug.Log("Triggernote 1"); break; case 2: synth.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc2_trigger); //Debug.Log("Triggernote 2"); break; case 3: synth.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc3_trigger); //Debug.Log("Triggernote 3"); break; case 4: synth.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc4_trigger); //Debug.Log("Triggernote 4"); break; default: break; } }
public override void OnInspectorGUI() { bool isEnabled = _dsp.IsInstantiated(); if (!isEnabled) { EditorGUILayout.LabelField("Press Play!", EditorStyles.centeredGreyMiniLabel); } GUILayout.BeginVertical(); // EVENTS GUI.enabled = isEnabled; EditorGUILayout.Space(); // osc1_trigger if (GUILayout.Button("osc1_trigger")) { _dsp.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc1_trigger); } // osc2_trigger if (GUILayout.Button("osc2_trigger")) { _dsp.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc2_trigger); } // osc3_trigger if (GUILayout.Button("osc3_trigger")) { _dsp.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc3_trigger); } // osc4_trigger if (GUILayout.Button("osc4_trigger")) { _dsp.SendEvent(Hv_FishSynth_01_AudioLib.Event.Osc4_trigger); } // PARAMETERS GUI.enabled = true; EditorGUILayout.Space(); EditorGUI.indentLevel++; // freq GUILayout.BeginHorizontal(); float freq = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Freq); float newFreq = EditorGUILayout.Slider("freq", freq, 100.0f, 2000.0f); if (freq != newFreq) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Freq, newFreq); } GUILayout.EndHorizontal(); // gain GUILayout.BeginHorizontal(); float gain = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Gain); float newGain = EditorGUILayout.Slider("gain", gain, 0.0f, 1.0f); if (gain != newGain) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Gain, newGain); } GUILayout.EndHorizontal(); // osc1Gain GUILayout.BeginHorizontal(); float osc1Gain = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc1gain); float newOsc1gain = EditorGUILayout.Slider("osc1Gain", osc1Gain, 0.0f, 1.0f); if (osc1Gain != newOsc1gain) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc1gain, newOsc1gain); } GUILayout.EndHorizontal(); // osc1attack GUILayout.BeginHorizontal(); float osc1attack = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc1attack); float newOsc1attack = EditorGUILayout.Slider("osc1attack", osc1attack, 1.0f, 50.0f); if (osc1attack != newOsc1attack) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc1attack, newOsc1attack); } GUILayout.EndHorizontal(); // osc1releasetime GUILayout.BeginHorizontal(); float osc1releasetime = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc1releasetime); float newOsc1releasetime = EditorGUILayout.Slider("osc1releasetime", osc1releasetime, 100.0f, 5000.0f); if (osc1releasetime != newOsc1releasetime) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc1releasetime, newOsc1releasetime); } GUILayout.EndHorizontal(); // osc2Gain GUILayout.BeginHorizontal(); float osc2Gain = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc2gain); float newOsc2gain = EditorGUILayout.Slider("osc2Gain", osc2Gain, 0.0f, 1.0f); if (osc2Gain != newOsc2gain) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc2gain, newOsc2gain); } GUILayout.EndHorizontal(); // osc2attack GUILayout.BeginHorizontal(); float osc2attack = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc2attack); float newOsc2attack = EditorGUILayout.Slider("osc2attack", osc2attack, 1.0f, 50.0f); if (osc2attack != newOsc2attack) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc2attack, newOsc2attack); } GUILayout.EndHorizontal(); // osc2releasetime GUILayout.BeginHorizontal(); float osc2releasetime = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc2releasetime); float newOsc2releasetime = EditorGUILayout.Slider("osc2releasetime", osc2releasetime, 100.0f, 5000.0f); if (osc2releasetime != newOsc2releasetime) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc2releasetime, newOsc2releasetime); } GUILayout.EndHorizontal(); // osc3Gain GUILayout.BeginHorizontal(); float osc3Gain = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc3gain); float newOsc3gain = EditorGUILayout.Slider("osc3Gain", osc3Gain, 0.0f, 1.0f); if (osc3Gain != newOsc3gain) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc3gain, newOsc3gain); } GUILayout.EndHorizontal(); // osc3attack GUILayout.BeginHorizontal(); float osc3attack = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc3attack); float newOsc3attack = EditorGUILayout.Slider("osc3attack", osc3attack, 1.0f, 50.0f); if (osc3attack != newOsc3attack) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc3attack, newOsc3attack); } GUILayout.EndHorizontal(); // osc3releasetime GUILayout.BeginHorizontal(); float osc3releasetime = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc3releasetime); float newOsc3releasetime = EditorGUILayout.Slider("osc3releasetime", osc3releasetime, 100.0f, 5000.0f); if (osc3releasetime != newOsc3releasetime) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc3releasetime, newOsc3releasetime); } GUILayout.EndHorizontal(); // osc4Gain GUILayout.BeginHorizontal(); float osc4Gain = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc4gain); float newOsc4gain = EditorGUILayout.Slider("osc4Gain", osc4Gain, 0.0f, 1.0f); if (osc4Gain != newOsc4gain) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc4gain, newOsc4gain); } GUILayout.EndHorizontal(); // osc4attack GUILayout.BeginHorizontal(); float osc4attack = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc4attack); float newOsc4attack = EditorGUILayout.Slider("osc4attack", osc4attack, 1.0f, 50.0f); if (osc4attack != newOsc4attack) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc4attack, newOsc4attack); } GUILayout.EndHorizontal(); // osc4releasetime GUILayout.BeginHorizontal(); float osc4releasetime = _dsp.GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc4releasetime); float newOsc4releasetime = EditorGUILayout.Slider("osc4releasetime", osc4releasetime, 100.0f, 5000.0f); if (osc4releasetime != newOsc4releasetime) { _dsp.SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter.Osc4releasetime, newOsc4releasetime); } GUILayout.EndHorizontal(); EditorGUI.indentLevel--; GUILayout.EndVertical(); }