diff options
author | kbr <[email protected]> | 2006-01-10 11:07:30 +0000 |
---|---|---|
committer | kbr <[email protected]> | 2006-01-10 11:07:30 +0000 |
commit | 1a0b7c61155813ac0bf3c6d58b4dac15f0225101 (patch) | |
tree | e3b573ca2193ae8a6aacd5bc5cb3060321308ba7 /make | |
parent | 0badf374064da5c608dcb06ef2d2e9966792ddc8 (diff) |
Merged gluegen-branch-1-0 on to the main JOAL trunk. JOAL is now built
using GlueGen and currently requires a built JOGL workspace as a
sibling workspace of the JOAL workspace.
git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@101 03bf7f67-59de-4072-a415-9a990d468a3f
Diffstat (limited to 'make')
-rwxr-xr-x | make/build.xml | 755 | ||||
-rwxr-xr-x | make/joal-CustomCCode.c | 40 | ||||
-rwxr-xr-x | make/joal-alc-constants.cfg | 8 | ||||
-rwxr-xr-x | make/joal-alc.cfg | 57 | ||||
-rwxr-xr-x | make/joal-common-CustomCCode.c | 9 | ||||
-rwxr-xr-x | make/joal-common.cfg | 9 | ||||
-rwxr-xr-x | make/joal-constants.cfg | 12 | ||||
-rwxr-xr-x | make/joal.cfg | 67 | ||||
-rwxr-xr-x | make/joal.properties | 69 | ||||
-rwxr-xr-x | make/readme.txt | 9 | ||||
-rwxr-xr-x | make/stub_includes/openal/al.h | 756 | ||||
-rwxr-xr-x | make/stub_includes/openal/alc.h | 277 | ||||
-rwxr-xr-x | make/stub_includes/openal/alut.h | 68 | ||||
-rw-r--r-- | make/stub_includes/openal/eax.h | 32 | ||||
-rwxr-xr-x | make/validate-properties.xml | 73 |
15 files changed, 2241 insertions, 0 deletions
diff --git a/make/build.xml b/make/build.xml new file mode 100755 index 0000000..e04f629 --- /dev/null +++ b/make/build.xml @@ -0,0 +1,755 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + - Ant build for JOAL. This build has been tested with ANT 1.6.2. The + - optional.jar that contains the optional ANT tasks must be in the ANT + - classpath (typically the ant/lib directory). + - + - A clean download of JOAL is required for this build. + - + - This build has no dependence on environment variables; the needed + - ones (e.g. java.home, ANT_HOME) are all set by the Ant wrapper shell + - script, by the virtual machine, or elsewhere. However, on all platforms, + - the C compiler and linker should be in the path. All other paths that + - need to be set are in host.properties. + - + - NOTE: because the GlueGen config files have their own relative paths + - which cannot be overridden by GlueGen, GlueGen MUST be run from + - the "make" directory. This also means that this build.xml MUST + - be run from the "make" directory. + - + - All targets do the following: + - Build the ancillary Ant tasks. + - Generate the Java and C files. + - Compile all sources. + - Create the joal.jar and platform library. + - Public targets: + - linux + - macosx + - solaris + - win32.vc6 + - win32.vc7 + - win32.mingw: build everything (jar, DSOs) for the current platform + - clean: clean all built + - javadoc: create the standard developer Javadoc + - + - Optional properties: + - -Djoal.cg=1 when combined with the build or javadoc targets will cause + - the experimental binding to NVidia's Cg language to be built. + - + - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the + - ANT build, including the GlueGen and StaticGLInfo tasks, the building of + - the Java generated sources, the first and second phase Java compiles, and + - the building of the jar file. + --> +<project name="JOAL" basedir="." default="all"> + + <!-- ================================================================== --> + <!-- + - Base initialization and detection of operating system. + --> + <target name="base.init"> + <!-- Set the project root directory to be up one directory. --> + <property name="project.root" value=".." /> + + <!-- Set the configuration and build files to this directory. --> + <property name="make" value="." /> + + <!-- Detection of operating system. --> + <condition property="isOSX"> + <and> + <os family="mac"/> + <os family="unix"/> + </and> + </condition> + <condition property="isUnix"> + <and> + <os family="unix" /> + <not> + <os family="mac" /> + </not> + </and> + </condition> + <condition property="isLinux"> + <os name="Linux" /> + </condition> + <condition property="isSolaris"> + <os name="SunOS" /> + </condition> + <condition property="isWindows"> + <os family="windows" /> + </condition> + <condition property="isFreeBSD"> + <os name="FreeBSD" /> + </condition> + <condition property="isLinuxAMD64"> + <and> + <istrue value="${isLinux}" /> + <os arch="AMD64" /> + </and> + </condition> + <condition property="isIA64"> + <os arch="IA64" /> + </condition> + <echo message="OS X=${isOSX}" /> + <echo message="Windows=${isWindows}" /> + <echo message="Unix=${isUnix}" /> + <echo message="Linux=${isLinux}" /> + <echo message="Solaris=${isSolaris}" /> + <echo message="FreeBSD=${isFreeBSD}" /> + <echo message="LinuxAMD64=${isLinuxAMD64}" /> + <echo message="IA64=${isIA64}" /> + </target> + + <!-- ================================================================== --> + <!-- + - Load user properties which override build defaults. + --> + <target name="load.user.properties" depends="base.init"> + <!-- Load the user specified properties file that defines various host + - specific paths. The user will be notified if this is does not + - exist. --> + <property name="user.properties.file" value="${user.home}/joal.properties" /> + <property file="${user.properties.file}" /> + <echo message="Loaded ${user.properties.file}." /> + <echo message="antlr.jar=${antlr.jar}" /> + <fail message="antlr.jar was not specified in joal.properties. Please see README.txt for instructions" unless="antlr.jar"/> + <fail message="joal.lib.dir was not specified in joal.properties. Please see README.txt for instructions" unless="joal.lib.dir"/> + <condition property="isVC6"> + <and> + <istrue value="${isWindows}" /> + <equals arg1="${win32.c.compiler}" arg2="vc6" /> + </and> + </condition> + <condition property="isVC7"> + <and> + <istrue value="${isWindows}" /> + <equals arg1="${win32.c.compiler}" arg2="vc7" /> + </and> + </condition> + <condition property="isMingw"> + <and> + <istrue value="${isWindows}" /> + <equals arg1="${win32.c.compiler}" arg2="mingw" /> + </and> + </condition> + <echo message="VC6=${isVC6}" /> + <echo message="VC7=${isVC7}" /> + <echo message="MingW=${isMingw}" /> + </target> + + <!-- ================================================================== --> + <!-- + - Set up java.home.dir appropriately on all platforms. + --> + <target name="setup.java.home.dir.nonmacosx" depends="load.user.properties" unless="isOSX"> + <!-- java home dir is up one directory as java.home points to '<java-install-dir>/jre' --> + <property name="java.home.dir" value="${java.home}/.." /> + </target> + <target name="setup.java.home.dir.macosx" depends="load.user.properties" if="isOSX"> + <property name="java.home.dir" value="/System/Library/Frameworks/JavaVM.framework/Home" /> + </target> + <target name="setup.java.home.dir" depends="setup.java.home.dir.nonmacosx,setup.java.home.dir.macosx"/> + + <!-- ================================================================== --> + <!-- + - Declare all paths and user defined variables. + --> + <target name="declare.common" description="Declare properties" depends="base.init"> + <!-- Shorthand for file.separator --> + <property name="sep" value="${file.separator}" /> + + <!-- The location and name of the configuration ANT file that will + - validate to ensure that all user-define variables are set. --> + <property name="validate.user.properties" value="${make}/validate-properties.xml" /> + + <!-- Properties pointing to root of the workspace containing GlueGen. + This build.xml expects that GlueGen has already been built and that its + classes are in the build/classes subdirectory of this other workspace. + Currently we expect that it is contained in the JOGL project. --> + <property name="jogl.root" value="../../jogl" /> + <property name="gluegen.classes" value="${jogl.root}/build/classes" /> + + <!-- Names of directories relative to the project root. + Some of these are used in FileMappers later for dependence information + and need exact string matching, which is why they use file.separator + instead of "/". --> + <property name="rootrel.src" value="src" /> + <property name="rootrel.src.java" value="${rootrel.src}${sep}java" /> + <property name="rootrel.src.c" value="${rootrel.src}${sep}native" /> + <property name="rootrel.build" value="build" /> + <property name="rootrel.src.generated" value="${rootrel.build}${sep}gensrc" /> + <property name="rootrel.generated.java" value="${rootrel.src.generated}${sep}classes" /> + <property name="rootrel.generated.c.joal" value="${rootrel.src.generated}${sep}native${sep}joal" /> + <property name="rootrel.obj" value="${rootrel.build}${sep}obj" /> + <property name="rootrel.obj.joal" value="${rootrel.obj}${sep}joal" /> + + <!-- The source directories. --> + <property name="src" value="${project.root}/${rootrel.src}" /> + <property name="src.c" value="${project.root}/${rootrel.src.c}" /> + <property name="src.java" value="${project.root}/${rootrel.src.java}" /> + <property name="build" value="${project.root}/${rootrel.build}" /> + + <!-- The generated source directories. --> + <property name="src.generated" value="${build}/gensrc" /> + <property name="src.generated.java" value="${src.generated}/classes" /> + <property name="src.generated.c" value="${src.generated}/native/joal" /> + + <!-- The compiler output directories. --> + <property name="classes" value="${build}/classes" /> + <property name="obj" value="${project.root}/${rootrel.obj}" /> + <property name="obj.joal" value="${project.root}/${rootrel.obj.joal}" /> + + <!-- The headers from which Java files are generated --> + <property name="config" value="${project.root}/make" /> + <property name="stub.includes" value="${config}/stub_includes" /> + <property name="stub.includes.dir" value="stub_includes" /> <!-- NOTE: this MUST be relative for FileSet --> + <property name="stub.includes.openal" value="${stub.includes}/openal" /> + <dirset id="stub.includes.fileset.all" dir="."> + <include name="${stub.includes.dir}/openal/**" /> + </dirset> + <fileset id="stub.includes.dependencies.fileset" dir="."> + <include name="${stub.includes.dir}/openal/**" /> + <include name="*.cfg" /> + <include name="*.java" /> + <include name="*.c" /> + </fileset> + + <property name="java.includes.dir" value="${java.home.dir}/include" /> <!-- NOTE: this MUST be relative for FileSet --> + <property name="java.includes.dir.win32" value="${java.includes.dir}/win32" /> + <property name="java.includes.dir.linux" value="${java.includes.dir}/linux" /> + <property name="java.includes.dir.solaris" value="${java.includes.dir}/solaris" /> + <property name="java.includes.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" /> + + <!-- Create the classpath that includes ANTLR and any already + - compiled classes. This requires the user-defined "antlr.jar" + - property. --> + <path id="antlr.classpath"> + <pathelement path="${classpath}" /> + <pathelement location="${gluegen.classes}" /> + <pathelement location="${classes}" /> + <pathelement location="${antlr.jar}" /> + </path> + + <!-- The resulting joal.jar. --> + <property name="joal.jar" value="${build}/joal.jar" /> + + <!-- The javadoc dirs. --> + <property name="javadoc" value="${project.root}/javadoc_public" /> + <property name="javadoc.dev" value="${project.root}/javadoc_joal_dev" /> + <property name="javadoc.link" value="http://java.sun.com/j2se/1.4.2/docs/api/" /> + <property name="javadoc.packagenames" value="net.java.games.joal,net.java.games.joal.util" /> + <property name="javadoc.dev.packagenames" value="${javadoc.packagenames},net.java.games.joal.impl" /> + + <!-- Names of configuration files used during glue code generation. --> + <property name="joal.cfg" value="${config}/joal.cfg" /> + <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" /> + </target> + + <!-- ================================================================== --> + <!-- + - Platform specific declares. + --> + <target name="declare.win32.vc6" if="isVC6"> + <echo message="Win32.VC6" /> + <property name="c.compiler.include.root" value="${vc6.root}" /> + <property name="c.linker.lib.root" value="${vc6.root}" /> + + <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" /> + <property name="linker.cfg.id" value="linker.cfg.win32.msvc" /> + </target> + + <target name="declare.win32.vc7" if="isVC7"> + <echo message="Win32.VC7" /> + <property name="c.compiler.include.root" value="${vc7.root}" /> + <property name="c.linker.lib.root" value="${vc7.root}" /> + + <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" /> + <property name="linker.cfg.id" value="linker.cfg.win32.msvc" /> + </target> + + <target name="declare.win32.mingw" if="isMingw"> + <echo message="Win32.MingW" /> + <property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" /> + <property name="linker.cfg.id" value="linker.cfg.win32.mingw" /> + </target> + + <target name="declare.win32" depends="declare.win32.vc6,declare.win32.vc7,declare.win32.mingw" if="isWindows"> + <property name="java.includes.dir.platform" value="${java.includes.dir.win32}" /> + <property name="java.lib.dir.platform" value="${java.lib.dir.win32}" /> + </target> + + <target name="declare.linux.x86" if="isLinux" unless="isLinuxAMD64"> + <echo message="Linux.x86" /> + <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" /> + <property name="java.lib.dir.platform" value="${java.lib.dir.linux}" /> + + <property name="compiler.cfg.id" value="compiler.cfg.linux" /> + <property name="linker.cfg.id" value="linker.cfg.linux" /> + </target> + + <target name="declare.linux.amd64" if="isLinuxAMD64"> + <echo message="Linux.AMD64" /> + <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" /> + <property name="java.lib.dir.platform" value="${java.lib.dir.linux.amd64}" /> + + <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" /> + <property name="linker.cfg.id" value="linker.cfg.linux.amd64" /> + </target> + + <target name="declare.linux" depends="declare.linux.x86,declare.linux.amd64" if="isLinux" /> + + <target name="declare.solaris" if="isSolaris"> + <echo message="Solaris" /> + <property name="java.includes.dir.platform" value="${java.includes.dir.solaris}" /> + <property name="java.lib.dir.platform" value="${java.lib.dir.solaris}" /> + + <property name="compiler.cfg.id" value="compiler.cfg.solaris" /> + <property name="linker.cfg.id" value="linker.cfg.solaris" /> + </target> + + <target name="declare.macosx" if="isOSX"> + <echo message="MacOSX" /> + <property name="java.includes.dir.platform" value="${java.includes.dir.macosx}" /> + <property name="java.lib.dir.platform" value="${java.lib.dir.macosx}" /> + + <property name="compiler.cfg.id" value="compiler.cfg.macosx" /> + <property name="linker.cfg.id" value="linker.cfg.macosx" /> + </target> + + <target name="declare.freebsd" if="isFreeBSD"> + <echo message="FreeBSD" /> + <property name="java.includes.dir.platform" value="${java.includes.dir.freebsd}" /> + <property name="java.lib.dir.platform" value="${java.lib.dir.linux}" /> + + <property name="compiler.cfg.id" value="compiler.cfg.freebsd" /> + <property name="linker.cfg.id" value="linker.cfg.linux" /> + </target> + + <!-- ================================================================== --> + <!-- + - Initialize all parameters required for the build and create any + - required directories. + --> + <target name="init" depends="declare.common"> + <!-- Call the external config validator script to make sure the config is ok and consistent --> + <ant antfile="${validate.user.properties}" inheritall="true"/> + + <!-- Create the required output directories. --> + <mkdir dir="${src.generated.java}" /> + <mkdir dir="${src.generated.c}" /> + <mkdir dir="${classes}" /> + <mkdir dir="${obj}" /> + <mkdir dir="${obj.joal}" /> + </target> + + <target name="declare" depends="init,declare.win32,declare.linux,declare.solaris,declare.macosx,declare.freebsd" /> + + <!-- ================================================================== --> + <!-- Java file generation --> + <!-- + - Check to see whether we need to rebuild the generated sources. + --> + + <target name="java.generate.check"> + <!-- Blow away all target files if any dependencies are violated + (the uptodate task doesn't allow arbitrary source and target filesets but should) --> + <dependset> + <srcfileset refid="stub.includes.dependencies.fileset" /> + <srcfileset dir="."> + <include name="${classes}/net/java/games/gluegen/**/*.class" /> + </srcfileset> + <targetfileset dir="."> + <include name="${src.generated.java}/**/*.java" /> + <include name="${src.generated.c}/**/*.c" /> + </targetfileset> + </dependset> + + <!-- Now check for the presence of one well-known file --> + <uptodate property="java.generate.skip"> + <srcfiles refid="stub.includes.dependencies.fileset" /> + <mapper type="merge" to="${src.generated.java}/net/java/games/joal/AL.java" /> + </uptodate> + </target> + + <!-- + - Setup the generating ANT tasks and use it to generate the Java files + - from the C GL headers. This involves setting the taskdef and creating + - the classpath reference id then running the task on each header. + --> + <target name="java.generate" depends="java.generate.check" unless="java.generate.skip"> + <!-- Add the GlueGen task to ANT --> + <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask" + classpathref="antlr.classpath" /> + + <!-- Use the GlueGen task to generate the Java files --> + + <!-- Generate the AL interface class and implementation --> + <gluegen src="${stub.includes.openal}/al.h" + config="${joal.cfg}" + includeRefid="stub.includes.fileset.all" + emitter="com.sun.gluegen.procaddress.ProcAddressEmitter"> + <classpath refid="antlr.classpath" /> + </gluegen> + + <!-- Generate the ALConstants interface class --> + <gluegen src="${stub.includes.openal}/al.h" + config="${joal.constants.cfg}" + includeRefid="stub.includes.fileset.all" + emitter="com.sun.gluegen.JavaEmitter"> + <classpath refid="antlr.classpath" /> + </gluegen> + + <!-- Generate the ALC interface class and implementation --> + <gluegen src="${stub.includes.openal}/alc.h" + config="${joal.alc.cfg}" + includeRefid="stub.includes.fileset.all" + emitter="com.sun.gluegen.procaddress.ProcAddressEmitter"> + <classpath refid="antlr.classpath" /> + </gluegen> + + <!-- Generate the ALCConstants interface class --> + <gluegen src="${stub.includes.openal}/alc.h" + config="${joal.alc.constants.cfg}" + includeRefid="stub.includes.fileset.all" + emitter="com.sun.gluegen.JavaEmitter"> + <classpath refid="antlr.classpath" /> + </gluegen> + + <!-- Inform the user that the generators have successfully created + - the necessary Java files --> + <echo message="" /> + <echo message="GlueGen has successfully generated files." /> + + </target> + + <!-- ================================================================== --> + <!-- + - Compile the original and generated source. + --> + <target name="java.compile" depends="java.generate"> + <javac destdir="${classes}" source="1.4" debug="true" debuglevel="source,lines"> + <src path="${src.java}" /> + <src path="${src.generated.java}" /> + <classpath refid="antlr.classpath" /> + </javac> + </target> + + <!-- ================================================================== --> + <!-- + - Compile the native C code for JOAL. + --> + + <target name="c.configure"> + + <!-- import cpptasks --> + <typedef resource="net/sf/antcontrib/cpptasks/antlib.xml" classpath="${jogl.root}/make/lib/cpptasks.jar"/> + <!--typedef resource="net/sf/antcontrib/cpptasks/antlib.xml"/--> + + <!-- compiler configuration --> + <compiler id="compiler.cfg.linux" name="gcc" /> + + <compiler id="compiler.cfg.linux.amd64" name="gcc"> + <compilerarg value="-fPIC"/> + </compiler> + + <compiler id="compiler.cfg.solaris" name="suncc"> + </compiler> + + <compiler id="compiler.cfg.win32.mingw" name="gcc"> + <defineset> + <define name="_DEBUG" if="c.compiler.use-debug"/> + <define name="DEBUG" if="c.compiler.use-debug"/> + <define name="NDEBUG" unless="c.compiler.use-debug"/> + + <define name="DBUILD_DLL" /> + <define name="_WINGDI_" /> + <define name="_STRICT_ANSI" /> + <define name="_JNI_IMPLEMENTATION_" /> + </defineset> + </compiler> + + <compiler id="compiler.cfg.win32.msvc" name="msvc"> + <compilerarg value="/W3"/> <!-- set warning level --> + <compilerarg value="/Ob1"/> <!-- inline only functions marked inline --> + <compilerarg value="/GF"/> <!-- enable string pooling --> + <compilerarg value="/Gy"/> <!-- enable function level linking --> + <compilerarg value="/GS" if="isVC7"/> <!-- buffer security checks --> + <compilerarg value="/Wp64" if="isVC7"/> <!-- detect 64-bit port problems --> + <compilerarg value="/RTCcsu" if="isVC7"/> <!-- various runtime checks --> + <!-- Note: previous compiler options for VC7 were: + Debug: /MDd /Yd /GS /RTCs /RTCu /RTCc /W3 /Od /GF /EHsc /Zi /GS /Gy /Wp64 /Zi /D "_DEBUG" + Optimized: /MD /W3 /O2 /Ob1 /GF /EHsc /GS /Gy /Wp64 /D "NDEBUG" --> + + <sysincludepath path="${c.compiler.include.root}/PlatformSDK/Include"/> + <sysincludepath path="${c.compiler.include.root}/include"/> + + <defineset> + <define name="_DEBUG" if="c.compiler.use-debug"/> + <define name="DEBUG" if="c.compiler.use-debug"/> + <define name="NDEBUG" unless="c.compiler.use-debug"/> + </defineset> + </compiler> + + <compiler id="compiler.cfg.macosx" name="gcc"> + <compilerarg value="-arch" if="macosxfat"/> + <compilerarg value="ppc" if="macosxfat"/> + <compilerarg value="-arch" if="macosxfat"/> + <compilerarg value="i386" if="macosxfat"/> + <compilerarg value="-Wmost" /> + <compilerarg value="-ObjC" /> + <defineset> + <define name="macosx" /> + </defineset> + </compiler> + + <compiler id="compiler.cfg.freebsd" name="gcc"> + <includepath path="/usr/X11R6/include" /> + </compiler> + + <!-- linker configuration --> + + <linker id="linker.cfg.linux" name="gcc"> + <syslibset dir="${joal.lib.dir}" libs="openal"/> + </linker> + + <linker id="linker.cfg.linux.amd64" name="gcc"> + <syslibset dir="${joal.lib.dir}" libs="openal"/> + </linker> + + <linker id="linker.cfg.solaris" name="suncc"> + <syslibset dir="${joal.lib.dir}" libs="openal"/> + </linker> + + <linker id="linker.cfg.win32.mingw" name="gcc" incremental="false"> + <linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names --> + <syslibset dir="${joal.lib.dir}" libs="openal32, kernel32"/> + </linker> + + <linker id="linker.cfg.win32.msvc" name="msvc" incremental="false"> + <linkerarg value="/OPT:REF,ICF" /> <!-- enable link-time optimisations --> + <linkerarg value="/SUBSYSTEM:WINDOWS" /> <!-- output is not a console app as uses WinMain entry point --> + <linkerarg value="/MACHINE:IX86" /> <!-- explicity set target platform --> + + <syslibset dir="${joal.lib.dir}" libs="openal32" /> + <syslibset dir="${c.linker.lib.root}/lib" libs="kernel32" unless="isVC7"/> + <syslibset dir="${c.linker.lib.root}/PlatformSDK/lib" libs="kernel32" if="isVC7"/> + </linker> + + <linker id="linker.cfg.macosx" name="gcc"> + <linkerarg value="-arch" if="macosxfat"/> + <linkerarg value="ppc" if="macosxfat"/> + <linkerarg value="-arch" if="macosxfat"/> + <linkerarg value="i386" if="macosxfat"/> + <linkerarg value="-framework" /> + <linkerarg value="Cocoa" /> + <linkerarg value="-framework" /> + <linkerarg value="OpenGL" /> + <linkerarg value="-framework" if="c.compiler.use-cglib" /> + <linkerarg value="Cg" if="c.compiler.use-cglib" /> + </linker> + + <patternset id="c.src.files.joal"> + <include name="${rootrel.src.c}/*.c"/> + <include name="${rootrel.generated.c.joal}/*.c"/> + </patternset> + + </target> + + <target name="c.build" depends="c.configure"> + <fail message="Requires '${c.compiler.src.files}'" unless="c.compiler.src.files"/> + <fail message="Requires '${compiler.cfg.id}'" unless="compiler.cfg.id"/> + <fail message="Requires '${linker.cfg.id}'" unless="linker.cfg.id"/> + <fail message="Requires '${output.lib.name}'" unless="output.lib.name"/> + + <echo message="Output lib name = ${output.lib.name}" /> + + <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally --> + <property name="c.compiler.debug" value="false" /> + <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } --> + <property name="c.compiler.optimise" value="none" /> + + <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition> + + <cc outtype="shared" + objdir="${obj.joal}" + outfile="${obj}/${output.lib.name}" + optimize="${c.compiler.optimise}" + debug="${c.compiler.debug}" + multithreaded="true" + exceptions="false" + rtti="false"> + + <!-- TODO: versioninfo companyname="java.net" + legalcopyright="Copyright" + productname="JOAL" + productversion="x.y.z" + description="Description" + fileversion="x.y.z" + filecomments="File Comment" /--> + + <fileset dir="${project.root}"><patternset refid="${c.compiler.src.files}"/></fileset> + + <compiler extends="${compiler.cfg.id}" > + <sysincludepath path="${java.includes.dir}"/> + <sysincludepath path="${java.includes.dir.platform}"/> + <includepath path="stub_includes/openal"/> + </compiler> + + <linker extends="${linker.cfg.id}" /> + </cc> + </target> + + <target name="c.rename.joal.lib.mingw" if="isMingw"> + <!-- FIXME: this is a hack; the cpptask should have an option to change the + suffix or at least understand the override from .so to .dll --> + <move file="${obj}/libjoal.so" tofile="${obj}/joal.dll" failonerror="false" /> + </target> + + <target name="c.rename.joal.lib.macosx" if="isOSX"> + <!-- FIXME: this is a hack; the cpptask should have an option to change the + suffix or at least understand the override from dylib to jnilib --> + <move file="${obj}/libjoal.dylib" tofile="${obj}/libjoal.jnilib" /> + </target> + + <target name="c.build.joal"> + <antcall target="c.build" inheritRefs="true"> + <param name="c.compiler.src.files" value="c.src.files.joal"/> + <param name="output.lib.name" value="joal_native"/> + </antcall> + <antcall target="c.rename.joal.lib.mingw" inheritRefs="true" /> + <antcall target="c.rename.joal.lib.macosx" inheritRefs="true" /> + </target> + + <!-- ================================================================== --> + <!-- + - Build the joal.jar file. + --> + <target name="jar" depends="java.compile"> + <!-- Build the jar excluding any build specific classes. --> + <jar destfile="${joal.jar}"> + <fileset dir="${classes}"> + <include name="net/java/games/**" /> + </fileset> + <fileset dir="${gluegen.classes}"> + <include name="com/sun/gluegen/runtime/**" /> + </fileset> + </jar> + + </target> + + <!-- ================================================================== --> + <!-- + - Build the Javadocs for the sources. + - NOTE: these are not entirely correct as the javadocs targets depend + - on the platform specific build targets. To circumvent any + - errors, ensure that the source is built first. + --> + <target name="javadoc" depends="setup.java.home.dir,init"> + <javadoc packagenames="${javadoc.packagenames}" + sourcepath="${src.java};${src.generated.java}" + classpath="${gluegen.classes}" + destdir="${javadoc}" windowtitle="JOAL API" + source="1.4" + link="${javadoc.link}" /> + </target> + + <target name="javadoc.dev" depends="init"> + <!-- Build the internal developer Javadoc --> + <javadoc packagenames="${javadoc.dev.packagenames},${javadoc.dev.packagenames.platform}" + sourcepath="${src.java};${src.generated.java}" + destdir="${javadoc.dev}" windowtitle="JOAL API" + source="1.4" + link="${javadoc.link}" /> + </target> + + <!-- ================================================================== --> + <!-- + - Build the platform-independent distribution out of jars built for + - Windows, Linux and Mac OS X; the Java sources for Joal can't be + - fully cross-compiled at this time. 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 both the joal.jar for that + - platform as well as the native code (libjoal.so, joal.dll, or + - libjoal.jnilib). Also builds jars containing the native code for + - Windows, Linux, Mac OS X, Solaris/SPARC and Solaris/x86. + --> + <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"> + <delete file="${joal.dist.dir}/joal.jar" /> + <delete> + <fileset dir="${joal.dist.dir}" includes="joal-natives-*.jar" /> + </delete> + <jar destfile="${joal.dist.dir}/joal.jar" duplicate="preserve"> + <zipgroupfileset dir="${joal.dist.dir}" + includes="joal-win32/*.jar, joal-linux/*.jar, joal-macosx/*.jar" /> + </jar> + <jar destfile="${joal.dist.dir}/joal-natives-win32.jar" + basedir="${joal.dist.dir}/joal-win32" + includes="joal.dll" /> + <jar destfile="${joal.dist.dir}/joal-natives-linux.jar" + basedir="${joal.dist.dir}/joal-linux" + includes="libjoal.so" /> + <jar destfile="${joal.dist.dir}/joal-natives-macosx.jar" + basedir="${joal.dist.dir}/joal-macosx" + includes="libjoal.jnilib" /> + <jar destfile="${joal.dist.dir}/joal-natives-solsparc.jar" + basedir="${joal.dist.dir}/joal-solsparc" + includes="libjoal.so" /> + <!-- Note: Solaris/x86 elided for now as it requires Mesa to + be installed --> + <!-- jar destfile="${joal.dist.dir}/joal-natives-solx86.jar" + basedir="${joal.dist.dir}/joal-solx86" + includes="libjoal.so" --> + </target> + + <!-- ================================================================== --> + <!-- + - Clean up all that is built. + --> + <target name="clean" depends="declare.common"> + <delete includeEmptyDirs="true" quiet="true"> + <fileset dir="${build}" /> + <fileset dir="${javadoc}" /> + <fileset dir="${javadoc.dev}" /> + </delete> + <ant dir="../unit_tests" target="clean"/> + </target> + + <!-- ================================================================== --> + <!-- + - Build everything. + --> + <target name="all" depends="setup.java.home.dir,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 and run tests. + --> + + <target name="runtests" depends="all"> + <ant dir="../unit_tests" target="compile"/> + <ant dir="../unit_tests" target="runOpenALTest"/> + <ant dir="../unit_tests" target="runSound3DTest"/> + </target> +</project> diff --git a/make/joal-CustomCCode.c b/make/joal-CustomCCode.c new file mode 100755 index 0000000..a6d0bb6 --- /dev/null +++ b/make/joal-CustomCCode.c @@ -0,0 +1,40 @@ +#if defined(_MSC_VER) /* Windows */ +#include <windows.h> +static HMODULE oalModule = NULL; +#endif + +/* Java->C glue code: + * Java package: net.java.games.joal.impl.ALImpl + * Java method: long dynamicLookupFunction0(java.lang.String fname) + * C function: ALproc alGetProcAddress(const ALchar * fname); + */ +JNIEXPORT jlong JNICALL +Java_net_java_games_joal_impl_ALImpl_dynamicLookupFunction0__Ljava_lang_String_2(JNIEnv *env, jobject _unused, jstring fname) { + const char* _UTF8fname = NULL; + ALproc _res; + if (fname != NULL) { + if (fname != NULL) { + _UTF8fname = (*env)->GetStringUTFChars(env, fname, (jboolean*)NULL); + if (_UTF8fname == NULL) { + (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"), + "Failed to get UTF-8 chars for argument \"fname\" in native dispatcher for \"alGetProcAddress\""); + return 0; + } + } + } +#if defined(_MSC_VER) /* Windows */ + if (oalModule == NULL) { + oalModule = GetModuleHandle("OpenAL32"); + } + _res = (ALproc) GetProcAddress(oalModule, _UTF8fname); +/* Looks like we can use dlsym on OS X as well as other Unix flavors */ +/* #elif defined(__APPLE__) && defined(__MACH__) */ /* OS X */ +#else /* Assume vanilla Unix */ + _res = (ALproc) dlsym(RTLD_DEFAULT, _UTF8fname); +#endif + + if (fname != NULL) { + (*env)->ReleaseStringUTFChars(env, fname, _UTF8fname); + } + return (jlong) (intptr_t) _res; +} diff --git a/make/joal-alc-constants.cfg b/make/joal-alc-constants.cfg new file mode 100755 index 0000000..83ea061 --- /dev/null +++ b/make/joal-alc-constants.cfg @@ -0,0 +1,8 @@ +# This .cfg file is used to generate the ALCConstants interface. +Include joal-common.cfg + +Style InterfaceOnly +JavaClass ALCConstants + +# Factor out the OpenAL constants into their own interface +IgnoreNot ^ALC_.+ diff --git a/make/joal-alc.cfg b/make/joal-alc.cfg new file mode 100755 index 0000000..cdc24bb --- /dev/null +++ b/make/joal-alc.cfg @@ -0,0 +1,57 @@ +# This .cfg file is used to generate the JOAL interface. +Include joal-common.cfg + +Style InterfaceAndImpl +JavaClass ALC +ImplPackage net.java.games.joal.impl +ImplJavaClass ALCImpl +Extends ALC ALCConstants + +EmitProcAddressTable true +ProcAddressTableClassName ALCProcAddressTable +GetProcAddressTableExpr ALProcAddressLookup.getALCProcAddressTable() +ProcAddressNameExpr LP $UPPERCASE({0}) + +Import java.nio.* +Import net.java.games.joal.* +Import net.java.games.joal.impl.* + +# Factor out the OpenAL constants into their own interface +Ignore ^AL_.+ +Ignore ^ALC_.+ + +# This routine is ignored. The analogous routine alGetProcAddress is +# broken at least up through OpenAL 1.1 so there is no point in trying +# to use this routine to look up the ALC function pointers. +Ignore alcGetProcAddress + +# These routines use or return strings +ReturnsString alcGetString +ArgumentIsString alcIsExtensionPresent 1 +ArgumentIsString alcOpenDevice 0 + +# Mappings for data types +Opaque boolean ALCboolean + +# Provide #includes to native code +CustomCCode #include "alc.h" + +# Indicate that the direct buffers for ALCcontext, etc. are "opaque", +# i.e., the user shouldn't be poking around in them +ReturnValueCapacity alcCreateContext 0 +ReturnValueCapacity alcGetContextsDevice 0 +ReturnValueCapacity alcGetCurrentContext 0 +ReturnValueCapacity alcGetCurrentDevice 0 +ReturnValueCapacity alcOpenDevice 0 + +# These routines need to be statically linked for bootstrapping +SkipProcAddressGen alcOpenDevice +SkipProcAddressGen alcCreateContext +SkipProcAddressGen alcMakeContextCurrent + +# Need an epilogue on alcOpenDevice and alcMakeContextCurrent to set +# up the proc address tables the first time +JavaEpilogue alcOpenDevice ALProcAddressLookup.resetALCProcAddressTable(); +JavaEpilogue alcMakeContextCurrent ALProcAddressLookup.resetALProcAddressTable(); + +IncludeAs CustomCCode joal-common-CustomCCode.c diff --git a/make/joal-common-CustomCCode.c b/make/joal-common-CustomCCode.c new file mode 100755 index 0000000..f749723 --- /dev/null +++ b/make/joal-common-CustomCCode.c @@ -0,0 +1,9 @@ +#ifdef _MSC_VER /* Windows, Microsoft compilers */ +/* This typedef is only needed for VC6 */ +#if _MSC_VER <= 1200 +typedef int intptr_t; +#endif +#else +/* This header seems to be available on all other platforms */ +#include <inttypes.h> +#endif diff --git a/make/joal-common.cfg b/make/joal-common.cfg new file mode 100755 index 0000000..85dba07 --- /dev/null +++ b/make/joal-common.cfg @@ -0,0 +1,9 @@ +Package net.java.games.joal + +# Specify output directories +HierarchicalNativeOutput false +JavaOutputDir ../build/gensrc/classes +NativeOutputDir ../build/gensrc/native/joal + +# Raise ALException instead of RuntimeException in glue code +RuntimeExceptionType ALException diff --git a/make/joal-constants.cfg b/make/joal-constants.cfg new file mode 100755 index 0000000..9abd941 --- /dev/null +++ b/make/joal-constants.cfg @@ -0,0 +1,12 @@ +# This .cfg file is used to generate the ALConstants interface. +Include joal-common.cfg + +Style InterfaceOnly +JavaClass ALConstants + +# Factor out the OpenAL constants into their own interface +IgnoreNot ^AL_.+ + +# Add back in the constants the PCPP can't currently parse +# (FIXME: once it does, these lines will have to be removed) +CustomJavaCode ALConstants public static final int AL_INVALID = -1; diff --git a/make/joal.cfg b/make/joal.cfg new file mode 100755 index 0000000..c6894d9 --- /dev/null +++ b/make/joal.cfg @@ -0,0 +1,67 @@ +# This .cfg file is used to generate the JOAL interface. +Include joal-common.cfg + +Style InterfaceAndImpl +JavaClass AL +ImplPackage net.java.games.joal.impl +ImplJavaClass ALImpl +Extends AL ALConstants + +Implements ALImpl DynamicLookupHelper + +EmitProcAddressTable true +ProcAddressTableClassName ALProcAddressTable +GetProcAddressTableExpr ALProcAddressLookup.getALProcAddressTable() +ProcAddressNameExpr LP $UPPERCASE({0}) + +Import net.java.games.joal.* +Import net.java.games.joal.impl.* +Import com.sun.gluegen.runtime.* + +# Factor out the OpenAL constants into their own interface +Ignore ^AL_.+ + +# alGetProcAddress is broken for core OpenAL routines at least up +# through OpenAL 1.1, so we have to implement our own dlsym() +# operation in order to populate the ALProcAddressTable and +# ALCProcAddressTable. If / when it is fixed and we don't need +# compatibility with preexisting OpenAL 1.0 and 1.1 installations we +# can enable the code below and delete the custom C code for +# dynamicLookupFunction0. +Ignore alGetProcAddress + +# This routine is not exposed in the public API +# AccessControl alGetProcAddress PACKAGE_PRIVATE +# And it's also statically linked for bootstrapping +# (could also consider looking it up via dlsym to more fully allow +# unloading of OpenAL, but that doesn't seem necessary and requires +# more native code to load/unload libraries) +# SkipProcAddressGen alGetProcAddress +# We also have to hack its return type for now because we can't make +# just that void* opaque +# Opaque long ALproc + +# This routine doesn't seem to exist +Ignore alHint + +# Mappings for data types +Opaque boolean ALboolean + +# These routines use or return strings +ReturnsString alGetString +ArgumentIsString alIsExtensionPresent 0 +ArgumentIsString alGetEnumValue 0 +ArgumentIsString alGetProcAddress 0 + +# Provide #includes to native code +CustomCCode #include "al.h" + +CustomJavaCode ALImpl /** Provides dlsym() capabilities because alGetProcAddress is +CustomJavaCode ALImpl broken for core OpenAL routines at least up through OpenAL 1.1. */ +CustomJavaCode ALImpl public long dynamicLookupFunction(String functionName) { +CustomJavaCode ALImpl return dynamicLookupFunction0(functionName); +CustomJavaCode ALImpl } +CustomJavaCode ALImpl private native long dynamicLookupFunction0(String functionName); + +IncludeAs CustomCCode joal-common-CustomCCode.c +IncludeAs CustomCCode joal-CustomCCode.c diff --git a/make/joal.properties b/make/joal.properties new file mode 100755 index 0000000..436dc9f --- /dev/null +++ b/make/joal.properties @@ -0,0 +1,69 @@ +############################################################################### +# The host specific properties. The build will inform you of required +# properties. This file must be copied into your home directory (pointed +# to by the Java system property user.home) and the copy modified appropriately. +############################################################################### +# +# java.home.dir is usually inferred from the java.home variable. +# If it appears the build is failing because of an inability to +# find e.g. JAWT or JNI headers, override this to point to the +# root directory of your JDK. +# +# java.home.dir=C:/jdk1.4.2 + +# +# The required antlr.jar property that is the full path to the antlr.jar +# including the name of the jar +# +# Windows +antlr.jar=C:/Users/kbr/ANTLR/antlr-2.7.2/antlr.jar +# Linux +# antlr.jar=/home/kbr/antlr-2.7.2/antlr.jar +# Mac OS X +# antlr.jar=/Users/kbr/antlr-2.7.2/antlr.jar +# Solaris +# antlr.jar=/export/kbr/ANTLR/antlr-2.7.2/antlr.jar + +# +# The required joal.lib.dir points to the directory containing the +# OpenAL library against which JOAL is linked. On Windows, this is the +# directory containing OpenAL32.lib (the import library); on other +# platforms, it's the directory containing libopenal.so. +# Windows +# OpenAL 1.0 +# joal.lib.dir=C:/Program Files/OpenAL 1.0 Software Development Kit/libs +# OpenAL 1.1 (can link against either version; binding supports OpenAL +# 1.1 if available at run time) +# joal.lib.dir=C:/Program Files/OpenAL 1.1 SDK/libs/Win32 +# Linux +# joal.lib.dir=/usr/lib +# Mac OS X +# joal.lib.dir=/Library/Frameworks/OpenAL.framework +# Solaris (not yet supported) +# joal.lib.dir=/usr/lib + +# If you are building on Windows and have the Microsoft Visual C++ +# compilers installed, you can choose an alternate compiler with which +# to build the JOAL native code. Valid strings here are "vc6", "vc7", +# and "mingw". +win32.c.compiler=mingw + +# +# If you are building on Windows with Visual C++ 6.0 and have installed +# the compiler in somewhere other than the default location, modify this +# to point to the absolute path of the VC98 directory +# +vc6.root=C:/Program Files/Microsoft Visual Studio/VC98 + +# +# If you are building on Windows with Visual C++ 7.0 and have installed +# the compiler in somewhere other than the default location, modify this +# to point to the absolute path of the VC98 directory +# +vc7.root=C:/Program Files/Microsoft Visual Studio .NET/Vc7 + +# +# If you are building on a Mac OS X system supporting +# cross-compilation and want to generate fat (PPC and x86) binaries, +# uncomment the property below +# macosxfat=true diff --git a/make/readme.txt b/make/readme.txt new file mode 100755 index 0000000..f435b83 --- /dev/null +++ b/make/readme.txt @@ -0,0 +1,9 @@ +We needed to modify the OpenAL headers from creative.com (the ones +from the Windows installer) in the following ways: + + - In the untaken arms of the #ifdef _WIN32 clauses at the top of al.h + and alc.h, change the #define ALAPIENTRY and #define ALCAPIENTRY to + define those to the empty token rather than to __cdecl. + + - Hoist the typedefs of ALCdevice and ALCcontext in alc.h out of the + #ifdef _WIN32 clause. diff --git a/make/stub_includes/openal/al.h b/make/stub_includes/openal/al.h new file mode 100755 index 0000000..d73a1c0 --- /dev/null +++ b/make/stub_includes/openal/al.h @@ -0,0 +1,756 @@ +#ifndef AL_AL_H +#define AL_AL_H + +/** + * OpenAL cross platform audio library + * Copyright (C) 1999-2000 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(_WIN32) && !defined(_XBOX) + /* _OPENAL32LIB is deprecated */ + #if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB) + #define AL_API __declspec(dllexport) + #else + #define AL_API __declspec(dllimport) + #endif +#else + #define AL_API extern +#endif + +#if defined(_WIN32) + #define AL_APIENTRY __cdecl +#else + #define AL_APIENTRY +#endif + +#if TARGET_OS_MAC + #pragma export on +#endif + +/* The OPENAL, ALAPI, and ALAPIENTRY macros are deprecated, but are included for applications porting code + from AL 1.0 */ +#define OPENAL +#define ALAPI AL_API +#define ALAPIENTRY AL_APIENTRY + +#define AL_VERSION_1_0 +#define AL_VERSION_1_1 + + +/** 8-bit boolean */ +typedef char ALboolean; + +/** character */ +typedef char ALchar; + +/** signed 8-bit 2's complement integer */ +typedef char ALbyte; + +/** unsigned 8-bit integer */ +typedef unsigned char ALubyte; + +/** signed 16-bit 2's complement integer */ +typedef short ALshort; + +/** unsigned 16-bit integer */ +typedef unsigned short ALushort; + +/** signed 32-bit 2's complement integer */ +typedef int ALint; + +/** unsigned 32-bit integer */ +typedef unsigned int ALuint; + +/** non-negative 32-bit binary integer size */ +typedef int ALsizei; + +/** enumerated 32-bit value */ +typedef int ALenum; + +/** 32-bit IEEE754 floating-point */ +typedef float ALfloat; + +/** 64-bit IEEE754 floating-point */ +typedef double ALdouble; + +/** void type (for opaque pointers only) */ +typedef void ALvoid; + +/** Function pointer type */ +typedef void* ALproc; + +/* Enumerant values begin at column 50. No tabs. */ + +/* bad value */ +#define AL_INVALID -1 + +#define AL_NONE 0 + +/* Boolean False. */ +#define AL_FALSE 0 + +/** Boolean True. */ +#define AL_TRUE 1 + +/** Indicate Source has relative coordinates. */ +#define AL_SOURCE_RELATIVE 0x202 + + + +/** + * Directional source, inner cone angle, in degrees. + * Range: [0-360] + * Default: 360 + */ +#define AL_CONE_INNER_ANGLE 0x1001 + +/** + * Directional source, outer cone angle, in degrees. + * Range: [0-360] + * Default: 360 + */ +#define AL_CONE_OUTER_ANGLE 0x1002 + +/** + * Specify the pitch to be applied, either at source, + * or on mixer results, at listener. + * Range: [0.5-2.0] + * Default: 1.0 + */ +#define AL_PITCH 0x1003 + +/** + * Specify the current location in three dimensional space. + * OpenAL, like OpenGL, uses a right handed coordinate system, + * where in a frontal default view X (thumb) points right, + * Y points up (index finger), and Z points towards the + * viewer/camera (middle finger). + * To switch from a left handed coordinate system, flip the + * sign on the Z coordinate. + * Listener position is always in the world coordinate system. + */ +#define AL_POSITION 0x1004 + +/** Specify the current direction. */ +#define AL_DIRECTION 0x1005 + +/** Specify the current velocity in three dimensional space. */ +#define AL_VELOCITY 0x1006 + +/** + * Indicate whether source is looping. + * Type: ALboolean? + * Range: [AL_TRUE, AL_FALSE] + * Default: FALSE. + */ +#define AL_LOOPING 0x1007 + +/** + * Indicate the buffer to provide sound samples. + * Type: ALuint. + * Range: any valid Buffer id. + */ +#define AL_BUFFER 0x1009 + +/** + * Indicate the gain (volume amplification) applied. + * Type: ALfloat. + * Range: ]0.0- ] + * A value of 1.0 means un-attenuated/unchanged. + * Each division by 2 equals an attenuation of -6dB. + * Each multiplicaton with 2 equals an amplification of +6dB. + * A value of 0.0 is meaningless with respect to a logarithmic + * scale; it is interpreted as zero volume - the channel + * is effectively disabled. + */ +#define AL_GAIN 0x100A + +/* + * Indicate minimum source attenuation + * Type: ALfloat + * Range: [0.0 - 1.0] + * + * Logarthmic + */ +#define AL_MIN_GAIN 0x100D + +/** + * Indicate maximum source attenuation + * Type: ALfloat + * Range: [0.0 - 1.0] + * + * Logarthmic + */ +#define AL_MAX_GAIN 0x100E + +/** + * Indicate listener orientation. + * + * at/up + */ +#define AL_ORIENTATION 0x100F + +/** + * Specify the channel mask. (Creative) + * Type: ALuint + * Range: [0 - 255] + */ +#define AL_CHANNEL_MASK 0x3000 + + +/** + * Source state information. + */ +#define AL_SOURCE_STATE 0x1010 +#define AL_INITIAL 0x1011 +#define AL_PLAYING 0x1012 +#define AL_PAUSED 0x1013 +#define AL_STOPPED 0x1014 + +/** + * Buffer Queue params + */ +#define AL_BUFFERS_QUEUED 0x1015 +#define AL_BUFFERS_PROCESSED 0x1016 + +/** + * Source buffer position information + */ +#define AL_SEC_OFFSET 0x1024 +#define AL_SAMPLE_OFFSET 0x1025 +#define AL_BYTE_OFFSET 0x1026 + +/* + * Source type (Static, Streaming or undetermined) + * Source is Static if a Buffer has been attached using AL_BUFFER + * Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers + * Source is undetermined when it has the NULL buffer attached + */ +#define AL_SOURCE_TYPE 0x1027 +#define AL_STATIC 0x1028 +#define AL_STREAMING 0x1029 +#define AL_UNDETERMINED 0x1030 + +/** Sound samples: format specifier. */ +#define AL_FORMAT_MONO8 0x1100 +#define AL_FORMAT_MONO16 0x1101 +#define AL_FORMAT_STEREO8 0x1102 +#define AL_FORMAT_STEREO16 0x1103 + +/** + * source specific reference distance + * Type: ALfloat + * Range: 0.0 - +inf + * + * At 0.0, no distance attenuation occurs. Default is + * 1.0. + */ +#define AL_REFERENCE_DISTANCE 0x1020 + +/** + * source specific rolloff factor + * Type: ALfloat + * Range: 0.0 - +inf + * + */ +#define AL_ROLLOFF_FACTOR 0x1021 + +/** + * Directional source, outer cone gain. + * + * Default: 0.0 + * Range: [0.0 - 1.0] + * Logarithmic + */ +#define AL_CONE_OUTER_GAIN 0x1022 + +/** + * Indicate distance above which sources are not + * attenuated using the inverse clamped distance model. + * + * Default: +inf + * Type: ALfloat + * Range: 0.0 - +inf + */ +#define AL_MAX_DISTANCE 0x1023 + +/** + * Sound samples: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ +#define AL_FREQUENCY 0x2001 +#define AL_BITS 0x2002 +#define AL_CHANNELS 0x2003 +#define AL_SIZE 0x2004 + +/** + * Buffer state. + * + * Not supported for public use (yet). + */ +#define AL_UNUSED 0x2010 +#define AL_PENDING 0x2011 +#define AL_PROCESSED 0x2012 + + +/** Errors: No Error. */ +#define AL_NO_ERROR AL_FALSE + +/** + * Invalid Name paramater passed to AL call. + */ +#define AL_INVALID_NAME 0xA001 + +/** + * Invalid parameter passed to AL call. + */ +#define AL_ILLEGAL_ENUM 0xA002 +#define AL_INVALID_ENUM 0xA002 + +/** + * Invalid enum parameter value. + */ +#define AL_INVALID_VALUE 0xA003 + +/** + * Illegal call. + */ +#define AL_ILLEGAL_COMMAND 0xA004 +#define AL_INVALID_OPERATION 0xA004 + + +/** + * No mojo. + */ +#define AL_OUT_OF_MEMORY 0xA005 + + +/** Context strings: Vendor Name. */ +#define AL_VENDOR 0xB001 +#define AL_VERSION 0xB002 +#define AL_RENDERER 0xB003 +#define AL_EXTENSIONS 0xB004 + +/** Global tweakage. */ + +/** + * Doppler scale. Default 1.0 + */ +#define AL_DOPPLER_FACTOR 0xC000 + +/** + * Tweaks speed of propagation. + */ +#define AL_DOPPLER_VELOCITY 0xC001 + +/** + * Speed of Sound in units per second + */ +#define AL_SPEED_OF_SOUND 0xC003 + +/** + * Distance models + * + * used in conjunction with DistanceModel + * + * implicit: NONE, which disances distance attenuation. + */ +#define AL_DISTANCE_MODEL 0xD000 +#define AL_INVERSE_DISTANCE 0xD001 +#define AL_INVERSE_DISTANCE_CLAMPED 0xD002 +#define AL_LINEAR_DISTANCE 0xD003 +#define AL_LINEAR_DISTANCE_CLAMPED 0xD004 +#define AL_EXPONENT_DISTANCE 0xD005 +#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006 + + +/* FIXME: no way to parse both the prototypes and the function pointer typedefs. */ +/* GlueGen requires both in order to recognize a function as dynamically linked. */ +/* #if !defined(AL_NO_PROTOTYPES) */ + +/* + * Renderer State management + */ +AL_API void AL_APIENTRY alEnable( ALenum capability ); + +AL_API void AL_APIENTRY alDisable( ALenum capability ); + +AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability ); + + +/* + * State retrieval + */ +AL_API const ALchar* AL_APIENTRY alGetString( ALenum param ); + +AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data ); + +AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data ); + +AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data ); + +AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data ); + +AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param ); + +AL_API ALint AL_APIENTRY alGetInteger( ALenum param ); + +AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param ); + +AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param ); + + +/* + * Error support. + * Obtain the most recent error generated in the AL state machine. + */ +AL_API ALenum AL_APIENTRY alGetError( void ); + + +/* + * Extension support. + * Query for the presence of an extension, and obtain any appropriate + * function pointers and enum values. + */ +AL_API ALboolean AL_APIENTRY alIsExtensionPresent( const ALchar* extname ); + +AL_API ALproc AL_APIENTRY alGetProcAddress( const ALchar* fname ); + +AL_API ALenum AL_APIENTRY alGetEnumValue( const ALchar* ename ); + + +/* + * LISTENER + * Listener represents the location and orientation of the + * 'user' in 3D-space. + * + * Properties include: - + * + * Gain AL_GAIN ALfloat + * Position AL_POSITION ALfloat[3] + * Velocity AL_VELOCITY ALfloat[3] + * Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors) +*/ + +/* + * Set Listener parameters + */ +AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value ); + +AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); + +AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values ); + +AL_API void AL_APIENTRY alListeneri( ALenum param, ALint value ); + +AL_API void AL_APIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 ); + +AL_API void AL_APIENTRY alListeneriv( ALenum param, const ALint* values ); + +/* + * Get Listener parameters + */ +AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value ); + +AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); + +AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values ); + +AL_API void AL_APIENTRY alGetListeneri( ALenum param, ALint* value ); + +AL_API void AL_APIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); + +AL_API void AL_APIENTRY alGetListeneriv( ALenum param, ALint* values ); + + +/** + * SOURCE + * Sources represent individual sound objects in 3D-space. + * Sources take the PCM data provided in the specified Buffer, + * apply Source-specific modifications, and then + * submit them to be mixed according to spatial arrangement etc. + * + * Properties include: - + * + * Gain AL_GAIN ALfloat + * Min Gain AL_MIN_GAIN ALfloat + * Max Gain AL_MAX_GAIN ALfloat + * Position AL_POSITION ALfloat[3] + * Velocity AL_VELOCITY ALfloat[3] + * Direction AL_DIRECTION ALfloat[3] + * Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE) + * Reference Distance AL_REFERENCE_DISTANCE ALfloat + * Max Distance AL_MAX_DISTANCE ALfloat + * RollOff Factor AL_ROLLOFF_FACTOR ALfloat + * Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat + * Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat + * Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat + * Pitch AL_PITCH ALfloat + * Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE) + * MS Offset AL_MSEC_OFFSET ALint or ALfloat + * Byte Offset AL_BYTE_OFFSET ALint or ALfloat + * Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat + * Attached Buffer AL_BUFFER ALint + * State (Query only) AL_SOURCE_STATE ALint + * Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint + * Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint + */ + +/* Create Source objects */ +AL_API void AL_APIENTRY alGenSources( ALsizei n, ALuint* sources ); + +/* Delete Source objects */ +AL_API void AL_APIENTRY alDeleteSources( ALsizei n, const ALuint* sources ); + +/* Verify a handle is a valid Source */ +AL_API ALboolean AL_APIENTRY alIsSource( ALuint sid ); + +/* + * Set Source parameters + */ +AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value ); + +AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); + +AL_API void AL_APIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values ); + +AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value ); + +AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); + +AL_API void AL_APIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values ); + +/* + * Get Source parameters + */ +AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value ); + +AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); + +AL_API void AL_APIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values ); + +AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value ); + +AL_API void AL_APIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); + +AL_API void AL_APIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values ); + + +/* + * Source vector based playback calls + */ + +/* Play, replay, or resume (if paused) a list of Sources */ +AL_API void AL_APIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids ); + +/* Stop a list of Sources */ +AL_API void AL_APIENTRY alSourceStopv( ALsizei ns, const ALuint *sids ); + +/* Rewind a list of Sources */ +AL_API void AL_APIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids ); + +/* Pause a list of Sources */ +AL_API void AL_APIENTRY alSourcePausev( ALsizei ns, const ALuint *sids ); + +/* + * Source based playback calls + */ + +/* Play, replay, or resume a Source */ +AL_API void AL_APIENTRY alSourcePlay( ALuint sid ); + +/* Stop a Source */ +AL_API void AL_APIENTRY alSourceStop( ALuint sid ); + +/* Rewind a Source (set playback postiton to beginning) */ +AL_API void AL_APIENTRY alSourceRewind( ALuint sid ); + +/* Pause a Source */ +AL_API void AL_APIENTRY alSourcePause( ALuint sid ); + +/* + * Source Queuing + */ +AL_API void AL_APIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids ); + +AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids ); + + +/** + * BUFFER + * Buffer objects are storage space for sample data. + * Buffers are referred to by Sources. One Buffer can be used + * by multiple Sources. + * + * Properties include: - + * + * Frequency (Query only) AL_FREQUENCY ALint + * Size (Query only) AL_SIZE ALint + * Bits (Query only) AL_BITS ALint + * Channels (Query only) AL_CHANNELS ALint + */ + +/* Create Buffer objects */ +AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* buffers ); + +/* Delete Buffer objects */ +AL_API void AL_APIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers ); + +/* Verify a handle is a valid Buffer */ +AL_API ALboolean AL_APIENTRY alIsBuffer( ALuint bid ); + +/* Specify the data to be copied into a buffer */ +AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq ); + +/* + * Set Buffer parameters + */ +AL_API void AL_APIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value ); + +AL_API void AL_APIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); + +AL_API void AL_APIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values ); + +AL_API void AL_APIENTRY alBufferi( ALuint bid, ALenum param, ALint value ); + +AL_API void AL_APIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); + +AL_API void AL_APIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values ); + +/* + * Get Buffer parameters + */ +AL_API void AL_APIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value ); + +AL_API void AL_APIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); + +AL_API void AL_APIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values ); + +AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value ); + +AL_API void AL_APIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); + +AL_API void AL_APIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values ); + + +/* + * Global Parameters + */ +AL_API void AL_APIENTRY alDopplerFactor( ALfloat value ); + +AL_API void AL_APIENTRY alDopplerVelocity( ALfloat value ); + +AL_API void AL_APIENTRY alSpeedOfSound( ALfloat value ); + +AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel ); + +/* FIXME: see above */ +/* #else */ /* AL_NO_PROTOTYPES */ + +typedef void (AL_APIENTRY *LPALENABLE)( ALenum capability ); +typedef void (AL_APIENTRY *LPALDISABLE)( ALenum capability ); +typedef ALboolean (AL_APIENTRY *LPALISENABLED)( ALenum capability ); +typedef const ALchar* (AL_APIENTRY *LPALGETSTRING)( ALenum param ); +typedef void (AL_APIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data ); +typedef void (AL_APIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data ); +typedef void (AL_APIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data ); +typedef void (AL_APIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data ); +typedef ALboolean (AL_APIENTRY *LPALGETBOOLEAN)( ALenum param ); +typedef ALint (AL_APIENTRY *LPALGETINTEGER)( ALenum param ); +typedef ALfloat (AL_APIENTRY *LPALGETFLOAT)( ALenum param ); +typedef ALdouble (AL_APIENTRY *LPALGETDOUBLE)( ALenum param ); +typedef ALenum (AL_APIENTRY *LPALGETERROR)( void ); +typedef ALboolean (AL_APIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname ); +typedef void* (AL_APIENTRY *LPALGETPROCADDRESS)( const ALchar* fname ); +typedef ALenum (AL_APIENTRY *LPALGETENUMVALUE)( const ALchar* ename ); +typedef void (AL_APIENTRY *LPALLISTENERF)( ALenum param, ALfloat value ); +typedef void (AL_APIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void (AL_APIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values ); +typedef void (AL_APIENTRY *LPALLISTENERI)( ALenum param, ALint value ); +typedef void (AL_APIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void (AL_APIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values ); +typedef void (AL_APIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value ); +typedef void (AL_APIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 ); +typedef void (AL_APIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values ); +typedef void (AL_APIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value ); +typedef void (AL_APIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 ); +typedef void (AL_APIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values ); +typedef void (AL_APIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources ); +typedef void (AL_APIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources ); +typedef ALboolean (AL_APIENTRY *LPALISSOURCE)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value); +typedef void (AL_APIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void (AL_APIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values ); +typedef void (AL_APIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value); +typedef void (AL_APIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void (AL_APIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values ); +typedef void (AL_APIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value ); +typedef void (AL_APIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +typedef void (AL_APIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values ); +typedef void (AL_APIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value ); +typedef void (AL_APIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +typedef void (AL_APIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values ); +typedef void (AL_APIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids ); +typedef void (AL_APIENTRY *LPALSOURCEPLAY)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCESTOP)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEREWIND)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEPAUSE)( ALuint sid ); +typedef void (AL_APIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids ); +typedef void (AL_APIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids ); +typedef void (AL_APIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers ); +typedef void (AL_APIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers ); +typedef ALboolean (AL_APIENTRY *LPALISBUFFER)( ALuint bid ); +typedef void (AL_APIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq ); +typedef void (AL_APIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value); +typedef void (AL_APIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 ); +typedef void (AL_APIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values ); +typedef void (AL_APIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value); +typedef void (AL_APIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 ); +typedef void (AL_APIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values ); +typedef void (AL_APIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value ); +typedef void (AL_APIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3); +typedef void (AL_APIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values ); +typedef void (AL_APIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value ); +typedef void (AL_APIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3); +typedef void (AL_APIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values ); +typedef void (AL_APIENTRY *LPALDOPPLERFACTOR)( ALfloat value ); +typedef void (AL_APIENTRY *LPALDOPPLERVELOCITY)( ALfloat value ); +typedef void (AL_APIENTRY *LPALSPEEDOFSOUND)( ALfloat value ); +typedef void (AL_APIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel ); + +/* FIXME: see above */ +/* #endif */ /* AL_NO_PROTOTYPES */ + +#if TARGET_OS_MAC + #pragma export off +#endif + +#if defined(__cplusplus) +} /* extern "C" */ +#endif + +#endif /* AL_AL_H */ diff --git a/make/stub_includes/openal/alc.h b/make/stub_includes/openal/alc.h new file mode 100755 index 0000000..0c50a88 --- /dev/null +++ b/make/stub_includes/openal/alc.h @@ -0,0 +1,277 @@ +#ifndef AL_ALC_H +#define AL_ALC_H + +#if defined(__cplusplus) +extern "C" { +#endif + +#if defined(_WIN32) && !defined(_XBOX) + /* _OPENAL32LIB is deprecated */ + #if defined(AL_BUILD_LIBRARY) || defined (_OPENAL32LIB) + #define ALC_API __declspec(dllexport) + #else + #define ALC_API __declspec(dllimport) + #endif +#else + #define ALC_API extern +#endif + +#if defined(_WIN32) + #define ALC_APIENTRY __cdecl +#else + #define ALC_APIENTRY +#endif + +#if TARGET_OS_MAC + #pragma export on +#endif + +/* The ALCAPI, and ALCAPIENTRY macros are deprecated, but are included for applications porting code + from AL 1.0 */ +#define ALCAPI ALC_API +#define ALCAPIENTRY ALC_APIENTRY + +#define ALC_VERSION_0_1 1 + +typedef struct ALCdevice_struct ALCdevice; +typedef struct ALCcontext_struct ALCcontext; + + +/** 8-bit boolean */ +typedef char ALCboolean; + +/** character */ +typedef char ALCchar; + +/** signed 8-bit 2's complement integer */ +typedef char ALCbyte; + +/** unsigned 8-bit integer */ +typedef unsigned char ALCubyte; + +/** signed 16-bit 2's complement integer */ +typedef short ALCshort; + +/** unsigned 16-bit integer */ +typedef unsigned short ALCushort; + +/** signed 32-bit 2's complement integer */ +typedef int ALCint; + +/** unsigned 32-bit integer */ +typedef unsigned int ALCuint; + +/** non-negative 32-bit binary integer size */ +typedef int ALCsizei; + +/** enumerated 32-bit value */ +typedef int ALCenum; + +/** 32-bit IEEE754 floating-point */ +typedef float ALCfloat; + +/** 64-bit IEEE754 floating-point */ +typedef double ALCdouble; + +/** void type (for opaque pointers only) */ +typedef void ALCvoid; + + +/* Enumerant values begin at column 50. No tabs. */ + +/* bad value */ +#define ALC_INVALID 0 + +/* Boolean False. */ +#define ALC_FALSE 0 + +/* Boolean True. */ +#define ALC_TRUE 1 + +/** + * followed by <int> Hz + */ +#define ALC_FREQUENCY 0x1007 + +/** + * followed by <int> Hz + */ +#define ALC_REFRESH 0x1008 + +/** + * followed by AL_TRUE, AL_FALSE + */ +#define ALC_SYNC 0x1009 + +/** + * followed by <int> Num of requested Mono (3D) Sources + */ +#define ALC_MONO_SOURCES 0x1010 + +/** + * followed by <int> Num of requested Stereo Sources + */ +#define ALC_STEREO_SOURCES 0x1011 + +/** + * errors + */ + +/** + * No error + */ +#define ALC_NO_ERROR ALC_FALSE + +/** + * No device + */ +#define ALC_INVALID_DEVICE 0xA001 + +/** + * invalid context ID + */ +#define ALC_INVALID_CONTEXT 0xA002 + +/** + * bad enum + */ +#define ALC_INVALID_ENUM 0xA003 + +/** + * bad value + */ +#define ALC_INVALID_VALUE 0xA004 + +/** + * Out of memory. + */ +#define ALC_OUT_OF_MEMORY 0xA005 + + +/** + * The Specifier string for default device + */ +#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004 +#define ALC_DEVICE_SPECIFIER 0x1005 +#define ALC_EXTENSIONS 0x1006 + +#define ALC_MAJOR_VERSION 0x1000 +#define ALC_MINOR_VERSION 0x1001 + +#define ALC_ATTRIBUTES_SIZE 0x1002 +#define ALC_ALL_ATTRIBUTES 0x1003 + +/** + * Capture extension + */ +#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310 +#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311 +#define ALC_CAPTURE_SAMPLES 0x312 + + +/* FIXME: no way to parse both the prototypes and the function pointer typedefs. */ +/* GlueGen requires both in order to recognize a function as dynamically linked. */ +/* #if !defined(ALC_NO_PROTOTYPES) */ + +/* + * Context Management + */ +ALC_API ALCcontext * ALC_APIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist ); + +ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent( ALCcontext *context ); + +ALC_API void ALC_APIENTRY alcProcessContext( ALCcontext *context ); + +ALC_API void ALC_APIENTRY alcSuspendContext( ALCcontext *context ); + +ALC_API void ALC_APIENTRY alcDestroyContext( ALCcontext *context ); + +ALC_API ALCcontext * ALC_APIENTRY alcGetCurrentContext( ALCvoid ); + +ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice( ALCcontext *context ); + + +/* + * Device Management + */ +ALC_API ALCdevice * ALC_APIENTRY alcOpenDevice( const ALCchar *devicename ); + +ALC_API ALCboolean ALC_APIENTRY alcCloseDevice( ALCdevice *device ); + + +/* + * Error support. + * Obtain the most recent Context error + */ +ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device ); + + +/* + * Extension support. + * Query for the presence of an extension, and obtain any appropriate + * function pointers and enum values. + */ +ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname ); + +ALC_API void * ALC_APIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname ); + +ALC_API ALCenum ALC_APIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname ); + + +/* + * Query functions + */ +ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param ); + +ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data ); + + +/* + * Capture functions + */ +ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); + +ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice( ALCdevice *device ); + +ALC_API void ALC_APIENTRY alcCaptureStart( ALCdevice *device ); + +ALC_API void ALC_APIENTRY alcCaptureStop( ALCdevice *device ); + +ALC_API void ALC_APIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); + +/* FIXME: see above */ +/* #else */ /* ALC_NO_PROTOTYPES */ + +typedef ALCcontext * (ALC_APIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist); +typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context ); +typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context ); +typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context ); +typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context ); +typedef ALCcontext * (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)( ALCvoid ); +typedef ALCdevice * (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context ); +typedef ALCdevice * (ALC_APIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename ); +typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device ); +typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)( ALCdevice *device ); +typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname ); +typedef void * (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname ); +typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname ); +typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param ); +typedef void (ALC_APIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest ); +typedef ALCdevice * (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); +typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device ); +typedef void (ALC_APIENTRY *LPALCCAPTURESTART)( ALCdevice *device ); +typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)( ALCdevice *device ); +typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); + +/* FIXME: see above */ +/* #endif */ /* ALC_NO_PROTOTYPES */ + +#if TARGET_OS_MAC + #pragma export off +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* AL_ALC_H */ diff --git a/make/stub_includes/openal/alut.h b/make/stub_includes/openal/alut.h new file mode 100755 index 0000000..7a33ccb --- /dev/null +++ b/make/stub_includes/openal/alut.h @@ -0,0 +1,68 @@ +#ifndef _AL_ALUT_H +#define _AL_ALUT_H + +#include <al.h> + +#if defined(_WIN32) && !defined(_XBOX) && 0 + #if defined (_OPENAL32LIB) + #define ALUTAPI __declspec(dllexport) + #else + #define ALUTAPI __declspec(dllimport) + #endif +#else + #define ALUTAPI extern +#endif + +#if defined(_WIN32) + #define ALUTAPIENTRY __cdecl +#else + #define ALUTAPIENTRY +#endif + +#if TARGET_OS_MAC + #pragma export on +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +#if !defined(ALUT_NO_PROTOTYPES) + +ALUTAPI void ALUTAPIENTRY alutInit( int *argc, char *argv[] ); +ALUTAPI void ALUTAPIENTRY alutExit( void ); + +#if defined(MACINTOSH_AL) +/* Windows and Linux versions have a loop parameter, Macintosh doesn't */ +ALUTAPI void ALUTAPIENTRY alutLoadWAVFile( const ALbyte *file, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq ); +ALUTAPI void ALUTAPIENTRY alutLoadWAVMemory( const ALbyte *memory, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq ); +#else +ALUTAPI void ALUTAPIENTRY alutLoadWAVFile( const ALbyte *file, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop ); +ALUTAPI void ALUTAPIENTRY alutLoadWAVMemory( const ALbyte *memory, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop ); +#endif +ALUTAPI void ALUTAPIENTRY alutUnloadWAV( ALenum format, ALvoid *data, ALsizei size, ALsizei freq ); + +#else /* ALUT_NO_PROTOTYPES */ + +ALUTAPI void (ALUTAPIENTRY *alutInit)( int *argc, char *argv[] ); +ALUTAPI void (ALUTAPIENTRY *alutExit)( void ); +#if defined(MACINTOSH_AL) +ALUTAPI void (ALUTAPIENTRY *alutLoadWAVFile)( const ALbyte *file, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq ); +ALUTAPI void (ALUTAPIENTRY *alutLoadWAVMemory)( const ALbyte *memory, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq ); +#else +ALUTAPI void (ALUTAPIENTRY *alutLoadWAVFile)( const ALbyte *file, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop ); +ALUTAPI void (ALUTAPIENTRY *alutLoadWAVMemory)( const ALbyte *memory, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop ); +#endif +ALUTAPI void (ALUTAPIENTRY *alutUnloadWAV)( ALenum format, ALvoid *data, ALsizei size, ALsizei freq ); + +#endif /* ALUT_NO_PROTOTYPES */ + +#if TARGET_OS_MAC + #pragma export off +#endif + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/make/stub_includes/openal/eax.h b/make/stub_includes/openal/eax.h new file mode 100644 index 0000000..bf0d9b6 --- /dev/null +++ b/make/stub_includes/openal/eax.h @@ -0,0 +1,32 @@ +#ifndef _EAX_H +#define _EAX_H + +#ifdef _WIN32 +#include "windows.h" +#endif + +#include "al.h" + +#ifdef _WIN32 +DEFINE_GUID(DSPROPSETID_EAX20_ListenerProperties, + 0x306a6a8, + 0xb224, + 0x11d2, + 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22); + +DEFINE_GUID(DSPROPSETID_EAX20_BufferProperties, + 0x306a6a7, + 0xb224, + 0x11d2, + 0x99, 0xe5, 0x0, 0x0, 0xe8, 0xd8, 0xc7, 0x22); +#endif + +#ifdef _WIN32 +typedef ALenum (*EAXSet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint); +typedef ALenum (*EAXGet)(const GUID*, ALuint, ALuint, ALvoid*, ALuint); + +extern EAXSet eaxSet; +extern EAXGet eaxGet; +#endif + +#endif /* _EAX_H */ diff --git a/make/validate-properties.xml b/make/validate-properties.xml new file mode 100755 index 0000000..8fc9e33 --- /dev/null +++ b/make/validate-properties.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + - A validator for all of the user-defined properties. It will be called + - from build.xml in the "init" task. + --> +<project name="Configuration validator" default="validate"> + + <!-- ================================================================== --> + <!-- + - Ensure that "antlr.jar" is set. + --> + <target name="antlr.jar.validate" unless="antlr.jar"> + <fail> + + ***************************************************************** + ** The property "antlr.jar" was not set in the JOAL properties ** + ** file ** + ** "${user.properties.file}" ** + ** (or this file was not found). ** + ** ** + ** Please set "antlr.jar" to to the full path of the ANTLR jar ** + ** including the jar itself. ** + ***************************************************************** + </fail> + </target> + + <!-- + - Ensure that "java.home.dir" is set. + - NOTE: "java.home" is an internal property for ANT that is not + - typically set to what the build needs it to be. + --> + <target name="java.home.dir.validate" unless="java.home.dir"> + <fail> + + ************************************************************* + ** The property "java.home.dir" was not set in the JOGL ** + ** properties file ** + ** "${user.properties.file}" ** + ** (or this file was not found). ** + ** ** + ** Please set "java.home.dir" to your JAVA_HOME directory. ** + ************************************************************* + </fail> + </target> + + <!-- + - Make sure that jogl.jar is not on the CLASSPATH; this can cause + - builds to fail since if this Java process has the jar file open + - we can not overwrite it. + --> + <target name="test.for.jogl.jar"> + <available property="jogl.jar.on.class.path" classname="net.java.games.jogl.GL" /> + </target> + <target name="java.class.path.validate" depends="test.for.jogl.jar" if="jogl.jar.on.class.path"> + <fail> + + ****************************************************************** + ** Your CLASSPATH environment variable appears to be set (some ** + ** JOGL classes are currently visible to the build.) This can ** + ** cause the build to fail. Please unset your CLASSPATH ** + ** variable and restart the build. ** + ****************************************************************** + </fail> + </target> + + <!-- ================================================================== --> + <!-- + - Validate the required properties + --> + <target name="validate" depends="antlr.jar.validate, java.home.dir.validate, java.class.path.validate" + description="Validate required properties" /> + +</project> |