ftp.nice.ch/pub/next/science/physics/delta-sigma.s.tar.gz#/delta-sigma.src/include/filter.h

This is filter.h in view mode; [Download] [Up]

#ifndef FILTERH
#define FILTERH

#include "ratfn.h"

class filter{
    private:
	int numSections, numIsOdd, denSections, denIsOdd;
	vector state, feedback, feedforward;
    public:
	filter( ratfn& ); 
	double operator()(double u);
	void reset();
    friend ostream& operator<<(ostream&, const filter& );
};

struct state { cxVector v; int t; }; // THIS HAS TO BE OUTSIDE THE CLASS FOR 2.1?

class cxfilter{
    private:
	int order;
	cxVector feedback, feedforward;
	int t;		// an index into the state vector
	complex delay( int i ) { return delay_chain[(t+i-1)%order]; }
	void shift_in( const complex );
	cxVector delay_chain;
    public:
	cxfilter( ratfn& ); 
	complex simulate(complex);
	void reset();
	struct state get_state(){
	    struct state s; s.v=delay_chain; s.t=t;
	    return s;
	}
	void set_state(const struct state &s){
	    t = s.t;
	    delay_chain = s.v;
	}	    
};

#endif

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.