private void SetParameter(int index, double value)
{
if (index == P_TYPE)
{
FilterType = (int)(value * 6.99);
BiquadL.Type = (Biquad.FilterType)FilterType;
BiquadR.Type = (Biquad.FilterType)FilterType;
ParameterInfo[index].Display = BiquadL.Type.ToString();
}
else if (index == P_FREQ)
{
Frequency = ValueTables.Get(value, ValueTables.Response3Dec) * 22000;
BiquadL.Frequency = Frequency;
BiquadR.Frequency = Frequency;
ParameterInfo[index].Display = String.Format("{0:0.00}", Frequency);
}
else if (index == P_SLOPE)
{
Slope = value;
BiquadL.Slope = Slope;
BiquadR.Slope = Slope;
ParameterInfo[index].Display = String.Format("{0:0.00}", Slope);
}
else if (index == P_Q)
{
if (value < 0.5)
Q = 0.1 + 0.9 * 2 * value;
else
Q = 1 + (value - 0.5) * 12;
BiquadL.Q = Q;
BiquadR.Q = Q;
ParameterInfo[index].Display = String.Format("{0:0.00}", Q);
}
else if (index == P_GAIN)
{
GainDB = (2 * value - 1) * 20;
BiquadL.GainDB = GainDB;
BiquadR.GainDB = GainDB;
ParameterInfo[index].Display = String.Format("{0:0.0}", GainDB);
}
ParameterInfo[index].Value = value;
BiquadL.Update();
BiquadR.Update();
}