org.tritonus.share.midi
Class TMidiDevice

java.lang.Object
  extended by org.tritonus.share.midi.TMidiDevice
All Implemented Interfaces:
MidiDevice
Direct Known Subclasses:
AlsaMidiDevice, TDirectSynthesizer, TSequencer

public abstract class TMidiDevice
extends java.lang.Object
implements MidiDevice

Base class for MidiDevice implementations. The goal of this class is to supply the common functionality for classes that implement the interface MidiDevice.


Nested Class Summary
static class TMidiDevice.Info
           
 class TMidiDevice.TReceiver
          Receiver proxy class.
 class TMidiDevice.TTransmitter
           
 
Constructor Summary
TMidiDevice(MidiDevice.Info info)
          Initialize this class.
TMidiDevice(MidiDevice.Info info, boolean bUseTransmitter, boolean bUseReceiver)
          Initialize this class.
 
Method Summary
 void close()
           
 MidiDevice.Info getDeviceInfo()
          Retrieves a description of this instance.
 int getMaxReceivers()
           
 int getMaxTransmitters()
           
 long getMicrosecondPosition()
          Returns the device time in microseconds.
 Receiver getReceiver()
          Creates a new Receiver object associated with this instance.
 java.util.List<Receiver> getReceivers()
           
 Transmitter getTransmitter()
          Creates a new Transmitter object associated with this instance.
 java.util.List<Transmitter> getTransmitters()
           
 boolean isOpen()
           
 void open()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TMidiDevice

public TMidiDevice(MidiDevice.Info info)
Initialize this class. This sets the info from the passed one, sets the open status to false, the number of Receivers to zero and the collection of Transmitters to be empty.

Parameters:
info - The info object that describes this instance.

TMidiDevice

public TMidiDevice(MidiDevice.Info info,
                   boolean bUseTransmitter,
                   boolean bUseReceiver)
Initialize this class. This sets the info from the passed one, sets the open status to false, the number of Receivers to zero and the collection of Transmitters to be empty.

Parameters:
info - The info object that describes this instance.
Method Detail

getDeviceInfo

public MidiDevice.Info getDeviceInfo()
Retrieves a description of this instance. This returns the info object passed to the constructor.

Specified by:
getDeviceInfo in interface MidiDevice
Returns:
the description
See Also:
TMidiDevice(javax.sound.midi.MidiDevice.Info, boolean, boolean)

open

public void open()
          throws MidiUnavailableException
Specified by:
open in interface MidiDevice
Throws:
MidiUnavailableException

close

public void close()
Specified by:
close in interface MidiDevice

isOpen

public boolean isOpen()
Specified by:
isOpen in interface MidiDevice

getMicrosecondPosition

public long getMicrosecondPosition()
Returns the device time in microseconds. This is a default implementation, telling the application program that the device doesn't track time. If a device wants to give timing information, it has to override this method.

Specified by:
getMicrosecondPosition in interface MidiDevice

getMaxReceivers

public int getMaxReceivers()
Specified by:
getMaxReceivers in interface MidiDevice

getMaxTransmitters

public int getMaxTransmitters()
Specified by:
getMaxTransmitters in interface MidiDevice

getReceiver

public Receiver getReceiver()
                     throws MidiUnavailableException
Creates a new Receiver object associated with this instance. In this implementation, an unlimited number of Receivers per MidiDevice can be created.

Specified by:
getReceiver in interface MidiDevice
Throws:
MidiUnavailableException

getTransmitter

public Transmitter getTransmitter()
                           throws MidiUnavailableException
Creates a new Transmitter object associated with this instance. In this implementation, an unlimited number of Transmitters per MidiDevice can be created.

Specified by:
getTransmitter in interface MidiDevice
Throws:
MidiUnavailableException

getReceivers

public java.util.List<Receiver> getReceivers()
Specified by:
getReceivers in interface MidiDevice

getTransmitters

public java.util.List<Transmitter> getTransmitters()
Specified by:
getTransmitters in interface MidiDevice