/** * Obtains string values from ALC. This is a custom implementation for those tokens that return a list of strings instead of a single string. * * @param deviceHandle the device to query * @param token the information to query. One of:<br>{@link ALC11#ALC_ALL_DEVICES_SPECIFIER}, {@link ALC11#ALC_CAPTURE_DEVICE_SPECIFIER} */ @Nullable public static List<String> getStringList(long deviceHandle, int token) { long __result = nalcGetString(deviceHandle, token); if (__result == NULL) { return null; } ByteBuffer buffer = memByteBuffer(__result, Integer.MAX_VALUE); List<String> strings = new ArrayList<>(); int offset = 0; while (true) { if (buffer.get() == 0) { int limit = buffer.position() - 1; if (limit == offset) { // Previous char was also a \0 == end of list. break; } strings.add(memUTF8(buffer, limit - offset, offset)); offset = buffer.position(); } } return strings; }
/** * Obtains string value(s) from ALC. * * <p><b>LWJGL note</b>: Use {@link ALUtil#getStringList} for those tokens that return multiple values.</p> * * @param deviceHandle the device to query * @param token the information to query. One of:<br><table><tr><td>{@link #ALC_DEFAULT_DEVICE_SPECIFIER DEFAULT_DEVICE_SPECIFIER}</td><td>{@link #ALC_DEVICE_SPECIFIER DEVICE_SPECIFIER}</td><td>{@link #ALC_EXTENSIONS EXTENSIONS}</td></tr><tr><td>{@link ALC11#ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER CAPTURE_DEFAULT_DEVICE_SPECIFIER}</td><td>{@link ALC11#ALC_CAPTURE_DEVICE_SPECIFIER CAPTURE_DEVICE_SPECIFIER}</td></tr></table> */ @Nullable @NativeType("ALCchar const *") public static String alcGetString(@NativeType("ALCdevice *") long deviceHandle, @NativeType("ALCenum") int token) { long __result = nalcGetString(deviceHandle, token); return memUTF8Safe(__result); }