inpro.apps
Class SimpleMonitor

java.lang.Object
  extended by inpro.apps.SimpleMonitor
All Implemented Interfaces:
gov.nist.jrtp.RtpListener

public class SimpleMonitor
extends java.lang.Object
implements gov.nist.jrtp.RtpListener

SimpleMonitor is kind of a "mixer" application with several input ports (microphone, OAA-goals, RTP, programmatically) and several output ports (speakers or file). More or less, the software works as follows (and should probably be refactored to be self-explanatory) createMicrophoneSource() createDispatcherSource()

Author:
timo

Field Summary
(package private)  MonitorCommandLineParser clp
           
(package private)  edu.cmu.sphinx.util.props.ConfigurationManager cm
           
(package private)  java.io.FileOutputStream fileStream
           
(package private)  javax.sound.sampled.SourceDataLine line
           
private static org.apache.log4j.Logger logger
           
 
Constructor Summary
SimpleMonitor(MonitorCommandLineParser clp)
           
SimpleMonitor(MonitorCommandLineParser clp, edu.cmu.sphinx.util.props.ConfigurationManager cm)
           
 
Method Summary
(package private)  java.lang.Runnable createDispatcherSource(java.lang.String name)
          returns a runnable that will read data from an OAADispatchStream (which in turn either returns silence, sine waves, or data from audio files, depending on how it is instructed via OAA
(package private)  java.lang.Runnable createMicrophoneSource()
          returns a runnable that will continuously read data from the microphone and append the data read to the output stream(s) using newData() (see below)
(package private)  void createRTPSource()
          creates an RTP session that piepes incoming audio to newData()
(package private)  javax.sound.sampled.AudioFormat getFormat()
          defines the supported audio format
 void handleRtpErrorEvent(gov.nist.jrtp.RtpErrorEvent arg0)
           
 void handleRtpPacketEvent(gov.nist.jrtp.RtpPacketEvent arg0)
          RtpListener interface (this is used in RTP input mode)
 void handleRtpStatusEvent(gov.nist.jrtp.RtpStatusEvent arg0)
           
 void handleRtpTimeoutEvent(gov.nist.jrtp.RtpTimeoutEvent arg0)
           
static void main(java.lang.String[] args)
          main
(package private)  void newData(byte[] bytes, int offset, int length)
          handle incoming data: copy to lineout and/or filebuffer
static DispatchStream setupDispatcher()
           
(package private)  void setupFileStream()
          setup output to file
(package private)  void setupSpeakers()
          setup output to speakers
private  void startDeamon(java.lang.Runnable r, java.lang.String description)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.log4j.Logger logger

clp

final MonitorCommandLineParser clp

cm

final edu.cmu.sphinx.util.props.ConfigurationManager cm

line

javax.sound.sampled.SourceDataLine line

fileStream

java.io.FileOutputStream fileStream
Constructor Detail

SimpleMonitor

SimpleMonitor(MonitorCommandLineParser clp)
        throws gov.nist.jrtp.RtpException,
               java.io.IOException,
               edu.cmu.sphinx.util.props.PropertyException
Throws:
gov.nist.jrtp.RtpException
java.io.IOException
edu.cmu.sphinx.util.props.PropertyException

SimpleMonitor

public SimpleMonitor(MonitorCommandLineParser clp,
                     edu.cmu.sphinx.util.props.ConfigurationManager cm)
              throws gov.nist.jrtp.RtpException,
                     java.io.IOException,
                     edu.cmu.sphinx.util.props.PropertyException
Throws:
gov.nist.jrtp.RtpException
java.io.IOException
edu.cmu.sphinx.util.props.PropertyException
Method Detail

startDeamon

private void startDeamon(java.lang.Runnable r,
                         java.lang.String description)

setupFileStream

void setupFileStream()
setup output to file


setupSpeakers

void setupSpeakers()
setup output to speakers


getFormat

javax.sound.sampled.AudioFormat getFormat()
defines the supported audio format


createMicrophoneSource

java.lang.Runnable createMicrophoneSource()
returns a runnable that will continuously read data from the microphone and append the data read to the output stream(s) using newData() (see below)

Returns:
a Runnable that continuously drains the microphone and pipes its data to newData()

createDispatcherSource

java.lang.Runnable createDispatcherSource(java.lang.String name)
                                    throws edu.cmu.sphinx.util.props.PropertyException
returns a runnable that will read data from an OAADispatchStream (which in turn either returns silence, sine waves, or data from audio files, depending on how it is instructed via OAA

Returns:
a Runnable that pipes its data to newData()
Throws:
edu.cmu.sphinx.util.props.PropertyException

createRTPSource

void createRTPSource()
               throws java.net.SocketException,
                      java.net.UnknownHostException,
                      gov.nist.jrtp.RtpException
creates an RTP session that piepes incoming audio to newData()

Throws:
java.net.SocketException
java.net.UnknownHostException
gov.nist.jrtp.RtpException

handleRtpPacketEvent

public void handleRtpPacketEvent(gov.nist.jrtp.RtpPacketEvent arg0)
RtpListener interface (this is used in RTP input mode)

Specified by:
handleRtpPacketEvent in interface gov.nist.jrtp.RtpListener

handleRtpStatusEvent

public void handleRtpStatusEvent(gov.nist.jrtp.RtpStatusEvent arg0)
Specified by:
handleRtpStatusEvent in interface gov.nist.jrtp.RtpListener

handleRtpErrorEvent

public void handleRtpErrorEvent(gov.nist.jrtp.RtpErrorEvent arg0)
Specified by:
handleRtpErrorEvent in interface gov.nist.jrtp.RtpListener

handleRtpTimeoutEvent

public void handleRtpTimeoutEvent(gov.nist.jrtp.RtpTimeoutEvent arg0)
Specified by:
handleRtpTimeoutEvent in interface gov.nist.jrtp.RtpListener

setupDispatcher

public static DispatchStream setupDispatcher()

newData

void newData(byte[] bytes,
             int offset,
             int length)
handle incoming data: copy to lineout and/or filebuffer


main

public static void main(java.lang.String[] args)
main