|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmarf.Storage.SampleLoader
public abstract class SampleLoader
Abstract class that provides a generic implementation of the sample loading interface. Must be overridden by a concrete sample loader.
$Id: SampleLoader.java,v 1.29 2008/02/21 06:05:08 mokhov Exp $
| Field Summary | |
|---|---|
protected float |
fRequiredFrequency
Current frequency. |
protected int |
iRequiredBitSize
Current bit size of a sample. |
protected int |
iRequiredChannels
Current number of channels. |
protected java.io.ByteArrayOutputStream |
oByteArrayOutputStream
Output stream used for writing audio data. |
protected Sample |
oSample
Sample references of the sample to be loaded. |
| Fields inherited from interface marf.Storage.ISampleLoader |
|---|
DEFAULT_CHANNELS, DEFAULT_FREQUENCY, DEFAULT_SAMPLE_BIT_SIZE, MARF_INTERFACE_CODE_REVISION |
| Constructor Summary | |
|---|---|
SampleLoader()
Default constructor. |
|
| Method Summary | |
|---|---|
static java.lang.String |
getMARFSourceCodeRevision()
Returns source code revision information. |
int |
getRequiredBitSize()
|
int |
getRequiredChannels()
|
float |
getRequiredFrequency()
|
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)
Converts the byte array into a buffered byte array input stream and passes it on. |
Sample |
loadSample(java.io.File poInFile)
Loads sample data from a file. |
Sample |
loadSample(java.io.InputStream poDataInputStream)
Not implemented. |
Sample |
loadSample(java.lang.String pstrFilename)
Same as loadSample(File) but takes filename as an argument. |
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 |
setRequiredBitSize(int piRequiredBitSize)
|
void |
setRequiredChannels(int piRequiredChannels)
|
void |
setRequiredFrequency(float piRequiredFrequency)
|
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). |
| 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 int iRequiredBitSize
protected int iRequiredChannels
protected float fRequiredFrequency
protected Sample oSample
protected java.io.ByteArrayOutputStream oByteArrayOutputStream
| Constructor Detail |
|---|
public SampleLoader()
ByteArrayOutputStream.
| Method Detail |
|---|
public Sample loadSample(java.lang.String pstrFilename)
throws StorageException
loadSample(File) but takes filename as an argument.
loadSample in interface ISampleLoaderpstrFilename - filename of a sample to be read from
StorageException - if there was an error loading the sampleloadSample(File)
public Sample loadSample(java.io.File poInFile)
throws StorageException
loadSample in interface ISampleLoaderpoInFile - incoming sample File object
StorageException - if there was a problem loading the sampleloadSample(InputStream)
public Sample loadSample(byte[] patFileData)
throws StorageException
loadSample in interface ISampleLoaderpatFileData - the byte data of a sample to be read from
StorageException - if there was an error loading the sampleISampleLoader.loadSample(byte[]),
loadSample(InputStream)
public Sample loadSample(java.io.InputStream poDataInputStream)
throws StorageException
loadSample in interface ISampleLoaderpoDataInputStream - the stream of a sample to be read from
NotImplementedException
StorageException - if there was an error loading the sampleISampleLoader.loadSample(java.io.InputStream)
public void saveSample(java.lang.String pstrFilename)
throws StorageException
saveSample in interface ISampleLoaderpstrFilename - filename of a sample to be saved to
StorageException - if there was an error saving the sample
public void saveSample(byte[] patFileData)
throws StorageException
ISampleLoader
saveSample in interface ISampleLoaderpatFileData - the byte data of a sample to be read from
NotImplementedException - incomplete
StorageException - if there was an error loading the sampleISampleLoader.saveSample(byte[])
public void saveSample(java.io.File poOutFile)
throws StorageException
ISampleLoader
saveSample in interface ISampleLoaderpoOutFile - File object of a sample to be saved to
StorageException - if there was an error saving the sampleISampleLoader.saveSample(java.io.File)
public void saveSample(java.io.OutputStream poDataOutputStream)
throws StorageException
ISampleLoader
saveSample in interface ISampleLoaderpoDataOutputStream - the stream of a sample to be written to
StorageException - if there was an error loading the sampleISampleLoader.saveSample(java.io.OutputStream)
public void 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.
updateSample in interface ISampleLoaderStorageException - if there was an error updating the sample data array
public void reset()
throws StorageException
reset in interface ISampleLoaderStorageException - if there was an error resetting the audio stream
public long getSampleSize()
throws StorageException
getSampleSize in interface ISampleLoaderStorageException - if there was an error getting sample sizepublic final Sample getSample()
getSample in interface ISampleLoaderpublic final void setSample(Sample poSample)
setSample in interface ISampleLoaderpoSample - Sample objectpublic int getRequiredBitSize()
public void setRequiredBitSize(int piRequiredBitSize)
public int getRequiredChannels()
public void setRequiredChannels(int piRequiredChannels)
public float getRequiredFrequency()
public void setRequiredFrequency(float piRequiredFrequency)
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||