1 package com.jamesbryangraves.bob.midi;
2
3 import java.util.List;
4
5 import javax.sound.midi.MidiDevice;
6 import javax.sound.midi.MidiUnavailableException;
7 import javax.sound.midi.Receiver;
8 import javax.sound.midi.Transmitter;
9
10 public abstract class BobMidiDevice implements MidiDevice {
11
12 private String name;
13 private String description;
14 private String vendor;
15 private String version;
16
17 private int maxReceivers;
18 private int maxTransmitters;
19
20 private long microsecondPosition = 0;
21
22 private List<Receiver> receivers;
23 private List<Transmitter> transmitters;
24
25 private Receiver receiver;
26 private Transmitter transmitter;
27
28 private boolean open = false;
29
30
31
32
33
34 public static class Info extends MidiDevice.Info {
35 protected Info(String name, String description, String vendor, String version) {
36 super(name, description, vendor, version);
37 }
38 }
39
40 public void close() {
41
42 }
43
44 public MidiDevice.Info getDeviceInfo() {
45 return new Info(name, description, vendor, version);
46 }
47
48 public int getMaxReceivers() {
49 return maxReceivers;
50 }
51
52 public int getMaxTransmitters() {
53 return maxTransmitters;
54 }
55
56 public long getMicrosecondPosition() {
57 return microsecondPosition;
58 }
59
60 public Receiver getReceiver() {
61 return receiver;
62 }
63
64 public Transmitter getTransmitter() {
65 return transmitter;
66 }
67
68 public List<Transmitter> getTransmitters() {
69 return transmitters;
70 }
71
72 public boolean isOpen() {
73 return open;
74 }
75
76 public void open() throws MidiUnavailableException {
77 open = true;
78 }
79
80 public String getName() {
81 return name;
82 }
83
84 public void setName(String name) {
85 this.name = name;
86 }
87
88 public String getDescription() {
89 return description;
90 }
91
92 public void setDescription(String description) {
93 this.description = description;
94 }
95
96 public String getVendor() {
97 return vendor;
98 }
99
100 public void setVendor(String vendor) {
101 this.vendor = vendor;
102 }
103
104 public String getVersion() {
105 return version;
106 }
107
108 public void setVersion(String version) {
109 this.version = version;
110 }
111
112 public void setMaxReceivers(int maxReceivers) {
113 this.maxReceivers = maxReceivers;
114 }
115
116 public void setMaxTransmitters(int maxTransmitters) {
117 this.maxTransmitters = maxTransmitters;
118 }
119
120 public List<Receiver> getReceivers() {
121 return receivers;
122 }
123
124 public void setReceivers(List<Receiver> receivers) {
125 this.receivers = receivers;
126 }
127
128 public void setReceiver(Receiver receiver) {
129 this.receiver = receiver;
130 }
131
132 public void setTransmitter(Transmitter transmitter) {
133 this.transmitter = transmitter;
134 }
135
136 public void setTransmitters(List<Transmitter> transmitters) {
137 this.transmitters = transmitters;
138 }
139
140 }