public class ALHelpers extends Object
Constructor and Description |
---|
ALHelpers() |
Modifier and Type | Method and Description |
---|---|
static String |
alChannelLayoutName(int alChannelLayout)
Returns the readable name of the given AL channel layout
|
static String |
alSampleTypeName(int alSampleType)
Returns the readable name of the given AL sample type
|
static int |
bytesToSampleCount(int byteCount,
int alChannelLayout,
int alSampleType) |
static int |
getALFormat(int alChannelLayout,
int alSampleType,
boolean hasSOFTBufferSamples,
AL al,
ALExt alExt)
Returns a compatible AL buffer format given the AL channel layout and
AL sample type.
|
static int |
getALSampleType(int sampleSize,
boolean signed,
boolean fixedP)
Returns the AL sample type matching the given audio type attributes, or
ALConstants.AL_NONE . |
static int |
getDefaultALChannelLayout(int channelCount)
Returns the default AL channel layout matching the given channel count, or
ALConstants.AL_NONE . |
static int |
samplesToByteCount(int sampleCount,
int alChannelLayout,
int alSampleType) |
static int |
sizeOfALSampleType(int alSampleType)
Returns the byte size of the given AL sample type
|
public static final int getALFormat(int alChannelLayout, int alSampleType, boolean hasSOFTBufferSamples, AL al, ALExt alExt)
hasSOFTBufferSamples
is true,
it will be called to find the closest-matching format from
AL_SOFT_buffer_samples
.
Returns ALConstants.AL_NONE
if no supported format can be found.
alChannelLayout
- AL channel layout, see getDefaultALChannelLayout(int)
alSampleType
- AL sample type, see getALSampleType(int, boolean, boolean)
.hasSOFTBufferSamples
- true if having extension AL_SOFT_buffer_samples
, otherwise falseal
- AL instancealExt
- ALExt instancepublic static final int getDefaultALChannelLayout(int channelCount)
ALConstants.AL_NONE
.channelCount
- number of channelssigned
- true if signed number, false for unsignedfixedP
- true for fixed point value, false for floating point value with a sampleSize of 32 (float) or 64 (double)public static final String alChannelLayoutName(int alChannelLayout)
public static final int getALSampleType(int sampleSize, boolean signed, boolean fixedP)
ALConstants.AL_NONE
.sampleSize
- sample size in bitssigned
- true if signed number, false for unsignedfixedP
- true for fixed point value, false for floating point value with a sampleSize of 32 (float) or 64 (double)public static final String alSampleTypeName(int alSampleType)
public static final int sizeOfALSampleType(int alSampleType) throws IllegalArgumentException
IllegalArgumentException
- for unknown alChannelLayout
or alSampleType
values.public static final int samplesToByteCount(int sampleCount, int alChannelLayout, int alSampleType) throws IllegalArgumentException
sampleCount
- number of samples per channelalChannelLayout
- AL channel layoutalSampleType
- AL sample typeIllegalArgumentException
- for unknown alChannelLayout
or alSampleType
values.public static final int bytesToSampleCount(int byteCount, int alChannelLayout, int alSampleType)