Top Description Fields Constructors Methods
com.jogamp.openal.util

public final Class WAVData

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .IOException, .InputStream, java.nio.ByteBuffer, .ByteOrder, com.jogamp.common.util.IOUtil, com.jogamp.openal.ALConstants, .UnsupportedAudioFileException

This class is a holder for WAV (.wav ) file Data returned from the WavLoader, or directly via loadFromStream(InputStream, int, int, int).
Author
Athomas Goldberg, et.al.

Field Summary

Modifier and TypeField and Description
public final ByteBuffer
data

The audio data

public final int
format

the format of the Data.

public final int
freq

The frequency of the data

public final boolean
loop

flag indicating whether or not the sound in the data should loop

public final int
size

Size (in bytes) of the data

Constructor Summary

AccessConstructor and Description
public
WAVData(final ByteBuffer data, final int format, final int size, final int freq, final boolean loop)

Method Summary

Modifier and TypeMethod and Description
public static WAVData

Returns:

a WAVData object containing the audio data
loadFromStream
(InputStream aIn, final int
initial buffer capacity in bytes, if > available bytes
initialCapacity
,
final int numChannels, final int bits, final int sampleRate, final ByteOrder byteOrder, final boolean loop)

This method loads a (.wav) file into a WAVData object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
public final ByteBuffer data

The audio data

formatback to summary
public final int format

the format of the Data. One of:

AL.AL_FORMAT_MONO8
AL.AL_FORMAT_MONO16
AL.AL_FORMAT_STEREO8
AL.AL_FORMAT_STEREO16
freqback to summary
public final int freq

The frequency of the data

loopback to summary
public final boolean loop

flag indicating whether or not the sound in the data should loop

sizeback to summary
public final int size

Size (in bytes) of the data

Constructor Detail

WAVDataback to summary
public WAVData(final ByteBuffer data, final int format, final int size, final int freq, final boolean loop)

Method Detail

loadFromStreamback to summary
public static WAVData loadFromStream(InputStream aIn, final int initialCapacity, final int numChannels, final int bits, final int sampleRate, final ByteOrder byteOrder, final boolean loop) throws IOException

This method loads a (.wav) file into a WAVData object.

Parameters
initialCapacity:int

initial buffer capacity in bytes, if > available bytes

Returns:WAVData

a WAVData object containing the audio data

Exceptions
IOException:
If the file can no be found or some other IO error occurs
UnsupportedAudioFileException:
if the format of the audio if not supported.