com.webkitchen.brainathlon.gameComponents
Class SpectrumFilter

java.lang.Object
  extended by com.webkitchen.brainathlon.gameComponents.SpectrumFilter
All Implemented Interfaces:
ISpectrumGenerator, IChannelSampleListener, java.util.EventListener

public class SpectrumFilter
extends java.lang.Object
implements IChannelSampleListener, ISpectrumGenerator

Listens for new raw samples, filters the raw data into the four standard frequency bands of Beta, Alpha, Theta and Delta, then notifies listeners of the latest values values packaged in a Spectrum. Objects can add themselves as listeners/observers to receive copies of all new Spectrums.

See Also:
ISpectrumGenerator, ISpectrumListener, Spectrum

Constructor Summary
SpectrumFilter()
          Creates a new filter that notifies listeners of sample values in the four standard frequency bands of Beta, Alpha, Theta and Delta
 
Method Summary
 void addSpectrumListener(ISpectrumListener listener)
          Attach listener to receive notification/copies of all new spectrums
 void receiveSample(double rawSample)
          Processes the sample to filter for our four frequency bands, and notifies our listeners of the latest sample values
 void removeAllSpectrumListeners()
          Remove all listeners from our notification list
 void removeSpectrumListener(ISpectrumListener listener)
          Remove listener from our notification list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpectrumFilter

public SpectrumFilter()
Creates a new filter that notifies listeners of sample values in the four standard frequency bands of Beta, Alpha, Theta and Delta

Method Detail

receiveSample

public void receiveSample(double rawSample)
Processes the sample to filter for our four frequency bands, and notifies our listeners of the latest sample values

Specified by:
receiveSample in interface IChannelSampleListener
Parameters:
rawSample - the raw sample that we will process

addSpectrumListener

public void addSpectrumListener(ISpectrumListener listener)
Attach listener to receive notification/copies of all new spectrums

Specified by:
addSpectrumListener in interface ISpectrumGenerator
Parameters:
listener - the observer who wants to receive spectrums

removeSpectrumListener

public void removeSpectrumListener(ISpectrumListener listener)
Remove listener from our notification list

Specified by:
removeSpectrumListener in interface ISpectrumGenerator
Parameters:
listener - the observer to remove

removeAllSpectrumListeners

public void removeAllSpectrumListeners()
Remove all listeners from our notification list

Specified by:
removeAllSpectrumListeners in interface ISpectrumGenerator