27 #define MINUSINFINITY -99 //Value for an infinitely negative number
43 SetSpectralRange(22050);
48 : Output(
"Output",this)
49 , Gain(
"Gain",this, &
FDFilterGen::UpdateControlChangedFlag)
50 , HighCutOff(
"High Cutoff Frecuency",this, &
FDFilterGen::UpdateControlChangedFlag)
51 , LowCutOff(
"Low Cutoff Frecuency",this, &
FDFilterGen::UpdateControlChangedFlag)
52 , PassBandSlope(
"Pass Band Slope",this, &
FDFilterGen::UpdateControlChangedFlag)
53 , StopBandSlope(
"Stop Band Slope",this, &
FDFilterGen::UpdateControlChangedFlag)
56 , mControlChanged( false )
68 if (mConfig.HasSpectralRange())
69 SpectralRange=mConfig.GetSpectralRange();
70 if (mConfig.HasGain())
72 if (mConfig.HasHighCutOff())
74 if (mConfig.HasLowCutOff())
76 if (mConfig.HasPassBandSlope())
78 if (mConfig.HasStopBandSlope())
80 if (mConfig.HasType())
81 Type=mConfig.GetType();
101 if (!mControlChanged)
return false;
102 mControlChanged=
false;
114 EScale originalScale = out.GetScale();
117 TData g,flc,fhc,spb,ssb,fsr;
140 TData fsr_by_flc = fsr/flc;
142 SetFilterPoint(out,0,0,g);
143 SetFilterPoint(out,1,flc*
CLAM_pow(2.0,-3.0/ssb),g);
144 SetFilterPoint(out,2,flc,g-3);
145 SetFilterPoint(out,3,fsr,g-3-ssb*(log(fsr_by_flc)/log(
TData(2))));
152 SetFilterPoint(out,1,fhc,g-3);
153 SetFilterPoint(out,2,fhc*
CLAM_pow(2.0,3.0/spb),g);
154 SetFilterPoint(out,3,fsr,g);
161 SetFilterPoint(out,1,flc,g-3);
162 SetFilterPoint(out,2,flc*
CLAM_pow(2.0,3.0/spb),g);
163 SetFilterPoint(out,3,fhc*
CLAM_pow(2.0,-3.0/ssb),g);
164 SetFilterPoint(out,4,fhc,g-3);
172 SetFilterPoint(out,0,0,g);
173 SetFilterPoint(out,1,flc*
CLAM_pow(2.0,-3.0/ssb),g);
174 SetFilterPoint(out,2,flc,g-3);
175 TData crossFreq=(
CLAM_pow((
double)flc,(1.0/(1.0-spb/ssb)))/
CLAM_pow((
double)fhc,(1.0/(ssb/spb-1.0))));
176 TData crossf_by_flc = crossFreq/flc;
177 SetFilterPoint(out,3,crossFreq,g-3-ssb*(log(crossf_by_flc)/log(
TData(2))));
178 SetFilterPoint(out,4,fhc,g-3);
179 SetFilterPoint(out,5,fhc*
CLAM_pow(2.0,3.0/spb),g);
180 SetFilterPoint(out,6,fsr,g);
188 BPF& bpf=out.GetMagBPF();
190 for (
int i=0; i<bpfSize; i++) {
194 tmpValue = (tmpValue==0.0001) ? 0 :
CLAM_pow(10.0,tmpValue/20.0);
205 out.GetMagBPF().SetValue(pos, mag);
206 out.GetMagBPF().SetXValue(pos,freq);
207 out.GetPhaseBPF().SetValue(pos,phase);
208 out.GetPhaseBPF().SetXValue(pos,freq);