org.jfugue
Class StreamingMidiEventManager

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

public class StreamingMidiEventManager
extends java.lang.Object

Assists the StreamingMidiRenderer in converting Patterns to MIDI.

Version:
3.2
Author:
David Koelle
See Also:
StreamingPlayer

Constructor Summary
StreamingMidiEventManager()
           
 
Method Summary
 void addEvent(int command, int data1)
          Adds a MIDI event to the current track.
 void addEvent(int command, int data1, int data2)
          Adds a MIDI event to the current track.
 void addMetaMessage(int type, byte[] bytes)
          Adds a MetaMessage to the current track.
 void addNoteEvents(byte noteValue, byte attackVelocity, byte decayVelocity, long duration, boolean addNoteOn, boolean addNoteOff)
          Adds a ShortMessage.NOTE_ON event to the current track, using attack and decay velocity values.
 void advanceTrackTimer(long duration)
          Advances the timer for the current track by the specified duration, which is specified in Pulses Per Quarter (PPQ)
 void close()
           
 long getTrackTimer()
          Returns the timer for the current track.
 void setCurrentLayer(byte layer)
          Sets the current layer within the track to which new events will be added.
 void setCurrentTrack(byte track)
          Sets the current track, or channel, to which new events will be added.
 void setTrackTimer(long newTime)
          Sets the timer for the current track by the given time, which is specified in Pulses Per Quarter (PPQ)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamingMidiEventManager

public StreamingMidiEventManager()
Method Detail

close

public void close()

setCurrentTrack

public void setCurrentTrack(byte track)
Sets the current track, or channel, to which new events will be added.

Parameters:
track - the track to select

setCurrentLayer

public void setCurrentLayer(byte layer)
Sets the current layer within the track to which new events will be added.

Parameters:
track - the track to select

advanceTrackTimer

public void advanceTrackTimer(long duration)
Advances the timer for the current track by the specified duration, which is specified in Pulses Per Quarter (PPQ)

Parameters:
duration - the duration to increase the track timer

setTrackTimer

public void setTrackTimer(long newTime)
Sets the timer for the current track by the given time, which is specified in Pulses Per Quarter (PPQ)

Parameters:
newTime - the time at which to set the track timer

getTrackTimer

public long getTrackTimer()
Returns the timer for the current track.

Returns:
the timer value for the current track, specified in Pulses Per Quarter (PPQ)

addMetaMessage

public void addMetaMessage(int type,
                           byte[] bytes)
Adds a MetaMessage to the current track.

Parameters:
command - the MIDI command represented by this message
data1 - the first data byte
data2 - the second data byte

addEvent

public void addEvent(int command,
                     int data1)
Adds a MIDI event to the current track.

Parameters:
command - the MIDI command represented by this message
data1 - the first data byte

addEvent

public void addEvent(int command,
                     int data1,
                     int data2)
Adds a MIDI event to the current track.

Parameters:
command - the MIDI command represented by this message
data1 - the first data byte
data2 - the second data byte

addNoteEvents

public void addNoteEvents(byte noteValue,
                          byte attackVelocity,
                          byte decayVelocity,
                          long duration,
                          boolean addNoteOn,
                          boolean addNoteOff)
Adds a ShortMessage.NOTE_ON event to the current track, using attack and decay velocity values. Also adds a ShortMessage.NOTE_OFF command for the note, using the duration parameter to space the NOTE_OFF command properly. Both the NOTE_ON and NOTE_OFF events can be suppressed. This is useful when notes are tied to other notes.

Parameters:
data1 - the first data byte, which contains the note value
data2 - the second data byte for the NOTE_ON event, which contains the attack velocity
data3 - the second data byte for the NOTE_OFF event, which contains the decay velocity
duration - the duration of the note
addNoteOn - whether a ShortMessage.NOTE_ON event should be created for for this event. For the end of a tied note, this should be false; otherwise it should be true.
addNoteOff - whether a ShortMessage.NOTE_OFF event should be created for for this event. For the start of a tied note, this should be false; otherwise it should be true.