// see Hv_FishSynth_01_AudioLib.Parameter for definitions public float GetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter param) { switch (param) { case Parameter.Freq: return(freq); case Parameter.Gain: return(gain); case Parameter.Osc1gain: return(osc1Gain); case Parameter.Osc1attack: return(osc1attack); case Parameter.Osc1releasetime: return(osc1releasetime); case Parameter.Osc2gain: return(osc2Gain); case Parameter.Osc2attack: return(osc2attack); case Parameter.Osc2releasetime: return(osc2releasetime); case Parameter.Osc3gain: return(osc3Gain); case Parameter.Osc3attack: return(osc3attack); case Parameter.Osc3releasetime: return(osc3releasetime); case Parameter.Osc4gain: return(osc4Gain); case Parameter.Osc4attack: return(osc4attack); case Parameter.Osc4releasetime: return(osc4releasetime); default: return(0.0f); } }
public void SetFloatParameter(Hv_FishSynth_01_AudioLib.Parameter param, float x) { switch (param) { case Parameter.Freq: { x = Mathf.Clamp(x, 100.0f, 2000.0f); freq = x; break; } case Parameter.Gain: { x = Mathf.Clamp(x, 0.0f, 1.0f); gain = x; break; } case Parameter.Osc1gain: { x = Mathf.Clamp(x, 0.0f, 1.0f); osc1Gain = x; break; } case Parameter.Osc1attack: { x = Mathf.Clamp(x, 1.0f, 50.0f); osc1attack = x; break; } case Parameter.Osc1releasetime: { x = Mathf.Clamp(x, 100.0f, 5000.0f); osc1releasetime = x; break; } case Parameter.Osc2gain: { x = Mathf.Clamp(x, 0.0f, 1.0f); osc2Gain = x; break; } case Parameter.Osc2attack: { x = Mathf.Clamp(x, 1.0f, 50.0f); osc2attack = x; break; } case Parameter.Osc2releasetime: { x = Mathf.Clamp(x, 100.0f, 5000.0f); osc2releasetime = x; break; } case Parameter.Osc3gain: { x = Mathf.Clamp(x, 0.0f, 1.0f); osc3Gain = x; break; } case Parameter.Osc3attack: { x = Mathf.Clamp(x, 1.0f, 50.0f); osc3attack = x; break; } case Parameter.Osc3releasetime: { x = Mathf.Clamp(x, 100.0f, 5000.0f); osc3releasetime = x; break; } case Parameter.Osc4gain: { x = Mathf.Clamp(x, 0.0f, 1.0f); osc4Gain = x; break; } case Parameter.Osc4attack: { x = Mathf.Clamp(x, 1.0f, 50.0f); osc4attack = x; break; } case Parameter.Osc4releasetime: { x = Mathf.Clamp(x, 100.0f, 5000.0f); osc4releasetime = x; break; } default: return; } if (IsInstantiated()) { _context.SendFloatToReceiver((uint)param, x); } }