This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.sound.midi
class MidiFileFormat

java.lang.Object extended by javax.sound.midi.MidiFileFormat

public 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


Field Summary
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 Summary
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 properties)

          Construct a MidiFileFormat with a set of properties.
 
Method Summary
 int

          Obtains the length of the MIDI file, expressed in 8-bit bytes.
 float

          Obtains the timing division type for the MIDI file.
 long

          Obtains the length of the MIDI file, expressed in microseconds.
 Object

          Obtain the property value specified by the key.
 int

          Obtains the timing resolution for the MIDI file.
 int

          Obtains the MIDI file type.
 Map

          Obtain an unmodifiable map of properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

byteLength

protected int byteLength
The length of the MIDI file in bytes.

divisionType

protected float divisionType
The division type of the MIDI file.

microsecondLength

protected long microsecondLength
The duration of the MIDI file in microseconds.

resolution

protected int resolution
The timing resolution of the MIDI file.

type

protected int type
The type of MIDI file.

UNKNOWN_LENGTH

public static final int UNKNOWN_LENGTH
Represents unknown length.
Constructor Detail

MidiFileFormat

public MidiFileFormat(int type,
                      float divisionType,
                      int resolution,
                      int bytes,
                      long microseconds)
Constructs a MidiFileFormat.

Parameters:
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

MidiFileFormat

public MidiFileFormat(int type,
                      float divisionType,
                      int resolution,
                      int bytes,
                      long microseconds,
                      Map properties)
Construct a MidiFileFormat with a set of properties.

Parameters:
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
Method Detail

getByteLength

public int getByteLength()
Obtains the length of the MIDI file, expressed in 8-bit bytes.

Returns:
the number of bytes in the file, or UNKNOWN_LENGTH if not known

getDivisionType

public float getDivisionType()
Obtains the timing division type for the MIDI file.

Returns:
the division type (PPQ or one of the SMPTE types)

getMicrosecondLength

public long getMicrosecondLength()
Obtains the length of the MIDI file, expressed in microseconds.

Returns:
the file's duration in microseconds, or UNKNOWN_LENGTH if not known

getProperty

public Object getProperty(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.

Parameters:
key - the key of the desired property
Returns:
the value of the property with the specified key, or null if the property does not exist.

getResolution

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.

Returns:
the number of ticks per beat (PPQ) or per frame (SMPTE)

getType

public int getType()
Obtains the MIDI file type.

Returns:
the file's type (0, 1, or 2)

properties

public Map properties()
Obtain an unmodifiable map of properties. The concept of properties is further explained in the {@link MidiFileFormat class description}.

Returns:
a Map<String,Object> object containing all properties. If no properties are recognized, an empty map is returned.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.