- java.lang.Object
-
- javax.sound.midi.MidiFileFormat
-
public class MidiFileFormat extends Object
AMidiFileFormat
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 typeString
, 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
-
-
Field Summary
Fields 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 Summary
Constructors Constructor and Description MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds)
Constructs aMidiFileFormat
.MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds, Map<String,Object> properties)
Construct aMidiFileFormat
with a set of properties.
-
Method Summary
Methods 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.
-
-
-
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.
-
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 aMidiFileFormat
.- 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 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 known- See Also:
UNKNOWN_LENGTH
,Sequence.PPQ
,Sequence.SMPTE_24
,Sequence.SMPTE_25
,Sequence.SMPTE_30DROP
,Sequence.SMPTE_30
-
MidiFileFormat
public MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds, Map<String,Object> properties)
Construct aMidiFileFormat
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 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
- aMap<String,Object>
object with properties- Since:
- 1.5
- 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 (0, 1, or 2)
-
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, or UNKNOWN_LENGTH if not known
- See Also:
UNKNOWN_LENGTH
-
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
- See Also:
Sequence.getMicrosecondLength()
,getByteLength()
,UNKNOWN_LENGTH
-
properties
public Map<String,Object> properties()
Obtain an unmodifiable map of properties. The concept of properties is further explained in theclass description
.- Returns:
- a
Map<String,Object>
object containing all properties. If no properties are recognized, an empty map is returned. - Since:
- 1.5
- See Also:
getProperty(String)
-
getProperty
public Object getProperty(String key)
Obtain the property value specified by the key. The concept of properties is further explained in theclass 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. - Since:
- 1.5
- See Also:
properties()
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
22/12/2024 15:23:35 Cette version de la page est en cache (à la date du 22/12/2024 15:23:35) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 31/08/2006, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/sound/midi/midifileformat.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.