Class WireInput

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--WireInput
All Implemented Interfaces:
javax.sound.midi.MidiDevice, java.lang.Runnable, javax.sound.midi.Transmitter

public final class WireInput
extends java.lang.Thread
implements javax.sound.midi.MidiDevice, javax.sound.midi.Transmitter

WireInput represents a MIDI input device. Active sensing is filtered out (you will not see it back). When an exception is thrown, the device is stopped automatically.

Version:
WireInput 0.97
Author:
Niels Gorisse, 22 april 1999, Bonneville

Inner classes inherited from class javax.sound.midi.MidiDevice
javax.sound.midi.MidiDevice.Info
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
WireInput()
           
 
Method Summary
 void close()
          Close this device.
 javax.sound.midi.MidiDevice.Info getDeviceInfo()
          This method is not in use.
 java.lang.String getDeviceName(int port)
          Return the name of the MidiDevice number.
 int getMaxReceivers()
           
 int getMaxTransmitters()
          Return how many Transmitters are present in the system.
 long getMicrosecondPosition()
           
 int getport()
          Wire also keeps also track of the current 'port' (-1 is none).
 javax.sound.midi.Receiver getReceiver()
          Get the current receiver to which the input goes.
 javax.sound.midi.Transmitter getTransmitter()
           
 boolean isOpen()
          Returns weither this device is open or not
 void open()
          Open this device.
 void run()
           
 void setport(int port)
          Set which port this device represents.
 void setReceiver(javax.sound.midi.Receiver receiver)
          Set to which receiver the input should go.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WireInput

public WireInput()
          throws java.lang.Exception
Method Detail

close

public void close()
Close this device. Closing never throws an exception, because when any exception occurs, the device is closed anyway to prevent that the device is located even after the program has quit.
Specified by:
close in interface javax.sound.midi.MidiDevice

getDeviceInfo

public javax.sound.midi.MidiDevice.Info getDeviceInfo()
This method is not in use. I couldn't get the constructor of MidiDevice.Info working properly..
Specified by:
getDeviceInfo in interface javax.sound.midi.MidiDevice

isOpen

public boolean isOpen()
Returns weither this device is open or not
Specified by:
isOpen in interface javax.sound.midi.MidiDevice

open

public void open()
          throws javax.sound.midi.MidiUnavailableException
Open this device.
Specified by:
open in interface javax.sound.midi.MidiDevice

run

public void run()
Overrides:
run in class java.lang.Thread

getMaxTransmitters

public int getMaxTransmitters()
Return how many Transmitters are present in the system.
Specified by:
getMaxTransmitters in interface javax.sound.midi.MidiDevice

getDeviceName

public java.lang.String getDeviceName(int port)
                               throws java.lang.Exception
Return the name of the MidiDevice number. This method should actually be part of getDeviceInfo().

setport

public void setport(int port)
             throws java.lang.Exception
Set which port this device represents. When WireInput.getInfo() works, this is unnecessary. Then you should use MidiSystem.getTransmitter(). Standard, the port is -1 (=none).

getport

public int getport()
Wire also keeps also track of the current 'port' (-1 is none).

setReceiver

public void setReceiver(javax.sound.midi.Receiver receiver)
Set to which receiver the input should go.
Specified by:
setReceiver in interface javax.sound.midi.Transmitter

getReceiver

public javax.sound.midi.Receiver getReceiver()
Get the current receiver to which the input goes.
Specified by:
getReceiver in interface javax.sound.midi.MidiDevice

getMicrosecondPosition

public long getMicrosecondPosition()
Specified by:
getMicrosecondPosition in interface javax.sound.midi.MidiDevice

getMaxReceivers

public int getMaxReceivers()
Specified by:
getMaxReceivers in interface javax.sound.midi.MidiDevice

getTransmitter

public javax.sound.midi.Transmitter getTransmitter()
Specified by:
getTransmitter in interface javax.sound.midi.MidiDevice