|Method from com.sun.media.sound.AbstractMidiDevice Detail:|
public void close()
public void closeInternal(Object object)
Close the device for an object that implicitely opened it.
This method is intended to be used by Transmitter.close() and Receiver.close().
Those methods should pass this for the object parameter. Since Transmitters or Receivers
do not know if their device has been opened implicitely because of them, they call this
method in any case. This method now is able to seperate Receivers/Transmitters that opened
the device implicitely from those that didn't by looking up the R/T in the
openKeepingObjects list. Only if the R/T is contained there, the reference count is
protected Receiver createReceiver() throws MidiUnavailableException
Create a Receiver object.
throwing an exception here means that Receivers aren't enabled.
Subclasses that use Receivers should override this method with
one that returns objects implementing Receiver.
Classes overriding this method should also override hasReceivers()
to return true.
protected Transmitter createTransmitter() throws MidiUnavailableException
Create a Transmitter object.
throwing an exception here means that Transmitters aren't enabled.
Subclasses that use Transmitters should override this method with
one that returns objects implementing Transmitters.
Classes overriding this method should also override hasTransmitters()
to return true.
public void doClose()
protected void finalize()
close this device if discarded by the garbage collector
public Info getDeviceInfo()
public final int getMaxReceivers()
Return the maximum number of Receivers supported by this device.
Depending on the return value of hasReceivers(), this method returns either 0 or -1.
Subclasses should rather override hasReceivers() than override this method.
public final int getMaxTransmitters()
Return the maximum number of Transmitters supported by this device.
Depending on the return value of hasTransmitters(), this method returns either 0 or -1.
Subclasses should override hasTransmitters().
public long getMicrosecondPosition()
This implementation always returns -1.
Devices that actually provide this should over-ride
public final Receiver getReceiver() throws MidiUnavailableException
Retrieve a Receiver for this device.
This method returns the value returned by createReceiver(), if it doesn't throw
an exception. Subclasses should rather override createReceiver() than override
If createReceiver returns a Receiver, it is added to the internal list
of Receivers (see getReceiversList)
public Receiver getReceiverReferenceCounting() throws MidiUnavailableException
Retrieve a Receiver and open the device implicitly.
This method is called by MidiSystem.getReceiver().
public final List<Receiver> getReceivers()
public final Transmitter getTransmitter() throws MidiUnavailableException
This implementation uses createTransmitter, which may throw an exception.
If a transmitter is returned in createTransmitter, it is added to the internal
protected TransmitterList getTransmitterList()
Return the internal list of Transmitters, possibly creating it first.
public Transmitter getTransmitterReferenceCounting() throws MidiUnavailableException
Retrieve a Transmitter and open the device implicitly.
This method is called by MidiSystem.getTransmitter().
public final List<Transmitter> getTransmitters()
protected boolean hasReceivers()
Returns if this device supports Receivers.
Subclasses that use Receivers should override this method to
return true. They also should override createReceiver().
protected boolean hasTransmitters()
Returns if this device supports Transmitters.
Subclasses that use Transmitters should override this method to
return true. They also should override createTransmitter().
protected void implClose()
abstract protected void implOpen() throws MidiUnavailableException
public boolean isOpen()
public void open() throws MidiUnavailableException
Open the device from an aplication program.
Setting the open reference count to -1 here prevents Transmitters and Receivers that
opened the the device implicitly from closing it. The only way to close the device after
this call is a call to close().