|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.Storage.SampleLoader marf.Storage.Loaders.SineLoader
public class SineLoader
Loads (by computing) a simple sine wave into the sample. Used for simple and quick testing of fake waves.
$Id: SineLoader.java,v 1.13 2007/02/04 07:51:30 mokhov Exp $
Field Summary | |
---|---|
static double |
DEFAULT_SINE_DEVIATION
Default sine frequency deviation of 0.1 kHz, in Hz. |
static double |
DEFAULT_SINE_FREQUENCY
Default sine frequency at 3 kHz, in Hz. |
Fields inherited from class marf.Storage.SampleLoader |
---|
fRequiredFrequency, iRequiredBitSize, iRequiredChannels, oByteArrayOutputStream, oSample |
Fields inherited from interface marf.Storage.ISampleLoader |
---|
DEFAULT_CHANNELS, DEFAULT_FREQUENCY, DEFAULT_SAMPLE_BIT_SIZE, MARF_INTERFACE_CODE_REVISION |
Constructor Summary | |
---|---|
SineLoader()
Constructs default Sine Loader. |
Method Summary | |
---|---|
static java.lang.String |
getMARFSourceCodeRevision()
Returns source code revision information. |
long |
getSampleSize()
Retrieves the length of the sample (# of audio data in the audio stream). |
Sample |
loadSample(java.io.File poInFile)
Fills in the contained sample's data array with a sine wave. |
Sample |
loadSample(java.lang.String pstrFilename)
Merely calls readAudioData() . |
int |
readSampleData(double[] padSampleData)
Generates sine wave at 3 kHz +- 0.0 kHz with 8 kHz sampling rate. |
void |
saveSample(java.io.File poOutFile)
Does nothing. |
void |
saveSample(java.lang.String pstrFilename)
Does nothing. |
void |
updateSample()
Overridden to reset sample's array mark only. |
int |
writeSampleData(double[] padSample,
int piLength)
Does nothing. |
Methods inherited from class marf.Storage.SampleLoader |
---|
getRequiredBitSize, getRequiredChannels, getRequiredFrequency, getSample, loadSample, loadSample, reset, saveSample, saveSample, setRequiredBitSize, setRequiredChannels, setRequiredFrequency, setSample |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DEFAULT_SINE_FREQUENCY
public static final double DEFAULT_SINE_DEVIATION
Constructor Detail |
---|
public SineLoader() throws InvalidSampleFormatException
InvalidSampleFormatException
Method Detail |
---|
public final int readSampleData(double[] padSampleData) throws StorageException
padSampleData
- to fill in with sample data
StorageException
AudioSampleLoader.readAudioData(double[])
public final int writeSampleData(double[] padSample, int piLength) throws StorageException
padSample
- used to verify the lengthpiLength
- used to verify the length
StorageException
- if piLength is less than zeroAudioSampleLoader.writeAudioData(double[], int)
public Sample loadSample(java.io.File poInFile) throws StorageException
readAudioData()
.
loadSample
in interface ISampleLoader
loadSample
in class SampleLoader
poInFile
- unused, can be null
StorageException
readSampleData(double[])
public void saveSample(java.io.File poOutFile) throws StorageException
saveSample
in interface ISampleLoader
saveSample
in class SampleLoader
poOutFile
- unused, can be null
StorageException,
- never thrown
StorageException
- if there was an error saving the sampleISampleLoader.saveSample(java.io.File)
public Sample loadSample(java.lang.String pstrFilename) throws StorageException
readAudioData()
.
loadSample
in interface ISampleLoader
loadSample
in class SampleLoader
pstrFilename
- unused, can be null
StorageException
- if readAudioData failsreadSampleData(double[])
public void saveSample(java.lang.String pstrFilename) throws StorageException
saveSample
in interface ISampleLoader
saveSample
in class SampleLoader
pstrFilename
- unused, can be null
StorageException,
- never thrown
StorageException
- if there was an error saving the samplepublic void updateSample() throws StorageException
updateSample
in interface ISampleLoader
updateSample
in class SampleLoader
StorageException,
- never thrown
StorageException
- if there was an error updating the sample data arraypublic long getSampleSize() throws StorageException
getSampleSize
in interface ISampleLoader
getSampleSize
in class SampleLoader
StorageException
- if there was an error getting sample sizepublic static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |