1 /* |
1 /* |
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package javax.sound.midi; |
26 package javax.sound.midi; |
27 |
27 |
28 |
|
29 /** |
28 /** |
30 * A <code>Transmitter</code> sends <code>{@link MidiEvent}</code> objects to one or more |
29 * A {@code Transmitter} sends {@link MidiEvent} objects to one or more |
31 * <code>{@link Receiver Receivers}</code>. Common MIDI transmitters include sequencers |
30 * {@link Receiver Receivers}. Common MIDI transmitters include sequencers and |
32 * and MIDI input ports. |
31 * MIDI input ports. |
33 * |
|
34 * @see Receiver |
|
35 * |
32 * |
36 * @author Kara Kytle |
33 * @author Kara Kytle |
|
34 * @see Receiver |
37 */ |
35 */ |
38 public interface Transmitter extends AutoCloseable { |
36 public interface Transmitter extends AutoCloseable { |
39 |
|
40 |
37 |
41 /** |
38 /** |
42 * Sets the receiver to which this transmitter will deliver MIDI messages. |
39 * Sets the receiver to which this transmitter will deliver MIDI messages. |
43 * If a receiver is currently set, it is replaced with this one. |
40 * If a receiver is currently set, it is replaced with this one. |
44 * @param receiver the desired receiver. |
41 * |
|
42 * @param receiver the desired receiver |
45 */ |
43 */ |
46 public void setReceiver(Receiver receiver); |
44 void setReceiver(Receiver receiver); |
47 |
|
48 |
45 |
49 /** |
46 /** |
50 * Obtains the current receiver to which this transmitter will deliver MIDI messages. |
47 * Obtains the current receiver to which this transmitter will deliver MIDI |
51 * @return the current receiver. If no receiver is currently set, |
48 * messages. |
52 * returns <code>null</code> |
49 * |
|
50 * @return the current receiver. If no receiver is currently set, returns |
|
51 * {@code null}. |
53 */ |
52 */ |
54 public Receiver getReceiver(); |
53 Receiver getReceiver(); |
55 |
|
56 |
54 |
57 /** |
55 /** |
58 * Indicates that the application has finished using the transmitter, and |
56 * Indicates that the application has finished using the transmitter, and |
59 * that limited resources it requires may be released or made available. |
57 * that limited resources it requires may be released or made available. |
60 * |
58 * <p> |
61 * <p>If the creation of this <code>Transmitter</code> resulted in |
59 * If the creation of this {@code Transmitter} resulted in implicitly |
62 * implicitly opening the underlying device, the device is |
60 * opening the underlying device, the device is implicitly closed by this |
63 * implicitly closed by this method. This is true unless the device is |
61 * method. This is true unless the device is kept open by other |
64 * kept open by other <code>Receiver</code> or <code>Transmitter</code> |
62 * {@code Receiver} or {@code Transmitter} instances that opened the device |
65 * instances that opened the device implicitly, and unless the device |
63 * implicitly, and unless the device has been opened explicitly. If the |
66 * has been opened explicitly. If the device this |
64 * device this {@code Transmitter} is retrieved from is closed explicitly by |
67 * <code>Transmitter</code> is retrieved from is closed explicitly |
65 * calling {@link MidiDevice#close MidiDevice.close}, the |
68 * by calling {@link MidiDevice#close MidiDevice.close}, the |
66 * {@code Transmitter} is closed, too. For a detailed description of |
69 * <code>Transmitter</code> is closed, too. For a detailed |
67 * open/close behaviour see the class description of |
70 * description of open/close behaviour see the class description |
68 * {@link MidiDevice MidiDevice}. |
71 * of {@link javax.sound.midi.MidiDevice MidiDevice}. |
|
72 * |
69 * |
73 * @see javax.sound.midi.MidiSystem#getTransmitter |
70 * @see javax.sound.midi.MidiSystem#getTransmitter |
74 */ |
71 */ |
75 public void close(); |
72 void close(); |
76 } |
73 } |