public class MidiFileFormat extends Object
MidiFileFormat
对象封装了一个MIDI文件的类型,以及它的长度和时间信息。
一个MidiFileFormat
对象可以包括一组属性。房地产是一对键和值:关键是String
型,相关的属性值是一个任意的对象。属性指定额外的信息元数据(如作者或版权)。属性是可选的信息,而文件阅读器和文件写入器实现不需要提供或识别属性。
下表列出了在实现中应使用的一些常见属性:
Property key | Value type | 描述 |
---|---|---|
"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
在字节的MIDI文件的长度。
|
protected float |
divisionType
MIDI文件的分型。
|
protected long |
microsecondLength
MIDI文件的持续时间在微秒。
|
protected int |
resolution
MIDI文件的定时分辨率。
|
protected int |
type
MIDI文件的类型。
|
static int |
UNKNOWN_LENGTH
表示未知长度。
|
Constructor and Description |
---|
MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds)
构建了一个
MidiFileFormat 。
|
MidiFileFormat(int type, float divisionType, int resolution, int bytes, long microseconds, Map<String,Object> properties)
构建一套性能
MidiFileFormat 。
|
Modifier and Type | Method and Description |
---|---|
int |
getByteLength()
得到了MIDI文件的长度,在8位字节表示。
|
float |
getDivisionType()
取得对MIDI文件定时分型。
|
long |
getMicrosecondLength()
得到了MIDI文件的长度,表示在微秒。
|
Object |
getProperty(String key)
获取由键指定的属性值。
|
int |
getResolution()
得到了MIDI文件的定时分辨率。
|
int |
getType()
得到的MIDI文件类型。
|
Map<String,Object> |
properties()
获取一个属性不可修改的Map。
|
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
- MIDI文件类型(0,1,或2)
divisionType
-时分型(PPQ或一个SMPTE类型)
resolution
的定时分辨率
bytes
-字节的MIDI文件的长度,或unknown_length如果不知道
microseconds
-在微秒的文件的时间,如果不知道或unknown_length
UNKNOWN_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
。
type
- MIDI文件类型(0,1,或2)
divisionType
-时分型(PPQ或一个SMPTE类型)
resolution
的定时分辨率
bytes
-字节的MIDI文件的长度,或unknown_length如果不知道
microseconds
-在微秒的文件的时间,如果不知道或unknown_length
properties
-
Map<String,Object>
对象属性
UNKNOWN_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>
对象。如果没有确认属性,则返回一个空的Map。
getProperty(String)
public Object getProperty(String key)
class description
如果指定的属性不为特定的文件格式定义,此方法返回null
。
key
-预期性能的关键
null
如果属性不存在。
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, 2014, Oracle and/or its affiliates. All rights reserved.