edu.columbia.ee.csmit.MidiKaraoke.MidiMessage
Class RawMidiMessageParser

java.lang.Object
  extended by edu.columbia.ee.csmit.MidiKaraoke.MidiMessage.RawMidiMessageParser

public class RawMidiMessageParser
extends java.lang.Object

This class provides the parse function to parse raw javax.sound.midi.MidiMessage objects. For more information on the javax.sound.midi package, visit the java API website. For more information on the format and meaning of various midi messages, google "midi file format." I personally found the website http://faydoc.tripod.com/formats/mid.htm very useful. This call can parse most, but not necessarily all midi messages. You can add to its capabilities by implementing a new Parser for a new kind of midi message. Simply call addParser to add your new parser before calling parse.


Nested Class Summary
static interface RawMidiMessageParser.Parser
          Defines a class that can parse some kind of midi message.
 
Field Summary
static byte CHANNEL_AFTER_TOUCH
           
static byte CONTINUE_STOPPED_SEQUENCE
           
static byte CONTROL_CHANGE
           
static byte COPYRIGHT_TEXT_EVENT
           
static byte CUE_POINT
           
static byte KEY_AFTER_TOUCH
           
static byte KEY_SIGNATURE
           
static byte LOWER_NIBBLE
           
static byte LYRIC
           
static byte MARKER
           
static byte META_EVENT
           
static byte NOTE_OFF
           
static byte NOTE_ON
           
static byte PITCH_WHEEL_CHANGE
           
static byte PROGRAM_CHANGE
           
static byte SEQUENCE_OR_TRACK_NAME
           
static byte SEQUENCER_SPECIFIC_INFORMATION
           
static byte SET_TEMPO
           
static byte SET_TRACK_SEQUENCE_NUMBER
           
static byte START_CURRENT_SEQUENCE
           
static byte STOP_A_SEQUENCE
           
static byte TEXT_EVENT
           
static byte TIME_SIGNATURE
           
static byte TIMING_CLOCK
           
static byte TRACK_END
           
static byte TRACK_INSTRUMENT_NAME
           
static byte UPPER_NIBBLE
           
 
Constructor Summary
RawMidiMessageParser()
          Creates a new RawMidiMessageParser.
 
Method Summary
 void addParser(RawMidiMessageParser.Parser parser)
          When (@link #parse} is called, it tries each of the parsers in its list in order until it finds a Parser what will parse the current MidiMessage.
 void addParsers(java.util.Collection<RawMidiMessageParser.Parser> parsers)
          When (@link parse} is called, it tries each of the parsers in its list in order until it finds a Parser what will parse the current MidiMessage.
 MidiCommand parse(javax.sound.midi.MidiMessage mm)
          Returns a parsed raw MidiMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPPER_NIBBLE

public static final byte UPPER_NIBBLE
See Also:
Constant Field Values

LOWER_NIBBLE

public static final byte LOWER_NIBBLE
See Also:
Constant Field Values

NOTE_OFF

public static final byte NOTE_OFF
See Also:
Constant Field Values

NOTE_ON

public static final byte NOTE_ON
See Also:
Constant Field Values

KEY_AFTER_TOUCH

public static final byte KEY_AFTER_TOUCH
See Also:
Constant Field Values

CONTROL_CHANGE

public static final byte CONTROL_CHANGE
See Also:
Constant Field Values

PROGRAM_CHANGE

public static final byte PROGRAM_CHANGE
See Also:
Constant Field Values

CHANNEL_AFTER_TOUCH

public static final byte CHANNEL_AFTER_TOUCH
See Also:
Constant Field Values

PITCH_WHEEL_CHANGE

public static final byte PITCH_WHEEL_CHANGE
See Also:
Constant Field Values

META_EVENT

public static final byte META_EVENT
See Also:
Constant Field Values

SET_TRACK_SEQUENCE_NUMBER

public static final byte SET_TRACK_SEQUENCE_NUMBER
See Also:
Constant Field Values

TEXT_EVENT

public static final byte TEXT_EVENT
See Also:
Constant Field Values

COPYRIGHT_TEXT_EVENT

public static final byte COPYRIGHT_TEXT_EVENT
See Also:
Constant Field Values

SEQUENCE_OR_TRACK_NAME

public static final byte SEQUENCE_OR_TRACK_NAME
See Also:
Constant Field Values

TRACK_INSTRUMENT_NAME

public static final byte TRACK_INSTRUMENT_NAME
See Also:
Constant Field Values

LYRIC

public static final byte LYRIC
See Also:
Constant Field Values

MARKER

public static final byte MARKER
See Also:
Constant Field Values

CUE_POINT

public static final byte CUE_POINT
See Also:
Constant Field Values

TRACK_END

public static final byte TRACK_END
See Also:
Constant Field Values

SET_TEMPO

public static final byte SET_TEMPO
See Also:
Constant Field Values

TIME_SIGNATURE

public static final byte TIME_SIGNATURE
See Also:
Constant Field Values

KEY_SIGNATURE

public static final byte KEY_SIGNATURE
See Also:
Constant Field Values

SEQUENCER_SPECIFIC_INFORMATION

public static final byte SEQUENCER_SPECIFIC_INFORMATION
See Also:
Constant Field Values

TIMING_CLOCK

public static final byte TIMING_CLOCK
See Also:
Constant Field Values

START_CURRENT_SEQUENCE

public static final byte START_CURRENT_SEQUENCE
See Also:
Constant Field Values

CONTINUE_STOPPED_SEQUENCE

public static final byte CONTINUE_STOPPED_SEQUENCE
See Also:
Constant Field Values

STOP_A_SEQUENCE

public static final byte STOP_A_SEQUENCE
See Also:
Constant Field Values
Constructor Detail

RawMidiMessageParser

public RawMidiMessageParser()
Creates a new RawMidiMessageParser. This contructor adds all the parsers it already knows about.

Method Detail

addParser

public void addParser(RawMidiMessageParser.Parser parser)
When (@link #parse} is called, it tries each of the parsers in its list in order until it finds a Parser what will parse the current MidiMessage. This function adds a new RawMidiMessageParser.Parser to the beginning of the list of parsers. So, it will be the first Parser parse tries.

Parameters:
parser - The new parser you want to add.
See Also:
addParsers(java.util.Collection)

addParsers

public void addParsers(java.util.Collection<RawMidiMessageParser.Parser> parsers)
When (@link parse} is called, it tries each of the parsers in its list in order until it finds a Parser what will parse the current MidiMessage. This function adds the new collection of parsers to the front of its parser list in the same order as the collection's iterator returns the parsers.

Parameters:
parsers - The new parsers you want to add.
See Also:
addParser(edu.columbia.ee.csmit.MidiKaraoke.MidiMessage.RawMidiMessageParser.Parser)

parse

public MidiCommand parse(javax.sound.midi.MidiMessage mm)
Returns a parsed raw MidiMessage. This function reads the raw bytes in mm and parses them for you.

Parameters:
mm - the midi message you want to parse
Returns:
the parsed message