void IntPoleZero::Apply(Signal& ASource) { AdjustSignalEnviroment(ASource); unsigned int DelayBins = FDelay/GetSignalBinTime()+1; for(unsigned int i=0;i<DelayBins;++i) { SetSignalBin(i,0); } double Integral1 = 0; double Integral2 = 0; double OutVoltage = 0; unsigned int SignalBins=GetSignalBins(); for(unsigned int i=DelayBins;i<SignalBins;++i) { double Input = ASource.GetSignalBin(i); Integral1 +=CalcPoly(FDelta1Coefficients,Input-Integral1) -CalcPoly(FDecay1Coefficients,Integral1); Integral2 +=CalcPoly(FDelta2Coefficients,Input-Integral2) -CalcPoly(FDecay2Coefficients,Integral2); OutVoltage = CalcPoly(FWeight2Coefficients,Integral2)-Integral1; SetSignalBin(i,OutVoltage); } }
void LowPass::Apply(Signal& ASource) { AdjustSignalEnviroment(ASource); unsigned int DelayBins = FDelay/GetSignalBinTime()+1; for(unsigned int i=0;i<DelayBins;++i) { SetSignalBin(i,0); } unsigned int SignalBins = GetSignalBins(); double OutVoltage = 0; for(unsigned int i=DelayBins;i<SignalBins-1;++i) { double Diff = ASource.GetSignalBin(i-DelayBins+1)-ASource.GetSignalBin(i-DelayBins); OutVoltage += CalcPoly(FDiffCoefficients,Diff) -CalcPoly(FDecayCoefficients,OutVoltage); SetSignalBin(i,OutVoltage); } }