net.sourceforge.geeboss.controller.thread
Class MidiThread

java.lang.Object
  extended by java.lang.Thread
      extended by net.sourceforge.geeboss.controller.thread.MidiThread
All Implemented Interfaces:
java.lang.Runnable, javax.sound.midi.Receiver, javax.sound.midi.Transmitter

public class MidiThread
extends java.lang.Thread
implements javax.sound.midi.Receiver, javax.sound.midi.Transmitter

Thread responsible of handling midi comunication

Author:
Frederic BORRY

Nested Class Summary
static class MidiThread.StampedMidiMesasge
          Inner class used to add the waitForAck status to the midi event
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MidiThread(GeebossContainer container)
          Create a new Midi thread
 
Method Summary
 void close()
           
 javax.sound.midi.Receiver getReceiver()
          Get the receiver wrapper
 void run()
           
 void send(javax.sound.midi.MidiMessage message, long timeStamp)
          Send a message to the output port if any is connected
 void send(javax.sound.midi.MidiMessage message, long timeStamp, boolean waitForAck)
          Send a message to the output port if any is connected
 void setInputPort(javax.sound.midi.MidiDevice inputPort)
          Setter for input port
 void setOutputPort(javax.sound.midi.MidiDevice outputPort)
          Setter for output port
 void setReceiver(javax.sound.midi.Receiver receiver)
          Set the receiver that will get the input port messages
 void startThread()
          Start the Midi Thread
 void stopThread()
          Stop the Midi Thread
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MidiThread

public MidiThread(GeebossContainer container)
Create a new Midi thread

Parameters:
container - the container
Method Detail

setInputPort

public void setInputPort(javax.sound.midi.MidiDevice inputPort)
Setter for input port

Parameters:
inputPort - the input port

setOutputPort

public void setOutputPort(javax.sound.midi.MidiDevice outputPort)
Setter for output port

Parameters:
outputPort - the output port

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
See Also:
Thread.run()

startThread

public void startThread()
Start the Midi Thread


stopThread

public void stopThread()
Stop the Midi Thread


close

public void close()
Specified by:
close in interface javax.sound.midi.Receiver
Specified by:
close in interface javax.sound.midi.Transmitter

send

public void send(javax.sound.midi.MidiMessage message,
                 long timeStamp)
Send a message to the output port if any is connected

Specified by:
send in interface javax.sound.midi.Receiver

send

public void send(javax.sound.midi.MidiMessage message,
                 long timeStamp,
                 boolean waitForAck)
Send a message to the output port if any is connected

Parameters:
waitForAck - if true wait for data from the device before sending another message

setReceiver

public void setReceiver(javax.sound.midi.Receiver receiver)
Set the receiver that will get the input port messages

Specified by:
setReceiver in interface javax.sound.midi.Transmitter

getReceiver

public javax.sound.midi.Receiver getReceiver()
Get the receiver wrapper

Specified by:
getReceiver in interface javax.sound.midi.Transmitter


Copyright (c) 2005 The Geeboss team (http://geeboss.sourceforge.net). All Rights Reserved.