|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttapeutils.impl.zx81.ZX81SampleGenerator
This class provides a utility to generate a sound sample from the contents of a .P file.
Constructor Summary | |
---|---|
ZX81SampleGenerator(byte[][] programData,
byte[][] programNameBytes,
int[] programGaps)
Construct the sample generator from a .TZX file. |
|
ZX81SampleGenerator(java.util.List blocks)
Constructor from a sequence of TZX Generic blocks that represent ZX81 programs. |
|
ZX81SampleGenerator(PFile pFile,
java.lang.String programName)
Construct the sample generator from a .P file. |
Method Summary | |
---|---|
byte[] |
convertToSample(double rate,
boolean squareWave)
Convert the .P file to a sample. |
void |
play(float frequency,
boolean squareWave)
Play the data as a sample. |
void |
write(float frequency,
boolean squareWave,
java.io.File sampleFile)
Write the .P file as a sample file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ZX81SampleGenerator(PFile pFile, java.lang.String programName)
The program name is required as this is the first part of the sample, and is not in the .P file itself.
pFile
- The P file.programName
- The program name.public ZX81SampleGenerator(byte[][] programData, byte[][] programNameBytes, int[] programGaps)
The program names is required as this is the first part of the sample, and is not in the data file itself.
programData
- The program data.programNameBytes
- The program names.programGaps
- The program gaps.public ZX81SampleGenerator(java.util.List blocks)
blocks
- The blocks.Method Detail |
public void play(float frequency, boolean squareWave) throws javax.sound.sampled.LineUnavailableException
play
in interface SampleGenerator
frequency
- The frequency for the sample.squareWave
- Indicates whether to use a square wave.
javax.sound.sampled.LineUnavailableException
- An audio line could not be opened.public void write(float frequency, boolean squareWave, java.io.File sampleFile) throws java.io.IOException
write
in interface SampleGenerator
frequency
- The frequency for the sample.sampleFile
- The file to contain the sample.squareWave
- Indicates whether to use a square wave.
java.io.IOException
- An error occurred writing to a file.public byte[] convertToSample(double rate, boolean squareWave) throws java.lang.IllegalArgumentException
rate
- The sample rate.squareWave
- Indicates whether to use a square wave.
java.lang.IllegalArgumentException
- The program name is invalid.
|
||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |