Class MIDITrack
java.lang.Object
|
+----MIDITrack
- public class MIDITrack
- extends Object
A MIDITrack-instance stores all MIDI-events of a track.
It includes methods for deleting and inserting MIDI-events.
-
eventVector
- Vector for storing MIDI-events.
-
trackNumber
- Number (or ID) of track.
-
valid
- Marks track as valid (or not).
-
MIDITrack(FileInputStream)
- Creates an MIDITrack, reading its data from concerning file.
-
deleteEvent(int, int, int, byte[])
- Removes all MIDI-events described by the parameters.
-
deleteEvent(MIDIEvent, int)
- Removes all events equal to specified MIDI-event.
-
fromMIDI(FileInputStream)
- All neccessary MIDITrack-data is read from a standard MIDI-file.
-
fromTXT(FileInputStream)
- All neccessary MIDITrack-data is read from an ASCII MIDITXT-file.
-
insertEvent(MIDIEvent)
- Inserts specified MIDIEvent to eventVector if not exists jet.
-
setTrackNumber(int)
- Sets trackID.
-
size()
- Size in Bytes needed to represent this MIDITrack in a standard MIDI-file.
-
toMIDI(FileOutputStream)
- Writes itself to a standard MIDI-file.
-
toTXT(FileOutputStream)
- Writes itself to an ASCII MIDITXT-file.
-
trackNumber()
- Returns trackID.
-
valid()
- Returns valid.
trackNumber
int trackNumber
- Number (or ID) of track.
valid
boolean valid
- Marks track as valid (or not).
eventVector
Vector eventVector
- Vector for storing MIDI-events.
MIDITrack
public MIDITrack(FileInputStream readFile) throws MIDIException
- Creates MIDI-track concerning to the specified file.
Throws Exception if MIDI-track is not creatable with this file.
Filetype must be declared before: setFileType.
valid
public boolean valid()
- Returns valid.
trackNumber
public int trackNumber()
- Returns TrackID.
setTrackNumber
public void setTrackNumber(int i)
- Sets TrackID to i.
fromTXT
void fromTXT(FileInputStream readFile) throws MIDIException
- Reads all data for MIDI-track from ASCII MIDITXT-file readFile.
Throws Exception if MIDI-track is not creatable with this file.
This method should only be called by the constructor!
fromMIDI
void fromMIDI(FileInputStream readFile) throws MIDIException
- Reads all data for MIDI-track from standard MIDI-file readFile.
Throws Exception if MIDI-track is not creatable with this file.
This method should only be called by the constructor!
toTXT
public void toTXT(FileOutputStream writeFile) throws MIDIException
- Writes whole MIDITrack to ASCII MIDITXT-file writeFile.
Throws Exception if an IOError occurs.
toMIDI
public void toMIDI(FileOutputStream writeFile) throws MIDIException
- Writes whole MIDITrack to standard MIDI-file writeFile.
Throws Exception if an IOError occurs.
size
public int size() throws MIDIException
- Amount of Bytes needed to represent MIDI-track in a standard MIDI-file.
Throws Exception if MIDI-events are found, that are not representable
in a standard MIDI-file.
insertEvent
void insertEvent(MIDIEvent insert)
- Inserts MIDIEvent insert to eventVector if equal Event does not exist.
(All equal MIDIEvents are deleted before inserting!)
deleteEvent
void deleteEvent(int absTime,
int status,
int chn,
byte data[])
- Every MIDI-event that is described by the parameters is deleted.
absTime...absTime of event, or any time if absTime = -1.
status...event has statusByte status, or any statusByte if status = -1.
chn...event is send to MIDI-channel chn, or any MIDI-channel if chn = -1.
data[]...event has this following dataBytes, any if data = null.
If data is not null, data.length must be same as amount of dataBytes of event.
Each dataByte must be equal to events dataBytes, except dataBytes valued -1.
If event is not a voice-message, you must set chn to the lower 4bit of status.
(eg. to delete event with statusByte = 0xf7, status = 0xfn, chn = 0x07)
deleteEvent
void deleteEvent(MIDIEvent compare,
int chn)
- Every MIDI-event that is equal to MIDIEvent compare is deleted.
Also see deleteEvent.