aboutsummaryrefslogtreecommitdiffstats
path: root/make/joal-common-CustomJavaCode.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-12-13 07:30:20 +0100
committerSven Gothel <[email protected]>2010-12-13 07:30:20 +0100
commitb0c39f3f4259cf6eca8e1f7af0f0924cf7472abe (patch)
tree613781a5703e2052c21b1c35242c3d948bebcf72 /make/joal-common-CustomJavaCode.java
parenta68be2859454b75539cc5e44eb23129745932db3 (diff)
Bring back JOAL (code fixes and project structure)
- Use GlueGen DynamicLibraryBundle - Fix alGetString - Proper test/junit structure - NB project fix - add artifacts.properties and jar's manifest - proper ZIP file structure TODO: - check on windows and osx - actually hear a sound - add jnlp file template - joal-demos
Diffstat (limited to 'make/joal-common-CustomJavaCode.java')
-rw-r--r--make/joal-common-CustomJavaCode.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/make/joal-common-CustomJavaCode.java b/make/joal-common-CustomJavaCode.java
new file mode 100644
index 0000000..61c6d0c
--- /dev/null
+++ b/make/joal-common-CustomJavaCode.java
@@ -0,0 +1,33 @@
+static final DynamicLibraryBundle alDynamicLookupHelper;
+private static final ALProcAddressTable alProcAddressTable;
+
+static {
+ alProcAddressTable = new ALProcAddressTable();
+ if(null==alProcAddressTable) {
+ throw new RuntimeException("Couldn't instantiate ALProcAddressTable");
+ }
+ alDynamicLookupHelper = new DynamicLibraryBundle(new ALDynamicLibraryBundleInfo());
+ if(null==alDynamicLookupHelper) {
+ throw new RuntimeException("Null ALDynamicLookupHelper");
+ }
+ if(!alDynamicLookupHelper.isToolLibLoaded()) {
+ throw new RuntimeException("Couln't load native AL library");
+ }
+ if(!alDynamicLookupHelper.isLibComplete()) {
+ throw new RuntimeException("Couln't load native AL/JNI glue library");
+ }
+ alProcAddressTable.reset(alDynamicLookupHelper);
+}
+
+public static ALProcAddressTable getALProcAddressTable() { return alProcAddressTable; }
+
+static long alGetProcAddress(long alGetProcAddressHandle, java.lang.String procname)
+{
+ if (alGetProcAddressHandle == 0) {
+ throw new RuntimeException("Passed null pointer for method \"alGetProcAddress\"");
+ }
+ return dispatch_alGetProcAddressStatic(procname, alGetProcAddressHandle);
+}
+
+static native long dispatch_alGetProcAddressStatic(String fname, long procAddress);
+