|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objecttapeutils.zx81.TapeConverter
This class provides a utility to convert from a sample file to a (ZX81) .P file.
| Field Summary | |
|---|---|
static java.lang.String |
APPLICATION_NAME
The application name. |
static java.lang.String |
DEBUG_FILE
The debug file name. |
static java.lang.String |
PREF_ANALYSIS_CONFIG_FILE
The key used to access the analysis config file name. |
static java.lang.String |
PREF_DEBUG_BIT
The debug bit preference key. |
static java.lang.String |
PREF_DEBUG_BYTE
The debug byte preference key. |
static java.lang.String |
PREF_DEBUG_END
The debug end index preference key. |
static java.lang.String |
PREF_DEBUG_FILE
The debug file preference key. |
static java.lang.String |
PREF_DEBUG_START
The debug start index preference key. |
static java.lang.String |
PREF_DEBUG_WAVE
The debug wave preference key. |
static java.lang.String |
PREF_P_PROGRAM_NAME
The .P program name used when generating sample from .P. |
static java.lang.String |
PREF_PFILE_DIRECTORY
The key used to access the .P file directory. |
static java.lang.String |
PREF_SAMPLE_DIRECTORY
The key used to access the sample directory. |
static java.lang.String |
PREF_SAMPLE_RATE
The key used to access the sample rate. |
static java.lang.String |
PREF_SAVE_SAMPLE_AS_ZIP
The key used to access the save sample as zip file preference. |
static java.lang.String |
PREF_SQUARE_WAVE
The square wave indicator. |
static java.lang.String |
PREF_TZXFILE_DIRECTORY
The key used to access the .P file directory. |
| Constructor Summary | |
|---|---|
TapeConverter(java.io.File sample1File,
java.io.File sample2File,
TapeConverterParameters sample1Params,
TapeConverterParameters sample2Params,
boolean showGUI)
Constructor. |
|
TapeConverter(java.io.File sampleFile,
TapeConverterParameters sampleParams)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addAnalysisListener(int sampleNumber,
AnalysisListener l)
Register the given listener for analysis events. |
void |
addMessageSelectionListener(int sampleNumber,
MessageSelectionListener l)
Register the given listener for message selection events. |
void |
analysisComplete(AnalysisEvent event)
Handle an analysis completion event. |
void |
cleanUp()
Clean up the converter state. |
void |
closeSample(int sampleNumber)
Close the given sample. |
void |
convert()
Convert the loaded sample(s). |
void |
fireMessageSelectionEvent(int sampleNumber,
int messageNumber)
Fire a message selection event. |
ConversionFrame |
getConversionFrame()
Returns the conversion frame. |
TapeConverterParameters |
getParameters(int sampleNumber)
Get the ConvertParameters for the sample. |
PreferenceAccessor |
getPreferences(java.lang.Object accessor)
Get the preferences object. |
Sample |
getSample(int sampleNumber)
Get the Sample. |
SampleAnalyzer |
getSampleAnalyzer(int sampleNumber)
Get the Sample Analyzer |
java.io.File |
getSampleFile(int sampleNumber)
Returns the requested sample file. |
void |
loadConfig(java.io.File configFile)
Load the given configuration file. |
void |
loadSample(java.io.File sampleFile,
int sampleNumber)
Load the given sample file as the first or second sample. |
static void |
main(java.lang.String[] args)
Main routine. |
int |
numErrors(int sampleNumber)
Returns the number of errors in conversion. |
int |
numSamples()
Returns the number of samples being processed. |
int |
redo(int sampleNumber)
Redo the last change for the given sample. |
void |
samplePropertiesUpdated(int sampleNumber)
Inform the coverter that the sample properties have changed. |
void |
saveConfig(java.io.File configFile)
Save to the given configuration file. |
void |
saveSample(java.io.File sampleFile,
int sampleNumber)
Save the given sample file as the first or second sample. |
int |
undo(int sampleNumber)
Undo the last change for the given sample. |
void |
writePFile(int sampleNumber,
int index,
java.io.File pFile)
Write the analyzed data to the .P file. |
void |
writePFile(int sampleNumber,
int index,
java.io.OutputStream os)
Write the analyzed data to the output stream. |
void |
writePFiles(int sampleNumber,
boolean forceWrite)
Write the analyzed data to the .P files. |
void |
writePFiles(int sampleNumber,
boolean forceWrite,
java.lang.String[] pFileNames)
Write the analyzed data to the .P files. |
int |
writePFiles(int sampleNumber,
java.io.File directory)
Write out the results of analysis as .P files. |
void |
writeTZXFile(int sampleNumber,
java.io.File tzxFile)
Write the files as a single .TZX file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String APPLICATION_NAME
public static final java.lang.String DEBUG_FILE
public static final java.lang.String PREF_SAMPLE_DIRECTORY
public static final java.lang.String PREF_PFILE_DIRECTORY
public static final java.lang.String PREF_TZXFILE_DIRECTORY
public static final java.lang.String PREF_ANALYSIS_CONFIG_FILE
public static final java.lang.String PREF_SAMPLE_RATE
public static final java.lang.String PREF_P_PROGRAM_NAME
public static final java.lang.String PREF_SQUARE_WAVE
public static final java.lang.String PREF_SAVE_SAMPLE_AS_ZIP
public static final java.lang.String PREF_DEBUG_WAVE
public static final java.lang.String PREF_DEBUG_BIT
public static final java.lang.String PREF_DEBUG_BYTE
public static final java.lang.String PREF_DEBUG_START
public static final java.lang.String PREF_DEBUG_END
public static final java.lang.String PREF_DEBUG_FILE
| Constructor Detail |
public TapeConverter(java.io.File sampleFile,
TapeConverterParameters sampleParams)
throws java.lang.Exception
This variant is used to convert a single sample with no GUI.
sampleFile - The sample file.sampleParams - Conversion parameters.
java.lang.Exception
public TapeConverter(java.io.File sample1File,
java.io.File sample2File,
TapeConverterParameters sample1Params,
TapeConverterParameters sample2Params,
boolean showGUI)
throws java.lang.Exception
sample1File - The sample file.sample2File - The second sample file.sample1Params - Conversion parameters for sample 1.sample2Params - Conversion parameters for sample 2.showGUI - Indicates whether to show the GUI.
java.lang.Exception| Method Detail |
public static void main(java.lang.String[] args)
throws java.lang.Exception
Arguments:
[{-sampleFile |-s} fileName] The name of the sample file (.WAV, .AIFF, etc.)
[{-sample2File|-2} fileName] The name of the second sample file (.WAV, .AIFF, etc.)
[{-pFile |-p} fileName] The name of the .p file to save to (only valid with -noGui/-g)
[{-noGui |-g}] Don't display GUI.
[{-invert |-i}] Invert sample.
[{-noise |-n} noiseLevel] Noise threshold.
[{-minGap |-m} minGap] Minimum gap between groups.
[{-maxGap |-x} maxGap] Maximum gap between groups.
[{-channel |-h} channel] Channel number.
[{-data |-d} numBytes] Data only. Don't interpret as a BASIC program.
[{-forceWrite |-w}] Force write of result after errors.
[{-begin |-b} index] Index within sample to start processing.
[{-configFile |-c} configFile] Name of a properties file with convert parameters.
args - The arguments.
java.lang.Exception - Something went wrong.public void convert()
public void samplePropertiesUpdated(int sampleNumber)
throws java.io.IOException,
javax.sound.sampled.UnsupportedAudioFileException
sampleNumber - The sample number.
java.io.IOException
javax.sound.sampled.UnsupportedAudioFileException
public int writePFiles(int sampleNumber,
java.io.File directory)
throws java.io.IOException
sampleNumber - The sample number.directory - The directory in which to save the .P files.
java.io.IOException
public void writePFiles(int sampleNumber,
boolean forceWrite,
java.lang.String[] pFileNames)
throws java.io.IOException
sampleNumber - The sample number.forceWrite - Force writing of data after errors.pFileNames - The .P file names that override the generated ones.
java.io.IOException
public void writePFiles(int sampleNumber,
boolean forceWrite)
throws java.io.IOException
sampleNumber - The sample number.forceWrite - Force writing of data after errors.
java.io.IOException
public void writePFile(int sampleNumber,
int index,
java.io.File pFile)
throws java.io.IOException
sampleNumber - The sample number.index - The index of the data.pFile - The .P file.
java.io.IOException
public void writePFile(int sampleNumber,
int index,
java.io.OutputStream os)
throws java.io.IOException
sampleNumber - The sample number.index - The index of the data.os - The output stream.
java.io.IOException
public void writeTZXFile(int sampleNumber,
java.io.File tzxFile)
throws java.io.IOException
sampleNumber - The sample number.tzxFile - The .TZX file.
java.io.IOExceptionpublic int numErrors(int sampleNumber)
sampleNumber - The sample number.
public void cleanUp()
public TapeConverterParameters getParameters(int sampleNumber)
sampleNumber -
public Sample getSample(int sampleNumber)
sampleNumber - The sample number.
public SampleAnalyzer getSampleAnalyzer(int sampleNumber)
sampleNumber - The sample number.
public java.io.File getSampleFile(int sampleNumber)
sampleNumber - The sample number.
public int numSamples()
public int undo(int sampleNumber)
sampleNumber -
public int redo(int sampleNumber)
sampleNumber -
public ConversionFrame getConversionFrame()
public void loadSample(java.io.File sampleFile,
int sampleNumber)
throws java.io.IOException,
javax.sound.sampled.UnsupportedAudioFileException
If the file is actually a .p or .tzx file its converted to a sample.
sampleFile - The sample file.sampleNumber - The sample number.
java.io.IOException - The file could not be loaded.
javax.sound.sampled.UnsupportedAudioFileException
public void saveSample(java.io.File sampleFile,
int sampleNumber)
throws java.io.IOException
sampleFile - The sample file.sampleNumber - The sample number.
java.io.IOExceptionpublic void closeSample(int sampleNumber)
sampleNumber - The sample number.
public void loadConfig(java.io.File configFile)
throws java.io.IOException
configFile - The configuration file.
java.io.IOException
public void saveConfig(java.io.File configFile)
throws java.io.IOException
configFile - The configuration file.
java.io.IOExceptionpublic PreferenceAccessor getPreferences(java.lang.Object accessor)
accessor - The object accessing the preferences object.
public void addAnalysisListener(int sampleNumber,
AnalysisListener l)
sampleNumber - The sample number.l - The listener.public void analysisComplete(AnalysisEvent event)
Cascade the event to the listeners registered with this object.
analysisComplete in interface AnalysisListenerevent - An object representing the event.
public void addMessageSelectionListener(int sampleNumber,
MessageSelectionListener l)
sampleNumber - The sample number.l - The listener.
public void fireMessageSelectionEvent(int sampleNumber,
int messageNumber)
sampleNumber - The sample number.messageNumber - The message number.
|
||||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||