|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.webkitchen.eeg.analysis.RatioMonitor
public class RatioMonitor
Listens for samples in two given bands, calculates the amplitude averages for each and the ratio between the two, then notifies listeners of the ratio. Objects can add themselves as listeners/observers to receive copies of all new amplitude ratios.
| Constructor Summary | |
|---|---|
RatioMonitor(int sampleSize,
double tolerance,
int minNotificationInterval)
Creates a new monitor that will calculate the ratio between the amplitude values of two filtered signals |
|
| Method Summary | |
|---|---|
void |
addAmplitudeListener(IDualAmplitudeListener listener)
Attach listener to receive notification/copies of new amplitude levels for two different frequency bands |
void |
addRatioListener(IRatioListener listener)
Attach listener to receive notification of the player's ratio of 2 wave bands |
void |
receiveBand(double sample1,
double sample2)
Processes the samples to calculate the current amplitude ratio, and notifies all listeners if the difference between the new ratio and last sent ratio is greater than our tolerance amount, or if the number of processed values has reached our minNotificationInterval |
void |
removeAllAmplitudeListeners()
Remove all listeners from our notification list |
void |
removeAllRatioListeners()
Remove all listeners from our notification list |
void |
removeAmplitudeListener(IDualAmplitudeListener listener)
Remove listener from our notification list |
void |
removeRatioListener(IRatioListener 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 |
|---|
public RatioMonitor(int sampleSize,
double tolerance,
int minNotificationInterval)
sampleSize - the number of samples to use in our RMS calculationtolerance - the amount of change in ratio required before notifying listenersminNotificationInterval - the minimum interval for notifying listeners, even if amplitude
has not changed beyond tolerance amount| Method Detail |
|---|
public void receiveBand(double sample1,
double sample2)
receiveBand in interface IDualBandSampleListenersample1 - one filtered samplesample2 - the other filtered samplepublic void addRatioListener(IRatioListener listener)
addRatioListener in interface IRatioGeneratorlistener - the observer who wants to receive the player's ratio of 2 wave bandspublic void removeRatioListener(IRatioListener listener)
removeRatioListener in interface IRatioGeneratorlistener - the observer to removepublic void removeAllRatioListeners()
removeAllRatioListeners in interface IRatioGeneratorpublic void addAmplitudeListener(IDualAmplitudeListener listener)
addAmplitudeListener in interface IDualAmplitudeGeneratorlistener - the observer who wants to receive amplitude levelspublic void removeAmplitudeListener(IDualAmplitudeListener listener)
removeAmplitudeListener in interface IDualAmplitudeGeneratorlistener - the observer to removepublic void removeAllAmplitudeListeners()
removeAllAmplitudeListeners in interface IDualAmplitudeGenerator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||