001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package javax.sound.midi;
019:
020: import java.util.List;
021:
022: public interface MidiDevice {
023: class Info {
024: private String name;
025:
026: private String vendor;
027:
028: private String description;
029:
030: private String version;
031:
032: protected Info(String name, String vendor, String description,
033: String version) {
034: this .name = name;
035: this .vendor = vendor;
036: this .description = description;
037: this .version = version;
038: }
039:
040: /*
041: * returns true when objects are the same
042: *
043: * @see java.lang.Object#equals(java.lang.Object)
044: */
045: @Override
046: public final boolean equals(Object obj) {
047: return this == obj;
048: }
049:
050: public final String getDescription() {
051: return description;
052: }
053:
054: public final String getName() {
055: return name;
056: }
057:
058: public final String getVendor() {
059: return vendor;
060: }
061:
062: public final String getVersion() {
063: return version;
064: }
065:
066: @Override
067: public final int hashCode() {
068: final int PRIME = 31;
069: int result = super .hashCode();
070: result = PRIME
071: * result
072: + ((description == null) ? 0 : description
073: .hashCode());
074: result = PRIME * result
075: + ((name == null) ? 0 : name.hashCode());
076: result = PRIME * result
077: + ((vendor == null) ? 0 : vendor.hashCode());
078: result = PRIME * result
079: + ((version == null) ? 0 : version.hashCode());
080: return result;
081: }
082:
083: @Override
084: public final String toString() {
085: return name;
086: }
087: }
088:
089: void close();
090:
091: MidiDevice.Info getDeviceInfo();
092:
093: int getMaxReceivers();
094:
095: int getMaxTransmitters();
096:
097: long getMicrosecondPosition();
098:
099: Receiver getReceiver() throws MidiUnavailableException;
100:
101: List<Receiver> getReceivers();
102:
103: Transmitter getTransmitter() throws MidiUnavailableException;
104:
105: List<Transmitter> getTransmitters();
106:
107: boolean isOpen();
108:
109: void open() throws MidiUnavailableException;
110: }
|