JavaTM 2 Platform
Std. Ed. v1.3.1

javax.sound.midi
Class MidiFileFormat

java.lang.Object
  |
  +--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.

See Also:
MidiSystem.getMidiFileFormat(java.io.File), Sequencer.setSequence(java.io.InputStream stream)

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.
 
Method Summary
 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.
 int getResolution()
          Obtains the timing resolution for the MIDI file.
 int getType()
          Obtains the MIDI file type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN_LENGTH

public static final int UNKNOWN_LENGTH
Represents unknown length.

type

protected int type
The type of MIDI file.

divisionType

protected float divisionType
The division type of the MIDI file.
See Also:
Sequence.PPQ, Sequence.SMPTE_24, Sequence.SMPTE_25, Sequence.SMPTE_30DROP, Sequence.SMPTE_30

resolution

protected int resolution
The timing resolution of the MIDI file.

byteLength

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

microsecondLength

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

MidiFileFormat

public MidiFileFormat(int type,
                      float divisionType,
                      int resolution,
                      int bytes,
                      long microseconds)
Constructs a MidiFileFormat.
Parameters:
type - the MIDI file type
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
microseconds - the duration of the file in microseconds
See Also:
UNKNOWN_LENGTH, Sequence.PPQ, Sequence.SMPTE_24, Sequence.SMPTE_25, Sequence.SMPTE_30DROP, Sequence.SMPTE_30
Method Detail

getType

public int getType()
Obtains the MIDI file type.
Returns:
the file's type

getDivisionType

public float getDivisionType()
Obtains the timing division type for the MIDI file.
Returns:
the division type (PPQ or one of the SMPTE types)
See Also:
Sequence.Sequence(float, int), Sequence.PPQ, Sequence.SMPTE_24, Sequence.SMPTE_25, Sequence.SMPTE_30DROP, Sequence.SMPTE_30, Sequence.getDivisionType()

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)
See Also:
getDivisionType(), Sequence.getResolution()

getByteLength

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

getMicrosecondLength

public long getMicrosecondLength()
Obtains the length of the MIDI file, expressed in microseconds.
Returns:
the file's duration in microseconds
See Also:
Sequence.getMicrosecondLength(), getByteLength()

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.