1 /* 2 * @(#)Receiver.java 1.21 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 8 package javax.sound.midi; 9 10 11 /** 12 * A <code>Receiver</code> receives <code>{@link MidiEvent}</code> objects and 13 * typically does something useful in response, such as interpreting them to 14 * generate sound or raw MIDI output. Common MIDI receivers include 15 * synthesizers and MIDI Out ports. 16 * 17 * @see MidiDevice 18 * @see Synthesizer 19 * @see Transmitter 20 * 21 * @version 1.21, 03/12/19 22 * @author Kara Kytle 23 */ 24 public interface Receiver { 25 26 27 //$$fb 2002-04-12: fix for 4662090: Contradiction in Receiver specification 28 /** 29 * Sends a MIDI message and time-stamp to this receiver. 30 * If time-stamping is not supported by this receiver, the time-stamp 31 * value should be -1. 32 * @param message the MIDI message to send 33 * @param timeStamp the time-stamp for the message, in microseconds. 34 * @throws IllegalStateException if the receiver is closed 35 */ 36 public void send(MidiMessage message, long timeStamp); 37 38 /** 39 * Indicates that the application has finished using the receiver, and 40 * that limited resources it requires may be released or made available. 41 * 42 * <p>If the creation of this <code>Receiver</code> resulted in 43 * implicitly opening the underlying device, the device is 44 * implicitly closed by this method. This is true unless the device is 45 * kept open by other <code>Receiver</code> or <code>Transmitter</code> 46 * instances that opened the device implicitly, and unless the device 47 * has been opened explicitly. If the device this 48 * <code>Receiver</code> is retrieved from is closed explicitly by 49 * calling {@link MidiDevice#close MidiDevice.close}, the 50 * <code>Receiver</code> is closed, too. For a detailed 51 * description of open/close behaviour see the class description 52 * of {@link javax.sound.midi.MidiDevice MidiDevice}. 53 * 54 * @see javax.sound.midi.MidiSystem#getReceiver 55 */ 56 public void close(); 57 } 58