public class MidiFileFormat extends Object
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 |
Modifier and Type | Field and Description |
---|---|
protected int |
byteLength
The length of the MIDI file in bytes.
|
protected float |
divisionType
The division type of the MIDI file.
|
protected long |
microsecondLength
The duration of the MIDI file in microseconds.
|
protected int |
resolution
The timing resolution of the MIDI file.
|
protected int |
type
The type of MIDI file.
|
static int |
UNKNOWN_LENGTH
Represents unknown length.
|
Constructor and Description |
---|
MidiFileFormat(int type,
float divisionType,
int resolution,
int bytes,
long microseconds)
Constructs a
MidiFileFormat . |
MidiFileFormat(int type,
float divisionType,
int resolution,
int bytes,
long microseconds,
Map<String,Object> properties)
Construct a
MidiFileFormat with a set of properties. |
Modifier and Type | Method and Description |
---|---|
int |
getByteLength()
Obtains the length of the MIDI file, expressed in 8-bit bytes.
|
float |
getDivisionType()
Obtains the timing division type for the MIDI file.
|
long |
getMicrosecondLength()
Obtains the length of the MIDI file, expressed in microseconds.
|
Object |
getProperty(String key)
Obtain the property value specified by the key.
|
int |
getResolution()
Obtains the timing resolution for the MIDI file.
|
int |
getType()
Obtains the MIDI file type.
|
Map<String,Object> |
properties()
Obtain an unmodifiable map of properties.
|
public static final int UNKNOWN_LENGTH
protected int type
protected float divisionType
protected int resolution
protected int byteLength
protected long microsecondLength
public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds)
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 resolutionbytes
- the length of the MIDI file in bytes, or UNKNOWN_LENGTH if not knownmicroseconds
- the duration of the file in microseconds, or UNKNOWN_LENGTH if not knownUNKNOWN_LENGTH
,
Sequence.PPQ
,
Sequence.SMPTE_24
,
Sequence.SMPTE_25
,
Sequence.SMPTE_30DROP
,
Sequence.SMPTE_30
public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds, Map<String,Object> properties)
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 resolutionbytes
- the length of the MIDI file in bytes,
or UNKNOWN_LENGTH if not knownmicroseconds
- the duration of the file in microseconds,
or UNKNOWN_LENGTH if not knownproperties
- a Map<String,Object>
object
with propertiesUNKNOWN_LENGTH
,
Sequence.PPQ
,
Sequence.SMPTE_24
,
Sequence.SMPTE_25
,
Sequence.SMPTE_30DROP
,
Sequence.SMPTE_30
public int getType()
public float getDivisionType()
Sequence.Sequence(float, int)
,
Sequence.PPQ
,
Sequence.SMPTE_24
,
Sequence.SMPTE_25
,
Sequence.SMPTE_30DROP
,
Sequence.SMPTE_30
,
Sequence.getDivisionType()
public int getResolution()
getDivisionType()
,
Sequence.getResolution()
public int getByteLength()
UNKNOWN_LENGTH
public long getMicrosecondLength()
Sequence.getMicrosecondLength()
,
getByteLength()
,
UNKNOWN_LENGTH
public Map<String,Object> properties()
class description
.Map<String,Object>
object containing
all properties. If no properties are recognized, an empty map is
returned.getProperty(String)
public Object getProperty(String key)
class description
.
If the specified property is not defined for a
particular file format, this method returns
null
.
key
- the key of the desired propertynull
if the property does not exist.properties()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.