01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: package javax.sound.midi;
19:
20: import java.util.Collections;
21: import java.util.HashMap;
22: import java.util.Map;
23:
24: public class MidiFileFormat {
25: public static final int UNKNOWN_LENGTH = -1;
26:
27: protected int byteLength;
28:
29: protected float divisionType;
30:
31: protected long microsecondLength;
32:
33: protected int resolution;
34:
35: protected int type;
36:
37: private HashMap<String, Object> properties;
38:
39: public MidiFileFormat(int type, float divisionType, int resolution,
40: int bytes, long microseconds) {
41: this .type = type;
42: this .divisionType = divisionType;
43: this .resolution = resolution;
44: this .byteLength = bytes;
45: this .microsecondLength = microseconds;
46: this .properties = new HashMap<String, Object>();
47: }
48:
49: public MidiFileFormat(int type, float divisionType, int resolution,
50: int bytes, long microseconds, Map<String, Object> properties) {
51: this .type = type;
52: this .divisionType = divisionType;
53: this .resolution = resolution;
54: this .byteLength = bytes;
55: this .microsecondLength = microseconds;
56:
57: this .properties = new HashMap<String, Object>();
58: this .properties.putAll(properties);
59: }
60:
61: public int getByteLength() {
62: return byteLength;
63: }
64:
65: public float getDivisionType() {
66: return divisionType;
67: }
68:
69: public long getMicrosecondLength() {
70: return microsecondLength;
71: }
72:
73: public Object getProperty(String key) {
74: return properties.get(key);
75: }
76:
77: public int getResolution() {
78: return resolution;
79: }
80:
81: public int getType() {
82: return type;
83: }
84:
85: public Map<String, Object> properties() {
86: return Collections.unmodifiableMap(properties);
87:
88: }
89: }
|