aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/config/joal-alc-impl-CustomCCode.c5
-rwxr-xr-xmake/scripts/tests.sh4
-rw-r--r--src/java/com/jogamp/openal/JoalVersion.java22
-rw-r--r--src/java/jogamp/openal/ALCImpl.java12
-rw-r--r--src/native/almisc.c20
5 files changed, 28 insertions, 35 deletions
diff --git a/make/config/joal-alc-impl-CustomCCode.c b/make/config/joal-alc-impl-CustomCCode.c
index bd4a57a..bb36ff1 100644
--- a/make/config/joal-alc-impl-CustomCCode.c
+++ b/make/config/joal-alc-impl-CustomCCode.c
@@ -1,6 +1,5 @@
-#include <stdbool.h>
-bool alc_is_double_null_terminated_string(ALCdevice *device, int param) {
+static int alc_is_double_null_terminated_string(ALCdevice *device, int param) {
return device == NULL && (
param == ALC_DEVICE_SPECIFIER ||
param == ALC_CAPTURE_DEVICE_SPECIFIER ||
@@ -10,7 +9,7 @@ bool alc_is_double_null_terminated_string(ALCdevice *device, int param) {
int strlen_alc(ALCdevice *device, int param, const char* str) {
int len = 0;
- if (alc_is_double_null_terminated_string(device, param)) {
+ if ( alc_is_double_null_terminated_string(device, param) ) {
while (*str != 0) {
while (*str != 0) {
++str;
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index b015604..fbb39bf 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -103,11 +103,11 @@ function testnormal() {
}
-#testnormal com.jogamp.openal.JoalVersion $*
+testnormal com.jogamp.openal.JoalVersion $*
#testnormal com.jogamp.openal.test.manual.OpenALTest $*
#testnormal com.jogamp.openal.test.manual.Sound3DTest $*
#testnormal com.jogamp.openal.test.manual.Synth01AL $*
-testnormal com.jogamp.openal.test.manual.Synth02AL $*
+#testnormal com.jogamp.openal.test.manual.Synth02AL $*
#testnormal com.jogamp.openal.test.manual.Synth02bAL $*
#testnormal com.jogamp.openal.test.junit.ALVersionTest $*
#testnormal com.jogamp.openal.test.junit.ALutWAVLoaderTest $*
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);
}
diff --git a/src/native/almisc.c b/src/native/almisc.c
index 06fa794..22689b6 100644
--- a/src/native/almisc.c
+++ b/src/native/almisc.c
@@ -10,12 +10,9 @@
#endif
#include "efx.h"
#include <string.h>
-#include <stdbool.h>
extern int strlen_alc(ALCdevice *device, int param, const char* str);
-extern bool alc_is_double_null_terminated_string(ALCdevice *device, int param);
-
/* Java->C glue code:
* Java package: jogamp.openal.ALImpl
* Java method: long dispatch_alGetProcAddressStatic(java.lang.String fname)
@@ -53,22 +50,13 @@ Java_jogamp_openal_ALCImpl_dispatch_1alcGetStringImpl1(JNIEnv *env, jobject _unu
LPALCGETSTRING ptr_alcGetString;
ALCdevice * _device_ptr = NULL;
const ALCchar * _res;
- if ( NULL != device ) {
- _device_ptr = (ALCdevice *) (((char*) (*env)->GetDirectBufferAddress(env, device)) + 0);
- }
+ if ( NULL != device ) {
+ _device_ptr = (ALCdevice *) (((char*) (*env)->GetDirectBufferAddress(env, device)) + 0);
+ }
ptr_alcGetString = (LPALCGETSTRING) (intptr_t) procAddress;
assert(ptr_alcGetString != NULL);
_res = (* ptr_alcGetString) ((ALCdevice *) _device_ptr, (ALCenum) param);
if (NULL == _res) return NULL;
- return (*env)->NewDirectByteBuffer(env, _res, strlen_alc(_device_ptr, param, _res));
+ return (*env)->NewDirectByteBuffer(env, (void*)_res, strlen_alc(_device_ptr, param, _res));
}
-JNIEXPORT jboolean JNICALL
-Java_jogamp_openal_ALCImpl_dispatch_1alcIsDoubleNullTerminatedString(JNIEnv *env, jobject _unused, jobject device, jint param) {
- ALCdevice * _device_ptr = NULL;
- const ALCchar * _res;
- if ( NULL != device ) {
- _device_ptr = (ALCdevice *) (((char*) (*env)->GetDirectBufferAddress(env, device)) + 0);
- }
- return (jboolean) alc_is_double_null_terminated_string((ALCdevice *) _device_ptr, (ALCenum) param);
-}