tapeutils.impl
Class SineWaveIdentifier

java.lang.Object
  extended bytapeutils.impl.SineWaveIdentifier
All Implemented Interfaces:
WaveIdentifier

public class SineWaveIdentifier
extends java.lang.Object
implements WaveIdentifier

This class provides an identifier for sine waves within a sampled sound.

Author:
hldswrth

Constructor Summary
SineWaveIdentifier(Sample sample, SampleAnalyzer analyzer, int noiseThreshold, int maxWaveLength, WaveProcessor processor)
          Construct the processor from a sample.
 
Method Summary
 void cleanUp()
          Clean up the state of the wave identifier.
 void completeProcessing()
          Complete processing of the last wave, if necessary.
 int getActualMaxWaveLength()
          Get the actual maximum wave width.
 int getActualMinWaveLength()
          Get the actual minimum wave width.
 int getAverageWaveLength()
          Get the actual average wave width.
 int getFitValue(int index)
          Get the fit value at the given position in the sample.
 int getNoiseThreshold()
          Get the noise threshold.
 int getWaveValue(int index)
          Get the wave value at the given position in the sample.
 int identifyNextWave(int pos, int sampleValue)
          Identify the next wave in the sample.
 void initialize()
          Initialize this object ready for processing a sample.
 boolean processingDropOut()
          Return an indicator of whether we are currently processing a drop out of the signal.
 void startProcessingDropOut(int restoreIndex)
          Start processing a drop-out in the signal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SineWaveIdentifier

public SineWaveIdentifier(Sample sample,
                          SampleAnalyzer analyzer,
                          int noiseThreshold,
                          int maxWaveLength,
                          WaveProcessor processor)
Construct the processor from a sample.

Parameters:
sample - The sample.
analyzer - The sample analyzer.
noiseThreshold - The noise threshold for processing.
maxWaveLength - The maximum wave length.
processor - The wave processor.
Method Detail

initialize

public void initialize()
Initialize this object ready for processing a sample.

Specified by:
initialize in interface WaveIdentifier

identifyNextWave

public int identifyNextWave(int pos,
                            int sampleValue)
Identify the next wave in the sample.

Specified by:
identifyNextWave in interface WaveIdentifier
Parameters:
pos - The current position in the sample.
sampleValue - The current sample value.
Returns:
The next position in the sample.

completeProcessing

public void completeProcessing()
Complete processing of the last wave, if necessary.

Specified by:
completeProcessing in interface WaveIdentifier

processingDropOut

public boolean processingDropOut()
Return an indicator of whether we are currently processing a drop out of the signal.

Specified by:
processingDropOut in interface WaveIdentifier
Returns:
Indicates whether we are processing a drop-out.

startProcessingDropOut

public void startProcessingDropOut(int restoreIndex)
Start processing a drop-out in the signal.

Specified by:
startProcessingDropOut in interface WaveIdentifier
Parameters:
restoreIndex - The index of the sample to restore normal processing.

getActualMinWaveLength

public int getActualMinWaveLength()
Get the actual minimum wave width.

Specified by:
getActualMinWaveLength in interface WaveIdentifier
Returns:
The actual minimum wave width.

getActualMaxWaveLength

public int getActualMaxWaveLength()
Get the actual maximum wave width.

Specified by:
getActualMaxWaveLength in interface WaveIdentifier
Returns:
The actual maximum wave width.

getAverageWaveLength

public int getAverageWaveLength()
Get the actual average wave width.

Specified by:
getAverageWaveLength in interface WaveIdentifier
Returns:
The actual average wave width.

getNoiseThreshold

public int getNoiseThreshold()
Get the noise threshold.

Specified by:
getNoiseThreshold in interface WaveIdentifier
Returns:
The noise threshold.

getWaveValue

public int getWaveValue(int index)
Get the wave value at the given position in the sample.

Specified by:
getWaveValue in interface WaveIdentifier
Parameters:
index - The index of the sample.
Returns:
The wave value.

getFitValue

public int getFitValue(int index)
Get the fit value at the given position in the sample.

Specified by:
getFitValue in interface WaveIdentifier
Parameters:
index - The index of the sample.
Returns:
The fit value.

cleanUp

public void cleanUp()
Clean up the state of the wave identifier.

Specified by:
cleanUp in interface WaveIdentifier