|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttapeutils.MultiSampleAnalyzer
This class analyzes a sampled sound to extract data.
It provides a ZX81-specific implementation.
Constructor Summary | |
---|---|
MultiSampleAnalyzer(Sample sample,
SampleAnalyzerFactory factory,
TapeConverterParameters parameters)
Construct the multi sample analyzer from a sample and factory. |
Method Summary | |
---|---|
void |
addAnalysisListener(AnalysisListener l)
Register the given listener for analysis events. |
int |
analyze(int beginIndex,
boolean printMessages)
Analyze the sample to extract the data within it. |
void |
cleanUp()
Clean up the state of the sample analyzer. |
void |
clearMessages(int position)
Clear errors during analysis. |
void |
debugBitMessage(int index,
java.lang.String message)
Record the message if debugging bit processing. |
void |
debugByteMessage(int index,
java.lang.String message)
Record the message if debugging byte processing. |
boolean |
debuggingBit(int index)
Determine whether the given level of debugging is enabled at the index. |
boolean |
debuggingByte(int index)
Determine whether the given level of debugging is enabled at the index. |
boolean |
debuggingWave(int index)
Determine whether the given level of debugging is enabled at the index. |
void |
debugWaveMessage(int index,
java.lang.String message)
Record the message if debugging wave processing. |
void |
error(int position,
java.lang.String message)
Record an error during analysis. |
int |
getBitEndIndex(int bitNumber)
Get the index of the end of the given bit number. |
void |
getBitNumber(int index,
int[] pos)
Get the bit number at the given position in the sample. |
int |
getBitStartIndex(int bitNumber)
Get the index of the start of the given bit number. |
int |
getBitValue(int index)
Get the bit value at the given position in the sample. |
int |
getByte(int bytePosition)
Get the byte value at the given byte position. |
int |
getByteIndex(int bytePosition)
Get the position in the sample of the given byte. |
int |
getByteNumber(int index)
Get the byte number at the given position in the sample. |
void |
getByteNumber(int index,
int[] pos)
Get the byte number at the given position in the sample. |
byte[] |
getBytes()
Get all the bytes. |
java.lang.String |
getByteValue(int index)
Get the byte value at the given position in the sample. |
int |
getFirstBitStartIndex()
Get the index of the start of the first bit found in the sample. |
int |
getFitValue(int index)
Get the fit value at the given position in the sample. |
int |
getLastBitEndIndex()
Get the index of the end of the last bit extracted from the sample. |
int |
getMessageIndex(int messageNumber)
Get the position of an error. |
Message[] |
getMessages()
Get the error and warning messages. |
int |
getNoiseThreshold(int index)
Get the noise threshold. |
int |
getNumBytes()
Get the number of bytes. |
SampleAnalyzer |
getSampleAnalyzer(int analyzerNumber)
Get a specific sample analyzer. |
int |
getWaveValue(int index)
Get the wave value at the given position in the sample. |
boolean |
isLoadComplete()
Checks whether loading is complete. |
boolean |
isMessageError(int messageNumber)
Identifies whether a message is an error or warning |
void |
loadCompleted()
Indicates that loading is complete. |
int |
numAnalyzers()
Get the number of sample analyzers. |
int |
numErrors()
Return the number of errors. |
int |
numMessages()
Return the total number of messages generated during analysis. |
int |
numWarnings()
Return the number of warnings. |
void |
printMessages()
Print out all of the messages. |
int |
redo(boolean printMessages)
Redo the last change to the sample. |
int |
setBitValue(int index,
int value,
boolean printMessages)
Set the bit value at the given position in the sample. |
int |
undo(boolean printMessages)
Undo the last change to the sample. |
void |
warning(int position,
java.lang.String message)
Record a warning during analysis. |
void |
write(java.io.OutputStream output)
Write the bytes that have been extracted from the sample to the output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MultiSampleAnalyzer(Sample sample, SampleAnalyzerFactory factory, TapeConverterParameters parameters)
sample
- The sample.factory
- The SampleAnalyzer factory.parameters
- The ConvertParameters.Method Detail |
public int analyze(int beginIndex, boolean printMessages)
analyze
in interface SampleAnalyzer
beginIndex
- The index within the sample to begin processing.printMessages
- Indicates whether to print messages after analysis.
public boolean isLoadComplete()
isLoadComplete
in interface SampleAnalyzer
public void loadCompleted()
loadCompleted
in interface SampleAnalyzer
public void write(java.io.OutputStream output) throws java.io.IOException
write
in interface SampleAnalyzer
output
- The output stream.
java.io.IOException
- An error occurred writing to the stream.public int getWaveValue(int index)
getWaveValue
in interface SampleAnalyzer
index
- The index of the sample.
public int getFitValue(int index)
getFitValue
in interface SampleAnalyzer
index
- The index of the sample.
public int getBitValue(int index)
getBitValue
in interface SampleAnalyzer
index
- The index.
public void getBitNumber(int index, int[] pos)
getBitNumber
in interface SampleAnalyzer
index
- The index of the position in the sample.pos
- An array which will contain the bit number and offset from the start of the bit.public int getBitStartIndex(int bitNumber)
getBitStartIndex
in interface SampleAnalyzer
bitNumber
- The bit number.
public int getBitEndIndex(int bitNumber)
getBitEndIndex
in interface SampleAnalyzer
bitNumber
- The bit number.
public int setBitValue(int index, int value, boolean printMessages)
Causes re-analysis of the sample.
setBitValue
in interface SampleAnalyzer
index
- The index.value
- The new bit value.printMessages
- Indicates whether to print messages after analysis.
public int undo(boolean printMessages)
undo
in interface SampleAnalyzer
printMessages
- Indicates whether to print messages after analysis.
public int redo(boolean printMessages)
redo
in interface SampleAnalyzer
printMessages
- Indicates whether to print messages after analysis.
public java.lang.String getByteValue(int index)
getByteValue
in interface SampleAnalyzer
index
- The index.
public byte[] getBytes()
getBytes
in interface SampleAnalyzer
public int getByteNumber(int index)
getByteNumber
in interface SampleAnalyzer
index
- The index.
public void getByteNumber(int index, int[] pos)
getByteNumber
in interface SampleAnalyzer
index
- The index.pos
- An array which will contain the byte number and offset from the start of the byte.public int getByte(int bytePosition)
getByte
in interface SampleAnalyzer
bytePosition
- The index.
public int getNumBytes()
getNumBytes
in interface SampleAnalyzer
public int getByteIndex(int bytePosition)
getByteIndex
in interface SampleAnalyzer
bytePosition
- The byte number.
public int getNoiseThreshold(int index)
getNoiseThreshold
in interface SampleAnalyzer
index
- The index in the sample of the noise threshold value.
public int getFirstBitStartIndex()
getFirstBitStartIndex
in interface SampleAnalyzer
public int getLastBitEndIndex()
getLastBitEndIndex
in interface SampleAnalyzer
public void warning(int position, java.lang.String message)
warning
in interface SampleAnalyzer
position
- The position of the warning.message
- The warning message.public int numMessages()
numMessages
in interface SampleAnalyzer
public int numWarnings()
numWarnings
in interface SampleAnalyzer
public void error(int position, java.lang.String message)
error
in interface SampleAnalyzer
position
- The position of the warning.message
- The error message.public void clearMessages(int position)
clearMessages
in interface SampleAnalyzer
position
- The position from which to clear errors.public int numErrors()
numErrors
in interface SampleAnalyzer
public int getMessageIndex(int messageNumber)
getMessageIndex
in interface SampleAnalyzer
messageNumber
- The message number.
public boolean isMessageError(int messageNumber)
isMessageError
in interface SampleAnalyzer
messageNumber
- The message number.
public void printMessages()
printMessages
in interface SampleAnalyzer
public Message[] getMessages()
getMessages
in interface SampleAnalyzer
public void cleanUp()
cleanUp
in interface SampleAnalyzer
public void addAnalysisListener(AnalysisListener l)
addAnalysisListener
in interface SampleAnalyzer
l
- The listener.public SampleAnalyzer getSampleAnalyzer(int analyzerNumber)
analyzerNumber
- The number of the analyzer.
public int numAnalyzers()
public void debugWaveMessage(int index, java.lang.String message)
debugWaveMessage
in interface SampleAnalyzer
index
- The index in the sample to which the message applies.message
- public void debugBitMessage(int index, java.lang.String message)
debugBitMessage
in interface SampleAnalyzer
index
- The index in the sample to which the message applies.message
- public void debugByteMessage(int index, java.lang.String message)
debugByteMessage
in interface SampleAnalyzer
index
- The index in the sample to which the message applies.message
- public final boolean debuggingWave(int index)
debuggingWave
in interface SampleAnalyzer
index
- The index in the sample to which the message applies.
public final boolean debuggingBit(int index)
debuggingBit
in interface SampleAnalyzer
index
- The index in the sample to which the message applies.
public final boolean debuggingByte(int index)
debuggingByte
in interface SampleAnalyzer
index
- The index in the sample to which the message applies.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |