public bool AddFilter(int nFreq, double dGain, double dBandwidth, double dSRate) { this.LockFilter(); if (!this.m_lstFilterBank.ContainsKey(nFreq)) { Biquad biquad = new Biquad(); biquad.RefreshFilter(dGain, (double)nFreq, dSRate, dBandwidth); this.m_lstFilterBank.Add(nFreq, biquad); } this.UnlockFilter(); return(false); }
public void ModifyFilter(int nOldFreq, int nNewFreq, double dGain, double dBandwidth, double dSRate) { this.LockFilter(); if (nOldFreq == nNewFreq) { if (this.m_lstFilterBank.ContainsKey(nOldFreq)) { this.m_lstFilterBank[nOldFreq].RefreshFilter(dGain, (double)nNewFreq, dSRate, dBandwidth); } } else if (this.m_lstFilterBank.ContainsKey(nOldFreq) && !this.m_lstFilterBank.ContainsKey(nNewFreq)) { this.m_lstFilterBank.Remove(nOldFreq); Biquad biquad = new Biquad(); biquad.RefreshFilter(dGain, (double)nNewFreq, dSRate, dBandwidth); this.m_lstFilterBank.Add(nNewFreq, biquad); } this.UnlockFilter(); }