toxi.audio
Class AudioBuffer

java.lang.Object
  extended by toxi.audio.AudioBuffer

public class AudioBuffer
extends java.lang.Object

A wrapper for the actual sample data byte buffer in memory. The buffer can be queried to find out more information about the underlying audio data.


Nested Class Summary
static class AudioBuffer.Format
          Format descriptor
 
Constructor Summary
AudioBuffer(net.java.games.joal.AL al, int bufferID)
           
 
Method Summary
 AudioBuffer configure(java.nio.ByteBuffer data, AudioBuffer.Format format, int freq)
           
 AudioBuffer configure(java.nio.ByteBuffer data, int format, int freq)
          Configure the audio buffer
 boolean convertUlawToPCM(boolean isAlaw)
           
 boolean delete()
          Deletes this buffer, and frees its resources.
 int getBitDepth()
          Get the bit-depth of the data, (8 or 16)
 int getByteSize()
          Gets the size (in bytes) of the raw data contained in this buffer.
 java.nio.ByteBuffer getData()
          Gets the raw data contained in this buffer.
 int getFrequency()
          Gets the audio frequency of the data contained in this buffer.
 int getID()
          Returns the OpenAL reference ID for this buffer.
 int getNumChannels()
          Get the number of channels of the data (1-Mono, 2-Stereo)
 int getSampleSize()
          Gets the size (in samples) of the raw data contained in this buffer.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AudioBuffer

public AudioBuffer(net.java.games.joal.AL al,
                   int bufferID)
Method Detail

configure

public AudioBuffer configure(java.nio.ByteBuffer data,
                             AudioBuffer.Format format,
                             int freq)

configure

public AudioBuffer configure(java.nio.ByteBuffer data,
                             int format,
                             int freq)
Configure the audio buffer

Parameters:
data - the raw audio data
format - the internal format ID of the audio data
freq - the frequency of the data

convertUlawToPCM

public boolean convertUlawToPCM(boolean isAlaw)

delete

public boolean delete()
Deletes this buffer, and frees its resources.

Returns:
true, if removed successfully

getBitDepth

public final int getBitDepth()
Get the bit-depth of the data, (8 or 16)

Returns:
the bit-depth of the data

getByteSize

public final int getByteSize()
Gets the size (in bytes) of the raw data contained in this buffer.

Returns:
the size of the data.

getData

public final java.nio.ByteBuffer getData()
Gets the raw data contained in this buffer.

Returns:
the raw buffer data.

getFrequency

public final int getFrequency()
Gets the audio frequency of the data contained in this buffer.

Returns:
the frequency of the data

getID

public final int getID()
Returns the OpenAL reference ID for this buffer.

Returns:
buffer id

getNumChannels

public final int getNumChannels()
Get the number of channels of the data (1-Mono, 2-Stereo)

Returns:
the number of audio channels.

getSampleSize

public final int getSampleSize()
Gets the size (in samples) of the raw data contained in this buffer.

Returns:
sample size.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object