NoteMap


A NoteMap is an object which keeps tracks of which notes are on; it is essentially just an array of bits; one bit for each note. Note that the NoteMap has 256 notes, even though there are only 128 notes on a MIDI synthesizer. The reason for this is that transposed notes might go above 127 or below 0, and even though these out-of-range notes get octave-wrapped before they are sent to the synthesizer, it is necessary to keep track of what the note is really supposed to be, or you could end up with stuck notes. I don't really feel like explaining why, but if you think about it hard enough you'll see that it's true.

class NoteMap {
public:
  NoteMap();
  bool get(int) const;
  void set(int);
  void clear(int);
};
NoteMap()
The constructor creates a NoteMap which is initialized to all zeros.
bool get(int i)
Returns the state of the ith note, where 0 <= i <= 255. For efficiency, i is not checked, so make sure it is in the right range.
void set(int i)
Sets the ith note to 1, where 0 <= i <= 255. For efficiency, i is not checked, so make sure it is in the right range.
void clear(int i)
Sets the ith note to 0, where 0 <= i <= 255. For efficiency, i is not checked, so make sure it is in the right range.

Modified 25 October 1995 pepellet@mit.edu