openpiano.midi
Class MidiTrack

java.lang.Object
  extended by openpiano.midi.MidiTrack

public class MidiTrack
extends Object

The MidiTrack class represents single tracks of a MIDI file

Version:
1.0, 07/30/08
Author:
Sascha Westermann

Constructor Summary
MidiTrack(int channel)
          Constructs a new MIDI track with undefined name
MidiTrack(String trackName, int channel)
          Constructs a new MIDI track
 
Method Summary
 void addMidiControl(MidiControl midiControl)
          Adds a new MIDI control message to the track
 void addMidiNote(MidiNote midiNote)
          Adds a new MIDI note to the track
 int getChannel()
          Returns the channel of the track
 int getControlPos()
          Returns the actual index of the relevant MIDI control message
 int getInstrument()
          Returns the instrument of the track
 LinkedList<MidiControl> getMidiControls()
          Returns the list of MIDI control messages
 LinkedList<MidiNote> getMidiNotes()
          Returns the list of MIDI notes
 String getName()
          Returns the name of the track
 int getVolume()
          Returns the volume of the track
 void setChannel(int channel)
          Sets the channel of the track
 void setControlPos(int controlPos)
          Sets the actual index of the relevant MIDI control message
 void setInstrument(int instrument)
          Sets the instrument of the track
 void setTrackName(String trackName)
          Sets the name of the track
 void setVolume(int volume)
          Sets the volume of the track
 void sortElements()
          Sorts the elements of a MIDI track
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MidiTrack

public MidiTrack(String trackName,
                 int channel)
Constructs a new MIDI track

Parameters:
trackName - the name of the track
channel - the channel this track relies on

MidiTrack

public MidiTrack(int channel)
Constructs a new MIDI track with undefined name

Parameters:
channel - the channel this track relies on
Method Detail

addMidiNote

public void addMidiNote(MidiNote midiNote)
Adds a new MIDI note to the track

Parameters:
midiNote - the midiNote to add

addMidiControl

public void addMidiControl(MidiControl midiControl)
Adds a new MIDI control message to the track

Parameters:
midiControl - the MIDI control message to add

getMidiNotes

public LinkedList<MidiNote> getMidiNotes()
Returns the list of MIDI notes

Returns:
the list of MIDI notes

getMidiControls

public LinkedList<MidiControl> getMidiControls()
Returns the list of MIDI control messages

Returns:
the list of MIDI control messages

setTrackName

public void setTrackName(String trackName)
Sets the name of the track

Parameters:
trackName - the name of the track

setInstrument

public void setInstrument(int instrument)
Sets the instrument of the track

Parameters:
instrument - the instrument of the track

setChannel

public void setChannel(int channel)
Sets the channel of the track

Parameters:
channel - the channel of the track

setVolume

public void setVolume(int volume)
Sets the volume of the track

Parameters:
volume - the volume of the track

getName

public String getName()
Returns the name of the track

Returns:
the name of the track

getInstrument

public int getInstrument()
Returns the instrument of the track

Returns:
the instrument of the track

getChannel

public int getChannel()
Returns the channel of the track

Returns:
the channel of the track

getVolume

public int getVolume()
Returns the volume of the track

Returns:
the volume of the track

getControlPos

public int getControlPos()
Returns the actual index of the relevant MIDI control message

Returns:
the actual index of the relevant MIDI control message

setControlPos

public void setControlPos(int controlPos)
Sets the actual index of the relevant MIDI control message

Parameters:
controlPos - the actual index of the relevant MIDI control message

sortElements

public void sortElements()
Sorts the elements of a MIDI track