|
||||||||||
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
public abstract class AudioSampleLoader
Abstract class that provides a generic sound-oriented implementation of the sample loading interface. Must be overridden by a concrete audio sample loader.
$Id: AudioSampleLoader.java,v 1.6 2008/07/27 23:59:13 mokhov Exp $
Field Summary | |
---|---|
protected javax.sound.sampled.AudioFormat |
oAudioFormat
Properties of a sound sample. |
protected javax.sound.sampled.AudioInputStream |
oAudioInputStream
Stream representing sound sample. |
protected javax.sound.sampled.AudioFormat.Encoding |
oEncoding
Default audio encoding. |
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 | |
---|---|
AudioSampleLoader()
Default constructor. |
Method Summary | |
---|---|
javax.sound.sampled.AudioFormat |
getAudioFormat()
|
javax.sound.sampled.AudioInputStream |
getAudioInputStream()
|
javax.sound.sampled.AudioFormat.Encoding |
getEncoding()
|
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(byte[] patFileData)
Overrides the parent to include the AudioInputStream into the chain in order avoid audio format related errors. |
int |
readAudioData(double[] padAudioData)
Reads sample data from the sample's audio stream into padSampleData. |
void |
reset()
Resets the marker for the audio stream. |
void |
setAudioFormat(javax.sound.sampled.AudioFormat poAudioFormat)
|
void |
setAudioInputStream(javax.sound.sampled.AudioInputStream poAudioInputStream)
|
void |
setEncoding(javax.sound.sampled.AudioFormat.Encoding poEncoding)
|
int |
writeAudioData(double[] padSampleData,
int piWords)
Writes sample data into the sample's audio stream. |
Methods inherited from class marf.Storage.SampleLoader |
---|
getRequiredBitSize, getRequiredChannels, getRequiredFrequency, getSample, loadSample, loadSample, loadSample, saveSample, 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 |
Methods inherited from interface marf.Storage.ISampleLoader |
---|
readSampleData, writeSampleData |
Field Detail |
---|
protected javax.sound.sampled.AudioFormat oAudioFormat
protected javax.sound.sampled.AudioInputStream oAudioInputStream
protected javax.sound.sampled.AudioFormat.Encoding oEncoding
AudioFormat.Encoding.PCM_SIGNED
Constructor Detail |
---|
public AudioSampleLoader()
ByteArrayOutputStream
.
Method Detail |
---|
public Sample loadSample(byte[] patFileData) throws StorageException
loadSample
in interface ISampleLoader
loadSample
in class SampleLoader
patFileData
- the byte data of a sample to be read from
StorageException
- if there was an error loading the sampleSampleLoader.loadSample(byte[])
public int readAudioData(double[] padAudioData) throws StorageException
padAudioData
- an array of doubles to store the data read
StorageException
- if there was an error reading the datapublic int writeAudioData(double[] padSampleData, int piWords) throws StorageException
padSampleData
- an array of doublespiWords
- the number of audio data items to write from the padSampleData array
StorageException
- if there was an error loading the samplepublic void reset() throws StorageException
reset
in interface ISampleLoader
reset
in class SampleLoader
StorageException
- if there was an error resetting the audio streampublic long getSampleSize() throws StorageException
getSampleSize
in interface ISampleLoader
getSampleSize
in class SampleLoader
StorageException
- if there was an error getting sample sizepublic javax.sound.sampled.AudioFormat getAudioFormat()
public void setAudioFormat(javax.sound.sampled.AudioFormat poAudioFormat)
public javax.sound.sampled.AudioInputStream getAudioInputStream()
public void setAudioInputStream(javax.sound.sampled.AudioInputStream poAudioInputStream)
public javax.sound.sampled.AudioFormat.Encoding getEncoding()
public void setEncoding(javax.sound.sampled.AudioFormat.Encoding poEncoding)
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |