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