diff options
author | Sven Gothel <[email protected]> | 2023-05-17 18:07:44 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-05-17 18:07:44 +0200 |
commit | 518ae3b1432f43ea6659f0622536fb2135eec9fa (patch) | |
tree | 5e4daac4cdef1efc6a1ab7057f95ab7f6cfd310c /src/java/com/jogamp/openal | |
parent | b2b90538c2727709da4ed4efde84268700e2b7f8 (diff) |
ALAudioSink: Enhance using AL_EXT_MCFORMATS (max channels == 8), AL_EXT_FLOAT32, AL_EXT_DOUBLE
Note: AL_SOFT_buffer_samples is n/a since openal-soft 1.18.0
ALHelpers.getALFormat(..) uses cached booleans for optionally used available extensions.
Add DEBUG output for ALAudioSink.init() and ALAudioSink.isSupported(),
allowing to track supported and used formats.
Diffstat (limited to 'src/java/com/jogamp/openal')
-rw-r--r-- | src/java/com/jogamp/openal/util/ALHelpers.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/java/com/jogamp/openal/util/ALHelpers.java b/src/java/com/jogamp/openal/util/ALHelpers.java index 7c2b0d4..a666049 100644 --- a/src/java/com/jogamp/openal/util/ALHelpers.java +++ b/src/java/com/jogamp/openal/util/ALHelpers.java @@ -55,12 +55,19 @@ public class ALHelpers { * @param alChannelLayout AL channel layout, see {@link #getDefaultALChannelLayout(int)} * @param alSampleType AL sample type, see {@link #getALSampleType(int, boolean, boolean)}. * @param hasSOFTBufferSamples true if having extension <code>AL_SOFT_buffer_samples</code>, otherwise false + * @param hasEXTMcFormats true if having extension <code>AL_EXT_MCFORMATS</code>, otherwise false + * @param hasEXTFloat32 true if having extension <code>AL_EXT_FLOAT32</code>, otherwise false + * @param hasEXTDouble true if having extension <code>AL_EXT_DOUBLE</code>, otherwise false * @param al AL instance * @param alExt ALExt instance * @return AL buffer format */ public static final int getALFormat(final int alChannelLayout, final int alSampleType, - final boolean hasSOFTBufferSamples, final AL al, final ALExt alExt) { + final boolean hasSOFTBufferSamples, + final boolean hasEXTMcFormats, + final boolean hasEXTFloat32, + final boolean hasEXTDouble, + final AL al, final ALExt alExt) { int format = AL_NONE; /* If using AL_SOFT_buffer_samples, try looking through its formats */ @@ -154,7 +161,7 @@ public class ALHelpers { format = AL_FORMAT_MONO8; else if(alChannelLayout == AL_STEREO_SOFT) format = AL_FORMAT_STEREO8; - else if(al.alIsExtensionPresent("AL_EXT_MCFORMATS")) + else if( hasEXTMcFormats ) { if(alChannelLayout == AL_QUAD_SOFT) format = al.alGetEnumValue("AL_FORMAT_QUAD8"); @@ -172,7 +179,7 @@ public class ALHelpers { format = AL_FORMAT_MONO16; else if(alChannelLayout == AL_STEREO_SOFT) format = AL_FORMAT_STEREO16; - else if(al.alIsExtensionPresent("AL_EXT_MCFORMATS")) + else if( hasEXTMcFormats ) { if(alChannelLayout == AL_QUAD_SOFT) format = al.alGetEnumValue("AL_FORMAT_QUAD16"); @@ -184,13 +191,13 @@ public class ALHelpers { format = al.alGetEnumValue("AL_FORMAT_71CHN16"); } } - else if(alSampleType == AL_FLOAT_SOFT && al.alIsExtensionPresent("AL_EXT_FLOAT32")) + else if(alSampleType == AL_FLOAT_SOFT && hasEXTFloat32) { if(alChannelLayout == AL_MONO_SOFT) format = al.alGetEnumValue("AL_FORMAT_MONO_FLOAT32"); else if(alChannelLayout == AL_STEREO_SOFT) format = al.alGetEnumValue("AL_FORMAT_STEREO_FLOAT32"); - else if(al.alIsExtensionPresent("AL_EXT_MCFORMATS")) + else if( hasEXTMcFormats ) { if(alChannelLayout == AL_QUAD_SOFT) format = al.alGetEnumValue("AL_FORMAT_QUAD32"); @@ -202,7 +209,7 @@ public class ALHelpers { format = al.alGetEnumValue("AL_FORMAT_71CHN32"); } } - else if(alSampleType == AL_DOUBLE_SOFT && al.alIsExtensionPresent("AL_EXT_DOUBLE")) + else if(alSampleType == AL_DOUBLE_SOFT && hasEXTDouble) { if(alChannelLayout == AL_MONO_SOFT) format = al.alGetEnumValue("AL_FORMAT_MONO_DOUBLE"); |