void LateUpdate() { //Set the frequency variable to a frequency based on sector freqAdjust(sector); //Adjust the gain according to our speed SetGain(speed); //Adjust the pan according to our screen view position SetPan(pan); //Adjust the spread according to speed SetSpread(spread); //Add harmonics according to speed SetHarmonics(harmonics); synth.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Frequency, freq); }
public override void OnInspectorGUI() { bool isEnabled = _dsp.IsInstantiated(); if (!isEnabled) { EditorGUILayout.LabelField("Press Play!", EditorStyles.centeredGreyMiniLabel); } GUILayout.BeginVertical(); // EVENTS GUI.enabled = isEnabled; EditorGUILayout.Space(); // SpreadReset if (GUILayout.Button("SpreadReset")) { _dsp.SendEvent(Hv_Boidsynth07_AudioLib.Event.Spreadreset); } // noteOn_trigger if (GUILayout.Button("noteOn_trigger")) { _dsp.SendEvent(Hv_Boidsynth07_AudioLib.Event.Noteon_trigger); } // PARAMETERS GUI.enabled = true; EditorGUILayout.Space(); EditorGUI.indentLevel++; // Frequency GUILayout.BeginHorizontal(); float Frequency = _dsp.GetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Frequency); float newFrequency = EditorGUILayout.Slider("Frequency", Frequency, 0.0f, 100.0f); if (Frequency != newFrequency) { _dsp.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Frequency, newFrequency); } GUILayout.EndHorizontal(); // Harmonics GUILayout.BeginHorizontal(); float Harmonics = _dsp.GetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Harmonics); float newHarmonics = EditorGUILayout.Slider("Harmonics", Harmonics, 0.0f, 13.0f); if (Harmonics != newHarmonics) { _dsp.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Harmonics, newHarmonics); } GUILayout.EndHorizontal(); // Spread GUILayout.BeginHorizontal(); float Spread = _dsp.GetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Spread); float newSpread = EditorGUILayout.Slider("Spread", Spread, 0.0f, 100.0f); if (Spread != newSpread) { _dsp.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Spread, newSpread); } GUILayout.EndHorizontal(); // gain GUILayout.BeginHorizontal(); float gain = _dsp.GetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Gain); float newGain = EditorGUILayout.Slider("gain", gain, 0.0f, 1.0f); if (gain != newGain) { _dsp.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Gain, newGain); } GUILayout.EndHorizontal(); // gainSmoothTime GUILayout.BeginHorizontal(); float gainSmoothTime = _dsp.GetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Gainsmoothtime); float newGainsmoothtime = EditorGUILayout.Slider("gainSmoothTime", gainSmoothTime, 1.0f, 1000.0f); if (gainSmoothTime != newGainsmoothtime) { _dsp.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Gainsmoothtime, newGainsmoothtime); } GUILayout.EndHorizontal(); // mstrAttackRelease GUILayout.BeginHorizontal(); float mstrAttackRelease = _dsp.GetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Mstrattackrelease); float newMstrattackrelease = EditorGUILayout.Slider("mstrAttackRelease", mstrAttackRelease, 1.0f, 1000.0f); if (mstrAttackRelease != newMstrattackrelease) { _dsp.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Mstrattackrelease, newMstrattackrelease); } GUILayout.EndHorizontal(); // pan GUILayout.BeginHorizontal(); float pan = _dsp.GetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Pan); float newPan = EditorGUILayout.Slider("pan", pan, 0.0f, 100.0f); if (pan != newPan) { _dsp.SetFloatParameter(Hv_Boidsynth07_AudioLib.Parameter.Pan, newPan); } GUILayout.EndHorizontal(); EditorGUI.indentLevel--; GUILayout.EndVertical(); }