aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/openal/ALCImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/jogamp/openal/ALCImpl.java')
-rw-r--r--src/java/jogamp/openal/ALCImpl.java44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/java/jogamp/openal/ALCImpl.java b/src/java/jogamp/openal/ALCImpl.java
index 99494ca..f08541c 100644
--- a/src/java/jogamp/openal/ALCImpl.java
+++ b/src/java/jogamp/openal/ALCImpl.java
@@ -4,8 +4,11 @@
package jogamp.openal;
import com.jogamp.common.nio.Buffers;
+import com.jogamp.openal.ALCConstants;
import com.jogamp.openal.ALException;
import com.jogamp.openal.ALCdevice;
+import com.jogamp.openal.util.ALHelpers;
+
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@@ -15,10 +18,23 @@ import java.util.ArrayList;
* @author Michael Bien
*/
public class ALCImpl extends ALCAbstractImpl {
+ public boolean aclEnumerationExtIsPresent() {
+ return alcIsExtensionPresent(null, ALHelpers.ALC_ENUMERATION_EXT);
+ }
+
+ public boolean aclEnumerateAllExtIsPresent() {
+ return alcIsExtensionPresent(null, ALHelpers.ALC_ENUMERATE_ALL_EXT);
+ }
+
+ public boolean alcIsDoubleNullTerminatedString(final ALCdevice device, final int param) {
+ return dispatch_alcIsDoubleNullTerminatedString(((device == null) ? null : device.getBuffer()), param);
+ }
+
+ public native boolean dispatch_alcIsDoubleNullTerminatedString(ByteBuffer deviceBuffer, int param);
public String alcGetString(final ALCdevice device, final int param) {
- if (device == null && param == ALC_DEVICE_SPECIFIER) {
- throw new ALException("Call alcGetDeviceSpecifiers to fetch all available device names");
+ if (alcIsDoubleNullTerminatedString(device, param)) {
+ throw new ALException("Call alcGetString to get double null terminated string");
}
final ByteBuffer buf = alcGetStringImpl(device, param);
@@ -51,24 +67,24 @@ public class ALCImpl extends ALCAbstractImpl {
}
private native java.nio.ByteBuffer dispatch_alcGetStringImpl1(ByteBuffer deviceBuffer, int param, long addr);
- /**
- * Fetches the names of the available ALC device specifiers.
- * Equivalent to the C call alcGetString(NULL, ALC_DEVICE_SPECIFIER).
- */
public String[] alcGetDeviceSpecifiers() {
- return getDoubleNullTerminatedString(ALC_DEVICE_SPECIFIER);
+ return alcGetStringAsDoubleNullTerminatedString(null, ALC_DEVICE_SPECIFIER);
}
- /**
- * Fetches the names of the available ALC capture device specifiers.
- * Equivalent to the C call alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER).
- */
public String[] alcGetCaptureDeviceSpecifiers() {
- return getDoubleNullTerminatedString(ALC_CAPTURE_DEVICE_SPECIFIER);
+ return alcGetStringAsDoubleNullTerminatedString(null, ALC_CAPTURE_DEVICE_SPECIFIER);
+ }
+
+ public String[] alcGetAllDeviceSpecifiers() {
+ return alcGetStringAsDoubleNullTerminatedString(null, ALC_ALL_DEVICES_SPECIFIER);
}
- private String[] getDoubleNullTerminatedString(final int which) {
- final ByteBuffer buf = alcGetStringImpl(null, which);
+ public String[] alcGetStringAsDoubleNullTerminatedString(final ALCdevice device, final int param) {
+ if (!alcIsDoubleNullTerminatedString(device, param)) {
+ throw new ALException("Call alcGetString to get string");
+ }
+
+ final ByteBuffer buf = alcGetStringImpl(device, param);
if (buf == null) {
return null;
}