JavaTM 2 Platform
Std. Ed. v1.3.1

javax.sound.midi
Interface MidiDevice

All Known Subinterfaces:
Sequencer, Synthesizer

public interface MidiDevice

MidiDevice is the base interface for all MIDI devices. Common devices include synthesizers, sequencers, MIDI input ports, and MIDI output ports. A MidiDevice can be a transmitter or a receiver of MIDI events, or both. To this end, it typically also implements the Transmitter or Receiver interface (or both), or has access to objects that do.

A MidiDevice includes a MidiDevice.Info object to provide manufacturer information and so on.

See Also:
Synthesizer, Sequencer, MidiChannel.setMono(boolean)

Inner Class Summary
static class MidiDevice.Info
          A MidiDevice.Info object contains assorted data about a MidiDevice, including its name, the company who created it, and descriptive text.
 
Method Summary
 void close()
          Closes the device, indicating that the device should now release any system resources it is using.
 MidiDevice.Info getDeviceInfo()
          Obtains information about the device, including its Java class and Strings containing its name, vendor, and description.
 int getMaxReceivers()
          Obtains the maximum number of MIDI IN connections available on this MIDI device for receiving MIDI data.
 int getMaxTransmitters()
          Obtains the maximum number of MIDI OUT connections available on this MIDI device for transmitting MIDI data.
 long getMicrosecondPosition()
          Obtains the current time-stamp of the device, in microseconds.
 Receiver getReceiver()
          Obtains a MIDI IN receiver through which the MIDI device may receive MIDI data.
 Transmitter getTransmitter()
          Obtains a MIDI OUT connection from which the MIDI device will transmit MIDI data The returned transmitter must be closed when the application has finished using it.
 boolean isOpen()
          Reports whether the device is open.
 void open()
          Opens the device, indicating that it should now acquire any system resources it requires and become operational.
 

Method Detail

getDeviceInfo

public MidiDevice.Info getDeviceInfo()
Obtains information about the device, including its Java class and Strings containing its name, vendor, and description.
Returns:
device info

open

public void open()
          throws MidiUnavailableException
Opens the device, indicating that it should now acquire any system resources it requires and become operational.

Note that some devices, once closed, cannot be reopened. Attempts to reopen such a device will always result in a MidiUnavailableException.

Throws:
MidiUnavailableException - thrown if the device cannot be opened due to resource restrictions.
SecurityException - thrown if the device cannot be opened due to security restrictions.
See Also:
close(), isOpen()

close

public void close()
Closes the device, indicating that the device should now release any system resources it is using.
See Also:
open(), isOpen()

isOpen

public boolean isOpen()
Reports whether the device is open. The mechanism for opening particular devices is defined by subinterfaces and/or by classes implementing this interface.
Returns:
true if the device is open, otherwise false
See Also:
close()

getMicrosecondPosition

public long getMicrosecondPosition()
Obtains the current time-stamp of the device, in microseconds. If a device supports time-stamps, it should start counting at 0 when the device is opened and continue incrementing its time-stamp in microseconds until the device is closed. If it does not support time-stamps, it should always return -1.
Returns:
the current time-stamp of the device in microseconds, or -1 if time-stamping is not supported by the device.

getMaxReceivers

public int getMaxReceivers()
Obtains the maximum number of MIDI IN connections available on this MIDI device for receiving MIDI data.
Returns:
maximum number of MIDI IN connections

getMaxTransmitters

public int getMaxTransmitters()
Obtains the maximum number of MIDI OUT connections available on this MIDI device for transmitting MIDI data.
Returns:
maximum number of MIDI OUT connections

getReceiver

public Receiver getReceiver()
                     throws MidiUnavailableException
Obtains a MIDI IN receiver through which the MIDI device may receive MIDI data. The returned receiver must be closed when the application has finished using it.
Returns:
a receiver for the device.
Throws:
MidiUnavailableException - thrown if a receiver is not available due to resource restrictions
See Also:
Receiver.close()

getTransmitter

public Transmitter getTransmitter()
                           throws MidiUnavailableException
Obtains a MIDI OUT connection from which the MIDI device will transmit MIDI data The returned transmitter must be closed when the application has finished using it.
Returns:
a MIDI OUT transmitter for the device.
Throws:
MidiUnavailableException - thrown if a transmitter is not available due to resource restrictions
See Also:
Transmitter.close()

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.



Spec-Zone.ru - all specs in one place



free hit counter