edu.columbia.ee.csmit.MidiKaraoke.read
Class MidiCommandSorter

java.lang.Object
  extended by edu.columbia.ee.csmit.MidiKaraoke.read.MidiCommandSorter

public class MidiCommandSorter
extends java.lang.Object

Takes a Sequence, parses the midi commands, sorts them in time order, and calculates the time (in seconds) at which each occurs.


Nested Class Summary
static class MidiCommandSorter.Info
          Stores a MidiCommand and all the useful information about it in the midi stream, namely the track number, time in ticks, and time in seconds.
 
Constructor Summary
MidiCommandSorter()
           
 
Method Summary
static java.util.ArrayList<MidiCommandSorter.Info> sort(javax.sound.midi.Sequence seq)
          This function takes a Sequence seq, parses its midi commands, sorts them in time order, and calculates the time (in seconds) at which each occurs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MidiCommandSorter

public MidiCommandSorter()
Method Detail

sort

public static java.util.ArrayList<MidiCommandSorter.Info> sort(javax.sound.midi.Sequence seq)
                                                        throws SequenceDivisionTypeException
This function takes a Sequence seq, parses its midi commands, sorts them in time order, and calculates the time (in seconds) at which each occurs. The time in seconds is calculated by combining the tick information for each command with the tempo change commands.

Parameters:
seq -
Returns:
a time-sorted list of MidiCommandSorter.Info objects, which each contain an MidiCommand, the track for this command, the time in ticks for this command, and the time in seconds
Throws:
SequenceDivisionTypeException