Class OALBuffer
java.lang.Object
com.blackrook.gloop.openal.OALObject
com.blackrook.gloop.openal.OALBuffer
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OALBuffer.FormatSound format.protected intSound sampling rate.protected intThe sizes of each of the buffers.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Method Summary
Modifier and TypeMethodDescriptionprotected final intallocate()Allocates a new type of this object in OpenAL.protected final voidfree()Destroys this object (deallocates it on OpenAL).intintgetSize()voidsetData(byte[] data) Loads this buffer with sample data from an array of bytes.voidsetData(byte[] data, int offset, int length) Loads this buffer with sample data from an array of bytes.voidsetData(ByteBuffer data) Loads this buffer with sample data.voidsetFormat(OALBuffer.Format format) Sets this buffer's bitrate format.voidsetFormatByChannelsAndBits(int channels, int bits) Sets format by channels and bits.voidsetFrequencyAndFormat(AudioFormat format) Sets the audio frequency and format of this buffer using anAudioFormatinfo object.voidsetSamplingRate(int rate) Sets this buffer's sampling rate.toString()Methods inherited from class OALObject
clearError, destroy, equals, equals, errorCheck, getName, hashCode, requestContext
-
Field Details
-
SAMPLING_RATE_8KHZ
public static final int SAMPLING_RATE_8KHZ- See Also:
-
SAMPLING_RATE_11KHZ
public static final int SAMPLING_RATE_11KHZ- See Also:
-
SAMPLING_RATE_16KHZ
public static final int SAMPLING_RATE_16KHZ- See Also:
-
SAMPLING_RATE_22KHZ
public static final int SAMPLING_RATE_22KHZ- See Also:
-
SAMPLING_RATE_32KHZ
public static final int SAMPLING_RATE_32KHZ- See Also:
-
SAMPLING_RATE_44KHZ
public static final int SAMPLING_RATE_44KHZ- See Also:
-
SAMPLING_RATE_48KHZ
public static final int SAMPLING_RATE_48KHZ- See Also:
-
bufferSize
protected int bufferSizeThe sizes of each of the buffers. -
bufferFormat
Sound format. -
bufferRate
protected int bufferRateSound sampling rate.
-
-
Method Details
-
setFrequencyAndFormat
Sets the audio frequency and format of this buffer using anAudioFormatinfo object.- Parameters:
format- the JavaX sound format data to pull from.
-
allocate
-
free
-
setData
public void setData(byte[] data) Loads this buffer with sample data from an array of bytes. This is intended for pure convenience, and its use is discouraged if performance is desired.- Parameters:
data- the data to load into it.
-
setData
public void setData(byte[] data, int offset, int length) Loads this buffer with sample data from an array of bytes. This is intended for pure convenience, and its use is discouraged if performance is desired.- Parameters:
data- the data to load into it.offset- the offset into the array to use.length- the amount of bytes to load.- Throws:
ArrayIndexOutOfBoundsException- ifoffset + lengthexceedsdata.length.
-
setData
Loads this buffer with sample data. The data is loaded from the source byte buffer's current position to its current limit.- Parameters:
data- the data to load into it.
-
getSize
public int getSize()- Returns:
- the buffer size in bytes.
-
setFormat
Sets this buffer's bitrate format.- Parameters:
format- This buffer's format.- Throws:
IllegalArgumentException- if this is not set using a valid constant.
-
getFormat
- Returns:
- this buffer's format (AL constant).
-
setSamplingRate
public void setSamplingRate(int rate) Sets this buffer's sampling rate.- Parameters:
rate- the rate in kHz.
-
getSamplingRate
public int getSamplingRate()- Returns:
- this buffer's sampling rate.
-
setFormatByChannelsAndBits
public void setFormatByChannelsAndBits(int channels, int bits) Sets format by channels and bits.- Parameters:
channels- amount of channels.bits- bit per sample.- Throws:
IllegalArgumentException- if the combination of channels and bits create an unsupported format.
-
toString
-