aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/build-test.xml145
-rwxr-xr-xmake/build.xml214
-rwxr-xr-xmake/joal-alc-CustomJavaCode.java3
-rwxr-xr-xmake/joal-alc.cfg22
-rwxr-xr-xmake/joal-alcabstract-CustomJavaCode.java12
-rw-r--r--make/joal-common-CustomJavaCode.java33
-rwxr-xr-xmake/joal.cfg5
-rwxr-xr-xmake/joalversion14
-rw-r--r--nbproject/project.xml28
-rw-r--r--src/java/build.xml79
-rw-r--r--src/java/com/jogamp/openal/ALFactory.java4
-rw-r--r--src/java/com/jogamp/openal/impl/ALCImpl.java18
-rw-r--r--src/java/com/jogamp/openal/impl/ALDynamicLibraryBundleInfo.java91
-rwxr-xr-xsrc/java/com/jogamp/openal/impl/ALProcAddressLookup.java179
-rwxr-xr-xsrc/java/com/jogamp/openal/impl/NativeLibLoader.java114
-rw-r--r--src/native/almisc.c71
-rw-r--r--src/test/com/jogamp/openal/test/junit/ALTest.java (renamed from test/src/com/jogamp/openal/ALTest.java)10
-rw-r--r--src/test/com/jogamp/openal/test/manual/OpenALTest.java (renamed from test/src/com/jogamp/openal/OpenALTest.java)7
-rw-r--r--src/test/com/jogamp/openal/test/manual/Sound3DTest.java (renamed from test/src/com/jogamp/openal/Sound3DTest.java)3
-rw-r--r--src/test/com/jogamp/openal/test/resources/ResourceLocation.java6
-rw-r--r--src/test/com/jogamp/openal/test/resources/lewiscarroll.wav (renamed from test/src/com/jogamp/openal/lewiscarroll.wav)bin1025476 -> 1025476 bytes
-rw-r--r--test/.cvsignore1
-rw-r--r--test/build.xml78
23 files changed, 522 insertions, 615 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
new file mode 100644
index 0000000..e543a1c
--- /dev/null
+++ b/make/build-test.xml
@@ -0,0 +1,145 @@
+<?xml version="1.0"?>
+
+<!--
+* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* -Redistribution of source code must retain the above copyright notice,
+* this list of conditions and the following disclaimer.
+*
+* -Redistribution in binary form must reproduce the above copyright notice,
+* this list of conditions and the following disclaimer in the documentation
+* and/or other materials provided with the distribution.
+*
+* Neither the name of Sun Microsystems, Inc. or the names of contributors may
+* be used to endorse or promote products derived from this software without
+* specific prior written permission.
+*
+* This software is provided "AS IS," without a warranty of any kind.
+* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
+* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
+* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
+* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
+* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
+* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
+* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+*
+* You acknowledge that this software is not designed or intended for use in the
+* design, construction, operation or maintenance of any nuclear facility.
+-->
+
+<project name="JOALTest" basedir="." default="all">
+
+ <property name="junit.path" value="${basedir}/${gluegen.root}/make/lib/junit.jar"/>
+ <property name="ant-contrib.jar" value="${gluegen.root}/make/lib/ant-contrib-1.0b3.jar" />
+
+ <taskdef resource="net/sf/antcontrib/antlib.xml">
+ <classpath> <pathelement location="${ant-contrib.jar}"/> </classpath>
+ </taskdef>
+
+ <target name="test.init">
+ <mkdir dir="classes"/>
+ <property name="rootrel.src.test" value="src/test" />
+ <property name="src.test" value="${project.root}/${rootrel.src.test}" />
+
+ <property name="results.test" value="${build}/test/results" />
+ <property name="build.test" value="${build}/test/build" />
+ <property name="obj.test" value="${build.test}/obj"/>
+
+ <property name="classes" value="${build.test}/classes" />
+ <property name="classes.path" location="${classes}"/> <!-- absolute path -->
+
+ <property name="java.dir.test" value="com/jogamp/openal/test"/>
+ <property name="java.part.test" value="${java.dir.test}/**"/>
+ <property name="java.dir.junit" value="${java.dir.test}/junit"/>
+ <property name="java.dir.manual" value="${java.dir.test}/manual"/>
+
+ <property name="obj.all.paths" value="${gluegen.root}/build/obj${path.separator}${obj}"/>
+ <property name="classpath.all" value="${gluegen.root}/build/gluegen-rt.jar${path.separator}${build}/joal.jar${path.separator}${classes}${path.separator}${junit.path}"/>
+
+ <property name="batchtest.timeout" value="1800000"/> <!-- 30 min -->
+ </target>
+
+ <target name="test.compile" depends="test.init">
+ <javac debug="true" srcdir="${src.test}" destdir="${classes}" includeantruntime="false"
+ classpath="${gluegen.root}/build/gluegen-rt.jar;../build/joal.jar;${junit.path}"/>
+ <copy todir="${classes}">
+ <fileset dir="${src.test}" includes="**/*.wav"/>
+ </copy>
+ </target>
+
+ <target name="clean">
+ <delete dir="${build.test}"/>
+ </target>
+
+ <target name="test.auto.run" depends="junit.run"/>
+
+ <target name="junit.run" depends="test.compile">
+ <mkdir dir="${results.test}"/>
+ <junit forkmode="once" showoutput="true" fork="true" includeAntRuntime="true">
+ <env key="${system.env.library.path}" path="${obj.all.paths}"/>
+ <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
+ <jvmarg value="-Djogamp.debug.NativeLibrary=true"/>
+ <jvmarg value="-Djogamp.debug.NativeLibrary.Lookup=true"/>
+ <jvmarg value="-Djogamp.debug.ProcAddressHelper=true"/>
+ <batchtest todir="${results.test}">
+ <fileset dir="${classes}">
+ <include name="${java.dir.junit}/**/*Test*"/>
+ </fileset>
+ <formatter usefile="false" type="plain"/>
+ <formatter usefile="true" type="xml"/>
+ </batchtest>
+ <classpath>
+ <path path="${classpath.all}"/>
+ </classpath>
+ </junit>
+ </target>
+
+ <target name="test.manual.run" depends="test.compile">
+ <for param="test.class.path.m" keepgoing="true">
+ <!-- results in absolute path -->
+ <fileset dir="${classes}">
+ <include name="${java.dir.manual}/**/*Test*"/>
+ <exclude name="**/*$$*"/>
+ </fileset>
+ <sequential>
+ <var name="test.class.path" unset="true"/>
+ <property name="test.class.path" basedir="${classes}" relative="true" location="@{test.class.path.m}"/>
+ <var name="test.class.fqn" unset="true"/>
+ <pathconvert property="test.class.fqn">
+ <fileset file="${classes}${file.separator}${test.class.path}"/>
+ <chainedmapper>
+ <globmapper from="${classes.path}${file.separator}*" to="*"/> <!-- rel. -->
+ <packagemapper from="*.class" to="*"/> <!-- FQCN -->
+ </chainedmapper>
+ </pathconvert>
+ <var name="test.class.result.file" value="${results.test}/TEST-${test.class.fqn}.log"/>
+ <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/>
+ <apply dir="." executable="${java.home}/bin/java"
+ parallel="false"
+ timeout="${batchtest.timeout}"
+ vmlauncher="false"
+ relative="true"
+ failonerror="false">
+ <env key="${system.env.library.path}" path="${obj.all.paths}"/>
+ <env key="CLASSPATH" value="${classpath.all}"/>
+ <arg value="-Djava.library.path=${obj.all.paths}"/>
+ <arg line="-Djogamp.debug.NativeLibrary=true"/>
+ <arg line="-Djogamp.debug.NativeLibrary.Lookup=true"/>
+ <arg line="-Djogamp.debug.ProcAddressHelper=true"/>
+ <srcfile/>
+ <mappedresources>
+ <fileset dir="${classes}" includes="${test.class.path}"/>
+ <packagemapper from="*.class" to="*"/>
+ </mappedresources>
+ </apply>
+ </sequential>
+ </for>
+ </target>
+
+</project>
diff --git a/make/build.xml b/make/build.xml
index 710d0ef..fe020f2 100755
--- a/make/build.xml
+++ b/make/build.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- - Ant build for JOAL. This build has been tested with ANT 1.7.1. The
+ - Ant build for JOAL. This build has been tested with ANT 1.8.0. The
- optional.jar that contains the optional ANT tasks must be in the ANT
- classpath (typically the ant/lib directory).
-
@@ -31,36 +31,31 @@
-->
<project name="JOAL" basedir="." default="all">
- <!-- This is the version of JOAL you are building -->
- <property name="base_version" value="1.1.3"/>
+ <!-- This is the version of JOAL you are building -->
+ <property name="joal_base_version" value="2.0"/>
+ <tstamp>
+ <format property="version.timestamp" pattern="yyyyMMddHHmm"/>
+ </tstamp>
+ <property name="joal.version" value="${joal_base_version}-${version.timestamp}" />
- <condition property="rootrel.build" value="build">
+ <property name="project.root" value=".." />
+ <property name="gluegen.root" value="${project.root}/../gluegen" />
+
+ <condition property="rootrel.build" value="build">
<not>
<isset property="rootrel.build"/>
</not>
- </condition>
-
- <!-- Uncomment this property to perform a full release build -->
- <!-- property name="release-build" value="true" / -->
-
- <!-- Pull in GlueGen cpptasks build file -->
- <property name="gluegen.root" value="../../gluegen" />
- <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
+ </condition>
+ <property name="build" location="${project.root}/${rootrel.build}" />
- <!-- Set up version string (used in several places) based on whether we're
- doing a release build or not -->
- <target name="setup-version-string-release" if="release-build">
- <property name="version-string" value="${base_version}" />
- </target>
+ <property file="${build}/artifact.properties"/>
+ <property name="joal.build.number" value="manual-build"/>
+ <property name="joal.build.id" value="${version.timestamp}"/>
+ <property name="joal.build.branch" value="master"/>
+ <property name="joal.build.commit" value="manual"/>
- <target name="setup-version-string-prerelease" unless="release-build">
- <tstamp>
- <format property="timestamp" pattern="yyyyMMdd"/>
- </tstamp>
- <property name="version-string" value="${base_version}-pre-${timestamp}" />
- </target>
-
- <target name="setup-version-string" depends="setup-version-string-release,setup-version-string-prerelease" />
+ <!-- Pull in GlueGen cpptasks build file -->
+ <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
<!-- ================================================================== -->
<!--
@@ -315,6 +310,9 @@
<mkdir dir="${classes}" />
<mkdir dir="${obj}" />
<mkdir dir="${obj.joal}" />
+
+ <property name="archive.name" value="joal-${joal.version}" />
+ <property name="archive" value="${build}/${archive.name}" />
</target>
<target name="declare" depends="init,declare.win32,declare.linux,declare.solaris32,declare.macosx,declare.freebsd" />
@@ -365,7 +363,7 @@
-->
<target name="java.generate" depends="build.gluegen, java.generate.check" unless="java.generate.skip">
<!-- Add the GlueGen task to ANT -->
- <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask"
+ <taskdef name="gluegen" classname="com.jogamp.gluegen.ant.GlueGenTask"
classpathref="gluegen.classpath" />
<!-- Use the GlueGen task to generate the Java files -->
@@ -375,7 +373,7 @@
outputRootDir="${build}"
config="${joal.cfg}"
includeRefid="stub.includes.fileset.all"
- emitter="com.sun.gluegen.procaddress.ProcAddressEmitter">
+ emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
@@ -384,7 +382,7 @@
outputRootDir="${build}"
config="${joal.constants.cfg}"
includeRefid="stub.includes.fileset.all"
- emitter="com.sun.gluegen.JavaEmitter">
+ emitter="com.jogamp.gluegen.JavaEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
@@ -393,7 +391,7 @@
outputRootDir="${build}"
config="${joal.alc.cfg}"
includeRefid="stub.includes.fileset.all"
- emitter="com.sun.gluegen.procaddress.ProcAddressEmitter">
+ emitter="com.jogamp.gluegen.procaddress.ProcAddressEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
@@ -402,7 +400,7 @@
outputRootDir="${build}"
config="${joal.alc.constants.cfg}"
includeRefid="stub.includes.fileset.all"
- emitter="com.sun.gluegen.JavaEmitter">
+ emitter="com.jogamp.gluegen.JavaEmitter">
<classpath refid="gluegen.classpath" />
</gluegen>
@@ -517,14 +515,16 @@
<!--
- Build the joal.jar file.
-->
- <target name="jar" depends="java.compile,setup-version-string">
+ <target name="jar" depends="java.compile">
<!-- Prepare the manifest -->
<copy file="joalversion"
tofile="tempversion"
overwrite="true">
<filterset>
- <filter token="VERSION" value="${version-string}"/>
- <filter token="BASEVERSION" value="${base_version}"/>
+ <filter token="VERSION" value="${joal.version}"/>
+ <filter token="SCM_BRANCH" value="${joal.build.branch}"/>
+ <filter token="SCM_COMMIT" value="${joal.build.commit}"/>
+ <filter token="BASEVERSION" value="${joal_base_version}"/>
</filterset>
</copy>
@@ -561,99 +561,36 @@
linkoffline="${javadoc.link} 142-packages" />
</target>
- <!-- Build zip archives for developers, both source and binaries -->
- <target name="zip" depends="setup-version-string">
+ <!-- Build binary zip archives for developers -->
+ <target name="developer-zip-archive" depends="init" unless="build.noarchives">
<!-- Clean up and create temporary directory -->
- <delete dir="../${rootrel.build}/tmp" failonerror="false" />
- <delete>
- <fileset dir="../${rootrel.build}">
- <include name="*.zip" />
- </fileset>
- </delete>
- <property name="joal.tmp.version" value="joal-${version-string}-${os.and.arch}" />
- <mkdir dir="../${rootrel.build}/tmp/${joal.tmp.version}/lib" />
- <copy file="../${rootrel.build}/joal.jar" todir="../${rootrel.build}/tmp/${joal.tmp.version}/lib" />
- <copy file="${gluegen-rt.jar}" todir="../${rootrel.build}/tmp/${joal.tmp.version}/lib" />
- <copy todir="../${rootrel.build}/tmp/${joal.tmp.version}/lib">
- <fileset dir="../${rootrel.build}/obj">
- <include name="*.${native.library.suffix}" />
- </fileset>
+ <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
+ <mkdir dir="${archive}" />
+ <copy file="${build}/artifact.properties" todir="${archive}"/>
+ <mkdir dir="${archive}/jar" />
+ <copy todir="${archive}/jar">
+ <fileset dir="${build}" includes="joal*.jar"/>
</copy>
- <copy todir="../${rootrel.build}/tmp/${joal.tmp.version}/lib">
- <fileset dir="${gluegen.root}/${rootrel.build}/obj">
- <include name="*.${native.library.suffix}" />
- </fileset>
+ <mkdir dir="${archive}/lib" />
+ <copy todir="${archive}/lib">
+ <fileset dir="${build}/obj" includes="*.${native.library.suffix}"/>
</copy>
- <copy file="../README.txt" todir="../${rootrel.build}/tmp/${joal.tmp.version}" />
- <copy file="../LICENSE.txt" todir="../${rootrel.build}/tmp/${joal.tmp.version}" />
- <zip destfile="../${rootrel.build}/${joal.tmp.version}.zip"
- basedir="../${rootrel.build}/tmp"
- includes="${joal.tmp.version}/**" />
- <!-- Build a source archive as well -->
- <delete file="../${rootrel.build}/joal-${version-string}-src.zip" />
- <zip destfile="../${rootrel.build}/joal-${version-string}-src.zip"
- basedir="../.."
- includes="gluegen/LICENSE.txt,gluegen/doc/**,gluegen/make/**,gluegen/src/**,joal/README.txt,joal/LICENSE.txt,joal/make/**,joal/src/**,joal/${rootrel.build}/gensrc/classes/com/jogamp/openal/**"
- excludes="**/*.class,**/*~"
- />
- </target>
-
- <!-- ================================================================== -->
- <!--
- - Build the Java Web Start binaries out of native library builds for
- - each individual platform. To run this target, you need to
- - specify the property joal.dist.dir as a System property (i.e.,
- - "ant -Djoal.dist.dir=../dist dist"); directories named joal-linux,
- - joal-win32, and joal-macosx need to be inside that directory and each
- - of those directories needs to contain the native code for that platform
- - (libjoal.so, joal.dll, or libjoal.jnilib).
- -->
- <target name="dist.check" unless="joal.dist.dir">
- <fail>
-
- ******************************************************************
- ** To build the Joal distribution out of the platform-specific **
- ** component jars and native code, the property joal.dist.dir **
- ** needs to be specified on the command line. Please read the **
- ** comments associated with the "dist" target in the build.xml. **
- ******************************************************************
- </fail>
- </target>
-
- <target name="dist" depends="dist.check,setup-version-string">
- <delete>
- <fileset dir="${joal.dist.dir}" includes="*.jar" />
- <fileset dir="${joal.dist.dir}" includes="*.zip" />
- </delete>
- <!-- Copy Java Web Start jar files, source archive(s) and binary zip archives -->
- <copy todir="${joal.dist.dir}">
- <fileset dir="${joal.dist.dir}/joal-win/32">
- <include name="*.jar" />
- <include name="*.zip" />
- </fileset>
- <fileset dir="${joal.dist.dir}/joal-linux/32">
- <include name="*.jar" />
- <!-- Pick up source archive from Linux build as well -->
- <include name="*.zip" />
- </fileset>
- <fileset dir="${joal.dist.dir}/joal-macosx/ppc">
- <include name="*.jar" />
- <include name="*.zip" />
- </fileset>
- <fileset dir="${joal.dist.dir}/joal-macosx/fat">
- <include name="*.jar" />
- <include name="*.zip" />
- </fileset>
- <!-- NOTE: No OpenAL for Windows/AMD64, Linux/AMD64 or Solaris at the moment -->
+ <mkdir dir="${archive}/jnlp-files" />
+ <copy todir="${archive}/jnlp-files">
+ <fileset dir="${project.root}/jnlp-files" includes="*" />
</copy>
- <!-- Build one archive containing all jars related to Java Web Start -->
- <tstamp>
- <format property="timestamp" pattern="yyyyMMdd"/>
- </tstamp>
- <zip destfile="${joal.dist.dir}/joal-${version-string}-webstart.zip"
- basedir="${joal.dist.dir}"
- includes="*.jar"
- />
+ <mkdir dir="${archive}/www" />
+ <copy todir="${archive}/www">
+ <fileset dir="${project.root}/www" includes="*" />
+ </copy>
+ <copy file="../README.txt" todir="${archive}"/>
+ <copy file="../LICENSE.txt" todir="${archive}"/>
+ <delete quiet="true" file="${build}/${archive.name}.zip"/>
+ <zip destfile="${build}/${archive.name}.zip"
+ basedir="${build}"
+ includes="${archive.name}/**" />
+ <!-- Clean up after ourselves -->
+ <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
</target>
<!-- ================================================================== -->
@@ -666,31 +603,50 @@
<fileset dir="${javadoc}" />
<fileset dir="${javadoc.dev}" />
</delete>
- <ant dir="../test" target="clean"/>
+ <ant antfile="build-test.xml" target="clean"/>
</target>
<!-- ================================================================== -->
<!--
- Build everything.
-->
- <target name="all" depends="init,declare">
+ <target name="all" depends="joal.compile, test.compile, tag.build, developer-zip-archive"/>
+
+ <target name="joal.compile" depends="init, declare">
<!-- Generate, compile, and build the jar for the Java sources. -->
<antcall target="jar" inheritRefs="true" />
<!-- Compile the native C sources . -->
<antcall target="c.build.joal" inheritRefs="true" />
+ </target>
- <!-- Build zip archives. -->
- <antcall target="zip" inheritRefs="true" />
+ <target name="tag.build">
+ <copy file="${gluegen.root}/${rootrel.build}/artifact.properties" todir="${build}" overwrite="true"/>
+ <echo message='joal.build.number=${joal.build.number}${line.separator}' file="${build}/artifact.properties" append="true"/>
+ <echo message='joal.build.id=${joal.build.id}${line.separator}' file="${build}/artifact.properties" append="true"/>
+ <echo message='joal.build.branch=${joal.build.branch}${line.separator}' file="${build}/artifact.properties" append="true"/>
+ <echo message='joal.build.commit=${joal.build.commit}${line.separator}' file="${build}/artifact.properties" append="true"/>
</target>
<!-- ================================================================== -->
<!--
- - Build and run tests.
+ - unit tests
-->
- <target name="test" depends="all">
- <ant dir="../test" target="test"/>
+ <target name="test.compile" depends="joal.compile">
+ <ant antfile="build-test.xml" target="test.compile" inheritRefs="true" inheritAll="true"/>
+ </target>
+
+ <target name="test.auto.run" depends="test.compile">
+ <ant antfile="build-test.xml" target="test.auto.run" inheritRefs="true" inheritAll="true"/>
+ </target>
+
+ <target name="junit.run" depends="test.compile">
+ <ant antfile="build-test.xml" target="junit.run" inheritRefs="true" inheritAll="true"/>
+ </target>
+
+ <target name="test.manual.run" depends="test.compile">
+ <ant antfile="build-test.xml" target="test.manual.run" inheritRefs="true" inheritAll="true"/>
</target>
</project>
diff --git a/make/joal-alc-CustomJavaCode.java b/make/joal-alc-CustomJavaCode.java
index 53696f4..be28d8c 100755
--- a/make/joal-alc-CustomJavaCode.java
+++ b/make/joal-alc-CustomJavaCode.java
@@ -1,6 +1,3 @@
-/** Entry point (through function pointer) to C language function: <br> <code> const ALCchar * alcGetString(ALCdevice * device, ALCenum param); </code> */
-public java.lang.String alcGetString(ALCdevice device, int param);
-
/** Fetches the names of the available ALC device specifiers.
Equivalent to the C call alcGetString(NULL, ALC_DEVICE_SPECIFIER). */
public java.lang.String[] alcGetDeviceSpecifiers();
diff --git a/make/joal-alc.cfg b/make/joal-alc.cfg
index 3134a06..b8013ab 100755
--- a/make/joal-alc.cfg
+++ b/make/joal-alc.cfg
@@ -10,7 +10,7 @@ Extends ALC ALCConstants
EmitProcAddressTable true
ProcAddressTableClassName ALCProcAddressTable
-GetProcAddressTableExpr ALProcAddressLookup.getALCProcAddressTable()
+GetProcAddressTableExpr alcProcAddressTable
ProcAddressNameExpr LP $UPPERCASE({0})
Import java.io.UnsupportedEncodingException
@@ -27,15 +27,18 @@ Ignore ^ALC_.+
# to use this routine to look up the ALC function pointers.
Ignore alcGetProcAddress
-# Move the body of alcGetString to a private method so we can
+# Manually implement alcGetString so we can
# implement alcGetString(NULL, ALC_DEVICE_SPECIFIER) in another method
-RenameJavaMethod alcGetString alcGetStringImpl
-# Specify the return length of this function with our own custom strlen
-ReturnValueCapacity alcGetStringImpl strlen_alc(_device_ptr, {1}, _res)
+ReturnsString alcGetString
+ManuallyImplement alcGetString
+ForceProcAddressGen alcGetString
+## Specify the return length of this function with our own custom strlen
+##ReturnValueCapacity alcGetStringImpl strlen_alc(_device_ptr, {1}, _res)
# Note that we don't declare this as "ReturnsString" because we're
# going to wrap it in another method
IncludeAs CustomJavaCode ALC joal-alc-CustomJavaCode.java
+IncludeAs CustomJavaCode ALCAbstractImpl joal-alcabstract-CustomJavaCode.java
# These routines use strings
ArgumentIsString alcIsExtensionPresent 1
@@ -55,14 +58,5 @@ ReturnValueCapacity alcGetCurrentContext 0
ReturnValueCapacity alcGetCurrentDevice 0
ReturnValueCapacity alcOpenDevice 0
-# Need a prologue on alcOpenDevice and epilogue on alcMakeContextCurrent
-# to set up the proc address tables the first time
-JavaPrologue alcOpenDevice ALProcAddressLookup.resetALCProcAddressTable();
-JavaEpilogue alcMakeContextCurrent ALProcAddressLookup.resetALProcAddressTable();
-
-# To be able to use alcGetString before a context is created we need
-# to instrument that routine as well
-JavaPrologue alcGetString ALProcAddressLookup.resetALCProcAddressTable();
-
IncludeAs CustomCCode joal-common-CustomCCode.c
IncludeAs CustomCCode joal-alc-impl-CustomCCode.c
diff --git a/make/joal-alcabstract-CustomJavaCode.java b/make/joal-alcabstract-CustomJavaCode.java
new file mode 100755
index 0000000..3420cc2
--- /dev/null
+++ b/make/joal-alcabstract-CustomJavaCode.java
@@ -0,0 +1,12 @@
+private static final ALCProcAddressTable alcProcAddressTable;
+
+static {
+ alcProcAddressTable = new ALCProcAddressTable();
+ if(null==alcProcAddressTable) {
+ throw new RuntimeException("Couldn't instantiate ALCProcAddressTable");
+ }
+ alcProcAddressTable.reset(ALImpl.alDynamicLookupHelper);
+}
+
+public static ALCProcAddressTable getALCProcAddressTable() { return alcProcAddressTable; }
+
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);
+
diff --git a/make/joal.cfg b/make/joal.cfg
index 35bbd5c..e398112 100755
--- a/make/joal.cfg
+++ b/make/joal.cfg
@@ -9,9 +9,10 @@ Extends AL ALConstants
EmitProcAddressTable true
ProcAddressTableClassName ALProcAddressTable
-GetProcAddressTableExpr ALProcAddressLookup.getALProcAddressTable()
+GetProcAddressTableExpr alProcAddressTable
ProcAddressNameExpr LP $UPPERCASE({0})
+
Import com.jogamp.openal.*
Import com.jogamp.openal.impl.*
@@ -36,6 +37,8 @@ ArgumentIsString alIsExtensionPresent 0
ArgumentIsString alGetEnumValue 0
ArgumentIsString alGetProcAddress 0
+IncludeAs CustomJavaCode ALImpl joal-common-CustomJavaCode.java
+
# Provide #includes to native code
CustomCCode #include "al.h"
CustomCCode #ifndef _MSC_VER /* Non-Windows platforms */
diff --git a/make/joalversion b/make/joalversion
index 85b5770..da9fd7e 100755
--- a/make/joalversion
+++ b/make/joalversion
@@ -1,8 +1,12 @@
-Specification-Title: Java Binding for OpenAL
+Specification-Title: Java Bindings for OpenAL API Specification
Specification-Version: @BASEVERSION@
-Specification-Vendor: JogAmp.org
-Implementation-Title: Java Bindings for the OpenAL API
+Specification-Vendor: JogAmp Community
+Implementation-Title: Java Bindings for OpenAL Runtime Environment
Implementation-Version: @VERSION@
-Implementation-Vendor: JogAmp.org
+Implementation-Branch: @SCM_BRANCH@
+Implementation-Commit: @SCM_COMMIT@
+Implementation-Vendor: JogAmp Community
+Implementation-URL: http://jogamp.org/
Extension-Name: com.jogamp.openal
-Implementation-Vendor-Id: JogAmp.org
+Implementation-Vendor-Id: com.jogamp
+Trusted-Library: true
diff --git a/nbproject/project.xml b/nbproject/project.xml
index dc47ad4..4696351 100644
--- a/nbproject/project.xml
+++ b/nbproject/project.xml
@@ -9,7 +9,7 @@
<!-- Do not use Project Properties customizer when editing this file manually. -->
<name>JOAL</name>
<properties>
- <property name="ant.script">/home/mbien/NetBeansProjects/JOGAMP/joal/make/build.xml</property>
+ <property name="ant.script">make/build.xml</property>
</properties>
<folders>
<source-folder>
@@ -24,9 +24,15 @@
<encoding>UTF-8</encoding>
</source-folder>
<source-folder>
- <label>test/src</label>
+ <label>src/test</label>
<type>java</type>
- <location>test/src</location>
+ <location>src/test</location>
+ <encoding>UTF-8</encoding>
+ </source-folder>
+ <source-folder>
+ <label>build/gensrc/classes</label>
+ <type>java</type>
+ <location>build/gensrc/classes</location>
<encoding>UTF-8</encoding>
</source-folder>
</folders>
@@ -86,8 +92,12 @@
<location>src/java</location>
</source-folder>
<source-folder style="packages">
- <label>test/src</label>
- <location>test/src</location>
+ <label>src/test</label>
+ <location>src/test</location>
+ </source-folder>
+ <source-folder style="packages">
+ <label>build/gensrc/classes</label>
+ <location>build/gensrc/classes</location>
</source-folder>
<source-file>
<location>${ant.script}</location>
@@ -110,9 +120,13 @@
<source-level>1.5</source-level>
</compilation-unit>
<compilation-unit>
- <package-root>test/src</package-root>
+ <package-root>src/test</package-root>
<unit-tests/>
- <classpath mode="compile">../gluegen/build/gluegen-rt.jar:build/classes:../gluegen/make/lib/junit.jar</classpath>
+ <classpath mode="compile">build/classes</classpath>
+ <source-level>1.5</source-level>
+ </compilation-unit>
+ <compilation-unit>
+ <package-root>build/gensrc/classes</package-root>
<source-level>1.5</source-level>
</compilation-unit>
</java-data>
diff --git a/src/java/build.xml b/src/java/build.xml
deleted file mode 100644
index 9e11377..0000000
--- a/src/java/build.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="iso-8859-1"?>
-
-<!--
-* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* -Redistribution of source code must retain the above copyright notice,
-* this list of conditions and the following disclaimer.
-*
-* -Redistribution in binary form must reproduce the above copyright notice,
-* this list of conditions and the following disclaimer in the documentation
-* and/or other materials provided with the distribution.
-*
-* Neither the name of Sun Microsystems, Inc. or the names of contributors may
-* be used to endorse or promote products derived from this software without
-* specific prior written permission.
-*
-* This software is provided "AS IS," without a warranty of any kind.
-* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
-* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
-* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
-* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
-* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
-* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
-* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
-* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
-* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
-* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* You acknowledge that this software is not designed or intended for use in the
-* design, construction, operation or maintenance of any nuclear facility.
--->
-
-<project name="Sun Games Initiative Client Technologies" basedir="." default="all">
-
- <target name="init">
- <mkdir dir="../../classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac srcdir="." destdir="../../classes" debug="${debug}" optimize="${optimize}"/>
- </target>
-
- <target name="all" depends="init,compile">
- </target>
-
- <target name="javadoc" depends="compile">
- <javadoc packagenames="com.jogamp.openal.*"
- sourcepath="."
- additionalparam="-breakiterator"
- windowtitle="Java Bindings for OpenAL / Sound3D Toolkit"
- doctitle="Java Bindings for OpenAL / Sound3D Toolkit"
- destdir="../../apidocs">
- <group title = "Java Bindings for OpenAL">
- <package name="com.jogamp.openal"/>
- <package name="com.jogamp.openal.eax"/>
- <package name="com.jogamp.openal.util"/>
- </group>
- <group title="Sound3D Toolkit">
- <package name="com.jogamp.openal.sound3d"/>
- </group>
- </javadoc>
- </target>
-
- <target name="jar" depends="compile">
- <jar basedir="../../classes" destfile="../../lib/joal.jar" compress="yes" update="yes" index="yes">
-
- </jar>
- </target>
-
- <target name="clean">
- <delete dir="../../apidocs"/>
- <delete dir="../../classes/net"/>
- <delete file="../../lib/joal.jar"/>
- </target>
-
-</project> \ No newline at end of file
diff --git a/src/java/com/jogamp/openal/ALFactory.java b/src/java/com/jogamp/openal/ALFactory.java
index f58fe4b..64da325 100644
--- a/src/java/com/jogamp/openal/ALFactory.java
+++ b/src/java/com/jogamp/openal/ALFactory.java
@@ -53,7 +53,9 @@ public class ALFactory {
private static synchronized void initialize() throws ALException {
try {
if (!initialized) {
- NativeLibLoader.load();
+ if(null == ALImpl.getALProcAddressTable()) {
+ throw new RuntimeException("AL not initialized (ProcAddressTable null)");
+ }
initialized = true;
}
} catch (UnsatisfiedLinkError e) {
diff --git a/src/java/com/jogamp/openal/impl/ALCImpl.java b/src/java/com/jogamp/openal/impl/ALCImpl.java
index 208e64f..75fc47d 100644
--- a/src/java/com/jogamp/openal/impl/ALCImpl.java
+++ b/src/java/com/jogamp/openal/impl/ALCImpl.java
@@ -3,6 +3,7 @@
*/
package com.jogamp.openal.impl;
+import com.jogamp.common.nio.Buffers;
import com.jogamp.openal.ALException;
import com.jogamp.openal.ALCdevice;
import java.io.UnsupportedEncodingException;
@@ -33,6 +34,23 @@ public class ALCImpl extends ALCAbstractImpl {
}
}
+ /** Entry point (through function pointer) to C language function: <br> <code> const ALCchar * alcGetString(ALCdevice * device, ALCenum param); </code> */
+ public ByteBuffer alcGetStringImpl(ALCdevice device, int param) {
+
+ final long __addr_ = getALCProcAddressTable()._addressof_alcGetString;
+ if (__addr_ == 0) {
+ throw new UnsupportedOperationException("Method \"alcGetStringImpl\" not available");
+ }
+ ByteBuffer _res;
+ _res = dispatch_alcGetStringImpl1(((device == null) ? null : device.getBuffer()), param, __addr_);
+ if (_res == null) {
+ return null;
+ }
+ Buffers.nativeOrder(_res);
+ return _res;
+ }
+ private native java.nio.ByteBuffer dispatch_alcGetStringImpl1(ByteBuffer deviceBuffer, int param, long addr);
+
/**
* Fetches the names of the available ALC device specifiers.
* Equivalent to the C call alcGetString(NULL, ALC_DEVICE_SPECIFIER).
diff --git a/src/java/com/jogamp/openal/impl/ALDynamicLibraryBundleInfo.java b/src/java/com/jogamp/openal/impl/ALDynamicLibraryBundleInfo.java
new file mode 100644
index 0000000..9d41a69
--- /dev/null
+++ b/src/java/com/jogamp/openal/impl/ALDynamicLibraryBundleInfo.java
@@ -0,0 +1,91 @@
+/**
+ * Copyright 2010 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.openal.impl;
+
+import com.jogamp.common.os.DynamicLibraryBundleInfo;
+import java.util.*;
+
+public class ALDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo {
+ private static List/*<String>*/ glueLibNames;
+ static {
+ glueLibNames = new ArrayList();
+
+ glueLibNames.add("joal");
+ }
+
+ protected ALDynamicLibraryBundleInfo() {
+ }
+
+ /** FIXME: not default, maybe local ? **/
+ public boolean shallLinkGlobal() { return true; }
+
+ /** default **/
+ public boolean shallLookupGlobal() { return false; }
+
+ public final List/*<String>*/ getGlueLibNames() {
+ return glueLibNames;
+ }
+
+ public List getToolLibNames() {
+ List/*<List>*/ libNamesList = new ArrayList();
+
+ List/*<String>*/ alLibNames = new ArrayList();
+
+ // this is the default AL lib name, according to the spec
+ alLibNames.add("libopenal.so.1"); // unix
+ alLibNames.add("OpenAL32"); // windows
+ alLibNames.add("OpenAL"); // OSX
+
+ // try this one as well, if spec fails
+ alLibNames.add("libOpenAL.so.1");
+ alLibNames.add("libopenal.so");
+ alLibNames.add("libOpenAL.so");
+
+ // last but not least .. the generic one
+ alLibNames.add("openal");
+ alLibNames.add("OpenAL");
+
+ libNamesList.add(alLibNames);
+
+ return libNamesList;
+ }
+
+ public final List getToolGetProcAddressFuncNameList() {
+ List res = new ArrayList();
+ res.add("alGetProcAddress");
+ return res;
+ }
+
+ public final long toolDynamicLookupFunction(long toolGetProcAddressHandle, String funcName) {
+ return ALImpl.alGetProcAddress(toolGetProcAddressHandle, funcName);
+ }
+
+}
+
+
diff --git a/src/java/com/jogamp/openal/impl/ALProcAddressLookup.java b/src/java/com/jogamp/openal/impl/ALProcAddressLookup.java
deleted file mode 100755
index 45718dd..0000000
--- a/src/java/com/jogamp/openal/impl/ALProcAddressLookup.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistribution of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * -Redistribution in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind.
- * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
- * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS
- * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
- * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
- * OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
- * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
- * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use in the
- * design, construction, operation or maintenance of any nuclear facility.
- */
-
-package com.jogamp.openal.impl;
-
-import com.jogamp.common.os.DynamicLookupHelper;
-import com.jogamp.common.os.NativeLibrary;
-import java.lang.reflect.Field;
-
-import com.jogamp.openal.*;
-import com.jogamp.gluegen.runtime.*;
-
-/** Helper class for managing OpenAL-related proc address tables. */
-
-public class ALProcAddressLookup {
-
- private static final ALProcAddressTable alTable;
- private static final ALCProcAddressTable alcTable;
-
- private static volatile boolean alTableInitialized = false;
- private static volatile boolean alcTableInitialized = false;
-
- private static final DynamicLookup lookup;
- private static volatile NativeLibrary openAL;
-
- static {
- //workaround: map renamed fooImpl back to the real function name
- FunctionAddressResolver resolver = new FunctionAddressResolver() {
- public long resolve(String string, DynamicLookupHelper dlh) {
- if (string.endsWith("Impl")) {
- string = string.substring(0, string.length() - 4);
- }
- return dlh.dynamicLookupFunction(string);
- }
- };
- alcTable = new ALCProcAddressTable(resolver);
- alTable = new ALProcAddressTable();
- lookup = new DynamicLookup();
- }
-
- static class DynamicLookup implements DynamicLookupHelper {
- public long dynamicLookupFunction(String functionName) {
- // At some point this may require an OpenAL context to be
- // current as we will actually use alGetProcAddress. Since
- // this routine is currently broken and there are no
- // per-context function pointers anyway we could actually do
- // this work anywhere.
- if (openAL == null) {
- // We choose not to search the system path first because we
- // bundle a very recent version of OpenAL which we would like
- // to override existing installations
- openAL = NativeLibrary.open("OpenAL32", "openal", "OpenAL",
- false,
- ALProcAddressLookup.class.getClassLoader());
- if (openAL == null) {
- throw new RuntimeException("Unable to find and load OpenAL library");
- }
- }
- return openAL.dynamicLookupFunction(functionName);
- }
- }
-
- public static void resetALProcAddressTable() {
- if (!alTableInitialized) {
- synchronized (ALProcAddressLookup.class) {
- if (!alTableInitialized) {
- // At some point this may require an OpenAL context to be
- // current as we will actually use alGetProcAddress. Since
- // this routine is currently broken and there are no
- // per-context function pointers anyway we could actually do
- // this work anywhere. We should also in theory have
- // per-ALcontext ALProcAddressTables and per-ALCdevice
- // ALCProcAddressTables.
- alTable.reset(lookup);
-
- // The above only manages to find addresses for the core OpenAL
- // functions. The below uses alGetProcAddress() to find the addresses
- // of extensions such as EFX, just as in the C++ examples of the
- // OpenAL 1.1 SDK.
- useALGetProcAddress();
-
- alTableInitialized = true;
- }
- }
- }
- }
-
- public static void resetALCProcAddressTable() {
- if (!alcTableInitialized) {
- synchronized (ALProcAddressLookup.class) {
- if (!alcTableInitialized) {
- // At some point this may require an OpenAL device to be
- // created as we will actually use alcGetProcAddress. Since
- // this routine is currently broken and there are no
- // per-device function pointers anyway we could actually do
- // this work anywhere. We should also in theory have
- // per-ALcontext ALProcAddressTables and per-ALCdevice
- // ALCProcAddressTables.
- alcTable.reset(lookup);
- alcTableInitialized = true;
- }
- }
- }
- }
-
- public static ALProcAddressTable getALProcAddressTable() {
- return alTable;
- }
-
- public static ALCProcAddressTable getALCProcAddressTable() {
- return alcTable;
- }
-
-
- /**
- * Retrieves the values of the OpenAL functions using alGetProcAddress().
- */
- private static void useALGetProcAddress() {
- String addrOfPrefix = "_addressof_";
- ALImpl al = (ALImpl) ALFactory.getAL();
-
- Field[] fields = ALProcAddressTable.class.getFields();
- for (int i = 0; i < fields.length; i++) {
- Field field = fields[i];
-
- // Skip non-address fields
- String fieldname = field.getName();
- if (!fieldname.startsWith(addrOfPrefix)) {
- continue;
- }
- try {
- String functionname = fieldname.substring(addrOfPrefix.length());
- long fieldval = field.getLong(alTable);
-
- // Skip fields which have already been valued
- if (fieldval != 0) {
- continue;
- }
-
- // Get the address
- long procAddressVal = al.alGetProcAddress(functionname);
- field.setLong(alTable, procAddressVal);
- }
- catch (Exception ex) {
- throw new RuntimeException("Unable to repopulate ALProcAddressTable values", ex);
- }
- }
- }
-}
diff --git a/src/java/com/jogamp/openal/impl/NativeLibLoader.java b/src/java/com/jogamp/openal/impl/NativeLibLoader.java
deleted file mode 100755
index 38e0e69..0000000
--- a/src/java/com/jogamp/openal/impl/NativeLibLoader.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * - Redistribution of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * - Redistribution in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * Neither the name of Sun Microsystems, Inc. or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use
- * in the design, construction, operation or maintenance of any nuclear
- * facility.
- */
-
-package com.jogamp.openal.impl;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.security.*;
-
-import com.jogamp.gluegen.runtime.*;
-
-public class NativeLibLoader {
- private static volatile boolean loadingEnabled = true;
- private static volatile boolean didLoading;
-
- private NativeLibLoader() {}
-
- public static void disableLoading() {
- loadingEnabled = false;
- }
-
- public static void enableLoading() {
- loadingEnabled = true;
- }
-
- public static void load() {
- if (!didLoading && loadingEnabled) {
- synchronized (NativeLibLoader.class) {
- if (!didLoading && loadingEnabled) {
- didLoading = true;
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- // Workaround for problem in OpenAL32.dll, which is actually
- // the "wrapper" DLL which looks for real OpenAL
- // implementations like nvopenal.dll and "*oal.dll".
- // joal.dll matches this wildcard and a bug in OpenAL32.dll
- // causes a call through a null function pointer.
- loadLibraryInternal("joal");
-
- // Workaround for 4845371.
- // Make sure the first reference to the JNI GetDirectBufferAddress is done
- // from a privileged context so the VM's internal class lookups will succeed.
- // FIXME: need to figure out an appropriate entry point to call for JOAL
- // JAWT jawt = new JAWT();
- // JAWTFactory.JAWT_GetAWT(jawt);
-
- return null;
- }
- });
- }
- }
- }
- }
-
- private static void loadLibraryInternal(String libraryName) {
- String sunAppletLauncher = System.getProperty("sun.jnlp.applet.launcher");
- boolean usingJNLPAppletLauncher = Boolean.valueOf(sunAppletLauncher).booleanValue();
-
- if (usingJNLPAppletLauncher) {
- try {
- Class jnlpAppletLauncherClass = Class.forName("org.jdesktop.applet.util.JNLPAppletLauncher");
- Method jnlpLoadLibraryMethod = jnlpAppletLauncherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class });
- jnlpLoadLibraryMethod.invoke(null, new Object[] { libraryName });
- } catch (Exception e) {
- Throwable t = e;
- if (t instanceof InvocationTargetException) {
- t = ((InvocationTargetException) t).getTargetException();
- }
- if (t instanceof Error)
- throw (Error) t;
- if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- }
- // Throw UnsatisfiedLinkError for best compatibility with System.loadLibrary()
- throw (UnsatisfiedLinkError) new UnsatisfiedLinkError().initCause(e);
- }
- } else {
- System.loadLibrary(libraryName);
- }
- }
-}
diff --git a/src/native/almisc.c b/src/native/almisc.c
new file mode 100644
index 0000000..6658f64
--- /dev/null
+++ b/src/native/almisc.c
@@ -0,0 +1,71 @@
+
+#include <jni.h>
+#include <stdlib.h>
+
+#include <assert.h>
+
+ #include "al.h"
+ #include "alc.h"
+ #ifndef _MSC_VER /* Non-Windows platforms */
+ #define __cdecl /* Trim non-standard keyword */
+ #endif
+ #include "efx.h"
+ #ifdef _MSC_VER /* Windows, Microsoft compilers */
+ /* This typedef is apparently needed for compilers before VC8 */
+ #if _MSC_VER < 1400
+ typedef int intptr_t;
+ #endif
+ #else
+ /* This header seems to be available on all other platforms */
+ #include <inttypes.h>
+ #endif
+ #include <string.h>
+
+
+/* Java->C glue code:
+ * Java package: com.jogamp.openal.impl.ALImpl
+ * Java method: long dispatch_alGetProcAddressStatic(java.lang.String fname)
+ * C function: ALproc alGetProcAddress(const ALchar * fname);
+ */
+JNIEXPORT jlong JNICALL
+Java_com_jogamp_openal_impl_ALImpl_dispatch_1alGetProcAddressStatic(JNIEnv *env, jclass _unused, jstring fname, jlong procAddress) {
+ LPALGETPROCADDRESS ptr_alGetProcAddress;
+ const char* _strchars_fname = NULL;
+ ALproc _res;
+ if ( NULL != fname ) {
+ _strchars_fname = (*env)->GetStringUTFChars(env, fname, (jboolean*)NULL);
+ if ( NULL == _strchars_fname ) {
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"),
+ "Failed to get UTF-8 chars for argument \"fname\" in native dispatcher for \"dispatch_alGetProcAddress\"");
+ return 0;
+ }
+ }
+ ptr_alGetProcAddress = (LPALGETPROCADDRESS) (intptr_t) procAddress;
+ assert(ptr_alGetProcAddress != NULL);
+ _res = (* ptr_alGetProcAddress) ((ALchar *) _strchars_fname);
+ if ( NULL != fname ) {
+ (*env)->ReleaseStringUTFChars(env, fname, _strchars_fname);
+ }
+ return (jlong) (intptr_t) _res;
+}
+
+/* Java->C glue code:
+ * Java package: com.jogamp.openal.impl.ALCAbstractImpl
+ * Java method: java.nio.ByteBuffer dispatch_alcGetStringImpl(ALCdevice device, int param)
+ * C function: const ALCchar * alcGetString(ALCdevice * device, ALCenum param);
+ */
+JNIEXPORT jobject JNICALL
+Java_com_jogamp_openal_impl_ALCImpl_dispatch_1alcGetStringImpl1(JNIEnv *env, jobject _unused, jobject device, jint param, jlong procAddress) {
+ LPALCGETSTRING ptr_alcGetString;
+ ALCdevice * _device_ptr = NULL;
+ const ALCchar * _res;
+ if ( NULL != device ) {
+ _device_ptr = (ALCdevice *) (((char*) (*env)->GetDirectBufferAddress(env, device)) + 0);
+ }
+ ptr_alcGetString = (LPALCGETSTRING) (intptr_t) procAddress;
+ assert(ptr_alcGetString != NULL);
+ _res = (* ptr_alcGetString) ((ALCdevice *) _device_ptr, (ALCenum) param);
+ if (NULL == _res) return NULL;
+ return (*env)->NewDirectByteBuffer(env, _res, strlen_alc(_device_ptr, param, _res));
+}
+
diff --git a/test/src/com/jogamp/openal/ALTest.java b/src/test/com/jogamp/openal/test/junit/ALTest.java
index 9eb07a0..6a465f2 100644
--- a/test/src/com/jogamp/openal/ALTest.java
+++ b/src/test/com/jogamp/openal/test/junit/ALTest.java
@@ -4,13 +4,19 @@
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
-package com.jogamp.openal;
+package com.jogamp.openal.test.junit;
+import com.jogamp.openal.AL;
+import com.jogamp.openal.ALC;
+import com.jogamp.openal.ALCcontext;
+import com.jogamp.openal.ALCdevice;
+import com.jogamp.openal.ALFactory;
import java.io.IOException;
import java.io.InputStream;
import javax.sound.sampled.UnsupportedAudioFileException;
+import com.jogamp.openal.test.resources.ResourceLocation;
import com.jogamp.openal.util.*;
import java.io.FileNotFoundException;
import org.junit.AfterClass;
@@ -376,7 +382,7 @@ public class ALTest {
}
private WAVData loadTestWAV() throws IOException, UnsupportedAudioFileException {
- InputStream resource = getClass().getResourceAsStream(TEST_FILE);
+ InputStream resource = ResourceLocation.class.getResourceAsStream(TEST_FILE);
if(resource == null) {
throw new FileNotFoundException(TEST_FILE+" not found");
}
diff --git a/test/src/com/jogamp/openal/OpenALTest.java b/src/test/com/jogamp/openal/test/manual/OpenALTest.java
index 69ee204..98843c7 100644
--- a/test/src/com/jogamp/openal/OpenALTest.java
+++ b/src/test/com/jogamp/openal/test/manual/OpenALTest.java
@@ -1,4 +1,4 @@
-package com.jogamp.openal;
+package com.jogamp.openal.test.manual;
/**
* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
@@ -33,6 +33,11 @@ package com.jogamp.openal;
* design, construction, operation or maintenance of any nuclear facility.
*/
import com.jogamp.common.nio.Buffers;
+import com.jogamp.openal.AL;
+import com.jogamp.openal.ALC;
+import com.jogamp.openal.ALCcontext;
+import com.jogamp.openal.ALCdevice;
+import com.jogamp.openal.ALFactory;
import java.io.IOException;
import java.nio.*;
diff --git a/test/src/com/jogamp/openal/Sound3DTest.java b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java
index e451b9f..d91f0ec 100644
--- a/test/src/com/jogamp/openal/Sound3DTest.java
+++ b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java
@@ -35,6 +35,7 @@ package com.jogamp.openal;
import java.io.*;
import javax.sound.sampled.*;
import com.jogamp.openal.sound3d.*;
+import com.jogamp.openal.test.resources.ResourceLocation;
/**
* @author Athomas Goldberg
@@ -62,7 +63,7 @@ public class Sound3DTest {
listener.setPosition(0, 0, 0);
// load a source and play it
- Source source1 = AudioSystem3D.loadSource(Sound3DTest.class.getResourceAsStream("lewiscarroll.wav"));
+ Source source1 = AudioSystem3D.loadSource(ResourceLocation.class.getResourceAsStream("lewiscarroll.wav"));
source1.setPosition(0, 0, 0);
source1.setLooping(true);
source1.play();
diff --git a/src/test/com/jogamp/openal/test/resources/ResourceLocation.java b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java
new file mode 100644
index 0000000..74f1356
--- /dev/null
+++ b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java
@@ -0,0 +1,6 @@
+
+package com.jogamp.openal.test.resources;
+
+/** just a tag to locate the resources */
+public class ResourceLocation {
+}
diff --git a/test/src/com/jogamp/openal/lewiscarroll.wav b/src/test/com/jogamp/openal/test/resources/lewiscarroll.wav
index 2314d39..2314d39 100644
--- a/test/src/com/jogamp/openal/lewiscarroll.wav
+++ b/src/test/com/jogamp/openal/test/resources/lewiscarroll.wav
Binary files differ
diff --git a/test/.cvsignore b/test/.cvsignore
deleted file mode 100644
index 90b07e9..0000000
--- a/test/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-classes
diff --git a/test/build.xml b/test/build.xml
deleted file mode 100644
index 4d5f221..0000000
--- a/test/build.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
-* Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* -Redistribution of source code must retain the above copyright notice,
-* this list of conditions and the following disclaimer.
-*
-* -Redistribution in binary form must reproduce the above copyright notice,
-* this list of conditions and the following disclaimer in the documentation
-* and/or other materials provided with the distribution.
-*
-* Neither the name of Sun Microsystems, Inc. or the names of contributors may
-* be used to endorse or promote products derived from this software without
-* specific prior written permission.
-*
-* This software is provided "AS IS," without a warranty of any kind.
-* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
-* ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
-* NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
-* LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
-* RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
-* IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
-* OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
-* PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
-* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
-* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-*
-* You acknowledge that this software is not designed or intended for use in the
-* design, construction, operation or maintenance of any nuclear facility.
--->
-
-<project name="tests" basedir="." default="all">
-
- <property name="junit.path" value="${basedir}/${gluegen.root}/make/lib/junit.jar"/>
-
- <target name="init">
- <mkdir dir="classes"/>
- </target>
-
- <target name="compile" depends="init">
- <javac debug="true" srcdir="./src" destdir="classes" includeantruntime="false"
- classpath="${gluegen.root}/build/gluegen-rt.jar;../build/joal.jar;${junit.path}"/>
- <copy todir="classes">
- <fileset dir="src" includes="**/*.wav"/>
- </copy>
- </target>
-
- <target name="clean">
- <delete dir="classes"/>
- </target>
-
- <target name="test" depends="compile">
- <mkdir dir="${basedir}/results"/>
- <junit forkmode="once" showoutput="true" fork="true" includeAntRuntime="true">
- <jvmarg value="-Djava.library.path=${basedir}/${gluegen.root}/build/obj:${basedir}/../build/obj"/>
- <jvmarg value="-Djogamp.debug.NativeLibrary=true"/>
- <batchtest todir="${basedir}/results">
- <fileset dir="${basedir}/classes">
- <include name="com/jogamp/openal/**Test*"/>
- <!--TODO convert to junit -->
- <exclude name="com/jogamp/openal/OpenALTest*"/>
- <exclude name="com/jogamp/openal/Sound3DTest*"/>
- </fileset>
- <formatter usefile="false" type="plain"/>
- <formatter usefile="true" type="xml"/>
- </batchtest>
- <classpath>
- <path path="${gluegen.root}/build/gluegen-rt.jar:../build/joal.jar:${basedir}/classes:${junit.path}"/>
- </classpath>
- </junit>
-
- </target>
-
-</project>