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>Receiver</code> receives <code>{@link MidiEvent}</code> objects and |
29 * A {@code Receiver} receives {@link MidiEvent} objects and typically does |
31 * typically does something useful in response, such as interpreting them to |
30 * something useful in response, such as interpreting them to generate sound or |
32 * generate sound or raw MIDI output. Common MIDI receivers include |
31 * raw MIDI output. Common MIDI receivers include synthesizers and MIDI Out |
33 * synthesizers and MIDI Out ports. |
32 * ports. |
34 * |
33 * |
|
34 * @author Kara Kytle |
35 * @see MidiDevice |
35 * @see MidiDevice |
36 * @see Synthesizer |
36 * @see Synthesizer |
37 * @see Transmitter |
37 * @see Transmitter |
38 * |
|
39 * @author Kara Kytle |
|
40 */ |
38 */ |
41 public interface Receiver extends AutoCloseable { |
39 public interface Receiver extends AutoCloseable { |
42 |
40 |
|
41 //$$fb 2002-04-12: fix for 4662090: Contradiction in Receiver specification |
43 |
42 |
44 //$$fb 2002-04-12: fix for 4662090: Contradiction in Receiver specification |
|
45 /** |
43 /** |
46 * Sends a MIDI message and time-stamp to this receiver. |
44 * Sends a MIDI message and time-stamp to this receiver. If time-stamping is |
47 * If time-stamping is not supported by this receiver, the time-stamp |
45 * not supported by this receiver, the time-stamp value should be -1. |
48 * value should be -1. |
46 * |
49 * @param message the MIDI message to send |
47 * @param message the MIDI message to send |
50 * @param timeStamp the time-stamp for the message, in microseconds. |
48 * @param timeStamp the time-stamp for the message, in microseconds |
51 * @throws IllegalStateException if the receiver is closed |
49 * @throws IllegalStateException if the receiver is closed |
52 */ |
50 */ |
53 public void send(MidiMessage message, long timeStamp); |
51 void send(MidiMessage message, long timeStamp); |
54 |
52 |
55 /** |
53 /** |
56 * Indicates that the application has finished using the receiver, and |
54 * Indicates that the application has finished using the receiver, and that |
57 * that limited resources it requires may be released or made available. |
55 * limited resources it requires may be released or made available. |
58 * |
56 * <p> |
59 * <p>If the creation of this <code>Receiver</code> resulted in |
57 * If the creation of this {@code Receiver} resulted in implicitly opening |
60 * implicitly opening the underlying device, the device is |
58 * the underlying device, the device is implicitly closed by this method. |
61 * implicitly closed by this method. This is true unless the device is |
59 * This is true unless the device is kept open by other {@code Receiver} or |
62 * kept open by other <code>Receiver</code> or <code>Transmitter</code> |
60 * {@code Transmitter} instances that opened the device implicitly, and |
63 * instances that opened the device implicitly, and unless the device |
61 * unless the device has been opened explicitly. If the device this |
64 * has been opened explicitly. If the device this |
62 * {@code Receiver} is retrieved from is closed explicitly by calling |
65 * <code>Receiver</code> is retrieved from is closed explicitly by |
63 * {@link MidiDevice#close MidiDevice.close}, the {@code Receiver} is |
66 * calling {@link MidiDevice#close MidiDevice.close}, the |
64 * closed, too. For a detailed description of open/close behaviour see the |
67 * <code>Receiver</code> is closed, too. For a detailed |
65 * class description of {@link MidiDevice MidiDevice}. |
68 * description of open/close behaviour see the class description |
|
69 * of {@link javax.sound.midi.MidiDevice MidiDevice}. |
|
70 * |
66 * |
71 * @see javax.sound.midi.MidiSystem#getReceiver |
67 * @see javax.sound.midi.MidiSystem#getReceiver |
72 */ |
68 */ |
73 public void close(); |
69 void close(); |
74 } |
70 } |