MidiFileFormatpublic class MidiFileFormat extends Object A MidiFileFormat object encapsulates a MIDI file's
type, as well as its length and timing information.
A MidiFileFormat object can
include a set of properties. A property is a pair of key and value:
the key is of type String , the associated property
value is an arbitrary object.
Properties specify additional informational
meta data (like a author, or copyright).
Properties are optional information, and file reader and file
writer implementations are not required to provide or
recognize properties.
The following table lists some common properties that should
be used in implementations:
Property key |
Value type |
Description |
"author" |
{@link java.lang.String String} |
name of the author of this file |
"title" |
{@link java.lang.String String} |
title of this file |
"copyright" |
{@link java.lang.String String} |
copyright message |
"date" |
{@link java.util.Date Date} |
date of the recording or release |
"comment" |
{@link java.lang.String String} |
an arbitrary text |
|
Fields Summary |
---|
public static final int | UNKNOWN_LENGTHRepresents unknown length. | protected int | typeThe type of MIDI file. | protected float | divisionTypeThe division type of the MIDI file. | protected int | resolutionThe timing resolution of the MIDI file. | protected int | byteLengthThe length of the MIDI file in bytes. | protected long | microsecondLengthThe duration of the MIDI file in microseconds. | private HashMap | propertiesThe set of properties |
Constructors Summary |
---|
public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds)Constructs a MidiFileFormat .
this.type = type;
this.divisionType = divisionType;
this.resolution = resolution;
this.byteLength = bytes;
this.microsecondLength = microseconds;
this.properties = null;
| public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds, Map properties)Construct a MidiFileFormat with a set of properties.
this(type, divisionType, resolution, bytes, microseconds);
this.properties = new HashMap<String, Object>(properties);
|
Methods Summary |
---|
public int | getByteLength()Obtains the length of the MIDI file, expressed in 8-bit bytes.
return byteLength;
| public float | getDivisionType()Obtains the timing division type for the MIDI file.
return divisionType;
| public long | getMicrosecondLength()Obtains the length of the MIDI file, expressed in microseconds.
return microsecondLength;
| public java.lang.Object | getProperty(java.lang.String key)Obtain the property value specified by the key.
The concept of properties is further explained in
the {@link MidiFileFormat class description}.
If the specified property is not defined for a
particular file format, this method returns
null .
if (properties == null) {
return null;
}
return properties.get(key);
| public int | getResolution()Obtains the timing resolution for the MIDI file.
If the division type is PPQ, the resolution is specified in ticks per beat.
For SMTPE timing, the resolution is specified in ticks per frame.
return resolution;
| public int | getType()Obtains the MIDI file type.
return type;
| public java.util.Map | properties()Obtain an unmodifiable map of properties.
The concept of properties is further explained in
the {@link MidiFileFormat class description}.
Map<String,Object> ret;
if (properties == null) {
ret = new HashMap<String,Object>(0);
} else {
ret = (Map<String,Object>) (properties.clone());
}
return (Map<String,Object>) Collections.unmodifiableMap(ret);
|
|