Class MIDIEvent

java.lang.Object
   |
   +----MIDIEvent

public class MIDIEvent
extends Object
A MIDIEvent-instance stores one MIDI-event, with time, status and dataBytes.

Variable Index

 o absTime
Absolute time from starting in ticks.
 o dataVector
Vector for storing the dataBytes.
 o deltaTime
Timedifference between this and the MIDI-event before this event.
 o status
StatusByte of MIDI-event.
 o valid
Marks MIDI-event as valid or not.

Constructor Index

 o MIDIEvent()
Creates an empty invalid MIDIEvent with all variables set to -1.
 o MIDIEvent(int, int[], FileInputStream)
Creates an valid MIDIEvent, reading its data from concerning file.

Method Index

 o fromMIDI(int, int[], FileInputStream)
Reads all neccessary data from a standard MIDI-file.
 o fromTXT(int[], FileInputStream)
Reads all neccessary data from an ASCII MIDITXT-file.
 o size(int)
Size in Bytes neede to represent this MIDI-event in a standard MIDI-file.
 o toMIDI(int, FileOutputStream)
Writes itself to a standard MIDI-file.
 o toTXT(int, FileOutputStream)
Writes itself to an ASCII MIDITXT-file.
 o valid()
Returns weather this is valid or not.

Variables

 o deltaTime
 int deltaTime
Timedifference between this and the MIDI-event before this event in ticks.

 o absTime
 int absTime
Absolute time from starting in ticks.

 o valid
 boolean valid
Marks MIDI-event as valid or not.

 o status
 public int status
StatusByte of MIDI-event. If voice-message lower 4bit tell MIDI-channel.

 o dataVector
 Vector dataVector
Vector for storing the dataBytes.

Constructors

 o MIDIEvent
 public MIDIEvent()
Creates an empty invalid MIDIEvent with all variables set to -1.

 o MIDIEvent
 public MIDIEvent(int runningStatus,
                  int count[],
                  FileInputStream readFile) throws MIDIException
Creates an valid MIDIEvent, reading its data from concerning file readFIle.
If no statusByte is found in readFile, status = runningStatus.
count[0] stores all read Bytes from readFile,
count[1] stores absTime when readFile is a standard MIDI-file,
or marks endOfTrack-event reached if readFile is an ASCII MIDITXT-file.

Throws Exception if MIDI-event could not be created with readFile.

Methods

 o valid
 public boolean valid()
Returns variable valid.

 o fromTXT
 void fromTXT(int count[],
              FileInputStream readFile) throws MIDIException
Reads all neccessary data from ASCII MIDITXT-file readFile.
Throws Exception if event could not be created by readFile.

Should only be called by constructor!
Also see MIDIEvent constructor.

 o fromMIDI
 void fromMIDI(int runningStatus,
               int count[],
               FileInputStream readFile) throws MIDIException
Reads all neccessary data from standard MIDI-file readFile.
Throws Exception if event could not be created by readFile.

Should only be called by constructor!
Also see MIDIEvent constructor.

 o toTXT
 void toTXT(int track,
            FileOutputStream writeFile) throws MIDIException
Writes MIDI_event to ASCII MIDITXT-file writeFile.
track is used to print comments with trackNumber.
Throws Exception if an error occurs.

 o toMIDI
 void toMIDI(int runningStatus,
             FileOutputStream writeFile) throws MIDIException
Writes MIDI_event to standars MIDI-file writeFile.
runningStatus is used to skip status if equal to runningStatus.
Throws Exception if an error occurs.

 o size
 public int size(int runningStatus) throws MIDIException
Returns amount of Bytes used to represent this event in a standard MIDI-file.
runningStatus is used to know, weather status would be saved or not.