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)(MIDI_msg*, MidiFilter*);
public:
  void filter(MIDI_msg*) 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)(MIDI_msg* 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(MIDI_msg* 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.

Modified 26 October 1995 pepellet@mit.edu