summaryrefslogtreecommitdiffstats
path: root/make/joal-alc-impl-CustomJavaCode.java
diff options
context:
space:
mode:
Diffstat (limited to 'make/joal-alc-impl-CustomJavaCode.java')
-rwxr-xr-xmake/joal-alc-impl-CustomJavaCode.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/make/joal-alc-impl-CustomJavaCode.java b/make/joal-alc-impl-CustomJavaCode.java
new file mode 100755
index 0000000..a2f23c9
--- /dev/null
+++ b/make/joal-alc-impl-CustomJavaCode.java
@@ -0,0 +1,42 @@
+public java.lang.String alcGetString(ALCdevice device, int param) {
+ if (device == null && param == ALC_DEVICE_SPECIFIER) {
+ throw new ALException("Call alcGetDeviceSpecifiers to fetch all available device names");
+ }
+
+ ByteBuffer buf = alcGetStringImpl(device, param);
+ if (buf == null) {
+ return null;
+ }
+ byte[] res = new byte[buf.capacity()];
+ buf.get(res);
+ try {
+ return new String(res, "US-ASCII");
+ } catch (UnsupportedEncodingException e) {
+ throw new ALException(e);
+ }
+}
+
+/** Fetches the names of the available ALC device specifiers.
+ Equivalent to the C call alcGetString(NULL, ALC_DEVICE_SPECIFIER). */
+public java.lang.String[] alcGetDeviceSpecifiers() {
+ ByteBuffer buf = alcGetStringImpl(null, ALC_DEVICE_SPECIFIER);
+ if (buf == null) {
+ return null;
+ }
+ byte[] bytes = new byte[buf.capacity()];
+ buf.get(bytes);
+ try {
+ ArrayList/*<String>*/ res = new ArrayList/*<String>*/();
+ int i = 0;
+ while (i < bytes.length) {
+ int startIndex = i;
+ while ((i < bytes.length) && (bytes[i] != 0))
+ i++;
+ res.add(new String(bytes, startIndex, i - startIndex, "US-ASCII"));
+ i++;
+ }
+ return (String[]) res.toArray(new String[0]);
+ } catch (UnsupportedEncodingException e) {
+ throw new ALException(e);
+ }
+}