diff options
author | Sven Gothel <[email protected]> | 2023-11-28 12:08:55 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-11-28 12:08:55 +0100 |
commit | 1aa6f3080953eb4b3a4018b805a014c95dfce4dd (patch) | |
tree | 1d0035f9d1d9afd78d4234fd7dd5ccc14ffb4c86 /src/java | |
parent | 072c55ca78d57ce6cee44a83a78cffe1559f2b81 (diff) |
Bug 1475: Minor revision of orig patch-set
- Implement ALC.alcIsDoubleNullTerminatedString() in Java w/ our existing functionality,
drop JNI function
- JoalVersion.devicesToString(..) revert to original API
dropping boolean params
- C: Drop using stdbool.h, earmarked as obsolete in std
Diffstat (limited to 'src/java')
-rw-r--r-- | src/java/com/jogamp/openal/JoalVersion.java | 22 | ||||
-rw-r--r-- | src/java/jogamp/openal/ALCImpl.java | 12 |
2 files changed, 20 insertions, 14 deletions
diff --git a/src/java/com/jogamp/openal/JoalVersion.java b/src/java/com/jogamp/openal/JoalVersion.java index 6469189..77dcabf 100644 --- a/src/java/com/jogamp/openal/JoalVersion.java +++ b/src/java/com/jogamp/openal/JoalVersion.java @@ -131,6 +131,7 @@ public class JoalVersion extends JogampVersion { sb.append(Platform.getNewline()); final boolean enumerationExtIsPresent = alc.aclEnumerationExtIsPresent(); final boolean enumerateAllExtIsPresent = alc.aclEnumerateAllExtIsPresent(); + final String enumExtAvailInfo = "(enumExt[def "+enumerationExtIsPresent+", all "+enumerateAllExtIsPresent+"])"; { final int[] iversion = { 0, 0 }; alc.alcGetIntegerv(device, ALCConstants.ALC_MAJOR_VERSION, 1, iversion, 0); @@ -138,8 +139,7 @@ public class JoalVersion extends JogampVersion { sb.append("ALC_VERSION ").append(iversion[0]).append(".").append(iversion[1]); sb.append(Platform.getNewline()); if (!enumerationExtIsPresent && !enumerateAllExtIsPresent) { - sb.append("ALC_DEF_OUTPUT Unknown (Missing "+ - ALHelpers.ALC_ENUMERATION_EXT+" and "+ALHelpers.ALC_ENUMERATE_ALL_EXT+")"); + sb.append("ALC_DEF_OUTPUT Unknown ").append(enumExtAvailInfo); sb.append(Platform.getNewline()); } else { if (enumerationExtIsPresent) { @@ -155,11 +155,10 @@ public class JoalVersion extends JogampVersion { } if (enumerationExtIsPresent) { sb.append("ALC_DEF_CAPTURE ").append(alc.alcGetString(device, ALCConstants.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); - sb.append(Platform.getNewline()); } else { - sb.append("ALC_DEF_CAPTURE Unknown (Missing "+ALHelpers.ALC_ENUMERATION_EXT+")"); - sb.append(Platform.getNewline()); + sb.append("ALC_DEF_CAPTURE Unknown ").append(enumExtAvailInfo); } + sb.append(Platform.getNewline()); } if( null == initialContext ) { @@ -168,7 +167,7 @@ public class JoalVersion extends JogampVersion { alc.alcCloseDevice(device); } - devicesToString(sb, alc, enumerationExtIsPresent, enumerateAllExtIsPresent); + devicesToString(sb, alc); return sb; } @@ -268,10 +267,13 @@ public class JoalVersion extends JogampVersion { } } - public static void devicesToString(final StringBuilder sb, final ALC alc, final boolean enumerationExtIsPresent, final boolean enumerateAllExtIsPresent) { + public static void devicesToString(final StringBuilder sb, final ALC alc) { + final boolean enumerationExtIsPresent = alc.aclEnumerationExtIsPresent(); + final boolean enumerateAllExtIsPresent = alc.aclEnumerateAllExtIsPresent(); + final String enumExtAvailInfo = "(enumExt[def "+enumerationExtIsPresent+", all "+enumerateAllExtIsPresent+"])"; + if (!enumerationExtIsPresent && !enumerateAllExtIsPresent) { - sb.append("No output devices infos available (Missing "+ - ALHelpers.ALC_ENUMERATION_EXT+" and "+ALHelpers.ALC_ENUMERATE_ALL_EXT+")"); + sb.append("No output devices infos available ").append(enumExtAvailInfo); } else { if (enumerateAllExtIsPresent) { final String defOutAllDeviceName = alc.alcGetString(null, ALCConstants.ALC_DEFAULT_ALL_DEVICES_SPECIFIER); @@ -299,7 +301,7 @@ public class JoalVersion extends JogampVersion { } } if (!enumerationExtIsPresent) { - sb.append("No capture devices infos available (Missing " + ALHelpers.ALC_ENUMERATION_EXT + ")"); + sb.append("No capture devices infos available ").append(enumExtAvailInfo); } else { final String defInDeviceName = alc.alcGetString(null, ALCConstants.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER); sb.append("Capture devices:" + System.lineSeparator()); diff --git a/src/java/jogamp/openal/ALCImpl.java b/src/java/jogamp/openal/ALCImpl.java index f08541c..cdde31b 100644 --- a/src/java/jogamp/openal/ALCImpl.java +++ b/src/java/jogamp/openal/ALCImpl.java @@ -15,7 +15,6 @@ import java.util.ArrayList; /** * ALC implementation. - * @author Michael Bien */ public class ALCImpl extends ALCAbstractImpl { public boolean aclEnumerationExtIsPresent() { @@ -27,11 +26,14 @@ public class ALCImpl extends ALCAbstractImpl { } public boolean alcIsDoubleNullTerminatedString(final ALCdevice device, final int param) { - return dispatch_alcIsDoubleNullTerminatedString(((device == null) ? null : device.getBuffer()), param); + return ( null == device || 0 == device.getDirectBufferAddress() ) && + ( param == ALC_DEVICE_SPECIFIER || + param == ALC_CAPTURE_DEVICE_SPECIFIER || + param == ALC_ALL_DEVICES_SPECIFIER + ); } - public native boolean dispatch_alcIsDoubleNullTerminatedString(ByteBuffer deviceBuffer, int param); - + @Override public String alcGetString(final ALCdevice device, final int param) { if (alcIsDoubleNullTerminatedString(device, param)) { throw new ALException("Call alcGetString to get double null terminated string"); @@ -67,10 +69,12 @@ public class ALCImpl extends ALCAbstractImpl { } private native java.nio.ByteBuffer dispatch_alcGetStringImpl1(ByteBuffer deviceBuffer, int param, long addr); + @Override public String[] alcGetDeviceSpecifiers() { return alcGetStringAsDoubleNullTerminatedString(null, ALC_DEVICE_SPECIFIER); } + @Override public String[] alcGetCaptureDeviceSpecifiers() { return alcGetStringAsDoubleNullTerminatedString(null, ALC_CAPTURE_DEVICE_SPECIFIER); } |