WorkshopDemo
Class WorkshopProcess.ChannelDetector

java.lang.Object
  extended by WorkshopDemo.WorkshopProcess.ChannelDetector
Enclosing class:
WorkshopProcess

 class WorkshopProcess.ChannelDetector
extends java.lang.Object

Since the detector may be running on several channels, make a sub class for the actual detector code so that multiple instances may be created.

Author:
Doug

Field Summary
(package private)  double background
           
(package private)  int callCount
           
(package private)  int channel
           
(package private)  long detectionEndSample
           
(package private)  double detectionEnergy
           
(package private)  boolean detectionOn
           
(package private)  int detectionSliceCount
           
(package private)  long detectionStartSample
           
(package private) static int setupCount
           
 
Constructor Summary
WorkshopProcess.ChannelDetector(int channel)
           
 
Method Summary
private  void continueDetection(FFTDataUnit dataUnit, double energy)
           
private  void endDetection()
           
private  double energySum(Complex[] fftData, int bin1, int bin2)
           
 void newData(PamObservable o, FFTDataUnit arg)
          Performs the same funciton as newData in the outer class, but this time it should only ever get called with data for a single channel.
 void pamStart()
           
private  void startDetection(FFTDataUnit dataUnit, double energy)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

channel

int channel

detectionOn

boolean detectionOn

background

double background

callCount

int callCount

setupCount

static final int setupCount
See Also:
Constant Field Values

detectionEndSample

long detectionEndSample

detectionStartSample

long detectionStartSample

detectionEnergy

double detectionEnergy

detectionSliceCount

int detectionSliceCount
Constructor Detail

WorkshopProcess.ChannelDetector

public WorkshopProcess.ChannelDetector(int channel)
Method Detail

pamStart

public void pamStart()

newData

public void newData(PamObservable o,
                    FFTDataUnit arg)
Performs the same funciton as newData in the outer class, but this time it should only ever get called with data for a single channel. For the first few calls, it just updates the background by taking a straight mean of the energy values. After that it calculates a decaying average of the background.

Parameters:
o -
arg -

energySum

private double energySum(Complex[] fftData,
                         int bin1,
                         int bin2)

startDetection

private void startDetection(FFTDataUnit dataUnit,
                            double energy)

continueDetection

private void continueDetection(FFTDataUnit dataUnit,
                               double energy)

endDetection

private void endDetection()