Package com.jogamp.openal.util
Class ALHelpers
- java.lang.Object
-
- com.jogamp.openal.util.ALHelpers
-
public class ALHelpers extends Object
-
-
Constructor Summary
Constructors Constructor Description ALHelpers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringalChannelLayoutName(int alChannelLayout)Returns the readable name of the given AL channel layoutstatic StringalSampleTypeName(int alSampleType)Returns the readable name of the given AL sample typestatic intbytesToSampleCount(int byteCount, int alChannelLayout, int alSampleType)static intgetALFormat(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 intgetALSampleType(int sampleSize, boolean signed, boolean fixedP)Returns the AL sample type matching the given audio type attributes, orALConstants.AL_NONE.static intgetDefaultALChannelLayout(int channelCount)Returns the default AL channel layout matching the given channel count, orALConstants.AL_NONE.static intsamplesToByteCount(int sampleCount, int alChannelLayout, int alSampleType)static intsizeOfALSampleType(int alSampleType)Returns the byte size of the given AL sample type
-
-
-
Method Detail
-
getALFormat
public static final 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. IfhasSOFTBufferSamplesis true, it will be called to find the closest-matching format fromAL_SOFT_buffer_samples.Returns
ALConstants.AL_NONEif no supported format can be found.- Parameters:
alChannelLayout- AL channel layout, seegetDefaultALChannelLayout(int)alSampleType- AL sample type, seegetALSampleType(int, boolean, boolean).hasSOFTBufferSamples- true if having extensionAL_SOFT_buffer_samples, otherwise falseal- AL instancealExt- ALExt instance- Returns:
- AL buffer format
-
getDefaultALChannelLayout
public static final int getDefaultALChannelLayout(int channelCount)
Returns the default AL channel layout matching the given channel count, orALConstants.AL_NONE.- Parameters:
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)
-
alChannelLayoutName
public static final String alChannelLayoutName(int alChannelLayout)
Returns the readable name of the given AL channel layout
-
getALSampleType
public static final int getALSampleType(int sampleSize, boolean signed, boolean fixedP)Returns the AL sample type matching the given audio type attributes, orALConstants.AL_NONE.- Parameters:
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)
-
alSampleTypeName
public static final String alSampleTypeName(int alSampleType)
Returns the readable name of the given AL sample type
-
sizeOfALSampleType
public static final int sizeOfALSampleType(int alSampleType) throws IllegalArgumentExceptionReturns the byte size of the given AL sample type- Throws:
IllegalArgumentException- for unknownalChannelLayoutoralSampleTypevalues.
-
samplesToByteCount
public static final int samplesToByteCount(int sampleCount, int alChannelLayout, int alSampleType) throws IllegalArgumentException- Parameters:
sampleCount- number of samples per channelalChannelLayout- AL channel layoutalSampleType- AL sample type- Returns:
- bytes count required
- Throws:
IllegalArgumentException- for unknownalChannelLayoutoralSampleTypevalues.
-
bytesToSampleCount
public static final int bytesToSampleCount(int byteCount, int alChannelLayout, int alSampleType)
-
-