parser
A parser is a class which tells Rogus how to handle incoming MIDI
messages. The idea is that once your parser has been made active,
Rogus checks the parser's msg_hnd
array, based on the
message type of the message. If msg_hnd
for that message
type is NULL, Rogus ignores the message. Otherwise, it calls the
message handler whose address is in msg_hnd
.
class parser {
public:
typedef void (*handlerp)( MIDI_msg* );
handlerp msg_hnd[8]; // handlers for the basic message types
parser();
void parse( DWORD p1, DWORD p2, UINT n );
Bool handles( DWORD p );
virtual ~parser();
};
handlerp msg_hnd[8]
- The array of message handlers. This array is initialized to be all
NULLs; your parser should set any elements it wants to be non-NULL in
its constructor.
parser()
- Constructor for parser. You should subclass parser for your own
particular application, and instantiate that subclass, rather than
actually instantiating a
parser
. Yes, parser should
really be an abstract base class, but I haven't gotten around to doing
that.
void parse( DWORD p1, DWORD p2, UINT n )
- This is a member used internally by Rogus. What it does and what
the arguments mean is none of your business. Yes, I know it shouldn't
really be a public member, but this interface is left over from
ancient, prehistoric times, and I haven't gotten around to cleaning it
up.
Bool handles( DWORD p )
- ditto.
virtual ~parser()
- The destructor. You should override this when you subclass
parser
to do whatever cleanup you want to do.
Modified 28 March 1996 pepellet@mit.edu