java.lang.Object | |
↳ | javax.sound.midi.MidiFileFormat |
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" | String |
name of the author of this file |
"title" | String |
title of this file |
"copyright" | String |
copyright message |
"date" | Date |
date of the recording or release |
"comment" | String |
an arbitrary text |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | UNKNOWN_LENGTH | Represents unknown length. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
byteLength | The length of the MIDI file in bytes. | ||||||||||
divisionType | The division type of the MIDI file. | ||||||||||
microsecondLength | The duration of the MIDI file in microseconds. | ||||||||||
resolution | The timing resolution of the MIDI file. | ||||||||||
type | The type of MIDI file. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a
MidiFileFormat . | |||||||||||
Construct a
MidiFileFormat with a set of properties. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Obtains the length of the MIDI file, expressed in 8-bit bytes.
| |||||||||||
Obtains the timing division type for the MIDI file.
| |||||||||||
Obtains the length of the MIDI file, expressed in microseconds.
| |||||||||||
Obtain the property value specified by the key.
| |||||||||||
Obtains the timing resolution for the MIDI file.
| |||||||||||
Obtains the MIDI file type.
| |||||||||||
Obtain an unmodifiable map of properties.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Represents unknown length.
The length of the MIDI file in bytes.
The division type of the MIDI file.
The duration of the MIDI file in microseconds.
The timing resolution of the MIDI file.
The type of MIDI file.
Constructs a MidiFileFormat
.
type | the MIDI file type (0, 1, or 2) |
---|---|
divisionType | the timing division type (PPQ or one of the SMPTE types) |
resolution | the timing resolution |
bytes | the length of the MIDI file in bytes, or UNKNOWN_LENGTH if not known |
microseconds | the duration of the file in microseconds, or UNKNOWN_LENGTH if not known |
Construct a MidiFileFormat
with a set of properties.
type | the MIDI file type (0, 1, or 2) |
---|---|
divisionType | the timing division type (PPQ or one of the SMPTE types) |
resolution | the timing resolution |
bytes | the length of the MIDI file in bytes, or UNKNOWN_LENGTH if not known |
microseconds | the duration of the file in microseconds, or UNKNOWN_LENGTH if not known |
properties | a Map<String,Object> object
with properties |
Obtains the length of the MIDI file, expressed in 8-bit bytes.
Obtains the timing division type for the MIDI file.
Obtains the length of the MIDI file, expressed in microseconds.
Obtain the property value specified by the key.
The concept of properties is further explained in
the class description
.
If the specified property is not defined for a
particular file format, this method returns
null
.
key | the key of the desired property |
---|
null
if the property does not exist.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.
Obtains the MIDI file type.
Obtain an unmodifiable map of properties.
The concept of properties is further explained in
the class description
.
Map<String,Object>
object containing
all properties. If no properties are recognized, an empty map is
returned.