|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ISampleLoader
Common sample loading interface. Must be overridden by a concrete sample loader. Derivatives should try their best to inherit from the SampleLoader class; otherwise, they must implement this interface.
$Id: ISampleLoader.java,v 1.14 2007/12/23 06:29:46 mokhov Exp $
SampleLoader
Field Summary | |
---|---|
static int |
DEFAULT_CHANNELS
Mono. |
static float |
DEFAULT_FREQUENCY
Default sampling frequency of 8000 Hz. |
static int |
DEFAULT_SAMPLE_BIT_SIZE
Default number of bits per amplitude. |
static java.lang.String |
MARF_INTERFACE_CODE_REVISION
Interface source code revision. |
Method Summary | |
---|---|
Sample |
getSample()
Returns internal reference to a Sample object. |
long |
getSampleSize()
Retrieves the length of the sample (# of audio data in the audio stream). |
Sample |
loadSample(byte[] patFileData)
Assumes the file data is in the array of bytes for loading. |
Sample |
loadSample(java.io.File poInFile)
Prime SampleLoader interface. |
Sample |
loadSample(java.io.InputStream poDataInputStream)
Assumes the incoming stream is the sample file data. |
Sample |
loadSample(java.lang.String pstrFilename)
Same as loadSample(File) but takes filename as an argument. |
int |
readSampleData(double[] padSampleData)
Reads sample data from the sample's stream into the parameter. |
void |
reset()
Resets the marker for the audio stream. |
void |
saveSample(byte[] patFileData)
Assumes the file data is in the array of bytes for loading. |
void |
saveSample(java.io.File poOutFile)
Prime SampleLoader interface. |
void |
saveSample(java.io.OutputStream poDataOutputStream)
Assumes the output stream is the sample file data. |
void |
saveSample(java.lang.String pstrFilename)
Same as saveSample(File) but takes filename as an argument. |
void |
setSample(Sample poSample)
Sets internal sample reference from outside. |
void |
updateSample()
updateSample() is just used whenever the
AudioInputStream is assigned to a new value (wave file). |
int |
writeSampleData(double[] padSampleData,
int piWords)
Writes sample data into the sample's stream. |
Field Detail |
---|
static final int DEFAULT_SAMPLE_BIT_SIZE
static final int DEFAULT_CHANNELS
static final float DEFAULT_FREQUENCY
static final java.lang.String MARF_INTERFACE_CODE_REVISION
Method Detail |
---|
int readSampleData(double[] padSampleData) throws StorageException
readAudioData()
to readSampleData()
to accommodate non-audio loaders. readAudioData()
was moved down
to AudioSampleLoader
as a wrapper for this method for some
semblance of backwards compatibility.
padSampleData
- an array of doubles to store the data read
StorageException
- if there was an error reading the dataAudioSampleLoader.readAudioData(double[])
int writeSampleData(double[] padSampleData, int piWords) throws StorageException
writeAudioData()
to writeSampleData()
to accommodate non-audio loaders.
writeAudioData()
was moved down to AudioSampleLoader
as a wrapper for this method for some semblance of backwards compatibility.
padSampleData
- an array of doublespiWords
- the number of data items (words) to write from the padSampleData
StorageException
- if there was an error loading the sampleAudioSampleLoader.writeAudioData(double[], int)
Sample loadSample(java.io.File poInFile) throws StorageException
poInFile
- file object a sample to be read from
StorageException
Sample loadSample(java.lang.String pstrFilename) throws StorageException
pstrFilename
- filename of a sample to be read from
StorageException
- if there was an error loading the sampleSample loadSample(byte[] patFileData) throws StorageException
patFileData
- the byte data of a sample to be read from
StorageException
- if there was an error loading the sampleSample loadSample(java.io.InputStream poDataInputStream) throws StorageException
poDataInputStream
- the stream of a sample to be read from
StorageException
- if there was an error loading the samplevoid saveSample(java.io.File poOutFile) throws StorageException
poOutFile
- File object of a sample to be saved to
StorageException
- if there was an error saving the samplevoid saveSample(java.lang.String pstrFilename) throws StorageException
pstrFilename
- filename of a sample to be saved to
StorageException
- if there was an error saving the samplevoid saveSample(byte[] patFileData) throws StorageException
patFileData
- the byte data of a sample to be read from
StorageException
- if there was an error loading the samplevoid saveSample(java.io.OutputStream poDataOutputStream) throws StorageException
poDataOutputStream
- the stream of a sample to be written to
StorageException
- if there was an error loading the samplevoid updateSample() throws StorageException
updateSample()
is just used whenever the
AudioInputStream
is assigned to a new value (wave file).
Then you would simply call this method to update the
Sample
member with the contents of the new AudioInputStream
.
StorageException
- if there was an error updating the sample data arrayvoid reset() throws StorageException
StorageException
- if there was an error resetting the audio streamlong getSampleSize() throws StorageException
StorageException
- if there was an error getting sample sizeSample getSample()
void setSample(Sample poSample)
poSample
- Sample object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |