aboutsummaryrefslogtreecommitdiffstats
path: root/make/config
diff options
context:
space:
mode:
authorMathieu Féry <[email protected]>2023-11-10 15:50:24 +0100
committerMathieu Féry <[email protected]>2023-11-10 15:50:24 +0100
commitbf09df70444f38424a84fc382498b57498bb5601 (patch)
tree205464e22179c510cf41ad4df19af1ff05366cc5 /make/config
parent21079539c1f81bae9df328e6487e4d4d174b0b51 (diff)
feat(devices): Allow to retrieve devices specifiers with ALC_ENUMERATE_ALL_EXT
Diffstat (limited to 'make/config')
-rw-r--r--make/config/joal-alc-CustomJavaCode.java19
-rw-r--r--make/config/joal-alc-constants-CustomJavaCode.java3
-rw-r--r--make/config/joal-alc-constants.cfg2
-rw-r--r--make/config/joal-alc-impl-CustomCCode.c12
4 files changed, 35 insertions, 1 deletions
diff --git a/make/config/joal-alc-CustomJavaCode.java b/make/config/joal-alc-CustomJavaCode.java
index be28d8c..6615c01 100644
--- a/make/config/joal-alc-CustomJavaCode.java
+++ b/make/config/joal-alc-CustomJavaCode.java
@@ -1,3 +1,18 @@
+/** Specify if ALC_ENUMERATION_EXT is present */
+public boolean aclEnumerationExtIsPresent();
+
+/** Specify if ALC_ENUMERATE_ALL_EXT is present */
+public boolean aclEnumerateAllExtIsPresent();
+
+/** Specify if call of alGetString(device, param) must
+ must retrun a double null terminted string */
+public boolean alcIsDoubleNullTerminatedString(final com.jogamp.openal.ALCdevice device, final int param);
+
+/** Fetches all values of device and param supplied from result of call to alcGetString
+ Each value is extracted from string because is a string double null terminated
+ Equivalent to the C call alcGetString(device, param). */
+public java.lang.String[] alcGetStringAsDoubleNullTerminatedString(final com.jogamp.openal.ALCdevice device, final int param);
+
/** Fetches the names of the available ALC device specifiers.
Equivalent to the C call alcGetString(NULL, ALC_DEVICE_SPECIFIER). */
public java.lang.String[] alcGetDeviceSpecifiers();
@@ -5,3 +20,7 @@ public java.lang.String[] alcGetDeviceSpecifiers();
/** Fetches the names of the available ALC capture device specifiers.
Equivalent to the C call alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER). */
public java.lang.String[] alcGetCaptureDeviceSpecifiers();
+
+/** Fetches the names of the available ALC all capture device specifiers.
+ Equivalent to the C call alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER). */
+public java.lang.String[] alcGetAllDeviceSpecifiers();
diff --git a/make/config/joal-alc-constants-CustomJavaCode.java b/make/config/joal-alc-constants-CustomJavaCode.java
new file mode 100644
index 0000000..fe97124
--- /dev/null
+++ b/make/config/joal-alc-constants-CustomJavaCode.java
@@ -0,0 +1,3 @@
+public final java.lang.String ALC_ENUMERATION_EXT_NAME = "ALC_ENUMERATION_EXT";
+
+public final java.lang.String ALC_ENUMERATE_ALL_EXT_NAME = "ALC_ENUMERATE_ALL_EXT"; \ No newline at end of file
diff --git a/make/config/joal-alc-constants.cfg b/make/config/joal-alc-constants.cfg
index 83ea061..b58f700 100644
--- a/make/config/joal-alc-constants.cfg
+++ b/make/config/joal-alc-constants.cfg
@@ -6,3 +6,5 @@ JavaClass ALCConstants
# Factor out the OpenAL constants into their own interface
IgnoreNot ^ALC_.+
+
+IncludeAs CustomJavaCode ALCConstants joal-alc-constants-CustomJavaCode.java
diff --git a/make/config/joal-alc-impl-CustomCCode.c b/make/config/joal-alc-impl-CustomCCode.c
index 9207210..bd4a57a 100644
--- a/make/config/joal-alc-impl-CustomCCode.c
+++ b/make/config/joal-alc-impl-CustomCCode.c
@@ -1,6 +1,16 @@
+#include <stdbool.h>
+
+bool alc_is_double_null_terminated_string(ALCdevice *device, int param) {
+ return device == NULL && (
+ param == ALC_DEVICE_SPECIFIER ||
+ param == ALC_CAPTURE_DEVICE_SPECIFIER ||
+ param == ALC_ALL_DEVICES_SPECIFIER
+ );
+}
+
int strlen_alc(ALCdevice *device, int param, const char* str) {
int len = 0;
- if ((device == NULL) && (param == ALC_DEVICE_SPECIFIER)) {
+ if (alc_is_double_null_terminated_string(device, param)) {
while (*str != 0) {
while (*str != 0) {
++str;