Logo Search packages:      
Sourcecode: hamfax version File versions  Download package

template<class T>
T FirFilter< T >::filterSample ( const T &  sample  )  [inline]

Pass one sample through the filter and get the result as return value.

Definition at line 92 of file FirFilter.hpp.

{
        const T* c=&coeffs[0];
      T* const c_end=&coeffs[coeffs.size()];
      T* const b_begin=&buffer[0];
      T* const b_end=&buffer[buffer.size()];
        T sum=0;

        // replace oldest value with current
        *current=sample;

      // convolution
      while(current!=b_end)
            sum+=(*current++)*(*c++);
      current=b_begin;
      while(c!=c_end)
            sum+=(*current++)*(*c++);

        // point again to oldest value
        if(--current<b_begin)
                current=b_end-1;

        return sum;
}


Generated by  Doxygen 1.6.0   Back to index