|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.Storage.Sample
public class Sample
Sample data container.
The Sample Bean can contain data samples from audio, images, text, or any other data as a collection of double values. While started with Audio processing, it is not confined to audio data.
$Id: Sample.java,v 1.50 2008/02/20 07:29:06 mokhov Exp $
Field Summary | |
---|---|
protected double[] |
adSample
Sample data array (amplitudes). |
static int |
DEFAULT_CHUNK_SIZE
Default sample chunk's size (128). |
static int |
DEFAULT_SAMPLE_SIZE
Default sample array's size (1024). |
protected int |
iArrayIndex
Chunk pointer in the sample array. |
protected MARFAudioFileFormat |
oAudioFileFormat
Grouping of file format data. |
Constructor Summary | |
---|---|
Sample()
Constructs default sample object. |
|
Sample(double[] padData)
Accepts pre-set sample; for testing. |
|
Sample(int piFormat)
Constructor with format indication. |
|
Sample(int piFormat,
double[] padData)
Constructor with format indication and the sampled data. |
|
Sample(Sample poSample)
Copy-constructor. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clones this sample object by copying the sample format and its data. |
boolean |
equals(java.lang.Object poSample)
Checks if the parameter is equal to this object. |
int |
getAudioFileFormatCode()
Retrieves current sample's format. |
javax.sound.sampled.AudioFormat |
getAudioFormat()
Retrieves current sample's audio format data. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
int |
getNextChunk(double[] padChunkArray)
Gets the next chunk of the data and places it into padChunkArray. |
double[] |
getSampleArray()
Retrieves array containing audio data of the entire sample. |
long |
getSampleSize()
Returns the length of the sample. |
void |
reset()
Resets the marker used for reading audio data from sample array. |
void |
resetArrayMark()
Resets the marker used for reading audio data from sample array. |
void |
setAudioFileFormatCode(int piFileFormat)
Sets current format of a sample. |
void |
setSampleArray(double[] padSampleArray)
Sets the internal sample array (adSample) with the specified argument. |
void |
setSampleSize(int piDesiredSize)
Sets internal size of the sample array. |
java.lang.String |
toString()
Returns textual representation of the sample object. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected transient MARFAudioFileFormat oAudioFileFormat
public static final int DEFAULT_SAMPLE_SIZE
public static final int DEFAULT_CHUNK_SIZE
protected double[] adSample
protected transient int iArrayIndex
Constructor Detail |
---|
public Sample()
public Sample(double[] padData)
padData
- preset amplitude valuespublic Sample(int piFormat) throws InvalidSampleFormatException
piFormat
- format number for the enumeration
InvalidSampleFormatException
- if the parameter format is invalidpublic Sample(int piFormat, double[] padData) throws InvalidSampleFormatException
piFormat
- format number for the enumerationpadData
- preset amplitude values
InvalidSampleFormatException
- if the parameter format is invalidpublic Sample(Sample poSample) throws InvalidSampleFormatException
poSample
- sample object to copy data off from
InvalidSampleFormatException
- if the parameter format is invalidMethod Detail |
---|
public int getAudioFileFormatCode()
public javax.sound.sampled.AudioFormat getAudioFormat()
getAudioFileFormatCode()
public void setAudioFileFormatCode(int piFileFormat) throws InvalidSampleFormatException
piFileFormat
- format number from the enumeration
InvalidSampleFormatException
- if the parameter format is invalidgetAudioFileFormatCode()
public void setSampleArray(double[] padSampleArray)
padSampleArray
- an array of doublespublic double[] getSampleArray()
public int getNextChunk(double[] padChunkArray)
padChunkArray
- an array of doubles
public final void resetArrayMark()
public void reset()
resetArrayMark()
public long getSampleSize()
public void setSampleSize(int piDesiredSize)
piDesiredSize
- new desired size of the array
java.lang.IllegalArgumentException
- if the parameter is <= 0public java.lang.Object clone()
clone
in class java.lang.Object
Object.clone()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
public boolean equals(java.lang.Object poSample)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |