Class MIDIUtil
java.lang.Object
|
+----MIDIUtil
- public class MIDIUtil
- extends Object
Methods for handling IO, VarLenCode, Timeing ...
-
BAROFFSET
- Marks number of first bar (typically: 0 or 1).
-
COMMENTS
- Marks weather MIDITXT-files are commented (or not).
-
DENOMINATOR
- Current Denominator.
-
DIVISION
- Current Division.
-
FILETYPE
- True if standard MIDI-file, false if ASCII MIDITXT-file.
-
GERMAN
- If true, b is written as h.
-
NUMERATOR
- Current Numerator.
-
PROGRAMOFFSET
- Marks beginning of ProgramChange-number (typically: 0 or 1).
-
SMPTE
- Current SMPTE-rate.
-
TEMPO
- Current Tempo.
-
MIDIUtil()
-
-
getAbsTime(String)
- Returns value of absTime in ticks, represented by PPQN-String.
-
getInt(int, FileInputStream)
- Returns value read from file.
-
getLine(FileInputStream)
- Returns String representing a Line read from file.
-
getNextToken(FileInputStream)
- Returns Token read from file.
-
getNextValidToken(FileInputStream)
- Returns valid Token read from file.
-
getString(int, FileInputStream)
- Returns String read from file.
-
getTicks()
- Returns number of ticks, each beat endures.
-
getVarLen(int[], FileInputStream)
- Returns value stored as VariableLengthCode in file.
-
putComment(String, FileOutputStream)
- Writes comment to file.
-
putCopyright(FileOutputStream)
- Writes copyright-comments to file.
-
putInt(int, int, FileOutputStream)
- Writes int to file.
-
putString(String, FileOutputStream)
- Writes String to file.
-
putString(String, int, FileOutputStream)
- Writes String to file.
-
putVarLen(int, FileOutputStream)
- Writes value as VariableLengthCode to file.
-
setBarOffset(int)
- Sets BAROFFSET.
-
setComments(boolean)
- Sets current COMMENTS.
-
setDenominator(int)
- Sets current DENOMINATOR.
-
setDivision(int)
- Sets current DIVISION.
-
setFileType(boolean)
- Sets FILETYPE.
-
setGerman(boolean)
- Sets GERMAN.
-
setNumerator(int)
- Sets current NUMERATOR.
-
setProgramOffset(int)
- Sets PROGRAMOFFSET.
-
setSmpte(int)
- Sets current SMPTE.
-
setTempo(int)
- Sets current TEMPO.
-
skipLine(FileInputStream)
- Skips all Bytes in the current line from file.
NUMERATOR
static int NUMERATOR
- Sets current Numerator (typically 3 or 4).
DENOMINATOR
static int DENOMINATOR
- Sets current Denominator (note: 2=quarters 3=eights ...).
TEMPO
static int TEMPO
- Sets current Tempo (in microSeconds, 500.000 = 120 BPM).
SMPTE
static int SMPTE
- Sets current SMPTE-rate (24,25,29 or 29 FPS; 0 for OFF).
DIVISION
static int DIVISION
- Sets current Division (typically: 192,384 for PPQN; 20,40,80 for SMPTE).
FILETYPE
static boolean FILETYPE
- If true: file is standard MIDI-file; if false: file is an ASCII-file.
COMMENTS
static boolean COMMENTS
- If true: comments are added to MIDITXT-file.
GERMAN
static boolean GERMAN
- If true: the note b is written as h.
PROGRAMOFFSET
static int PROGRAMOFFSET
- Marks beginning of ProgramChange-number (typically: 0 or 1).
BAROFFSET
static int BAROFFSET
- Marks number of first bar (typically: 0 or 1).
MIDIUtil
public MIDIUtil()
setNumerator
public static void setNumerator(int i)
- Sets current NUMERATOR to i.
setDenominator
public static void setDenominator(int i)
- Sets current DENOMINATOR to i.
setTempo
public static void setTempo(int i)
- Sets current TEMPO to i.
setSmpte
public static void setSmpte(int i)
- Sets current SMPTE-rate to i.
setDivision
public static void setDivision(int i)
- Sets current DIVISION to i.
setComments
public static void setComments(boolean b)
- Sets COMMENTS to b.
setFileType
public static void setFileType(boolean b)
- Sets FILETYPE to b.
setGerman
public static void setGerman(boolean b)
- Sets GERMAN to b.
setProgramOffset
public static void setProgramOffset(int i)
- Sets PROGRAMOFFSET to i.
setBarOffset
public static void setBarOffset(int i)
- Sets BAROFFSET to i.
getTicks
public static double getTicks()
- Returns value representing the ticks each beat endures.
Needed to represent absTime in PPQN-notation.
getAbsTime
public static int getAbsTime(String s) throws MIDIException
- Returns absTime represented by String s.
Throws Exception if s is not in PPQN-notation.
getInt
public static int getInt(int length,
FileInputStream fpp) throws MIDIException
- Returns int represented by length Bytes read from file fpp.
Throws Exception if IOError occurs.
putInt
public static void putInt(int value,
int length,
FileOutputStream fpp) throws MIDIException
- Writes value to file fpp, using length Bytes.
Throws Exception if IOError occurs.
getVarLen
public static int getVarLen(int count[],
FileInputStream fpp) throws MIDIException
- Reads value stored as VLC from file fpp.
Number of read Bytes is stored in count[0].
Throws Exception if IOError occurs.
putVarLen
public static void putVarLen(int value,
FileOutputStream fpp) throws MIDIException
- Writes value as VLC to file fpp.
Throws Exception if IOError occurs.
getString
public static String getString(int length,
FileInputStream fpp) throws MIDIException
- Reads length Bytes from file fpp, and returns them as a String.
Throws Exception if IOError occurs.
putString
public static void putString(String s,
int length,
FileOutputStream fpp) throws MIDIException
- Writes only lenght Chars of String s to file fpp.
Throws Exception if IOError occurs.
putString
public static void putString(String s,
FileOutputStream fpp) throws MIDIException
- Writes String s to file fpp.
Throws Exception if IOError occurs.
putComment
public static void putComment(String s,
FileOutputStream fpp) throws MIDIException
- Writes String s as comment to file fpp.
Throws Exception if IOError occurs.
putCopyright
public static void putCopyright(FileOutputStream fpp) throws MIDIException
- Writes copyright-comments to file fpp.
Throws Exception if IOError occurs.
getLine
public static String getLine(FileInputStream fpp) throws MIDIException
- Reads a line from file fpp, and returns it as a String.
Throws Exception if IOError occurs.
skipLine
public static void skipLine(FileInputStream fpp) throws MIDIException
- Skips all Bytes in the current line from file fpp.
Throws Exception if IOError occurs.
getNextToken
public static String getNextToken(FileInputStream fpp) throws MIDIException
- Returns a String representing a Token read from file fpp.
Returns EOF if no more token can be found in file fpp.
Throws Exception if IOError occurs.
getNextValidToken
public static String getNextValidToken(FileInputStream fpp) throws MIDIException
- Returns a String representing a valid Token read from file fpp.
Throws Exception if IOError occurs.