diff options
author | Sven Gothel <[email protected]> | 2023-05-04 17:25:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-05-04 17:25:25 +0200 |
commit | b83ed843310f74655493ceefb2ee0e5420d1fe28 (patch) | |
tree | f1479ff6e5c5105e23a263d6ce615bb47ed25e50 /src/java/com/jogamp/openal/JoalVersion.java | |
parent | e481757000902582e80353f9b76f77793950d47a (diff) |
Add ALVersion, i.e. retrieve vendor, renderer, version and vendor-version. Test against OpenAL-Soft data >= 1.23.0
Diffstat (limited to 'src/java/com/jogamp/openal/JoalVersion.java')
-rw-r--r-- | src/java/com/jogamp/openal/JoalVersion.java | 79 |
1 files changed, 68 insertions, 11 deletions
diff --git a/src/java/com/jogamp/openal/JoalVersion.java b/src/java/com/jogamp/openal/JoalVersion.java index 0d756cc..2892082 100644 --- a/src/java/com/jogamp/openal/JoalVersion.java +++ b/src/java/com/jogamp/openal/JoalVersion.java @@ -1,5 +1,5 @@ /** - * Copyright 2013 JogAmp Community. All rights reserved. + * Copyright 2013-2023 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -56,24 +56,79 @@ public class JoalVersion extends JogampVersion { return jogampCommonVersionInfo; } - public StringBuilder toString(StringBuilder sb) { + public StringBuilder getBriefOSALBuildInfo(StringBuilder sb) { + if(null==sb) { + sb = new StringBuilder(); + } + sb.append("OS: ").append(Platform.getOSName()).append(", version ").append(Platform.getOSVersion()).append(", arch ").append(Platform.getArchName()); + sb.append(Platform.getNewline()); + sb.append("JOAL GIT sha1 ").append(getImplementationCommit()); + sb.append(Platform.getNewline()); + return sb; + } + + /** + * Return {@link JogampVersion} package information and AL informal strings. + * <p> + * The given {@link ALC} is being used and {@Link ALCdevice} and {@link ALCcontext} are allocated, + * made current and finally being released. + * </p> + * @param alc static {@link ALC} instance + * @param sb optional StringBuffer to be reused + */ + public StringBuilder toString(final ALC alc, StringBuilder sb) { sb = super.toString(sb).append(Platform.getNewline()); - // getGLInfo(gl, sb); + getALStrings(alc, sb); return sb; } - public String toString() { - return toString(null).toString(); + /** + * Return {@link JogampVersion} package information and AL informal strings. + * <p> + * The given {@link ALC} is being used and {@Link ALCdevice} and {@link ALCcontext} are allocated, + * made current and finally being released. + * </p> + * @param alc static {@link ALC} instance + */ + public String toString(final ALC alc) { + return toString(alc, null).toString(); } - public StringBuilder getBriefOSALBuildInfo(StringBuilder sb) { - if(null==sb) { + /** + * Return AL informal strings. + * <p> + * The given {@link ALC} is being used and {@Link ALCdevice} and {@link ALCcontext} are allocated, + * made current and finally being released. + * </p> + * @param alc static {@link ALC} instance + */ + public StringBuilder getALStrings(final ALC alc, StringBuilder sb) { + if( null == sb ) { sb = new StringBuilder(); } - sb.append("OS: ").append(Platform.getOSName()).append(", version ").append(Platform.getOSVersion()).append(", arch ").append(Platform.getArchName()); - sb.append(Platform.getNewline()); - sb.append("JOAL GIT sha1 ").append(getImplementationCommit()); + final ALCdevice device = alc.alcOpenDevice(null); + final ALCcontext context = alc.alcCreateContext(device, null); + alc.alcMakeContextCurrent(context); + final AL al = ALFactory.getAL(); // valid after makeContextCurrent(..) + final ALVersion alv = new ALVersion(al); + + alv.toString(true, sb); + sb.append("AL_EXTENSIONS ").append(al.alGetString(ALConstants.AL_EXTENSIONS)); sb.append(Platform.getNewline()); + { + final int[] iversion = { 0, 0 }; + alc.alcGetIntegerv(device, ALCConstants.ALC_MAJOR_VERSION, 1, iversion, 0); + alc.alcGetIntegerv(device, ALCConstants.ALC_MINOR_VERSION, 1, iversion, 1); + sb.append("ALC_VERSION ").append(iversion[0]).append(".").append(iversion[1]); + sb.append(Platform.getNewline()); + sb.append("ALC_DEF_OUTPUT ").append(alc.alcGetString(device, ALCConstants.ALC_DEFAULT_DEVICE_SPECIFIER)); + sb.append(Platform.getNewline()); + sb.append("ALC_DEF_CAPTURE ").append(alc.alcGetString(device, ALCConstants.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); + sb.append(Platform.getNewline()); + } + alc.alcMakeContextCurrent(null); + alc.alcDestroyContext(context); + alc.alcCloseDevice(device); return sb; } @@ -81,7 +136,9 @@ public class JoalVersion extends JogampVersion { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); // System.err.println(NativeWindowVersion.getInstance()); - System.err.println(JoalVersion.getInstance()); + // System.err.println(JoalVersion.getInstance()); + System.err.println(JoalVersion.getInstance().toString(ALFactory.getALC())); + } } |