29package com.jogamp.openal;
31import com.jogamp.common.GlueGenVersion;
33import com.jogamp.common.os.Platform;
34import com.jogamp.common.util.VersionUtil;
35import com.jogamp.common.util.JogampVersion;
36import com.jogamp.openal.util.ALHelpers;
38import java.util.jar.Manifest;
43 protected JoalVersion(
final String packageName,
final Manifest mf) {
44 super(packageName, mf);
51 final String packageName =
"com.jogamp.openal";
52 final Manifest mf = VersionUtil.getManifest(
JoalVersion.class.getClassLoader(), packageName);
62 sb =
new StringBuilder();
64 sb.append(
"OS: ").append(Platform.getOSName()).append(
", version ").append(Platform.getOSVersion()).append(
", arch ").append(Platform.getArchName());
65 sb.append(Platform.getNewline());
66 sb.append(
"JOAL GIT sha1 ").append(getImplementationCommit());
67 sb.append(Platform.getNewline());
80 public StringBuilder
toString(
final ALC alc, StringBuilder sb) {
81 sb = super.toString(sb).append(Platform.getNewline());
95 return toString(alc,
null).toString();
108 sb =
new StringBuilder();
111 sb.append(
"ALC null");
118 if(
null == initialContext) {
123 context = initialContext;
132 sb.append(Platform.getNewline());
135 final String enumExtAvailInfo =
"(enumExt[def "+enumerationExtIsPresent+
", all "+enumerateAllExtIsPresent+
"])";
138 final int[] iversion = { 0, 0 };
141 sb.append(
"ALC_VERSION ").append(iversion[0]).append(
".").append(iversion[1]);
142 sb.append(Platform.getNewline());
143 if (!enumerationExtIsPresent && !enumerateAllExtIsPresent) {
144 sb.append(
"ALC_DEF_OUTPUT Unknown ").append(enumExtAvailInfo);
145 sb.append(Platform.getNewline());
147 if (enumerationExtIsPresent) {
150 sb.append(Platform.getNewline());
152 if (enumerateAllExtIsPresent) {
155 sb.append(Platform.getNewline());
158 if (enumerationExtIsPresent) {
161 sb.append(
"ALC_DEF_CAPTURE Unknown ").append(enumExtAvailInfo);
163 sb.append(Platform.getNewline());
165 .append(softEventsIsPresent ?
"supported" :
"unsupported");
166 sb.append(Platform.getNewline());
167 if (softEventsIsPresent) {
169 public final String key;
170 public final int value;
171 EventType(
final String k,
final int i) { key = k; value = i; }
173 final EventType[] events = {
177 for (
final EventType event : events) {
179 sb.append(
" ").append(event.key).append(
" event for playback devices is ")
181 sb.append(Platform.getNewline());
183 sb.append(
" ").append(event.key).append(
" event for capture devices is ")
185 sb.append(Platform.getNewline());
190 if(
null == initialContext ) {
200 private static boolean checkALCError(
final ALC alc,
final ALCdevice device,
final String msg)
204 System.err.printf(
"ALC Error 0x%x occurred: '%s' while '%s'%n", error, alc.
alcGetString(device, error), msg);
210 public static void deviceToString(
final StringBuilder sb,
final ALC alc,
final String devName,
final boolean isInput,
final String defOutDeviceName,
final String defInDeviceName) {
212 final boolean isDefault = devName.equals(defInDeviceName);
213 sb.append(
" "+devName+
", input, default "+isDefault+System.lineSeparator());
215 final boolean isDefault = devName.equals(defOutDeviceName);
216 final String defStr = isDefault ?
"default " :
"";
217 final String inOutStr =
"output";
218 final int mixerFrequency, mixerRefresh, monoSourceCount, stereoSourceCount;
219 final int[] val = { 0 };
224 System.err.println(
"Error: Failed to open "+defStr+inOutStr+
" device "+devName);
229 System.err.println(
"Error: Failed to create context for "+defStr+inOutStr+
" device "+devName);
234 System.err.println(
"Error: Failed to make context current for "+defStr+inOutStr+
" device "+devName);
235 checkALCError(alc, d,
"alcMakeContextCurrent");
244 if( checkALCError(alc, d,
"read ALC_FREQUENCY") ) {
247 mixerFrequency = val[0];
253 if( checkALCError(alc, d,
"read ALC_REFRESH") ) {
256 mixerRefresh = val[0];
262 if( checkALCError(alc, d,
"read ALC_MONO_SOURCES") ) {
263 monoSourceCount = -1;
265 monoSourceCount = val[0];
271 if( checkALCError(alc, d,
"read ALC_STEREO_SOURCES") ) {
272 stereoSourceCount = -1;
274 stereoSourceCount = val[0];
277 sb.append(
" "+devName+
", "+inOutStr+
", default "+isDefault+
", mixer[freq "+mixerFrequency+
", refresh "+mixerRefresh+
278 " (min latency "+(1000f/mixerRefresh)+
" ms)], sources[mono "+monoSourceCount+
", stereo "+stereoSourceCount+
"]"+
279 System.lineSeparator());
281 if(
null != initialContext ) {
299 final String enumExtAvailInfo =
"(enumExt[def "+enumerationExtIsPresent+
", all "+enumerateAllExtIsPresent+
"])";
301 if (!enumerationExtIsPresent && !enumerateAllExtIsPresent) {
302 sb.append(
"No output devices infos available ").append(enumExtAvailInfo);
304 if (enumerateAllExtIsPresent) {
309 if (
null != outDevices) {
310 for (
final String devName : outDevices) {
311 deviceToString(sb, alc, devName,
false, defOutAllDeviceName,
null);
316 if (enumerationExtIsPresent) {
321 if (
null != outDevices) {
322 for (
final String devName : outDevices) {
329 if (!enumerationExtIsPresent) {
330 sb.append(
"No capture devices infos available ").append(enumExtAvailInfo);
333 sb.append(
"Capture devices:" + System.lineSeparator());
336 if (
null != inDevices) {
337 for (
final String devName : inDevices) {
345 public static void main(
final String args[]) {
346 System.err.println(VersionUtil.getPlatformInfo());
347 System.err.println(GlueGenVersion.getInstance());
final long getDirectBufferAddress()
Returns the native address of the underlying native ByteBuffer getBuffer().
final long getDirectBufferAddress()
Returns the native address of the underlying native ByteBuffer getBuffer().
This class provides factory methods for generating AL and ALC objects.
static AL getAL()
Get the default AL object.
static ALExt getALExt()
Get the default ALExt object.
static ALC getALC()
Get the default ALC object.
static JoalVersion getInstance()
StringBuilder toString(final ALC alc, StringBuilder sb)
Return JogampVersion package information and AL informal strings.
JoalVersion(final String packageName, final Manifest mf)
StringBuilder getBriefOSALBuildInfo(StringBuilder sb)
static void deviceToString(final StringBuilder sb, final ALC alc, final String devName, final boolean isInput, final String defOutDeviceName, final String defInDeviceName)
static volatile JoalVersion jogampCommonVersionInfo
String toString(final ALC alc)
Return JogampVersion package information and AL informal strings.
static void devicesToString(final StringBuilder sb, final ALC alc)
static StringBuilder getALStrings(final ALC alc, StringBuilder sb)
Return AL informal strings.
static void main(final String args[])
static final String ALC_ENUMERATION_EXT
static final String ALC_ENUMERATE_ALL_EXT
static final String ALC_SOFT_system_events
static final int ALC_MAJOR_VERSION
Define "ALC_MAJOR_VERSION" with expression '0x1000', CType: int.
static final int ALC_STEREO_SOURCES
Define "ALC_STEREO_SOURCES" with expression '0x1011', CType: int.
static final int ALC_MINOR_VERSION
Define "ALC_MINOR_VERSION" with expression '0x1001', CType: int.
static final int ALC_FREQUENCY
Define "ALC_FREQUENCY" with expression '0x1007', CType: int.
static final int ALC_NO_ERROR
Define "ALC_NO_ERROR" with expression '0', CType: int.
static final int ALC_MONO_SOURCES
Define "ALC_MONO_SOURCES" with expression '0x1010', CType: int.
static final int ALC_DEFAULT_DEVICE_SPECIFIER
Define "ALC_DEFAULT_DEVICE_SPECIFIER" with expression '0x1004', CType: int.
static final int ALC_REFRESH
Define "ALC_REFRESH" with expression '0x1008', CType: int.
static final int ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER
Define "ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER" with expression '0x311', CType: int.
static final int ALC_DEFAULT_ALL_DEVICES_SPECIFIER
Define "ALC_DEFAULT_ALL_DEVICES_SPECIFIER" with expression '0x1012', CType: int.
boolean alcEnumerationExtIsPresent()
Specify if ALC_ENUMERATION_EXT is present.
void alcDestroyContext(ALCcontext context)
Entry point (through function pointer) to C language function: void alcDestroyContext(ALCcontext * ...
boolean alcMakeContextCurrent(ALCcontext context)
Entry point (through function pointer) to C language function: ALCboolean alcMakeContextCurrent(ALC...
boolean alcSoftSystemEventsIsPresent()
Specify if ALC_SOFT_system_events is present.
ALCcontext alcGetCurrentContext()
Entry point (through function pointer) to C language function: ALCcontext * alcGetCurrentContext()
boolean alcEnumerateAllExtIsPresent()
Specify if ALC_ENUMERATE_ALL_EXT is present.
java.lang.String[] alcGetAllDeviceSpecifiers()
Fetches the names of the available ALC all capture device specifiers.
int alcGetError(ALCdevice device)
Entry point (through function pointer) to C language function: ALCenum alcGetError(ALCdevice * dev...
String alcGetString(ALCdevice device, int param)
Entry point (through function pointer) to C language function: const ALCchar * alcGetString(ALCdevi...
void alcGetIntegerv(ALCdevice device, int param, int size, IntBuffer values)
Entry point (through function pointer) to C language function: void alcGetIntegerv(ALCdevice * dev...
java.lang.String[] alcGetDeviceSpecifiers()
Fetches the names of the available ALC device specifiers.
boolean alcCloseDevice(ALCdevice device)
Entry point (through function pointer) to C language function: ALCboolean alcCloseDevice(ALCdevice ...
ALCdevice alcGetContextsDevice(ALCcontext context)
Entry point (through function pointer) to C language function: ALCdevice * alcGetContextsDevice(ALC...
java.lang.String[] alcGetCaptureDeviceSpecifiers()
Fetches the names of the available ALC capture device specifiers.
ALCdevice alcOpenDevice(String devicename)
Entry point (through function pointer) to C language function: ALCdevice * alcOpenDevice(const ALCc...
ALCcontext alcCreateContext(ALCdevice device, IntBuffer attrlist)
Entry point (through function pointer) to C language function: ALCcontext * alcCreateContext(ALCdev...
static final int AL_EXTENSIONS
Define "AL_EXTENSIONS" with expression '0xB004', CType: int.
static final int ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT
Define "ALC_EVENT_TYPE_DEFAULT_DEVICE_CHANGED_SOFT" with expression '0x19D6', CType: int.
static final int ALC_CAPTURE_DEVICE_SOFT
Define "ALC_CAPTURE_DEVICE_SOFT" with expression '0x19D5', CType: int.
static final int ALC_EVENT_TYPE_DEVICE_ADDED_SOFT
Define "ALC_EVENT_TYPE_DEVICE_ADDED_SOFT" with expression '0x19D7', CType: int.
static final int ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT
Define "ALC_EVENT_TYPE_DEVICE_REMOVED_SOFT" with expression '0x19D8', CType: int.
static final int ALC_PLAYBACK_DEVICE_SOFT
Define "ALC_PLAYBACK_DEVICE_SOFT" with expression '0x19D4', CType: int.
static final int ALC_EVENT_SUPPORTED_SOFT
Define "ALC_EVENT_SUPPORTED_SOFT" with expression '0x19D9', CType: int.
int alcEventIsSupportedSOFT(int eventType, int deviceType)
Entry point (through function pointer) to C language function: ALCenum alcEventIsSupportedSOFT(ALCe...
String alGetString(int param)
Entry point (through function pointer) to C language function: const ALchar * alGetString(ALenum pa...