diff options
author | Michael Zucchi <[email protected]> | 2013-01-25 15:37:49 +0100 |
---|---|---|
committer | Xerxes Rånby <[email protected]> | 2013-01-25 15:37:49 +0100 |
commit | 3cf2b66e13104b372611b3a9dbb722110370a9c7 (patch) | |
tree | 070bbe4e58f4661a601259e1ddfe6e96eefb3be4 | |
parent | 6b86449596dabf87201d7321799a39a7b78ab692 (diff) |
Bug 567 (part 1): add support for openal extensions
Imported JOAL specific parts from the patch made by Michael Zucchi.
Author: Michael Zucchi <[email protected]>
Signed-off-by: Xerxes Rånby <[email protected]>
-rwxr-xr-x | make/build.xml | 21 | ||||
-rw-r--r-- | make/joal-alext-constants.cfg | 9 | ||||
-rw-r--r-- | make/joal-alext.cfg | 41 | ||||
-rw-r--r-- | make/joal-alextabstract-CustomJavaCode.java | 12 | ||||
-rw-r--r-- | src/java/com/jogamp/openal/ALFactory.java | 16 | ||||
-rw-r--r-- | src/java/jogamp/openal/ALExtImpl.java | 15 | ||||
-rw-r--r-- | src/java/jogamp/openal/Debug.java | 2 | ||||
-rw-r--r-- | src/native/almisc.c | 2 |
8 files changed, 116 insertions, 2 deletions
diff --git a/make/build.xml b/make/build.xml index 51c92d5..b2b0ec9 100755 --- a/make/build.xml +++ b/make/build.xml @@ -175,6 +175,8 @@ <property name="joal.constants.cfg" value="${config}/joal-constants.cfg" /> <property name="joal.alc.cfg" value="${config}/joal-alc.cfg" /> <property name="joal.alc.constants.cfg" value="${config}/joal-alc-constants.cfg" /> + <property name="joal.alext.cfg" value="${config}/joal-alext.cfg" /> + <property name="joal.alext.constants.cfg" value="${config}/joal-alext-constants.cfg" /> <!-- Create the required output directories. --> <mkdir dir="${src.generated.java}" /> @@ -276,6 +278,25 @@ <classpath refid="gluegen.classpath" /> </gluegen> + <!-- Generate the ALExt interface class and implementation --> + <gluegen src="${stub.includes.openal}/alext.h" + outputRootDir="${build}" + config="${joal.alext.cfg}" + includeRefid="stub.includes.fileset.all" + emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter"> + <classpath refid="gluegen.classpath" /> + </gluegen> + + <!-- Generate the ALExt constants interface --> + <gluegen src="${stub.includes.openal}/alext.h" + outputRootDir="${build}" + config="${joal.alext.constants.cfg}" + includeRefid="stub.includes.fileset.all" + emitter="com.jogamp.gluegen.JavaEmitter"> + <classpath refid="gluegen.classpath" /> + </gluegen> + + <!-- Inform the user that the generators have successfully created - the necessary Java files --> <echo message="" /> diff --git a/make/joal-alext-constants.cfg b/make/joal-alext-constants.cfg new file mode 100644 index 0000000..e645bb8 --- /dev/null +++ b/make/joal-alext-constants.cfg @@ -0,0 +1,9 @@ +# This .cfg file is used to generate the ALCConstants interface. +Include joal-common.cfg + +Style InterfaceOnly +JavaClass ALExtConstants + +# Factor out the OpenAL constants into their own interface +#IgnoreNot ^ALC_.+ +IgnoreNot ^AL.+ diff --git a/make/joal-alext.cfg b/make/joal-alext.cfg new file mode 100644 index 0000000..4798f31 --- /dev/null +++ b/make/joal-alext.cfg @@ -0,0 +1,41 @@ +# This .cfg file is used to generate the JOAL interface. +Include joal-common.cfg + +Style InterfaceAndImpl +JavaClass ALExt +ImplPackage jogamp.openal +ImplJavaClass ALExtAbstractImpl +AccessControl ALExtAbstractImpl PUBLIC_ABSTRACT +Extends ALExt ALExtConstants + +EmitProcAddressTable true +ProcAddressTableClassName ALExtProcAddressTable +GetProcAddressTableExpr alExtProcAddressTable +ProcAddressNameExpr LP $UPPERCASE({0}) + +Import java.io.UnsupportedEncodingException +Import java.util.* +Import com.jogamp.openal.* +Import jogamp.openal.* + +# Factor out the OpenAL constants into their own interface +Ignore ^AL_.+ +Ignore ^ALC_.+ + +IncludeAs CustomJavaCode ALExtAbstractImpl joal-alextabstract-CustomJavaCode.java + +# Mappings for data types +Opaque boolean ALCboolean + +# These routines use or return strings +ArgumentIsString alcLoopbackOpenDeviceSOFT 0 + +# Provide #includes to native code +CustomCCode #include "alext.h" + +# Indicate that the direct buffers for ALCcontext, etc. are "opaque", +# i.e., the user shouldn't be poking around in them +ReturnValueCapacity alcLoopbackOpenDeviceSOFT 0 + +IncludeAs CustomCCode joal-common-CustomCCode.c + diff --git a/make/joal-alextabstract-CustomJavaCode.java b/make/joal-alextabstract-CustomJavaCode.java new file mode 100644 index 0000000..e73dc60 --- /dev/null +++ b/make/joal-alextabstract-CustomJavaCode.java @@ -0,0 +1,12 @@ +private static final ALExtProcAddressTable alExtProcAddressTable; + +static { + alExtProcAddressTable = new ALExtProcAddressTable(); + if(null==alExtProcAddressTable) { + throw new RuntimeException("Couldn't instantiate ALExtProcAddressTable"); + } + alExtProcAddressTable.reset(ALImpl.alDynamicLookupHelper); +} + +public static ALExtProcAddressTable getALExtProcAddressTable() { return alExtProcAddressTable; } + diff --git a/src/java/com/jogamp/openal/ALFactory.java b/src/java/com/jogamp/openal/ALFactory.java index 29174ba..f442f00 100644 --- a/src/java/com/jogamp/openal/ALFactory.java +++ b/src/java/com/jogamp/openal/ALFactory.java @@ -36,6 +36,7 @@ package com.jogamp.openal; import com.jogamp.common.os.Platform; import com.jogamp.openal.AL; import com.jogamp.openal.ALC; +import com.jogamp.openal.ALExt; import jogamp.openal.*; /** @@ -50,6 +51,7 @@ public class ALFactory { private static boolean initialized = false; private static AL al; private static ALC alc; + private static ALExt alext; private ALFactory() {} @@ -97,4 +99,18 @@ public class ALFactory { } return alc; } + + /** + * Get the default ALExt object. This object is used to access most of the + * OpenAL extension functionality. + * + * @return the ALExt object + */ + public static ALExt getALExt() throws ALException{ + initialize(); + if (alext == null) { + alext = new ALExtImpl(); + } + return alext; + } } diff --git a/src/java/jogamp/openal/ALExtImpl.java b/src/java/jogamp/openal/ALExtImpl.java new file mode 100644 index 0000000..23deab1 --- /dev/null +++ b/src/java/jogamp/openal/ALExtImpl.java @@ -0,0 +1,15 @@ +package jogamp.openal; + +import com.jogamp.common.nio.Buffers; +import com.jogamp.openal.ALException; +import com.jogamp.openal.ALCdevice; +import java.io.UnsupportedEncodingException; +import java.nio.ByteBuffer; +import java.util.ArrayList; + +/** + * ALExt implementation. + */ +public class ALExtImpl extends ALExtAbstractImpl { + +} diff --git a/src/java/jogamp/openal/Debug.java b/src/java/jogamp/openal/Debug.java index 36d2ecd..b73c955 100644 --- a/src/java/jogamp/openal/Debug.java +++ b/src/java/jogamp/openal/Debug.java @@ -68,6 +68,6 @@ public class Debug extends PropertyAccess { } public static boolean debug(String subcomponent) { - return debugAll() || isPropertyDefined("joal.debug." + subcomponent, true); + return debugAll() || isPropertyDefined("joal.debug." + subcomponent, true, null); } } diff --git a/src/native/almisc.c b/src/native/almisc.c index b850a9f..c77cb0e 100644 --- a/src/native/almisc.c +++ b/src/native/almisc.c @@ -31,7 +31,7 @@ JNIEXPORT jlong JNICALL Java_jogamp_openal_ALImpl_dispatch_1alGetProcAddressStatic(JNIEnv *env, jclass _unused, jstring fname, jlong procAddress) { LPALGETPROCADDRESS ptr_alGetProcAddress; const char* _strchars_fname = NULL; - ALproc _res; + void *_res; if ( NULL != fname ) { _strchars_fname = (*env)->GetStringUTFChars(env, fname, (jboolean*)NULL); if ( NULL == _strchars_fname ) { |