Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

marf.Storage
Class Sample  view Sample download Sample.java

java.lang.Object
  extended bymarf.Storage.Sample
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
ArtificialSample, Wave

public class Sample
extends java.lang.Object
implements java.io.Serializable

Audio sample data container.

$Id: Sample.java,v 1.39 2005/08/12 11:53:55 susan_fan Exp $

Since:
0.0.1
Version:
$Revision: 1.39 $

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.
private  MARFAudioFileFormat oAudioFileFormat
          Groupping of file format data.
private static long serialVersionUID
          For serialization versioning.
 
Constructor Summary
Sample()
          Constructs default sample object.
Sample(double[] padData)
          Accepts pre-set sample; for testing.
Sample(int piFormat)
          Constructor with format indication.
 
Method Summary
 int getAudioFormat()
          Retrieves current sample's format.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
 int getNextChunk(double[] padChunkArray)
          Gets the next chunk of audio 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 resetArrayMark()
          Resets the marker used for reading audio data from sample array.
 void setAudioFormat(int piFormat)
          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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

oAudioFileFormat

private MARFAudioFileFormat oAudioFileFormat
Groupping of file format data.

Since:
0.3.0.2

DEFAULT_SAMPLE_SIZE

public static final int DEFAULT_SAMPLE_SIZE
Default sample array's size (1024).

Since:
0.3.0.2
See Also:
Constant Field Values

DEFAULT_CHUNK_SIZE

public static final int DEFAULT_CHUNK_SIZE
Default sample chunk's size (128).

Since:
0.3.0.2
See Also:
Constant Field Values

adSample

protected double[] adSample
Sample data array (amplitudes).


iArrayIndex

protected transient int iArrayIndex
Chunk pointer in the sample array.


serialVersionUID

private static final long serialVersionUID
For serialization versioning. When adding new members or make other structural changes regenerate this number with the serialver tool that comes with JDK.

Since:
0.3.0.4
See Also:
Constant Field Values
Constructor Detail

Sample

public Sample()
Constructs default sample object.


Sample

public Sample(double[] padData)
Accepts pre-set sample; for testing.


Sample

public Sample(int piFormat)
       throws marf.util.InvalidSampleFormatException
Constructor with format indication.

Method Detail

getAudioFormat

public final int getAudioFormat()
Retrieves current sample's format.


setAudioFormat

public final void setAudioFormat(int piFormat)
                          throws marf.util.InvalidSampleFormatException
Sets current format of a sample.


setSampleArray

public final void setSampleArray(double[] padSampleArray)
Sets the internal sample array (adSample) with the specified argument. Index gets reset as well.


getSampleArray

public final double[] getSampleArray()
Retrieves array containing audio data of the entire sample.


getNextChunk

public final int getNextChunk(double[] padChunkArray)
Gets the next chunk of audio data and places it into padChunkArray. Similar to readAudioData() method only it reads from the array instead of the audio stream (file).


resetArrayMark

public final void resetArrayMark()
Resets the marker used for reading audio data from sample array.


getSampleSize

public final long getSampleSize()
Returns the length of the sample.


setSampleSize

public void setSampleSize(int piDesiredSize)
Sets internal size of the sample array. If array did not exist, it its created, else cut or enlarged to the desired size. The previous content is retained unless the desired size is less than the current.

Since:
0.3.0.2

toString

public java.lang.String toString()
Returns textual representation of the sample object. The contents is the format and lengthon the first line, and then a column of data.

Since:
0.3.0.3

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Since:
0.3.0.2