|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objecttapeutils.impl.zx81.ZX81SampleAnalyzer
This class analyzes a sampled sound to extract data.
It provides a ZX81-specific implementation.
| Constructor Summary | |
|---|---|
ZX81SampleAnalyzer(Sample sample,
ZX81SampleAnalyzerParameters params)
Construct the sample analyzer from a sample. |
|
| 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 index)
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 number)
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 number)
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 byteNumber)
Get the byte value at the given index. |
int |
getByteIndex(int number)
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 a message. |
Message[] |
getMessages()
Get the error and warning messages. |
int |
getNoiseThreshold(int index)
Get the noise threshold. |
int |
getNumBytes()
Get the number of bytes. |
java.lang.String |
getProgramName()
Get the name of the program. |
byte[] |
getProgramNameBytes()
Get the name of the program as bytes. |
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 |
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. |
void |
setDebugLevels(DebugLevels levels)
Set debug levels. |
void |
setProgramName(java.lang.String name)
Set the name of the program. |
void |
setProgramNameBytes(byte[] bytes,
int length)
Set the name of the program as bytes. |
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 extraced 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 ZX81SampleAnalyzer(Sample sample,
ZX81SampleAnalyzerParameters params)
sample - The sample.params - The parameters.| Method Detail |
public int analyze(int beginIndex,
boolean printMessages)
analyze in interface SampleAnalyzerbeginIndex - The index within the sample to begin processing.printMessages - Indicates whether to print messages after analysis.
public boolean isLoadComplete()
isLoadComplete in interface SampleAnalyzerpublic void loadCompleted()
loadCompleted in interface SampleAnalyzer
public void write(java.io.OutputStream output)
throws java.io.IOException
write in interface SampleAnalyzeroutput - The output stream.
java.io.IOException - An error occurred writing to the stream.public int getWaveValue(int index)
getWaveValue in interface SampleAnalyzerindex - The index of the sample.
public int getFitValue(int index)
getFitValue in interface SampleAnalyzerindex - The index of the sample.
public int getBitValue(int index)
getBitValue in interface SampleAnalyzerindex - The index.
public void getBitNumber(int index,
int[] pos)
getBitNumber in interface SampleAnalyzerindex - 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 number)
getBitStartIndex in interface SampleAnalyzernumber - The bit number.
public int getBitEndIndex(int number)
getBitEndIndex in interface SampleAnalyzernumber - The bit number.
public int setBitValue(int index,
int value,
boolean printMessages)
Causes re-analysis of the sample.
setBitValue in interface SampleAnalyzerindex - The index.value - The new bit value.printMessages - Indicates whether to print messages after analysis.
public int undo(boolean printMessages)
undo in interface SampleAnalyzerprintMessages - Indicates whether to print messages after analysis.
public int redo(boolean printMessages)
redo in interface SampleAnalyzerprintMessages - Indicates whether to print messages after analysis.
public java.lang.String getByteValue(int index)
getByteValue in interface SampleAnalyzerindex - The index.
public byte[] getBytes()
getBytes in interface SampleAnalyzerpublic int getByteNumber(int index)
getByteNumber in interface SampleAnalyzerindex - The index.
public void getByteNumber(int index,
int[] pos)
getByteNumber in interface SampleAnalyzerindex - The index.pos - An array which will contain the byte number and offset from the start of the byte.public int getByte(int byteNumber)
getByte in interface SampleAnalyzerbyteNumber - The index.
public int getNumBytes()
getNumBytes in interface SampleAnalyzerpublic int getByteIndex(int number)
getByteIndex in interface SampleAnalyzernumber - The byte number.
public int getNoiseThreshold(int index)
getNoiseThreshold in interface SampleAnalyzerindex - The index in the sample of the noise threshold value.
public int getFirstBitStartIndex()
getFirstBitStartIndex in interface SampleAnalyzerpublic int getLastBitEndIndex()
getLastBitEndIndex in interface SampleAnalyzer
public void warning(int position,
java.lang.String message)
warning in interface SampleAnalyzerposition - The position of the warning.message - The warning message.public int numMessages()
numMessages in interface SampleAnalyzerpublic int numWarnings()
numWarnings in interface SampleAnalyzer
public void error(int position,
java.lang.String message)
error in interface SampleAnalyzerposition - The position of the warning.message - The error message.public void clearMessages(int index)
clearMessages in interface SampleAnalyzerindex - The index from which to clear errors/warnings.public int numErrors()
numErrors in interface SampleAnalyzerpublic int getMessageIndex(int messageNumber)
getMessageIndex in interface SampleAnalyzermessageNumber - The message number.
public boolean isMessageError(int messageNumber)
isMessageError in interface SampleAnalyzermessageNumber - The message number.
public void printMessages()
printMessages in interface SampleAnalyzerpublic Message[] getMessages()
getMessages in interface SampleAnalyzerpublic void setProgramName(java.lang.String name)
name - The program name.public java.lang.String getProgramName()
public void setProgramNameBytes(byte[] bytes,
int length)
bytes - The program name bytes.length - The program name bytes length.public byte[] getProgramNameBytes()
public void cleanUp()
cleanUp in interface SampleAnalyzerpublic void addAnalysisListener(AnalysisListener l)
addAnalysisListener in interface SampleAnalyzerl - The listener.public void setDebugLevels(DebugLevels levels)
levels -
public void debugWaveMessage(int index,
java.lang.String message)
debugWaveMessage in interface SampleAnalyzerindex - The index in the sample to which the message applies.message -
public void debugBitMessage(int index,
java.lang.String message)
debugBitMessage in interface SampleAnalyzerindex - The index in the sample to which the message applies.message -
public void debugByteMessage(int index,
java.lang.String message)
debugByteMessage in interface SampleAnalyzerindex - The index in the sample to which the message applies.message - public final boolean debuggingWave(int index)
debuggingWave in interface SampleAnalyzerindex - The index in the sample to which the message applies.
public final boolean debuggingBit(int index)
debuggingBit in interface SampleAnalyzerindex - The index in the sample to which the message applies.
public final boolean debuggingByte(int index)
debuggingByte in interface SampleAnalyzerindex - 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 | |||||||||||