|
||||||||||
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.AudioSampleLoader marf.Storage.Loaders.WAVLoader
public class WAVLoader
Loads/stores samples if WAVE format.
$Id: WAVLoader.java,v 1.33 2008/02/23 01:42:59 mokhov Exp $
Field Summary |
---|
Fields inherited from class marf.Storage.Loaders.AudioSampleLoader |
---|
oAudioFormat, oAudioInputStream, oEncoding |
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 | |
---|---|
WAVLoader()
Default WAVLoader Constructor. |
|
WAVLoader(float pfRequiredFrequency,
int piRequiredBitSize,
int piRequiredChannels,
javax.sound.sampled.AudioFormat.Encoding poEncoding)
Allows construction of the WAVE loader with non-default parameters. |
Method Summary | |
---|---|
static java.lang.String |
getMARFSourceCodeRevision()
Returns source code revision information. |
Sample |
loadSample(java.io.InputStream poAudioDataInputStream)
Loads and decodes the WAV sample from the provided stream. |
int |
readSampleData(double[] padAudioData)
Buffers out the contents of an audio buffer into the parameter. |
void |
reset()
Resets the marker for the audio and byte-array streams. |
void |
saveSample(java.io.File poOutFile)
Saves the wave into a file for playback. |
void |
validateAudioFormat(javax.sound.sampled.AudioFormat poFormat)
Validates audio file stream format for WAVE files. |
int |
writeSampleData(double[] padAudioData,
int piNbrWords)
Buffers the contents of audio data parameter into the equivalent AudioInputStream object given the audio format specification. |
Methods inherited from class marf.Storage.Loaders.AudioSampleLoader |
---|
getAudioFormat, getAudioInputStream, getEncoding, getSampleSize, loadSample, readAudioData, setAudioFormat, setAudioInputStream, setEncoding, writeAudioData |
Methods inherited from class marf.Storage.SampleLoader |
---|
getRequiredBitSize, getRequiredChannels, getRequiredFrequency, getSample, loadSample, loadSample, saveSample, saveSample, saveSample, setRequiredBitSize, setRequiredChannels, setRequiredFrequency, setSample, updateSample |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WAVLoader() throws InvalidSampleFormatException
InvalidSampleFormatException
- if the WAV file isn't really in WAV format
or any other error took place.public WAVLoader(float pfRequiredFrequency, int piRequiredBitSize, int piRequiredChannels, javax.sound.sampled.AudioFormat.Encoding poEncoding) throws InvalidSampleFormatException
piRequiredFrequency
- other than default of 8000piRequiredBitSize
- other than the default of 16piRequiredChannels
- other than the default of 1poEncoding
- other than the default of AudioFormat.Encoding.PCM_SIGNED
InvalidSampleFormatException
- if the WAV file isn't really in WAV format
or any other error took place.AudioFormat.Encoding
Method Detail |
---|
public Sample loadSample(java.io.InputStream poAudioDataInputStream) throws StorageException
loadSample
in interface ISampleLoader
loadSample
in class SampleLoader
poAudioDataInputStream
- the stream of a sample to be read from
StorageException
- if there was an error loading the sampleSampleLoader.loadSample(java.io.InputStream)
public final int readSampleData(double[] padAudioData) throws StorageException
padAudioData
- data array to fill in
StorageException
- if there was a problem reading the audio dataAudioSampleLoader.readAudioData(double[])
public final int writeSampleData(double[] padAudioData, int piNbrWords) throws StorageException
padAudioData
- array of data to be writtenpiNbrWords
- number of words to be written
StorageException
- if there was an error writing audio dataAudioSampleLoader.writeAudioData(double[], int)
public final void saveSample(java.io.File poOutFile) throws StorageException
saveSample
in interface ISampleLoader
saveSample
in class SampleLoader
poOutFile
- File object for output
StorageException
- if there was an error saving sampleISampleLoader.saveSample(java.io.File)
public void reset() throws StorageException
reset
in interface ISampleLoader
reset
in class AudioSampleLoader
StorageException
- if there was an error resetting the streamspublic void validateAudioFormat(javax.sound.sampled.AudioFormat poFormat) throws javax.sound.sampled.UnsupportedAudioFileException
poFormat
- the audio format to validate
javax.sound.sampled.UnsupportedAudioFileException
- if any of the three criteria are not metpublic static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |