MidiFilter
A MidiFilter is an abstract base class which represents things which
can be done to a MIDI message before it is sent to the synthesizer.
class MidiFilter {
protected:
const char* identity;
void (*ptr)(MidiMsg*, MidiFilter*);
public:
void filter(MidiMsg*) const;
virtual void apply(State*) const;
virtual void unapply(State*) const;
};
const char* identity
- The subclass should initialize this member to point to a string
which is the name of the subclass. (e. g. "Transposer")
void (*ptr)(MidiMsg* m, MidiFilter* f)
- The subclass should initialize this member to point to a function
which filters message m based on MidiFilter f. The reason this is a
pointer to a static function, rather than a virtual member function,
is that virtual functions don't seem to work right at interrupt time.
void filter(MidiMsg* m)
- This member function filters m.
void apply(State* s)
- This member function modifies s to the state it would be if the
filter was applied, assuming it was not applied before.
void unapply(State* s)
- This member function modifies s to the state it would be if the
filter was not applied, assuming it was applied before.