marf.Storage
Class MARFAudioFileFormat

java.lang.Object
  extended by javax.sound.sampled.AudioFileFormat
      extended by marf.Storage.MARFAudioFileFormat

public class MARFAudioFileFormat
extends javax.sound.sampled.AudioFileFormat

Supported MARF Audio File Formats.

NOTE: this code is still experimental.
$Id: MARFAudioFileFormat.java,v 1.14 2007/12/23 06:29:46 mokhov Exp $

Since:
0.3.0.2
Version:
$Revision: 1.14 $
Author:
Serguei Mokhov

Nested Class Summary
static class MARFAudioFileFormat.Type
          In addition to the types defined in AudioFileFormat.Type defines MP3, MIDI, and ULAW formats and their extensions.
 
Field Summary
static int AIFF
          AIFF sample format.
static int AIFFC
          AIFF-C sample format.
static int AU
          AU sample format.
static int CUSTOM
          Custom (plug-in) sample format.
static int DEFAULT_CHUNK_SIZE
          Default sample chunk's size (128).
static int DEFAULT_SAMPLE_SIZE
          Default sample array's size (1024).
private static int HIGHEST_FORMAT
          Highest possible sample format value.
protected  int iFormat
          Current sample's format.
private static int LOWEST_FORMAT
          Lowest possible sample format value.
static int MIDI
          MIDI sample format.
static int MP3
          Indicates MP3 incoming sample file format.
protected  MARFAudioFileFormat.Type oType
          File type.
static int SINE
          Sine sample format.
static int SND
          SND sample format.
static int TEXT
          Textual sample format.
static int ULAW
          Indicates ULAW incoming sample file format.
static int UNK
          Unknown sample format.
static int WAV
          Indicates WAVE incoming sample file format.
 
Constructor Summary
  MARFAudioFileFormat()
          Default constructor creates a WAVE-type format by default, which is PCM-signed, 16 bits, mono, little-endian.
  MARFAudioFileFormat(javax.sound.sampled.AudioFileFormat.Type poType, javax.sound.sampled.AudioFormat poFormat, int piFrameLength)
          Mimics parent's constructor.
  MARFAudioFileFormat(int piFormat)
          Constructs format instant given the format enumeration parameter and default AudioFormat parameters.
  MARFAudioFileFormat(MARFAudioFileFormat.Type poType, javax.sound.sampled.AudioFormat poFormat, int piFrameLength)
          MARF-related constructor.
protected MARFAudioFileFormat(MARFAudioFileFormat.Type poType, int piByteLength, javax.sound.sampled.AudioFormat poFormat, int piFrameLength)
          Constructs an audio file format object.
 
Method Summary
 int getAudioFormat()
          Retrieves current sample's format.
static java.lang.String getMARFSourceCodeRevision()
          Returns source code revision information.
 MARFAudioFileFormat.Type setAudioFormat(int piFormat)
          Sets current format of a sample.
 
Methods inherited from class javax.sound.sampled.AudioFileFormat
getByteLength, getFormat, getFrameLength, getProperty, getType, properties, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNK

public static final int UNK
Unknown sample format.

See Also:
Constant Field Values

WAV

public static final int WAV
Indicates WAVE incoming sample file format.

See Also:
Constant Field Values

ULAW

public static final int ULAW
Indicates ULAW incoming sample file format.

See Also:
Constant Field Values

MP3

public static final int MP3
Indicates MP3 incoming sample file format.

See Also:
Constant Field Values

SINE

public static final int SINE
Sine sample format.

Since:
0.3.0
See Also:
Constant Field Values

AIFF

public static final int AIFF
AIFF sample format.

Since:
0.3.0
See Also:
Constant Field Values

AIFFC

public static final int AIFFC
AIFF-C sample format.

Since:
0.3.0
See Also:
Constant Field Values

AU

public static final int AU
AU sample format.

Since:
0.3.0
See Also:
Constant Field Values

SND

public static final int SND
SND sample format.

Since:
0.3.0
See Also:
Constant Field Values

MIDI

public static final int MIDI
MIDI sample format.

Since:
0.3.0
See Also:
Constant Field Values

CUSTOM

public static final int CUSTOM
Custom (plug-in) sample format.

Since:
0.3.0.5
See Also:
Constant Field Values

TEXT

public static final int TEXT
Textual sample format.

Since:
0.3.0.6
See Also:
Constant Field Values

LOWEST_FORMAT

private static final int LOWEST_FORMAT
Lowest possible sample format value. For boundaries check.

See Also:
Constant Field Values

HIGHEST_FORMAT

private static final int HIGHEST_FORMAT
Highest possible sample format value. For boundaries check.

See Also:
Constant Field Values

DEFAULT_SAMPLE_SIZE

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

Since:
0.3.0
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
See Also:
Constant Field Values

iFormat

protected int iFormat
Current sample's format.


oType

protected transient MARFAudioFileFormat.Type oType
File type. Has to be added as the parent's is private.

Constructor Detail

MARFAudioFileFormat

public MARFAudioFileFormat()
                    throws InvalidSampleFormatException
Default constructor creates a WAVE-type format by default, which is PCM-signed, 16 bits, mono, little-endian.

Throws:
InvalidSampleFormatException - since 0.3.0.6 as implementation delegated to MARFAudioFileFormat(int)
See Also:
MARFAudioFileFormat(int)

MARFAudioFileFormat

public MARFAudioFileFormat(int piFormat)
                    throws InvalidSampleFormatException
Constructs format instant given the format enumeration parameter and default AudioFormat parameters.

Parameters:
piFormat - the desired format instance.
Throws:
InvalidSampleFormatException - if the specified format cannot be set
Since:
0.3.0.6
See Also:
setAudioFormat(int), AudioFormat.Encoding#PCM_SIGNED, ISampleLoader.DEFAULT_FREQUENCY, ISampleLoader.DEFAULT_SAMPLE_BIT_SIZE, ISampleLoader.DEFAULT_CHANNELS, ISampleLoader.DEFAULT_FREQUENCY

MARFAudioFileFormat

public MARFAudioFileFormat(javax.sound.sampled.AudioFileFormat.Type poType,
                           javax.sound.sampled.AudioFormat poFormat,
                           int piFrameLength)
Mimics parent's constructor.

Parameters:
poType - file format
poFormat - audio format
piFrameLength - frame length

MARFAudioFileFormat

public MARFAudioFileFormat(MARFAudioFileFormat.Type poType,
                           javax.sound.sampled.AudioFormat poFormat,
                           int piFrameLength)
MARF-related constructor.

Parameters:
poType - file format
poFormat - audio format
piFrameLength - frame length

MARFAudioFileFormat

protected MARFAudioFileFormat(MARFAudioFileFormat.Type poType,
                              int piByteLength,
                              javax.sound.sampled.AudioFormat poFormat,
                              int piFrameLength)
Constructs an audio file format object. Mimics parent's protected constructor.

Parameters:
poType - type of the audio file
piByteLength - length of the file in bytes, or AudioSystem.NOT_SPECIFIED
poFormat - format of the audio data in the file
piFrameLength - the audio data length in sample frames, or AudioSystem.NOT_SPECIFIED
Method Detail

getAudioFormat

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

Returns:
an integer representing the format of the sample

setAudioFormat

public final MARFAudioFileFormat.Type setAudioFormat(int piFormat)
                                              throws InvalidSampleFormatException
Sets current format of a sample.

Parameters:
piFormat - format number from the enumeration
Returns:
since 0.3.0.6 returns the resultant type.
Throws:
InvalidSampleFormatException - if piFormat is out of range

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Returns source code revision information.

Returns:
revision string


SourceForge Logo