org.jfugue
Class TimeEventManager

java.lang.Object
  extended by org.jfugue.TimeEventManager

public class TimeEventManager
extends java.lang.Object

Takes the events in a MIDI sequence and places them into a time-based map. This is done so the events can be played back in order of when the events occur, regardless of the tracks they happen to be in. This is useful when sending events to an external device, or any occasion when iterating through the tracks is not useful because the tracks would be played sequentially rather than in parallel.

Version:
3.0
Author:
David Koelle

Constructor Summary
TimeEventManager()
           
 
Method Summary
 javax.sound.midi.MidiEvent[] getAllEventsSortedByTimestamp(javax.sound.midi.Sequence sequence)
          Returns the events from this sequence in temporal order.
 long sortSequenceByTimestamp(javax.sound.midi.Sequence sequence, java.util.Map<java.lang.Long,java.util.List> timeMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeEventManager

public TimeEventManager()
Method Detail

sortSequenceByTimestamp

public long sortSequenceByTimestamp(javax.sound.midi.Sequence sequence,
                                    java.util.Map<java.lang.Long,java.util.List> timeMap)

getAllEventsSortedByTimestamp

public javax.sound.midi.MidiEvent[] getAllEventsSortedByTimestamp(javax.sound.midi.Sequence sequence)
Returns the events from this sequence in temporal order. This is done in a two step process: 1. mapSequence() populates timeMap. Each timestamp key in timeMap is mapped to a List of events that take place at that time 2. A list of all events from all timestamps is created and returned

Returns:
The events from the sequence, in temporal order