State


A State is an object which keeps track of the state of all of the channels of one or more synthesizers.

class State {
public:
  typedef UtilPtr<ChannelState> ChannelStatePtr;
  typedef PerChannel<bool> ChannelUseMap;
  typedef UtilPtr<ChannelUseMap> ChannelUseMapPtr;
  State(ChannelUseMapPtr);
  void update(const MIDI_msg*);
  void change(const State*, void (*func)(const MIDI_msg&));
  ChannelStatePtr& operator()(ioref, int);
  void iterate(void (*func)(ioref, int, ChannelStatePtr*, void*), void*);
};
State(ChannelUseMapPtr u)
Creates a State which can keep track of all of the nodes/channels listed in u. The State is initialized to the default synthesizer state.
void update(const MIDI_msg* m)
This member function changes the State to reflect what it would be after the MIDI message m was sent to the synthesizer.
void change(const State* s, void (*func)(const MIDI_msg&))
This member function sends MIDI messages (using func) to cause the synthesizers to have the state of this State object, assuming that their previous state was s.
ChannelStatePtr& operator()(ioref n, int c)
This operator returns the ChannelState object which holds the state for channel c of node n.
void iterate(void (*func)(ioref n, int c, ChannelStatePtr* e, void* x), void* x)
This iterates over every node/channel combination, and calls func exactly once for each. func is given the node n, the channel c, the ChannelState e, and the additional pointer x which was passed by the caller.

Modified 17 January 1996 pepellet@mit.edu