Removed devil and fmod support. yay.

This commit is contained in:
Elias Naur 2008-01-21 21:38:29 +00:00
parent 7fe1db23ec
commit dc3999b075
72 changed files with 3 additions and 16618 deletions

186
build.xml
View File

@ -24,10 +24,8 @@
<fileset id="lwjgl.fileset" dir="${lwjgl.bin}">
<include name="org/**/*" />
<exclude name="org/lwjgl/d3d/**" />
<exclude name="org/lwjgl/fmod3/**" />
<exclude name="org/lwjgl/test/**" />
<exclude name="org/lwjgl/util/**" />
<exclude name="org/lwjgl/devil/**" />
<exclude name="org/lwjgl/examples/**" />
</fileset>
@ -62,18 +60,6 @@
<include name="org/lwjgl/util/**" />
</fileset>
<!-- Files to include in the lwjgl_fmod3.jar file -->
<fileset id="lwjgl_fmod3.fileset" dir="${lwjgl.bin}">
<exclude name="**.*" />
<include name="org/lwjgl/fmod3/**" />
</fileset>
<!-- Files to include in the lwjgl_devil.jar file -->
<fileset id="lwjgl_devil.fileset" dir="${lwjgl.bin}">
<exclude name="**.*"/>
<include name="org/lwjgl/devil/**"/>
</fileset>
<!-- Files to include in the lwjgl_applet.jar file -->
<fileset id="lwjgl_applet.fileset" dir="${lwjgl.bin}">
<exclude name="**.*"/>
@ -108,15 +94,6 @@
<include name="jinput-raw.dll" />
</patternset>
<!-- Files to include in win32 optional package -->
<patternset id="lwjgl-win32_optional.fileset">
<include name="lwjgl-fmod3.dll" />
<include name="lwjgl-devil.dll" />
<include name="DevIL.dll" />
<include name="ILU.dll" />
<include name="ILUT.dll" />
</patternset>
<!-- Files to include in linux, glibc2.3 package -->
<patternset id="lwjgl-linux.fileset">
<include name="liblwjgl*.so" />
@ -124,15 +101,6 @@
<include name="libjinput-linux.so" />
</patternset>
<!-- Files to include in linux optional, glibc2.3 package -->
<patternset id="lwjgl-linux_optional.fileset">
<include name="liblwjgl-fmod3.so" />
<include name="liblwjgl-devil.so" />
<include name="libIL.so" />
<include name="libILU.so" />
<include name="libILUT.so" />
</patternset>
<!-- Files to include in mac os x package -->
<patternset id="lwjgl-macosx.fileset">
<include name="liblwjgl.jnilib" />
@ -141,15 +109,6 @@
<include name="libjinput-osx-legacy.jnilib" />
</patternset>
<!-- Files to include in mac os x optional package -->
<patternset id="lwjgl-macosx_optional.fileset">
<include name="liblwjgl-fmod3.jnilib" />
<include name="liblwjgl-devil.jnilib" />
<include name="libIL.dylib" />
<include name="libILU.dylib" />
<include name="libILUT.dylib" />
</patternset>
<!-- Files to include in source distribution -->
<fileset id="lwjgl.source.fileset" dir=".">
<include name="build.xml" />
@ -160,40 +119,18 @@
<!-- files in the base package -->
<patternset id="lwjgl_base">
<include name="**" />
<exclude name="jar/lwjgl_fmod3.jar" />
<exclude name="jar/lwjgl_devil.jar" />
<exclude name="native/win32/lwjgl-*.dll" />
<exclude name="native/win32/DevIL.dll" />
<exclude name="native/win32/ILU.dll" />
<exclude name="native/win32/ILUT.dll" />
<exclude name="native/linux/libIL*.so" />
<exclude name="native/linux/liblwjgl-*.so" />
<exclude name="native/macosx/libIL*.dylib" />
<exclude name="native/macosx/liblwjgl-*.jnilib" />
<exclude name="res/ILtest.*" />
<exclude name="res/Missing_you.mod" />
<exclude name="res/phero*.*" />
<exclude name="doc/3rdparty/openil_license.txt" />
</patternset>
<!-- files in the optional package -->
<patternset id="lwjgl_optional">
<include name="jar/lwjgl_fmod3.jar" />
<include name="jar/lwjgl_devil.jar" />
<include name="native/win32/lwjgl-*.dll" />
<include name="native/win32/DevIL.dll" />
<include name="native/win32/ILU.dll" />
<include name="native/win32/ILUT.dll" />
<include name="native/linux/libIL*.so" />
<include name="native/linux/liblwjgl-*.so" />
<include name="native/macosx/libIL*.dylib" />
<include name="native/macosx/liblwjgl-*.jnilib" />
<include name="res/**" />
<exclude name="res/logo/**" />
<exclude name="res/spaceinvaders/**" />
<exclude name="res/*.wav" />
<exclude name="res/*.xpm" />
<include name="doc/3rdparty/openil_license.txt" />
<include name="doc/CREDITS" />
<include name="doc/LICENSE" />
<include name="doc/README" />
@ -211,16 +148,6 @@
<srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/>
</uptodate>
<uptodate property="lwjgl.fmod.built" targetfile="${lwjgl.lib}/win32/lwjgl-fmod3.dll" >
<srcfiles dir= "${lwjgl.src.native}/common" includes="*.c"/>
<srcfiles dir= "${lwjgl.src.native}/common/fmod3" includes="*.c"/>
</uptodate>
<uptodate property="lwjgl.devil.built" targetfile="${lwjgl.lib}/win32/lwjgl-devil.dll" >
<srcfiles dir= "${lwjgl.src.native}/common" includes="*.c"/>
<srcfiles dir= "${lwjgl.src.native}/common/devil" includes="*.c"/>
</uptodate>
<!-- ================================================================== -->
<!-- Everything below this line is targets. -->
<!-- Do not modify, unless you know what you're doing -->
@ -232,8 +159,6 @@
<target name="-initialize">
<mkdir dir="${lwjgl.bin}" taskname="initialiazing bin folder" />
<mkdir dir="${lwjgl.bin}/lwjgl" taskname="initialiazing bin folder" />
<mkdir dir="${lwjgl.bin}/devil" taskname="initialiazing bin folder" />
<mkdir dir="${lwjgl.bin}/fmod3" taskname="initialiazing bin folder" />
<mkdir dir="${lwjgl.lib}" taskname="initialiazing lib folder" />
<mkdir dir="${lwjgl.dist}" taskname="initialiazing dist folder" />
<mkdir dir="${lwjgl.docs}/javadoc" taskname="initialiazing docs folder" />
@ -310,6 +235,7 @@
<!-- Create ONLY the jar archives -->
<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, generate-all, compile, -createjars">
<!-- <target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, compile, -createjars">-->
<!--<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize, compile, -createjars">-->
<move todir="libs/">
<fileset dir="${lwjgl.temp}/jar">
@ -346,22 +272,6 @@
<jar destfile="${lwjgl.temp}/jar/lwjgl_util.jar" taskname="lwjgl_util.jar">
<fileset refid="lwjgl_util.fileset" />
</jar>
<!-- Create lwjgl_fmod.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl_fmod3.jar" taskname="lwjgl_fmod3.jar">
<fileset refid="lwjgl_fmod3.fileset" />
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<!-- Create lwjgl_devil.jar -->
<jar destfile="${lwjgl.temp}/jar/lwjgl_devil.jar" taskname="lwjgl_devil.jar">
<fileset refid="lwjgl_devil.fileset" />
<manifest>
<attribute name="Sealed" value="false"/>
</manifest>
</jar>
</target>
<target name="applettest" depends="applet">
@ -420,8 +330,6 @@
<jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar">
<fileset dir="${lwjgl.lib}/win32">
<patternset refid="lwjgl-win32.fileset"/>
<patternset refid="lwjgl-win32_optional.fileset"/>
<include name="fmod.dll"/>
</fileset>
</jar>
<signjar jar="applet/windows_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
@ -429,8 +337,6 @@
<jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar">
<fileset dir="${lwjgl.lib}/linux">
<patternset refid="lwjgl-linux.fileset"/>
<patternset refid="lwjgl-linux_optional.fileset"/>
<include name="libfmod.so"/>
</fileset>
</jar>
<signjar jar="applet/linux_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
@ -438,8 +344,6 @@
<jar destfile="applet/macosx_natives.jar" taskname="macosx_natives.jar">
<fileset dir="${lwjgl.lib}/macosx">
<patternset refid="lwjgl-macosx.fileset"/>
<patternset refid="lwjgl-macosx_optional.fileset"/>
<include name="libfmod.dylib"/>
</fileset>
</jar>
<signjar jar="applet/macosx_natives.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
@ -460,8 +364,6 @@
<copy file="${lwjgl.lib}/lwjgl.jar" todir="applet"/>
<copy file="${lwjgl.lib}/lwjgl_util_applet.jar" todir="applet"/>
<copy file="${lwjgl.lib}/lwjgl_util.jar" todir="applet"/>
<copy file="${lwjgl.lib}/lwjgl_fmod3.jar" todir="applet"/>
<copy file="${lwjgl.lib}/lwjgl_devil.jar" todir="applet"/>
<copy file="${lwjgl.lib}/jinput.jar" todir="applet"/>
<zip destfile="applet/res.jar">
<zipfileset dir="${lwjgl.res}" includes="Footsteps.wav, ILtest.tga, Missing_you.mod"/>
@ -469,8 +371,6 @@
<signjar jar="applet/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="applet/jinput.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="applet/lwjgl_util_applet.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="applet/lwjgl_fmod3.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="applet/lwjgl_devil.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
</target>
<!-- Distributes files -->
@ -483,19 +383,16 @@
<copy todir="${lwjgl.temp}/native/win32">
<fileset dir="${lwjgl.lib}/win32">
<patternset refid="lwjgl-win32.fileset" />
<patternset refid="lwjgl-win32_optional.fileset" />
</fileset>
</copy>
<copy todir="${lwjgl.temp}/native/linux">
<fileset dir="${lwjgl.lib}/linux">
<patternset refid="lwjgl-linux.fileset" />
<patternset refid="lwjgl-linux_optional.fileset" />
</fileset>
</copy>
<copy todir="${lwjgl.temp}/native/macosx">
<fileset dir="${lwjgl.lib}/macosx">
<patternset refid="lwjgl-macosx.fileset" />
<patternset refid="lwjgl-macosx_optional.fileset" />
</fileset>
</copy>
@ -506,13 +403,6 @@
</zipfileset>
</zip>
<!-- create optional package -->
<zip destfile="${lwjgl.dist}/lwjgl_optional-${lwjgl.version}.zip">
<zipfileset dir="${lwjgl.temp}" prefix="lwjgl_optional-${lwjgl.version}/">
<patternset refid="lwjgl_optional"/>
</zipfileset>
</zip>
<!-- create applet package -->
<zip destfile="${lwjgl.dist}/lwjgl_applet-${lwjgl.version}.zip">
<zipfileset dir="." prefix="lwjgl_applet-${lwjgl.version}/">
@ -547,8 +437,6 @@
</javac>
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" />
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" />
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/fmod3/**" source="1.4" target="1.4" taskname="fmod" />
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/devil/**" source="1.4" target="1.4" taskname="devil"/>
</target>
<!-- Generates the native headers from source files -->
@ -608,18 +496,6 @@
<class name="org.lwjgl.opengl.GLContext" />
<class name="org.lwjgl.opengl.Pbuffer" />
</javah>
<!-- fmod -->
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/fmod3" force="yes">
<class name="org.lwjgl.fmod3.FMOD" />
<class name="org.lwjgl.fmod3.FMusic" />
<class name="org.lwjgl.fmod3.FSound" />
</javah>
<!-- DevIL -->
<javah classpath="${lwjgl.bin}" destdir="${lwjgl.src.headers}/devil" force="yes">
<class name="org.lwjgl.devil.ILNative" />
</javah>
</target>
<!-- Creates the Javadoc -->
@ -670,7 +546,7 @@
<arg path="${lwjgl.src}/generated"/>
<arg value="-d"/>
<arg path="${lwjgl.src.native}/generated"/>
<!--<arg value="-Ageneratechecks"/>-->
<arg value="-Ageneratechecks"/>
<arg value="-Acontextspecific"/>
<arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
@ -706,7 +582,7 @@
</apply>
</target>
<target name="compile_native_all" depends="compile_native, compile_native_optional" description="Compiles the native files"/>
<target name="compile_native_all" depends="compile_native" description="Compiles the native files"/>
<!-- Compiles the native files -->
<target name="compile_native" depends="headers" description="Compiles the native files">
@ -727,37 +603,12 @@
<antcall target="-compile_native_macosx" />
</target>
<target name="compile_native_optional" depends="headers" description="Compiles the native files">
<!-- check each platform, and run their build target -->
<condition property="lwjgl.platform.windows">
<os family="windows" />
</condition>
<antcall target="-compile_native_win32_optional" />
<condition property="lwjgl.platform.linux">
<os name="Linux" />
</condition>
<antcall target="-compile_native_linux_optional" />
<condition property="lwjgl.platform.macosx">
<os name="Mac OS X" />
</condition>
<antcall target="-compile_native_macosx_optional" />
</target>
<!-- Compiles LWJGL on Win32 platforms -->
<target name="-compile_native_win32" if="lwjgl.platform.windows">
<ant antfile="platform_build/windows_ant/build.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/lwjgl/lwjgl.dll" todir="${lwjgl.lib}/win32"/>
</target>
<target name="-compile_native_win32_optional" if="lwjgl.platform.windows">
<ant antfile="platform_build/windows_ant/build_fmod3.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/fmod3/lwjgl-fmod3.dll" todir="${lwjgl.lib}/win32"/>
<ant antfile="platform_build/windows_ant/build_devil.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/devil/lwjgl-devil.dll" todir="${lwjgl.lib}/win32"/>
</target>
<!-- Compiles LWJGL on Linux platforms -->
<target name="-compile_native_linux" if="lwjgl.platform.linux">
<ant antfile="platform_build/linux_ant/build.xml" inheritAll="false"/>
@ -766,32 +617,11 @@
</copy>
</target>
<target name="-compile_native_linux_optional" if="lwjgl.platform.linux">
<ant antfile="platform_build/linux_ant/build_fmod3.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/fmod3/liblwjgl-fmod3.so" todir="${lwjgl.lib}/linux"/>
<ant antfile="platform_build/linux_ant/build_devil.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/devil/liblwjgl-devil.so" todir="${lwjgl.lib}/linux"/>
</target>
<target name="-compile_native_macosx" if="lwjgl.platform.macosx">
<ant antfile="platform_build/macosx_ant/build.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/lwjgl/liblwjgl.jnilib" todir="${lwjgl.lib}/macosx"/>
</target>
<!-- Compiles LWJGL on Mac OS X platforms -->
<target name="-compile_native_macosx_optional" if="lwjgl.platform.macosx">
<!-- check for required properties -->
<property environment="env"/>
<fail message="Missing FMOD path environment property" unless="env.FMOD"/>
<ant antfile="platform_build/macosx_ant/build_fmod3.xml" inheritAll="false"/>
<ant antfile="platform_build/macosx_ant/build_devil.xml" inheritAll="false"/>
<copy file="${lwjgl.bin}/fmod3/liblwjgl-fmod3.jnilib" todir="${lwjgl.lib}/macosx"/>
<copy file="${lwjgl.bin}/devil/liblwjgl-devil.jnilib" todir="${lwjgl.lib}/macosx"/>
</target>
<target name="webstart_demo" depends="jars">
<antcall target="-webstart_demo">
<param name="keystore" value="applet/lwjglkeystore"/>
@ -818,22 +648,14 @@
<!-- unzip common files -->
<unzip src="${lwjgl.dist}/lwjgl-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/>
<unzip src="${lwjgl.dist}/lwjgl_optional-${lwjgl.version}.zip" dest="${lwjgl.temp}/jnlp/temp" overwrite="true"/>
<!-- move files to unified structure -->
<move todir="${lwjgl.temp}/jnlp/temp">
<fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl-${lwjgl.version}/">
<include name="**"/>
</fileset>
<fileset dir="${lwjgl.temp}/jnlp/temp/lwjgl_optional-${lwjgl.version}/">
<include name="**"/>
</fileset>
</move>
<!-- copy fmod dependent files -->
<copy file="${lwjgl.lib}/win32/fmod.dll" tofile="${lwjgl.temp}/jnlp/temp/native/win32/fmod.dll"/>
<copy file="${lwjgl.lib}/linux/libfmod.so" tofile="${lwjgl.temp}/jnlp/temp/native/linux/libfmod.so"/>
<!-- move relevant files to root -->
<move todir="${lwjgl.temp}/jnlp/" flatten="true">
<fileset dir="${lwjgl.temp}/jnlp/temp">
@ -851,8 +673,6 @@
<!-- sign 'em -->
<signjar jar="${lwjgl.temp}/jnlp/lwjgl.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/lwjgl_devil.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/lwjgl_fmod3.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/lwjgl_util.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/native_linux.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<signjar jar="${lwjgl.temp}/jnlp/native_macosx.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>

View File

@ -1,506 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser 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
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,51 +0,0 @@
<?xml version="1.0"?>
<project name="devil" basedir="../../bin/devil" default="compile">
<property name="native" location="../../src/native"/>
<property name="libname32" value="liblwjgl-devil.so"/>
<property name="libname64" value="liblwjgl64-devil.so"/>
<property name="libs32" value="-lpthread"/>
<property name="libs64" value="-lpthread"/>
<property name="cflags" value="-O2 -Wall -c -fPIC -std=c99 -pthread"/>
<target name="clean">
<delete>
<fileset dir="." includes="*.o"/>
<fileset dir="." includes="*.so"/>
</delete>
</target>
<target name="compile">
<exec executable="uname" outputproperty="hwplatform">
<arg value="-m"/>
</exec>
<condition property="libs" value="${libs64}" else="${libs32}">
<equals arg1="${hwplatform}" arg2="x86_64"/>
</condition>
<condition property="libname" value="${libname64}" else="${libname32}">
<equals arg1="${hwplatform}" arg2="x86_64"/>
</condition>
<property name="linker_flags" value="-Wl,--version-script=${native}/linux/lwjgl.map -shared -O2 -Wall -o ${libname} ${libs}"/>
<apply dir="." executable="cc" dest="." skipemptyfilesets="true" failonerror="true">
<arg line="${cflags}"/>
<arg value="-I${java.home}/../include"/>
<arg value="-I${java.home}/../include/linux"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/>
<arg value="-I${native}/common"/>
<arg value="-I${native}/common/devil"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*common*.c"/>
<fileset dir="${native}/common/devil" includes="*.c"/>
</apply>
<apply dir="." parallel="true" executable="cc" failonerror="true">
<srcfile/>
<arg line="${linker_flags}"/>
<fileset dir="." includes="*.o"/>
</apply>
<apply dir="." parallel="true" executable="strip" failonerror="true">
<fileset file="${libname}"/>
</apply>
</target>
</project>

View File

@ -1,56 +0,0 @@
<?xml version="1.0"?>
<project name="fmod3" basedir="../../bin/fmod3" default="compile">
<property name="native" location="../../src/native"/>
<property environment="env"/>
<property name="fmod.home" location="${env.FMOD}"/>
<property name="libname32" value="liblwjgl-fmod3.so"/>
<property name="libname64" value="liblwjgl64-fmod3.so"/>
<property name="libs32" value="-lpthread"/>
<property name="libs64" value="-lpthread"/>
<property name="cflags" value="-O2 -Wall -c -fPIC -std=c99 -pthread"/>
<fail message="Missing FMOD path environment property" unless="env.FMOD"/>
<target name="clean">
<delete>
<fileset dir="." includes="*.o"/>
<fileset dir="." includes="*.so"/>
</delete>
</target>
<target name="compile">
<exec executable="uname" outputproperty="hwplatform">
<arg value="-m"/>
</exec>
<condition property="libs" value="${libs64}" else="${libs32}">
<equals arg1="${hwplatform}" arg2="x86_64"/>
</condition>
<condition property="libname" value="${libname64}" else="${libname32}">
<equals arg1="${hwplatform}" arg2="x86_64"/>
</condition>
<property name="linker_flags" value="-Wl,--version-script=${native}/linux/lwjgl.map -shared -O2 -Wall -o ${libname} ${libs}"/>
<apply dir="." executable="cc" dest="." skipemptyfilesets="true" failonerror="true">
<arg line="${cflags}"/>
<arg value="-I${java.home}/../include"/>
<arg value="-I${java.home}/../include/linux"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/>
<arg value="-I${fmod.home}/api/inc"/>
<arg value="-I${native}/common"/>
<arg value="-I${native}/common/fmod3"/>
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*common*.c"/>
<fileset dir="${native}/common/fmod3" includes="*.c"/>
</apply>
<apply dir="." parallel="true" executable="cc" failonerror="true">
<srcfile/>
<arg line="${linker_flags}"/>
<fileset dir="." includes="*.o"/>
</apply>
<apply dir="." parallel="true" executable="strip" failonerror="true">
<fileset file="${libname}"/>
</apply>
</target>
</project>

View File

@ -1,81 +0,0 @@
<?xml version="1.0" ?>
<project name="OS X Native code" basedir="../../bin/devil" default="nativelibrary">
<property name="native" location="../../src/native"/>
<target name="init">
<mkdir dir="ppc"/>
<mkdir dir="intel"/>
</target>
<target name="clean">
<delete failonerror="false">
<fileset dir="intel"/>
<fileset dir="ppc"/>
<fileset dir="." includes="liblwjgl-devil.jnilib"/>
<fileset dir="." includes="devil.symbols"/>
</delete>
</target>
<target name="compile">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
<arg line="${cflags} -O2 -Wall -c -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common"/>
<!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c)" to="\1.o"/>
<fileset dir="${native}/common" includes="common_tools.c"/>
<fileset dir="${native}/common/devil" includes="*.c"/>
</apply>
</target>
<target name="link">
<apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
<arg line="${linkerflags} -exported_symbols_list ../devil.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true">
<arg line="-S -X"/>
<fileset dir="." file="${libname}"/>
</apply>
</target>
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
<property name="legacy_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot} -arch i386"/>
<property name="legacy_flags" value="-arch ppc"/>
<antcall target="compile">
<param name="dstdir" location="intel"/>
<param name="compiler" value="gcc-4.0"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="${universal_flags}"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="ppc"/>
<param name="compiler" value="gcc-3.3"/>
<param name="sdkroot" location="${legacy_sdkroot}"/>
<param name="cflags" value="${legacy_flags}"/>
</antcall>
<exec vmlauncher="false" executable="../../platform_build/macosx_ant/build-symbol-list" output="devil.symbols" failonerror="true">
<arg path="intel"/>
</exec>
<antcall target="link">
<param name="objdir" location="intel"/>
<param name="libname" value="liblwjgl-devil-intel.jnilib"/>
<param name="linker" value="gcc-4.0"/>
<param name="linkerflags" value="${universal_flags}"/>
</antcall>
<antcall target="link">
<param name="objdir" location="ppc"/>
<param name="libname" value="liblwjgl-devil-ppc.jnilib"/>
<param name="linker" value="gcc-3.3"/>
<param name="linkerflags" value="${legacy_flags}"/>
</antcall>
<apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" >
<arg value="-create"/>
<srcfile/>
<arg value="-output"/>
<arg path="liblwjgl-devil.jnilib"/>
<fileset file="ppc/liblwjgl-devil-ppc.jnilib"/>
<fileset file="intel/liblwjgl-devil-intel.jnilib"/>
</apply>
</target>
</project>

View File

@ -1,86 +0,0 @@
<?xml version="1.0" ?>
<project name="OS X Native code" basedir="../../bin/fmod3" default="nativelibrary">
<property environment="env"/>
<property name="native" location="../../src/native"/>
<property name="fmod.home" location="${env.FMOD}"/>
<target name="init">
<mkdir dir="ppc"/>
<mkdir dir="intel"/>
</target>
<target name="clean">
<delete failonerror="false">
<fileset dir="intel"/>
<fileset dir="ppc"/>
<fileset dir="." includes="liblwjgl-fmod3.jnilib"/>
<fileset dir="." includes="fmod3.symbols"/>
</delete>
</target>
<target name="compile">
<apply dir="${dstdir}" executable="${compiler}" os="Mac OS X" skipemptyfilesets="true" failonerror="true" dest="${dstdir}">
<arg line="${cflags} -O2 -Wall -c -fno-common -fPIC -I${sdkroot}/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers -I${native}/common -I${fmod.home}/api/inc"/>
<!-- Map from *.m and *.c to .o -->
<mapper type="regexp" from="^(.*)\.(c)" to="\1.o"/>
<fileset dir="${native}/common" includes="common_tools.c"/>
<fileset dir="${native}/common/fmod3" includes="*.c"/>
</apply>
</target>
<target name="link">
<apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
<arg line="${linkerflags} -single_module -exported_symbols_list ../fmod3.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon ${staticlibs}"/>
<fileset dir="${objdir}" includes="*.o"/>
</apply>
<apply dir="${objdir}" executable="strip" os="Mac OS X" failonerror="true">
<arg line="-S -X"/>
<fileset dir="." file="${libname}"/>
</apply>
</target>
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
<property name="legacy_sdkroot" location="/Developer/SDKs/MacOSX10.3.9.sdk"/>
<property name="universal_flags" value="-isysroot ${universal_sdkroot} -arch i386"/>
<property name="legacy_flags" value="-arch ppc"/>
<antcall target="compile">
<param name="dstdir" location="intel"/>
<param name="compiler" value="gcc-4.0"/>
<param name="sdkroot" location="${universal_sdkroot}"/>
<param name="cflags" value="${universal_flags}"/>
</antcall>
<antcall target="compile">
<param name="dstdir" location="ppc"/>
<param name="compiler" value="gcc-3.3"/>
<param name="sdkroot" location="${legacy_sdkroot}"/>
<param name="cflags" value="${legacy_flags}"/>
</antcall>
<exec vmlauncher="false" executable="../../platform_build/macosx_ant/build-symbol-list" output="fmod3.symbols" failonerror="true">
<arg path="intel"/>
</exec>
<antcall target="link">
<param name="objdir" location="intel"/>
<param name="libname" value="liblwjgl-fmod3-intel.jnilib"/>
<param name="linker" value="gcc-4.0"/>
<param name="linkerflags" value="${universal_flags}"/>
<param name="staticlibs" value="${fmod.home}/api/lib/libfmodx86.a"/>
</antcall>
<antcall target="link">
<param name="objdir" location="ppc"/>
<param name="libname" value="liblwjgl-fmod3-ppc.jnilib"/>
<param name="linker" value="gcc-3.3"/>
<param name="linkerflags" value="${legacy_flags}"/>
<param name="staticlibs" value="${fmod.home}/api/lib/libfmod.a"/>
</antcall>
<apply dir="." parallel="true" executable="lipo" os="Mac OS X" failonerror="true" skipemptyfilesets="true" >
<arg value="-create"/>
<srcfile/>
<arg value="-output"/>
<arg path="liblwjgl-fmod3.jnilib"/>
<fileset file="ppc/liblwjgl-fmod3-ppc.jnilib"/>
<fileset file="intel/liblwjgl-fmod3-intel.jnilib"/>
</apply>
</target>
</project>

View File

@ -1,52 +0,0 @@
<?xml version="1.0"?>
<project name="devil" basedir="../../bin/devil" default="compile">
<property name="native" location="../../src/native"/>
<property environment="env"/>
<property name="sdkhome" location="${env.MSSDK}"/>
<property name="fmodhome" location="${env.FMODHOME}"/>
<property name="dllname" value="lwjgl-devil.dll"/>
<target name="compile_dir">
<apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true">
<arg line="/Ox /Wp64 /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c /D WIN32 /c"/>
<arg value="/I${sdkhome}\include"/>
<arg value="/I${java.home}\..\include"/>
<arg value="/I${java.home}\..\include\win32"/>
<arg value="/I${native}\common"/>
<srcfile/>
<fileset dir="${native}/common/devil" includes="*.c"/>
<fileset dir="${native}/common" includes="*common*.c"/>
<mapper type="glob" from="*.c" to="*.obj"/>
</apply>
</target>
<target name="link">
<apply dir="." parallel="true" executable="cl" failonerror="true">
<arg line="/LD /nologo"/>
<srcfile/>
<arg line="/Fe${dllname} /link"/>
<arg value="/LIBPATH:${java.home}\..\lib"/>
<arg value="/LIBPATH:${sdkhome}\lib"/>
<arg value="/OPT:REF"/>
<arg value="/OPT:ICF"/>
<fileset dir="." includes="*.obj"/>
</apply>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.obj"/>
<fileset dir="." includes="*.dll"/>
<fileset dir="." includes="*.exp"/>
<fileset dir="." includes="*.lib"/>
</delete>
</target>
<target name="compile" depends="clean">
<property name="libs" value="user32.lib Gdi32.lib Advapi32.lib"/>
<antcall target="compile_dir"/>
<antcall target="link"/>
</target>
</project>

View File

@ -1,53 +0,0 @@
<?xml version="1.0"?>
<project name="fmod3" basedir="../../bin/fmod3" default="compile">
<property name="native" location="../../src/native"/>
<property environment="env"/>
<property name="sdkhome" location="${env.MSSDK}"/>
<property name="fmodhome" location="${env.FMODHOME}"/>
<property name="dllname" value="lwjgl-fmod3.dll"/>
<target name="compile_dir">
<apply dir="." failonerror="true" executable="cl" dest="." skipemptyfilesets="true">
<arg line="/Ox /Wp64 /W2 /nologo /Ox /Ob2 /Oi /Ot /Oy /FD /EHsc /MT /Gy /W2 /nologo /c /D WIN32 /c"/>
<arg value="/I${sdkhome}\include"/>
<arg value="/I${java.home}\..\include"/>
<arg value="/I${java.home}\..\include\win32"/>
<arg value="/I${native}\common"/>
<arg value="/I${fmodhome}\api\inc"/>
<srcfile/>
<fileset dir="${native}/common/fmod3" includes="*.c"/>
<fileset dir="${native}/common" includes="*common*.c"/>
<mapper type="glob" from="*.c" to="*.obj"/>
</apply>
</target>
<target name="link">
<apply dir="." parallel="true" executable="cl" failonerror="true">
<arg line="/LD /nologo"/>
<srcfile/>
<arg line="/Fe${dllname} /link"/>
<arg value="/LIBPATH:${java.home}\..\lib"/>
<arg value="/LIBPATH:${sdkhome}\lib"/>
<arg value="/OPT:REF"/>
<arg value="/OPT:ICF"/>
<fileset dir="." includes="*.obj"/>
</apply>
</target>
<target name="clean">
<delete>
<fileset dir="." includes="*.obj"/>
<fileset dir="." includes="*.dll"/>
<fileset dir="." includes="*.exp"/>
<fileset dir="." includes="*.lib"/>
</delete>
</target>
<target name="compile" depends="clean">
<property name="libs" value="user32.lib Gdi32.lib Advapi32.lib"/>
<antcall target="compile_dir"/>
<antcall target="link"/>
</target>
</project>

View File

@ -1,610 +0,0 @@
/*
* Copyright (c) 2002-2005 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.devil;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
/**
* <p>
* The core DevIL API.
* </p>
*
* @author captainjester <captainjester@users.sourceforge.net>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class IL {
public static final int IL_FALSE = 0;
public static final int IL_TRUE = 1;
// Matches OpenGL's right now.
public static final int IL_COLOUR_INDEX = 0x1900;
public static final int IL_COLOR_INDEX = 0x1900;
public static final int IL_RGB = 0x1907;
public static final int IL_RGBA = 0x1908;
public static final int IL_BGR = 0x80E0;
public static final int IL_BGRA = 0x80E1;
public static final int IL_LUMINANCE = 0x1909;
public static final int IL_BYTE = 0x1400;
public static final int IL_UNSIGNED_BYTE = 0x1401;
public static final int IL_SHORT = 0x1402;
public static final int IL_UNSIGNED_SHORT = 0x1403;
public static final int IL_INT = 0x1404;
public static final int IL_UNSIGNED_INT = 0x1405;
public static final int IL_FLOAT = 0x1406;
public static final int IL_DOUBLE = 0x140A;
public static final int IL_VENDOR = 0x1F00;
// IL-specific public const's
public static final int IL_LOAD_EXT = 0x1F01;
public static final int IL_SAVE_EXT = 0x1F02;
// Attribute Bits
public static final int IL_ORIGIN_BIT = 0x1;
public static final int IL_FILE_BIT = 0x2;
public static final int IL_PAL_BIT = 0x4;
public static final int IL_FORMAT_BIT = 0x8;
public static final int IL_TYPE_BIT = 0x10;
public static final int IL_COMPRESS_BIT = 0x20;
public static final int IL_LOADFAIL_BIT = 0x40;
public static final int IL_FORMAT_SPECIFIC_BIT = 0x80;
public static final int IL_ALL_ATTRIB_BITS = 0xFFFFF;
// Palette types
public static final int IL_PAL_NONE = 0x400;
public static final int IL_PAL_RGB24 = 0x401;
public static final int IL_PAL_RGB32 = 0x402;
public static final int IL_PAL_RGBA32 = 0x403;
public static final int IL_PAL_BGR24 = 0x404;
public static final int IL_PAL_BGR32 = 0x405;
public static final int IL_PAL_BGRA32 = 0x406;
// Image types
public static final int IL_TYPE_UNKNOWN = 0x0;
public static final int IL_BMP = 0x420;
public static final int IL_CUT = 0x421;
public static final int IL_DOOM = 0x422;
public static final int IL_DOOM_FLAT = 0x423;
public static final int IL_ICO = 0x424;
public static final int IL_JPG = 0x425;
public static final int IL_LBM = 0x426;
public static final int IL_PCD = 0x427;
public static final int IL_PCX = 0x428;
public static final int IL_PIC = 0x429;
public static final int IL_PNG = 0x42A;
public static final int IL_PNM = 0x42B;
public static final int IL_SGI = 0x42C;
public static final int IL_TGA = 0x42D;
public static final int IL_TIF = 0x42E;
public static final int IL_CHEAD = 0x42F;
public static final int IL_RAW = 0x430;
public static final int IL_MDL = 0x431;
public static final int IL_WAL = 0x432;
public static final int IL_OIL = 0x433;
public static final int IL_LIF = 0x434;
public static final int IL_MNG = 0x435;
public static final int IL_JNG = 0x435;
public static final int IL_GIF = 0x436;
public static final int IL_DDS = 0x437;
public static final int IL_DCX = 0x438;
public static final int IL_PSD = 0x439;
public static final int IL_EXIF = 0x43A;
public static final int IL_PSP = 0x43B;
public static final int IL_PIX = 0x43C;
public static final int IL_PXR = 0x43D;
public static final int IL_XPM = 0x43E;
public static final int IL_JASC_PAL = 0x475;
// Error Types
public static final int IL_NO_ERROR = 0x0;
public static final int IL_INVALID_ENUM = 0x501;
public static final int IL_OUT_OF_MEMORY = 0x502;
public static final int IL_FORMAT_NOT_SUPPORTED = 0x503;
public static final int IL_INTERNAL_ERROR = 0x504;
public static final int IL_INVALID_VALUE = 0x505;
public static final int IL_ILLEGAL_OPERATION = 0x506;
public static final int IL_ILLEGAL_FILE_VALUE = 0x507;
public static final int IL_INVALID_FILE_HEADER = 0x508;
public static final int IL_INVALID_PARAM = 0x509;
public static final int IL_COULD_NOT_OPEN_FILE = 0x50A;
public static final int IL_INVALID_EXTENSION = 0x50B;
public static final int IL_FILE_ALREADY_EXISTS = 0x50C;
public static final int IL_OUT_FORMAT_SAME = 0x50D;
public static final int IL_STACK_OVERFLOW = 0x50E;
public static final int IL_STACK_UNDERFLOW = 0x50F;
public static final int IL_INVALID_CONVERSION = 0x510;
public static final int IL_BAD_DIMENSIONS = 0x511;
public static final int IL_FILE_READ_ERROR = 0x512;
public static final int IL_LIB_GIF_ERROR = 0x5E1;
public static final int IL_LIB_JPEG_ERROR = 0x5E2;
public static final int IL_LIB_PNG_ERROR = 0x5E3;
public static final int IL_LIB_TIFF_ERROR = 0x5E4;
public static final int IL_LIB_MNG_ERROR = 0x5E5;
public static final int IL_UNKNOWN_ERROR = 0x5FF;
// Origin Definitions
public static final int IL_ORIGIN_SET = 0x600;
public static final int IL_ORIGIN_LOWER_LEFT = 0x601;
public static final int IL_ORIGIN_UPPER_LEFT = 0x602;
public static final int IL_ORIGIN_MODE = 0x603;
// Format and Type Mode Definitions
public static final int IL_FORMAT_SET = 0x610;
public static final int IL_FORMAT_MODE = 0x611;
public static final int IL_TYPE_SET = 0x612;
public static final int IL_TYPE_MODE = 0x613;
// File definitions
public static final int IL_FILE_OVERWRITE = 0x620;
public static final int IL_FILE_MODE = 0x621;
// Palette definitions
public static final int IL_CONV_PAL = 0x630;
// Load fail definitions
public static final int IL_DEFAULT_ON_FAIL = 0x632;
// Key colour definitions
public static final int IL_USE_KEY_COLOUR = 0x635;
public static final int IL_USE_KEY_COLOR = 0x635;
// Interlace definitions
public static final int IL_SAVE_INTERLACED = 0x639;
public static final int IL_INTERLACE_MODE = 0x63A;
// Quantization definitions
public static final int IL_QUANTIZATION_MODE = 0x640;
public static final int IL_WU_QUANT = 0x641;
public static final int IL_NEU_QUANT = 0x642;
public static final int IL_NEU_QUANT_SAMPLE = 0x643;
// Hints
public static final int IL_FASTEST = 0x660;
public static final int IL_LESS_MEM = 0x661;
public static final int IL_DONT_CARE = 0x662;
public static final int IL_MEM_SPEED_HINT = 0x665;
public static final int IL_USE_COMPRESSION = 0x666;
public static final int IL_NO_COMPRESSION = 0x667;
public static final int IL_COMPRESSION_HINT = 0x668;
// Subimage types
public static final int IL_SUB_NEXT = 0x680;
public static final int IL_SUB_MIPMAP = 0x681;
public static final int IL_SUB_LAYER = 0x682;
// Compression definitions (mostly for .oil)
public static final int IL_COMPRESS_MODE = 0x700;
public static final int IL_COMPRESS_NONE = 0x701;
public static final int IL_COMPRESS_RLE = 0x702;
public static final int IL_COMPRESS_LZO = 0x703;
public static final int IL_COMPRESS_ZLIB = 0x704;
// File format-specific values
public static final int IL_TGA_CREATE_STAMP = 0x710;
public static final int IL_JPG_QUALITY = 0x711;
public static final int IL_PNG_INTERLACE = 0x712;
public static final int IL_TGA_RLE = 0x713;
public static final int IL_BMP_RLE = 0x714;
public static final int IL_SGI_RLE = 0x715;
public static final int IL_TGA_ID_STRING = 0x717;
public static final int IL_TGA_AUTHNAME_STRING = 0x718;
public static final int IL_TGA_AUTHCOMMENT_STRING = 0x719;
public static final int IL_PNG_AUTHNAME_STRING = 0x71A;
public static final int IL_PNG_TITLE_STRING = 0x71B;
public static final int IL_PNG_DESCRIPTION_STRING = 0x71C;
public static final int IL_TIF_DESCRIPTION_STRING = 0x71D;
public static final int IL_TIF_HOSTCOMPUTER_STRING = 0x71E;
public static final int IL_TIF_DOCUMENTNAME_STRING = 0x71F;
public static final int IL_TIF_AUTHNAME_STRING = 0x720;
public static final int IL_JPG_SAVE_FORMAT = 0x721;
public static final int IL_CHEAD_HEADER_STRING = 0x722;
public static final int IL_PCD_PICNUM = 0x723;
// DXTC definitions
public static final int IL_DXTC_FORMAT = 0x705;
public static final int IL_DXT1 = 0x706;
public static final int IL_DXT2 = 0x707;
public static final int IL_DXT3 = 0x708;
public static final int IL_DXT4 = 0x709;
public static final int IL_DXT5 = 0x70A;
public static final int IL_DXT_NO_COMP = 0x70B;
public static final int IL_KEEP_DXTC_DATA = 0x70C;
public static final int IL_DXTC_DATA_FORMAT = 0x70D;
// Cube map definitions
public static final int IL_CUBEMAP_POSITIVEX = 0x400;
public static final int IL_CUBEMAP_NEGATIVEX = 0x800;
public static final int IL_CUBEMAP_POSITIVEY = 0x1000;
public static final int IL_CUBEMAP_NEGATIVEY = 0x2000;
public static final int IL_CUBEMAP_POSITIVEZ = 0x4000;
public static final int IL_CUBEMAP_NEGATIVEZ = 0x8000;
// Values
public static final int IL_VERSION_NUM = 0xDE2;
public static final int IL_IMAGE_WIDTH = 0xDE4;
public static final int IL_IMAGE_HEIGHT = 0xDE5;
public static final int IL_IMAGE_DEPTH = 0xDE6;
public static final int IL_IMAGE_SIZE_OF_DATA = 0xDE7;
public static final int IL_IMAGE_BPP = 0xDE8;
public static final int IL_IMAGE_BYTES_PER_PIXEL = 0xDE8;
public static final int IL_IMAGE_BITS_PER_PIXEL = 0xDE9;
public static final int IL_IMAGE_FORMAT = 0xDEA;
public static final int IL_IMAGE_TYPE = 0xDEB;
public static final int IL_PALETTE_TYPE = 0xDEC;
public static final int IL_PALETTE_SIZE = 0xDED;
public static final int IL_PALETTE_BPP = 0xDEE;
public static final int IL_PALETTE_NUM_COLS = 0xDEF;
public static final int IL_PALETTE_BASE_TYPE = 0xDF0;
public static final int IL_NUM_IMAGES = 0xDF1;
public static final int IL_NUM_MIPMAPS = 0xDF2;
public static final int IL_NUM_LAYERS = 0xDF3;
public static final int IL_ACTIVE_IMAGE = 0xDF4;
public static final int IL_ACTIVE_MIPMAP = 0xDF5;
public static final int IL_ACTIVE_LAYER = 0xDF6;
public static final int IL_CUR_IMAGE = 0xDF7;
public static final int IL_IMAGE_DURATION = 0xDF8;
public static final int IL_IMAGE_PLANESIZE = 0xDF9;
public static final int IL_IMAGE_BPC = 0xDFA;
public static final int IL_IMAGE_OFFX = 0xDFB;
public static final int IL_IMAGE_OFFY = 0xDFC;
public static final int IL_IMAGE_CUBEFLAGS = 0xDFD;
public static final int IL_SEEK_SET = 0;
public static final int IL_SEEK_CUR = 1;
public static final int IL_SEEK_END = 2;
public static final int IL_EOF = -1;
/**
* Return the version of the DevIL-LWJGL binding as a String.
*/
public static String getVersion() {
return ILNative.VERSION;
}
public static native boolean ilActiveImage(int Number);
public static native boolean ilActiveLayer(int Number);
public static native boolean ilActiveMipmap(int Number);
public static native boolean ilApplyPal(String FileName);
public static native boolean ilApplyProfile(String InProfile, String OutProfile);
public static native void ilBindImage(int image);
public static native boolean ilBlit(int Source, int DestX, int DestY,
int DestZ, int SrcX, int SrcY, int SrcZ,
int Width, int Height, int Depth);
public static native void ilClearColour(float Red, float Green, float Blue, float Alpha);
public static native boolean ilClearImage();
public static native int ilCloneCurImage();
public static native boolean ilCompressFunc(int Mode);
public static native boolean ilConvertImage(int DestFormat, int DestType);
public static native boolean ilConvertPal(int DestFormat);
public static native boolean ilCopyImage(int Src);
public static int ilCopyPixels( int XOff, int YOff, int ZOff,
int Width, int Height, int Depth,
int Format, int Type, ByteBuffer Data) {
BufferChecks.checkDirect(Data);
return nilCopyPixels(XOff, YOff, ZOff, Width, Height, Depth, Format, Type, Data, Data.position());
}
private static native int nilCopyPixels(int XOff, int YOff, int ZOff, int Width,
int Height, int Depth, int Format,
int Type, ByteBuffer Data, int data_offset);
public static native int ilCreateSubImage(int Type, int Num);
public static native boolean ilDefaultImage();
public static void ilDeleteImages(IntBuffer images) {
BufferChecks.checkDirect(images);
nilDeleteImages(images.remaining(), images, images.position());
}
private static native void nilDeleteImages(int num, IntBuffer images, int images_offset);
public static native boolean ilDisable(int Mode);
public static native boolean ilEnable(int Mode);
public static native boolean ilFormatFunc(int Mode);
public static void ilGenImages(IntBuffer images) {
BufferChecks.checkDirect(images);
nilGenImages(images.remaining(), images, images.position());
}
private static native void nilGenImages(int num, IntBuffer images, int images_offset);
public static native ByteBuffer ilGetAlpha(int Type);
public static native void ilModAlpha(int AlphaValue);
public static native void ilSetAlpha(int AlphaValue);
public static native boolean ilGetBoolean(int Mode);
public static void ilGetBooleanv(int mode, ByteBuffer param) {
nilGetBooleanv(mode, param, param.position());
}
private static native void nilGetBooleanv(int mode, ByteBuffer param, int position);
public static void ilGetIntegerv(int mode, IntBuffer param) {
nilGetIntegerv(mode, param, param.position());
}
private static native void nilGetIntegerv(int mode, IntBuffer param, int position);
public static native ByteBuffer ilGetData();
public static native int ilGetError();
public static native int ilGetInteger(int mode);
public static native int ilGetLumpPos();
public static native ByteBuffer ilGetPalette();
public static native String ilGetString(int StringName);
public static native void ilHint(int Target, int Mode);
static native void ilInit();
public static native boolean ilIsDisabled(int Mode);
public static native boolean ilIsEnabled(int Mode);
public static native boolean ilIsImage(int Image);
public static native boolean ilIsValid(int Type, String FileName);
public static boolean ilIsValidL(int Type, ByteBuffer Lump) {
BufferChecks.checkDirect(Lump);
return nilIsValidL(Type, Lump, Lump.position(), Lump.remaining());
}
private static native boolean nilIsValidL(int Type, ByteBuffer Lump, int lump_offset, int Size);
public static native void ilKeyColour(float Red, float Green, float Blue, float Alpha);
public static native boolean ilLoad(int Type, String FileName);
public static native boolean ilLoadImage(String fileName);
public static boolean ilLoadL(int Type, ByteBuffer Lump) {
BufferChecks.checkDirect(Lump);
return nilLoadL(Type, Lump, Lump.position(), Lump.remaining());
}
private static native boolean nilLoadL(int Type, ByteBuffer Lump, int lump_offset, int Size);
public static native boolean ilLoadPal(String FileName);
public static native boolean ilOriginFunc(int Mode);
public static native boolean ilOverlayImage(int Source, int XCoord, int YCoord, int ZCoord);
public static native void ilPopAttrib();
public static native void ilPushAttrib(int Bits);
public static native boolean ilRemoveLoad(String Ext);
public static native boolean ilRemoveSave(String Ext);
public static native void ilResetMemory();
public static native void ilResetRead();
public static native void ilResetWrite();
public static native boolean ilSave(int Type, String FileName);
public static native boolean ilSaveImage(String FileName);
public static int ilSaveL(int Type, ByteBuffer Lump) {
BufferChecks.checkDirect(Lump);
return nilSaveL(Type, Lump, Lump.position(), Lump.remaining());
}
private static native int nilSaveL(int Type, ByteBuffer Lump, int lump_offset, int Size);
public static native boolean ilSavePal(String FileName);
public static boolean ilSetData(ByteBuffer Data) {
BufferChecks.checkDirect(Data);
return nilSetData(Data, Data.position());
}
private static native boolean nilSetData(ByteBuffer Data, int data_offset);
public static native boolean ilSetDuration(int Duration);
public static native void ilSetInteger(int Mode, int Param);
public static void ilSetPixels( int XOff, int YOff, int ZOff, int Width,
int Height, int Depth, int Format, int Type, ByteBuffer Data) {
BufferChecks.checkDirect(Data);
nilSetPixels(XOff, YOff, ZOff, Width, Height, Depth, Format, Type, Data, Data.position());
}
private static native void nilSetPixels(int XOff, int YOff, int ZOff, int Width,
int Height, int Depth, int Format,
int Type, ByteBuffer Data, int data_offset);
public static native void ilSetString(int Mode, String string);
public static native void ilShutDown();
public static boolean ilTexImage( int Width, int Height, int Depth, byte Bpp,
int Format, int Type, ByteBuffer Data) {
BufferChecks.checkDirect(Data);
return nilTexImage(Width, Height, Depth, Bpp, Format, Type, Data, Data.position());
}
private static native boolean nilTexImage(int Width, int Height, int Depth, byte Bpp,
int Format, int Type, ByteBuffer Data, int data_offset);
public static native boolean ilTypeFunc(int Mode);
public static native boolean ilLoadData(String FileName, int Width, int Height, int Depth, byte Bpp);
public static boolean ilLoadDataL(ByteBuffer Lump, int Size, int Width, int Height, int Depth, byte Bpp) {
BufferChecks.checkDirect(Lump);
return nilLoadDataL(Lump, Lump.position(), Size, Width, Height, Depth, Bpp);
}
private static native boolean nilLoadDataL(ByteBuffer Lump, int lump_offset, int Size, int Width, int Height,
int Depth, byte Bpp);
public static native boolean ilSaveData(String FileName);
/**
* Determines the IL type for file passed
*
* @param filename File to determine type for
* @return IL type, or IL_TYPE_UNKNOWN if undeterminable
*/
public static int ilGetType(String extension) {
// Save having to use equalsIgnoreCase all the time
extension = extension.toLowerCase();
int type = IL_TYPE_UNKNOWN;
if (extension.equals("bmp")) {
type = IL_BMP;
} else if (extension.equals("cut")) {
type = IL_CUT;
} else if (extension.equals("gif")) {
type = IL_GIF;
} else if (extension.equals("ico")) {
type = IL_ICO;
} else if (extension.equals("jpg")) {
type = IL_JPG;
} else if (extension.equals("lif")) {
type = IL_LIF;
} else if (extension.equals("mng")) {
type = IL_MNG;
} else if (extension.equals("pcd")) {
type = IL_PCD;
} else if (extension.equals("pcx")) {
type = IL_PCX;
} else if (extension.equals("pic")) {
type = IL_PIC;
} else if (extension.equals("png")) {
type = IL_PNG;
} else if (extension.equals("pbm") || extension.equals("pgm")
|| extension.equals("ppm")) {
type = IL_PNM;
} else if (extension.equals("psd")) {
type = IL_PSD;
} else if (extension.equals("psp")) {
type = IL_PSP;
} else if (extension.equals("bw") || extension.equals("rgb")
|| extension.equals("rgba") || extension.equals("sgi")) {
type = IL_SGI;
} else if (extension.equals("tga")) {
type = IL_TGA;
} else if (extension.equals("tif") || extension.equals("tiff")) {
type = IL_TIF;
} else if (extension.equals("dds")) {
type = IL_DDS;
} else if (extension.equals("raw")) {
type = IL_RAW;
} else if (extension.equals("lbm")) {
type = IL_LBM;
} else if (extension.equals("jng")) {
type = IL_JNG;
} else if (extension.equals("wal")) {
type = IL_WAL;
} else if (extension.equals("pix")) {
type = IL_PIX;
} else if (extension.equals("mdl")) {
type = IL_MDL;
} else if (extension.equals("exif")) {
type = IL_EXIF;
} else if (extension.equals("oil")) {
type = IL_OIL;
} else if (extension.equals("dcx")) {
type = IL_DCX;
} else if (extension.equals("pxr")) {
type = IL_PXR;
} else if (extension.equals("xpm")) {
type = IL_XPM;
} else if (extension.equals("pal")) {
type = IL_JASC_PAL;
} else if (extension.equals("h")) {
type = IL_CHEAD;
}
return type;
}
/**
* Loads an image from the specified url
*
* @param url URL to load from
* @return true if image was loaded
*/
public static boolean ilLoadFromURL(URL url) throws IOException {
int type = IL_TYPE_UNKNOWN;
String file = url.toString();
int index = file.lastIndexOf('.');
if (index != -1) {
String extension = file.substring(index + 1);
type = ilGetType(extension);
}
return ilLoadFromStream(url.openStream(), type);
}
/**
* Reads an image from an inputstream
*
* @param stream Stream to read from
* @param type Type of image to expect
* @return true if image was loaded
*/
public static boolean ilLoadFromStream(InputStream stream, int type) throws IOException {
boolean result = false;
int lastRead = 0;
byte[] buffer = new byte[4096];
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedInputStream buf = new BufferedInputStream(stream);
try {
while((lastRead = buf.read(buffer, 0, buffer.length)) != -1) {
baos.write(buffer, 0, lastRead);
}
buffer = baos.toByteArray();
ByteBuffer lump = ByteBuffer.allocateDirect(buffer.length);
lump.put(buffer);
lump.flip();
result = ilLoadL(type, lump);
} catch (IOException e) {
try {
buf.close();
} catch (IOException f ) {}
throw e;
}
return result;
}
/** Have we been created? */
protected static boolean created;
/**
* Creates a new instance of IL.
*/
public static void create() throws LWJGLException {
if (created) {
return;
}
ILNative.createIL();
created = true;
}
/**
* Exit cleanly by calling destroy.
*/
public static void destroy() {
if (created) {
ILNative.destroyIL();
created = false;
}
}
/**
* @return true if DevIL has been created
*/
public static boolean isCreated() {
return created;
}
}

View File

@ -1,214 +0,0 @@
/*
* Copyright (c) 2002-2005 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.devil;
import java.io.File;
import java.security.AccessController;
import java.security.PrivilegedAction;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
/**
* <p>
* Native interface for DevIL
* </p>
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
class ILNative {
/** The native JNI library name */
private static String JNI_LIBRARY_NAME = "lwjgl-devil";
/** Version of IL */
static final String VERSION = "1.1.4";
/** Current version of the JNI library */
static final int JNI_VERSION = 2;
private static void loadLibrary(final String lib_name) {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
String library_path = System.getProperty("org.lwjgl.librarypath");
if (library_path != null) {
System.load(library_path + File.separator +
System.mapLibraryName(lib_name));
} else {
System.loadLibrary(lib_name);
}
return null;
}
});
}
static {
loadLibrary(JNI_LIBRARY_NAME);
// check for mismatch
int nativeVersion = getNativeLibraryVersion();
if (nativeVersion != JNI_VERSION) {
throw new LinkageError(
"Version mismatch: jar version is '" + JNI_VERSION +
"', native libary version is '" + nativeVersion + "'");
}
}
// IL
// ===========================================================
static native void initNativeStubsIL(Class clazz) throws LWJGLException;
static native void resetNativeStubsIL(Class clazz);
static native void nCreateIL(String[] ilPaths) throws LWJGLException;
static native void nDestroyIL();
private static native int getNativeLibraryVersion();
static void createIL() throws LWJGLException {
String libname;
String platform_libname;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_WINDOWS:
libname = "DevIL";
platform_libname = "DevIL.dll";
break;
case LWJGLUtil.PLATFORM_LINUX:
libname = "IL";
platform_libname = "libIL.so";
break;
case LWJGLUtil.PLATFORM_MACOSX:
libname = "IL";
platform_libname = "libIL.dylib";
break;
default:
throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
}
String[] illPaths = LWJGLUtil.getLibraryPaths(libname, platform_libname, IL.class.getClassLoader());
ILNative.nCreateIL(illPaths);
try {
ILNative.initNativeStubsIL(IL.class);
IL.ilInit();
} catch (LWJGLException e) {
IL.destroy();
throw e;
}
}
public static void destroyIL() {
ILNative.resetNativeStubsIL(IL.class);
ILNative.nDestroyIL();
}
// -----------------------------------------------------------
// ILU
// ===========================================================
static native void initNativeStubsILU(Class clazz) throws LWJGLException;
static native void resetNativeStubsILU(Class clazz);
static native void nCreateILU(String[] iluPaths) throws LWJGLException;
static native void nDestroyILU();
static void createILU() throws LWJGLException {
String libname;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_WINDOWS:
libname = "ILU.dll";
break;
case LWJGLUtil.PLATFORM_LINUX:
libname = "libILU.so";
break;
case LWJGLUtil.PLATFORM_MACOSX:
libname = "libILU.dylib";
break;
default:
throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
}
String[] iluPaths = LWJGLUtil.getLibraryPaths("ILU", libname, ILU.class.getClassLoader());
ILNative.nCreateILU(iluPaths);
try {
ILNative.initNativeStubsILU(ILU.class);
ILU.iluInit();
} catch (LWJGLException e) {
ILU.destroy();
throw e;
}
}
public static void destroyILU() {
ILNative.resetNativeStubsILU(ILU.class);
ILNative.nDestroyILU();
}
// -----------------------------------------------------------
// ILU
// ===========================================================
static native void initNativeStubsILUT(Class clazz) throws LWJGLException;
static native void resetNativeStubsILUT(Class clazz);
static native void nCreateILUT(String[] ilutPaths) throws LWJGLException;
static native void nDestroyILUT();
static void createILUT() throws LWJGLException {
String libname;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_WINDOWS:
libname = "ILUT.dll";
break;
case LWJGLUtil.PLATFORM_LINUX:
libname = "libILUT.so";
break;
case LWJGLUtil.PLATFORM_MACOSX:
libname = "libILUT.dylib";
break;
default:
throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
}
String[] ilutPaths = LWJGLUtil.getLibraryPaths("ILUT", libname, ILUT.class.getClassLoader());
ILNative.nCreateILUT(ilutPaths);
try {
ILNative.initNativeStubsILUT(ILUT.class);
ILUT.ilutInit();
} catch (LWJGLException e) {
ILUT.destroy();
throw e;
}
}
public static void destroyILUT() {
ILNative.resetNativeStubsILUT(ILUT.class);
ILNative.nDestroyILUT();
}
// -----------------------------------------------------------
}

View File

@ -1,178 +0,0 @@
/*
* Copyright (c) 2002-2005 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.devil;
import java.nio.IntBuffer;
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
/**
* <p>
* The DevIL ILU API.
* </p>
*
* @author captainjester <captainjester@users.sourceforge.net>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class ILU {
public static final int ILU_FILTER = 0x2600;
public static final int ILU_NEAREST = 0x2601;
public static final int ILU_LINEAR = 0x2602;
public static final int ILU_BILINEAR = 0x2603;
public static final int ILU_SCALE_BOX = 0x2604;
public static final int ILU_SCALE_TRIANGLE = 0x2605;
public static final int ILU_SCALE_BELL = 0x2606;
public static final int ILU_SCALE_BSPLINE = 0x2607;
public static final int ILU_SCALE_LANCZOS3 = 0x2608;
public static final int ILU_SCALE_MITCHELL = 0x2609;
// Error types
public static final int ILU_INVALID_ENUM = 0x0501;
public static final int ILU_OUT_OF_MEMORY = 0x0502;
public static final int ILU_INTERNAL_ERROR = 0x0504;
public static final int ILU_INVALID_VALUE = 0x0505;
public static final int ILU_ILLEGAL_OPERATION = 0x0506;
public static final int ILU_INVALID_PARAM = 0x0509;
// Values
public static final int ILU_PLACEMENT = 0x0700;
public static final int ILU_LOWER_LEFT = 0x0701;
public static final int ILU_LOWER_RIGHT = 0x0702;
public static final int ILU_UPPER_LEFT = 0x0703;
public static final int ILU_UPPER_RIGHT = 0x0704;
public static final int ILU_CENTER = 0x0705;
public static final int ILU_CONVOLUTION_MATRIX = 0x0710;
public static final int ILU_VERSION_NUM = IL.IL_VERSION_NUM;
public static final int ILU_VENDOR = IL.IL_VENDOR;
public static native boolean iluAlienify();
public static native boolean iluBlurAvg(int iter);
public static native boolean iluBlurGaussian(int iter);
public static native boolean iluBuildMipmaps();
public static native int iluColoursUsed();
public static native boolean iluCompareImage(int comp);
public static native boolean iluContrast(float contrast);
public static native boolean iluCrop(int xOff, int yOff, int zOff, int width, int height, int depth);
public static native void iluDeleteImage(int id);
public static native boolean iluEdgeDetectE();
public static native boolean iluEdgeDetectP();
public static native boolean iluEdgeDetectS();
public static native boolean iluEmboss();
public static native boolean iluEnlargeCanvas(int width, int height, int depth);
public static native boolean iluEnlargeImage(float xDim, float yDim, float zDim);
public static native boolean iluEqualize();
public static native String iluErrorString(int error);
public static native boolean iluFlipImage();
public static native boolean iluGammaCorrect(float gamma);
public static native int iluGenImage();
public static native void iluGetImageInfo(ILinfo info);
public static native int iluGetInteger(int mode);
public static void iluGetIntegerv(int mode, IntBuffer param) {
BufferChecks.checkDirect(param);
niluGetIntegerv(mode, param, param.position());
}
private static native void niluGetIntegerv(int mode, IntBuffer param, int param_offset);
public static native String iluGetString(int stringName);
public static native void iluImageParameter(int pName, int param);
static native void iluInit();
public static native boolean iluInvertAlpha();
public static native int iluLoadImage(String fileName);
public static native boolean iluMirror();
public static native boolean iluNegative();
public static native boolean iluNoisify(float tolerance);
public static native boolean iluPixelize(int pixSize);
public static native boolean iluReplaceColour(byte red, byte green, byte blue, float tolerance);
public static native boolean iluRotate(float angle);
public static native boolean iluSaturate1f(float saturation);
public static native boolean iluSaturate4f(float r, float g, float b, float saturation);
public static native boolean iluScale(int width, int height, int depth);
public static native boolean iluScaleColours(float r, float g, float b);
public static native boolean iluSharpen(float factor, int iter);
public static native boolean iluSwapColours();
public static native boolean iluWave(float angle);
// public static native void iluRegionfv(ILpointf points[], int n);
// public static native void iluRegioniv(ILpointi points[], int n);
// public static native boolean iluRotate3D(float x, float y, float z, float Angle);
/* DevIL lib allows both spellings of colour. We support that too */
// ========================================================================
public static void iluColorsUsed() {
iluColoursUsed();
}
public static void iluSwapColors() {
iluSwapColours();
}
public static void iluReplaceColor(byte red, byte green, byte blue, float tolerance) {
iluReplaceColour(red, green, blue, tolerance);
}
public static void iluScaleColors(float r, float g, float b) {
iluScaleColours(r, g, b);
}
// ------------------------------------------------------------------------
/** Have we been created? */
protected static boolean created;
/**
* Creates a new instance of ILU. Cannot be created unless IL has been created.
*/
public static void create() throws LWJGLException {
if(!IL.isCreated()) {
throw new LWJGLException("Cannot create ILU without having created IL instance");
}
ILNative.createILU();
created = true;
}
/**
* Exit cleanly by calling destroy.
*/
public static void destroy() {
if (created) {
ILNative.destroyILU();
created = false;
}
}
/**
* @return true if ILU has been created
*/
public static boolean isCreated() {
return created;
}
}

View File

@ -1,147 +0,0 @@
/*
* Copyright (c) 2002-2005 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.devil;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.LWJGLException;
/**
* <p>
* The DevIL ILUT API.
* </p>
*
* @author captainjester <captainjester@users.sourceforge.net>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class ILUT {
// Attribute Bits
public static final int ILUT_OPENGL_BIT = 0x00000001;
public static final int ILUT_ALL_ATTRIB_BITS = 0x000FFFFF;
// Error Types
public static final int ILUT_INVALID_ENUM = 0x0501;
public static final int ILUT_OUT_OF_MEMORY = 0x0502;
public static final int ILUT_INVALID_VALUE = 0x0505;
public static final int ILUT_ILLEGAL_OPERATION = 0x0506;
public static final int ILUT_INVALID_PARAM = 0x0509;
public static final int ILUT_COULD_NOT_OPEN_FILE = 0x050A;
public static final int ILUT_STACK_OVERFLOW = 0x050E;
public static final int ILUT_STACK_UNDERFLOW = 0x050F;
public static final int ILUT_BAD_DIMENSIONS = 0x0511;
public static final int ILUT_NOT_SUPPORTED = 0x0550;
// State Definitions
public static final int ILUT_PALETTE_MODE = 0x0600;
public static final int ILUT_OPENGL_CONV = 0x0610;
public static final int ILUT_MAXTEX_WIDTH = 0x0630;
public static final int ILUT_MAXTEX_HEIGHT = 0x0631;
public static final int ILUT_MAXTEX_DEPTH = 0x0632;
public static final int ILUT_GL_USE_S3TC = 0x0634;
public static final int ILUT_GL_GEN_S3TC = 0x0635;
public static final int ILUT_GL_AUTODETECT_TEXTURE_TARGET = 0x0807;
// The different rendering api's...more to be added later?
public static final int ILUT_OPENGL = 0;
public static final int ILUT_VENDOR = IL.IL_VENDOR;
public static final int ILUT_VERSION_NUM = IL.IL_VERSION_NUM;
public static native boolean ilutRenderer(int renderer);
public static native boolean ilutDisable(int mode);
public static native boolean ilutEnable(int mode);
public static native boolean ilutGetBoolean(int mode);
public static native int ilutGetInteger(int mode);
public static native void ilutGetBooleanv(int mode, ByteBuffer param);
public static native void ilutGetIntegerv(int mode, IntBuffer Param);
public static native String ilutGetString(int stringName);
static native void ilutInit();
public static native boolean ilutIsDisabled(int mode);
public static native boolean ilutIsEnabled(int mode);
public static native void ilutPopAttrib();
public static native void ilutPushAttrib(int bits);
public static native void ilutSetInteger(int Mode, int param);
// ImageLib Utility Toolkit's OpenGL Functions
public static native int ilutGLBindTexImage();
public static native int ilutGLBindMipmaps();
public static native boolean ilutGLBuildMipmaps();
public static native int ilutGLLoadImage(String fileName);
public static native boolean ilutGLScreen();
public static native boolean ilutGLScreenie();
public static native boolean ilutGLSaveImage(String fileName, int texID);
public static native boolean ilutGLSetTex(int texID);
public static native boolean ilutGLTexImage(int level);
/** Have we been created? */
protected static boolean created;
/**
* Creates a new instance of ILUT. Cannot be created unless IL has been created.
*/
public static void create() throws LWJGLException {
if(!IL.isCreated()) {
throw new LWJGLException("Cannot create ILUT without having created IL instance");
}
if(!ILU.isCreated()) {
throw new LWJGLException("Cannot create ILUT without having created ILU instance");
}
ILNative.createILUT();
created = true;
}
/**
* Exit cleanly by calling destroy.
*/
public static void destroy() {
if (created) {
ILNative.destroyILUT();
created = false;
}
}
/**
* @return true if ILUT has been created
*/
public static boolean isCreated() {
return created;
}
}

View File

@ -1,60 +0,0 @@
/*
* Copyright (c) 2002-2005 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.devil;
/**
*
* ILinfo information holding class.
*
* @author captainjester <captainjester@users.sourceforge.net>
* @version $Revision$
* $Id$
*/
public class ILinfo {
public int id; // the image's id
public byte data[]; // the image's data
public int width; // the image's width
public int height; // the image's height
public int depth; // the image's depth
public byte bpp; // bytes per pixel (not bits) of the image
public int sizeOfData; // the total size of the data (in bytes)
public int format; // image format (in IL enum style)
public int type; // image type (in IL enum style)
public int origin; // origin of the image
public byte palette[]; // the image's palette
public int palType; // palette type
public int palSize; // palette size
public int cubeFlags; // flags for what cube map sides are present
public int numNext; // number of images following
public int numMips; // number of mipmaps
public int numLayers; // number of layers
}

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2002-2005 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.devil;
/**
*
* ILpointf information holding class.
*
* @author captainjester <captainjester@users.sourceforge.net>
* @version $Revision$
* $Id$
*/
public class ILpointf {
public float x;
public float y;
}

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2002-2005 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.devil;
/**
*
* ILpointi information holding class.
*
* @author captainjester <captainjester@users.sourceforge.net>
* @version $Revision$
* $Id$
*/
public class ILpointi {
public int x;
public int y;
}

View File

@ -1,402 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.io.File;
import java.lang.reflect.Method;
import java.nio.FloatBuffer;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.HashMap;
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
/**
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FMOD {
/** Array of hashmaps for callbacks */
private static HashMap[] callbacks = new HashMap[17];
/** FMOD System level clear dsp unit */
static FSoundDSPUnit fmodClearUnit;
/** FMOD System level clip and copy dsp unit */
static FSoundDSPUnit fmodClipAndCopyUnit;
/** FMOD System level music dsp unit */
static FSoundDSPUnit fmodMusicUnit;
/** FMOD System level sound effects dsp unit */
static FSoundDSPUnit fmodSFXUnit;
/** FMOD System level FFT dsp unit */
static FSoundDSPUnit fmodFFTUnit;
/** FMOD System level FFT buffer */
static FloatBuffer fmodFFTBuffer;
/** Type defining the music callback entries in callback hashmap array */
public static final int FMUSIC_INSTCALLBACK = 0;
/** Type defining the music callback entries in callback hashmap array */
public static final int FMUSIC_ORDERCALLBACK = 1;
/** Type defining the music callback entries in callback hashmap array */
public static final int FMUSIC_ROWCALLBACK = 2;
/** Type defining the music callback entries in callback hashmap array */
public static final int FMUSIC_ZXXCALLBACK = 3;
/** Type defining the dsp callback entries in callback hashmap array */
public static final int FSOUND_DSPCALLBACK = 4;
/** Type defining the stream callback entries in callback hashmap array */
public static final int FSOUND_STREAMCALLBACK = 5;
/** Type defining the alloc callback entries in callback hashmap array */
public static final int FSOUND_ALLOCCALLBACK = 6;
/** Type defining the realloc callback entries in callback hashmap array */
public static final int FSOUND_REALLOCCALLBACK = 7;
/** Type defining the free callback entries in callback hashmap array */
public static final int FSOUND_FREECALLBACK = 8;
/** Type defining the open callback entries in callback hashmap array */
public static final int FSOUND_OPENCALLBACK = 9;
/** Type defining the close callback entries in callback hashmap array */
public static final int FSOUND_CLOSECALLBACK = 10;
/** Type defining the metadata callback entries in callback hashmap array */
public static final int FSOUND_METADATACALLBACK = 11;
/** Type defining the read callback entries in callback hashmap array */
public static final int FSOUND_READCALLBACK = 12;
/** Type defining the seek callback entries in callback hashmap array */
public static final int FSOUND_SEEKCALLBACK = 13;
/** Type defining the tell callback entries in callback hashmap array */
public static final int FSOUND_TELLCALLBACK = 14;
/** Type defining the "end" callback entries in callback hashmap array */
public static final int FSOUND_ENDCALLBACK = 15;
/** Type defining the "sync" callback entries in callback hashmap array */
public static final int FSOUND_SYNCCALLBACK = 16;
/** Have we been created? */
protected static boolean created;
/** No errors */
public static final int FMOD_ERR_NONE = 0;
/** Cannot call this command after FSOUND_Init. Call FSOUND_Close first. */
public static final int FMOD_ERR_BUSY = 1;
/** This command failed because FSOUND_Init was not called */
public static final int FMOD_ERR_UNINITIALIZED = 2;
/** Error initializing output device. */
public static final int FMOD_ERR_INIT = 3;
/** Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */
public static final int FMOD_ERR_ALLOCATED = 4;
/** Playing the sound failed. */
public static final int FMOD_ERR_PLAY = 5;
/** Soundcard does not support the features needed for this soundsystem (16bit stereo output) */
public static final int FMOD_ERR_OUTPUT_FORMAT = 6;
/** Error setting cooperative level for hardware. */
public static final int FMOD_ERR_COOPERATIVELEVEL = 7;
/** Error creating hardware sound buffer. */
public static final int FMOD_ERR_CREATEBUFFER = 8;
/** File not found */
public static final int FMOD_ERR_FILE_NOTFOUND = 9;
/** Unknown file format */
public static final int FMOD_ERR_FILE_FORMAT = 10;
/** Error loading file */
public static final int FMOD_ERR_FILE_BAD = 11;
/** Not enough memory */
public static final int FMOD_ERR_MEMORY = 12;
/** The version number of this file format is not supported */
public static final int FMOD_ERR_VERSION = 13;
/** An invalid parameter was passed to this function */
public static final int FMOD_ERR_INVALID_PARAM = 14;
/** Tried to use an EAX command on a non EAX enabled channel or output. */
public static final int FMOD_ERR_NO_EAX = 15;
/** Failed to allocate a new channel */
public static final int FMOD_ERR_CHANNEL_ALLOC = 17;
/** Recording is not supported on this machine */
public static final int FMOD_ERR_RECORD = 18;
/** Required Mediaplayer codec is not installed */
public static final int FMOD_ERR_MEDIAPLAYER = 19;
/** An error occured trying to open the specified CD device */
public static final int FMOD_ERR_CDDEVICE = 20;
/** Whether we have been initialized */
private static boolean initialized;
/** The native JNI library name */
private static String JNI_LIBRARY_NAME = "lwjgl-fmod3";
/** Version of FMOD */
private static final String VERSION = "1.1.4";
/** Current version of the JNI library */
static final int JNI_VERSION = 1;
static {
initialize();
}
/**
* Initializes the FMOD binding
*/
static void initialize() {
if (initialized) {
return;
}
initialized = true;
loadLibrary(JNI_LIBRARY_NAME);
// check for mismatch
int nativeVersion = getNativeLibraryVersion();
if (nativeVersion != JNI_VERSION) {
throw new LinkageError(
"Version mismatch: jar version is '" + JNI_VERSION +
"', native libary version is '" + nativeVersion + "'");
}
// Initialize callback hashmaps
for(int i=0; i<callbacks.length; i++) {
callbacks[i] = new HashMap();
}
}
private static void loadLibrary(final String lib_name) {
AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
String library_path = System.getProperty("org.lwjgl.librarypath");
if (library_path != null) {
System.load(library_path + File.separator +
System.mapLibraryName(lib_name));
} else {
System.loadLibrary(lib_name);
}
return null;
}
});
}
/**
* Return the version of the FMOD3-LWJGL binding as a String.
*/
public static String getVersion() {
return VERSION;
}
/**
* Return the version of the native library
*/
private static native int getNativeLibraryVersion();
/**
* @return true if AL has been created
*/
public static boolean isCreated() {
return created;
}
/**
* Creates an FMOD instance.
*/
public static void create() throws FMODException {
if (created) {
return;
}
try {
String libname;
switch (LWJGLUtil.getPlatform()) {
case LWJGLUtil.PLATFORM_WINDOWS:
libname = "fmod.dll";
break;
case LWJGLUtil.PLATFORM_LINUX:
libname = "libfmod.so";
break;
case LWJGLUtil.PLATFORM_MACOSX:
libname = "static-ignored";
break;
default:
throw new FMODException("Unknown platform: " + LWJGLUtil.getPlatform());
}
String[] fmodPaths = LWJGLUtil.getLibraryPaths("fmod", libname, FMOD.class.getClassLoader());
LWJGLUtil.log("Found " + fmodPaths.length + " FMOD paths");
nCreate(fmodPaths);
created = true;
} catch (LWJGLException le) {
throw new FMODException(le.getMessage());
}
}
/**
* Native method to create FMOD instance
*/
protected static native void nCreate(String[] paths);
/**
* Exit cleanly by calling destroy.
*/
public static void destroy() {
if(!created) {
return;
}
FSound.FSOUND_Close();
FMusic.FMUSIC_StopAllSongs();
created = false;
nDestroy();
}
/**
* Tries to locate FMOD from the JWS Library path
* This method exists because FMOD is loaded from native code, and as such
* is exempt from JWS library loading rutines. FMOD therefore always fails.
* We therefore invoke the protected method of the JWS classloader to see if it can
* locate it.
*
* @param libname Name of library to search for
* @return Absolute path to library if found, otherwise null
*/
private static String getPathFromJWS(String libname) {
try {
LWJGLUtil.log("getPathFromJWS: searching for: " + libname);
Object o = FMOD.class.getClassLoader();
Class c = o.getClass();
Method findLibrary =
c.getMethod("findLibrary", new Class[] { String.class });
Object[] arguments = new Object[] { libname };
return (String) findLibrary.invoke(o, arguments);
} catch (Exception e) {
LWJGLUtil.log("Failure locating FMOD using classloader:" + e);
}
return null;
}
/**
* Native method the destroy the FMOD
*/
protected static native void nDestroy();
/**
* Registers a callback by its handle
*
* @param handle Handle to native object being monitored
* @param callbackHandler Object to register as the call back handler
*/
static void registerCallback(int type, long handle, Object handled, Object callbackHandler) {
Long callbackID = new Long(handle);
ArrayList callbackList = (ArrayList) callbacks[type].get(callbackID);
if (callbackList == null ) {
if (callbackHandler == null) {
LWJGLUtil.log("No callbackhandlers registered for handle: " + handle);
} else {
callbackList = new ArrayList();
callbacks[type].put(callbackID, callbackList);
}
}
// are we going to add or remove from the list?
if(callbackHandler == null) {
callbacks[type].remove(callbackID);
} else {
callbackList.add(new FMOD.WrappedCallback(handled, callbackHandler));
}
}
/**
* Retrieves a call back handler by its native handle
* @param handle Handle to native object being monitored
* @return Call back handler, or null if no such handler
*/
static ArrayList getCallbacks(int type, long handle) {
return (ArrayList) callbacks[type].get(new Long(handle));
}
/**
* Retrieves the errorcode desription for specified code
*
* @param errorcode errorcode to lookup
* @return Description of errorcode
*/
public static native String FMOD_ErrorString(int errorcode);
/**
* Wrapper class for a callback handler, and the object associated
*/
static class WrappedCallback {
Object handled;
Object callback;
WrappedCallback(Object handled, Object callback) {
this.handled = handled;
this.callback = callback;
}
}
}

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import org.lwjgl.LWJGLException;
/**
* FMOD Exception specific for FMOD exceptions (duh!)
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FMODException extends LWJGLException {
private static final long serialVersionUID = -1979225393145509886L;
/**
* Creates a new FMODException
*
* @param msg Message describing nature of exception
*/
public FMODException(String msg) {
super(msg);
}
}

View File

@ -1,804 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import java.util.ArrayList;
import org.lwjgl.fmod3.callbacks.FMusicCallback;
/**
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FMusic {
/** No song being played */
public static final int FMUSIC_TYPE_NONE = 0;
/** Protracker / Fasttracker */
public static final int FMUSIC_TYPE_MOD = 1;
/** ScreamTracker 3 */
public static final int FMUSIC_TYPE_S3M = 2;
/** FastTracker 2 */
public static final int FMUSIC_TYPE_XM = 3;
/** Impulse Tracker */
public static final int FMUSIC_TYPE_IT = 4;
/** MIDI file */
public static final int FMUSIC_TYPE_MIDI = 5;
/** FMOD Sample Bank file */
public static final int FMUSIC_TYPE_FSB = 6;
/**
* To load a module or bank with a given filename. FMUSIC Supports loading of
* - .MOD (protracker/fasttracker modules)
* - .S3M (screamtracker 3 modules)
* - .XM (fasttracker 2 modules)
* - .IT (impulse tracker modules)
* - .MID (MIDI files)
* - .RMI (MIDI files)
* - .SGT (DirectMusic segment files)
* - .FSB (FMOD Sample Bank files)
*
* @param name Filename of module to load
* @return On success, a FMusicModule instance is returned. On failure, Null is returned
*/
public static FMusicModule FMUSIC_LoadSong(String name) {
long result = nFMUSIC_LoadSong(name);
if(result != FMUSIC_TYPE_NONE) {
return new FMusicModule(result, null);
}
return null;
}
private static native long nFMUSIC_LoadSong(String name);
/**
* To load a module or bank with a given filename. FMUSIC Supports loading of
* - .MOD (protracker/fasttracker modules)
* - .S3M (screamtracker 3 modules)
* - .XM (fasttracker 2 modules)
* - .IT (impulse tracker modules)
* - .MID (MIDI files)
* - .RMI (MIDI files)
* - .SGT (DirectMusic segment files)
* - .FSB (FMOD Sample Bank files)
* <p>
* <i>
* Loading a song from a memory handle is dangerous in one respect, if the data is corrupted or truncated, then FMUSIC could crash internally trying to load it.
* On PlayStation 2 the data and length pointer must be 16 byte aligned for DMA purposes.
* The samplelist and samplelistnum parameters are useful for limiting the amount of data fmod loads. This feature is for the FSB format only. It is especially useful if you have a bank of sounds and want to randomize the loading a bit by telling which sounds to load with random values, and consequently which not to load.
* On PlayStation 2, samplelistnum has a limit of 1536 entries.
* </i>
* </p>
*
* @param data containing song to load. On PlayStation 2 data must be 16 byte aligned if loading from memory
* @param mode Mode for opening song. With module files, only FSOUND_LOADMEMORY, FSOUND_NONBLOCKING, FSOUND_LOOP_NORMAL, or FSOUND_LOOP_OFF are supported. For FSB files, FSOUND_2D, FSOUND_HW3D, FSOUND_FORCEMONO also work
* @param sampleList Optional. Buffer of sample indicies to load. Leave as Null if you want all samples to be loaded (default behaviour). See Remarks for more on this
* @return On success, a FMusicModule instance is returned. On failure, Null is returned
*/
public static FMusicModule FMUSIC_LoadSongEx(ByteBuffer data, int mode, IntBuffer sampleList) {
long result = nFMUSIC_LoadSongEx(data, data.position(), data.remaining(), mode, (sampleList != null) ? sampleList : null, (sampleList != null) ? sampleList.position() : 0, (sampleList != null) ? sampleList.remaining() : 0);
if(result != FMUSIC_TYPE_NONE) {
return new FMusicModule(result, data);
}
return null;
}
/**
* @see #FMUSIC_LoadSongEx(ByteBuffer, int, int, int, IntBuffer)
* @param name of song
* @param offset Optional. 0 by default. If > 0, this value is used to specify an offset in a file, so fmod will seek before opening
* @param length Optional. 0 by default. If > 0, this value is used to specify the length of a memory block when using FSOUND_LOADMEMORY, or it is the length of a file or file segment if the offset parameter is used. On PlayStation 2 this must be 16 byte aligned for memory loading
* @param mode Mode for opening song. With module files, only FSOUND_LOADMEMORY, FSOUND_NONBLOCKING, FSOUND_LOOP_NORMAL, or FSOUND_LOOP_OFF are supported. For FSB files, FSOUND_2D, FSOUND_HW3D, FSOUND_FORCEMONO also work
* @param sampleList Optional. Buffer of sample indicies to load. Leave as Null if you want all samples to be loaded (default behaviour). See Remarks for more on this
* @return On success, a FMusicModule instance is returned. On failure, Null is returned
*/
public static FMusicModule FMUSIC_LoadSongEx(String name, int offset, int length, int mode, IntBuffer sampleList) {
long result = nFMUSIC_LoadSongEx(name, offset, length, mode, (sampleList != null) ? sampleList : null, (sampleList != null) ? sampleList.position() : 0, (sampleList != null) ? sampleList.remaining() : 0);
if(result != FMUSIC_TYPE_NONE) {
return new FMusicModule(result, null);
}
return null;
}
private static native long nFMUSIC_LoadSongEx(ByteBuffer data, int offset, int length, int mode, IntBuffer sampleList, int bufferOffset, int remaining);
private static native long nFMUSIC_LoadSongEx(String name, int offset, int length, int mode, IntBuffer sampleList, int bufferOffset, int remaining);
/**
* If a mod is opened with FSOUND_NONBLOCKING, this function returns the state of the opening mod.
* @param module Module to get the open state from
* @return 0 = mod is opened and ready. -1 = mod handle passed in is invalid. -2 = mod is still opening -3 = mod failed to open. (file not found, out of memory or other error).
*/
public static int FMUSIC_GetOpenState(FMusicModule module) {
return nFMUSIC_GetOpenState(module.moduleHandle);
}
private static native int nFMUSIC_GetOpenState(long module);
/**
* Frees memory allocated for a song and removes it from the FMUSIC system
* @param module Module to be freed
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_FreeSong(FMusicModule module) {
// when freeing a song, we automatically deregister any callbacks
FMOD.registerCallback(FMOD.FMUSIC_INSTCALLBACK, module.moduleHandle, null, null);
FMOD.registerCallback(FMOD.FMUSIC_ORDERCALLBACK, module.moduleHandle, null, null);
FMOD.registerCallback(FMOD.FMUSIC_ROWCALLBACK, module.moduleHandle, null, null);
FMOD.registerCallback(FMOD.FMUSIC_ZXXCALLBACK, module.moduleHandle, null, null);
module.release();
return nFMUSIC_FreeSong(module.moduleHandle);
}
private static native boolean nFMUSIC_FreeSong(long module);
/**
* Starts a song playing
* @param module Module to be played
* @return true if module succeeded playing. false if module failed playing
*/
public static boolean FMUSIC_PlaySong(FMusicModule module) {
return nFMUSIC_PlaySong(module.moduleHandle);
}
private static native boolean nFMUSIC_PlaySong(long module);
/**
* Stops a song from playing.
* @param module Module to be stopped
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_StopSong(FMusicModule module) {
return nFMUSIC_StopSong(module.moduleHandle);
}
private static native boolean nFMUSIC_StopSong(long module);
/**
* Stops all songs from playing. This is useful if you have multiple songs playing at once and
* want a quick way to stop them
*/
public static native void FMUSIC_StopAllSongs();
/**
* Sets a user callback for any Zxx commands encountered in an S3M, XM or IT file.
* <p>
* <b>Remarks</b>
* The value passed into the param parameter of the callback is the xx value specified in the Zxx
* command by the musician
* ------------
* It is important to note that this callback will be called from directly WITHIN the
* mixer / music update thread, therefore it is imperative that whatever you do from this
* callback be extremely efficient. If the routine takes too long then breakups in the sound
* will occur, or it will basically stop mixing until you return from the function.
* This sort of function is usually best for just setting a flag, or do some simple variable
* manipulation, and then exiting, letting your main thread do what it needs to based on these
* flags or variables.
* ------------
* This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization.
* Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively.
* ------------
* Note : This function is not supported with the MIDI format.
* @param module Module to set the callback for
* @param callback The callback function you supply to get called upon execution of a Zxx command
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetZxxCallback(FMusicModule module, FMusicCallback callback) {
FMOD.registerCallback(FMOD.FMUSIC_ZXXCALLBACK, module.moduleHandle, module, callback);
return nFMUSIC_SetZxxCallback(module.moduleHandle);
}
private static native boolean nFMUSIC_SetZxxCallback(long module);
/**
* Sets a user callback to occur on every row divisible by the rowstep parameter, played from a MOD, S3M, XM or IT file.
* <p>
* <b>Remarks</b>
* It is important to note that this callback will be called from directly WITHIN the
* mixer / music update thread, therefore it is imperative that whatever you do from this
* callback be extremely efficient. If the routine takes too long then breakups in the sound
* will occur, or it will basically stop mixing until you return from the function.
* This sort of function is usually best for just setting a flag, or do some simple variable
* manipulation, and then exiting, letting your main thread do what it needs to based on these
* flags or variables.
* ------------
* This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization.
* Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively.
* ------------
* Note : This function is not supported with the MIDI format.
* @param module Module to set the callback for
* @param callback The callback function you supply to get called
* @param rowstep Call the callback every multiple of this number of rows
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetRowCallback(FMusicModule module, FMusicCallback callback, int rowstep) {
FMOD.registerCallback(FMOD.FMUSIC_ROWCALLBACK, module.moduleHandle, module, callback);
return nFMUSIC_SetRowCallback(module.moduleHandle, rowstep);
}
private static native boolean nFMUSIC_SetRowCallback(long module, int rowstep);
/**
* Sets a user callback to occur on every order divisible by the orderstep parameter, played from a MOD, S3M, XM or IT file
* <p>
* <b>Remarks</b>
* It is important to note that this callback will be called from directly WITHIN the
* mixer / music update thread, therefore it is imperative that whatever you do from this
* callback be extremely efficient. If the routine takes too long then breakups in the sound
* will occur, or it will basically stop mixing until you return from the function.
* This sort of function is usually best for just setting a flag, or do some simple variable
* manipulation, and then exiting, letting your main thread do what it needs to based on these
* flags or variables.
* ------------
* This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization.
* Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively.
* ------------
* Note : This function is not supported with the MIDI format.
* @param module Module to set the callback for
* @param callback The callback function you supply to get called
* @param orderstep Call the callback every multiple of this number of orders
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetOrderCallback(FMusicModule module, FMusicCallback callback, int orderstep) {
FMOD.registerCallback(FMOD.FMUSIC_ORDERCALLBACK, module.moduleHandle, module, callback);
return nFMUSIC_SetOrderCallback(module.moduleHandle, orderstep);
}
private static native boolean nFMUSIC_SetOrderCallback(long module, int orderstep);
/**
* Sets a user callback to occur every time a instrument is played, triggered from a MOD, S3M, XM or IT file.
* <p>
* <b>Remarks</b>
* It is important to note that this callback will be called from directly WITHIN the
* mixer / music update thread, therefore it is imperative that whatever you do from this
* callback be extremely efficient. If the routine takes too long then breakups in the sound
* will occur, or it will basically stop mixing until you return from the function.
* This sort of function is usually best for just setting a flag, or do some simple variable
* manipulation, and then exiting, letting your main thread do what it needs to based on these
* flags or variables.
* ------------
* This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization.
* Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively.
* ------------
* Note : This function is not supported with the MIDI format.
* @param module Module set the callback for
* @param callback The callback function you supply to get called
* @param instrument Call the callback when this instrument number is triggered
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetInstCallback(FMusicModule module, FMusicCallback callback, int instrument) {
FMOD.registerCallback(FMOD.FMUSIC_INSTCALLBACK, module.moduleHandle, module, callback);
return nFMUSIC_SetInstCallback(module.moduleHandle, instrument);
}
private static native boolean nFMUSIC_SetInstCallback(long module, int instrument);
/**
* Replaces a mod's sample with a sample definition specified.
* <p>
* <b>Remarks</b>
* Because of the instrument nature of some formats like XM, this function lists all the samples in order of instruments and their subsamples.
* ie if instrument 1 has 2 samples and instrument 2 contains 3 samples, then sampno in this case would be 0 and 1 for instrument 1's samples, and 2,3 & 4 for instrument 2's samples.
* ------------
* FMOD does not free the existing mod sample that you may be overwriting. If you do overwrite an existing handle, it may be lost, and you may incur a memory leak. It is a good idea to free the existing sample first before overwriting it.
* ------------
* Important: For PlayStation 2, this function has to do a blocking query to the IOP, and can take significantly more time than a standard non blocking fmod function. This means it is best to cache the pointers for samples while loading, and not call this function in realtime.
* ------------
* This function is not supported with the MIDI format.
* </p>
* @param module Module to set the sample for.
* @param sampno index to sample inside module
* @param sptr sample definition to replace mod sample
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetSample(FMusicModule module, int sampno, FSoundSample sptr) {
return nFMUSIC_SetSample(module.moduleHandle, sampno, sptr.sampleHandle);
}
private static native boolean nFMUSIC_SetSample(long module, int sampno, long sptr);
/**
* Sets a user defined value to store with the music file to be retrieved later.
* @param module Module to set user data for
* @param userdata Value to store with music object
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetUserData(FMusicModule module, ByteBuffer userdata) {
module.userData = userdata;
return nFMUSIC_SetUserData(module.moduleHandle, userdata, userdata.position());
}
private static native boolean nFMUSIC_SetUserData(long module, ByteBuffer userdata, int offset);
/**
* This function helps with channel usage. If you are desperate for channels, and you are prepared to
* let the music routines drop a few channels, then calling this function can help.
* It basically doesnt try to play any new sounds if a certain channel limit is being played (including sound effects),
* and the new sound is below a certain specified volume.
* ie.
* You set it to maxchannels = 16, and minvolume = 0x10.
* In this case, the mod will play normally as long as the total number of channels being played inclusing sound effefcts is below 16
* (see FSOUND_GetChannelsPlaying).
* If the number of channels playing exceeds 16 (through a change in the music, or extra sound effects
* are spawned, then sounds with a musician specified volume of less than 0x10 will be ignored.
* The volume is based on volume column/default volume/volume set commands in the mod. master volume,
* envelope volumes etc are not taken into account (this gives more control over how it will work from the
* tracker).
* <p>
* <b>Remarks</b>
* maxchannels will default to the number of channels allocated by FSOUND, so this will never happen
* by default.
* minvolume will default to 0, so it will always succeed by default.
* To see how many channels are currently being MIXED, use FSOUND_GetChannelsPlaying.
* As a musician mentioned to me once, most of his default volumes are set fairly high, and any low end
* volumes are usually echoes etc, and can afford to be dropped.
* ------------
* Note : This function is not supported with the MIDI format.
* </p>
* @param module Module to set channel/volume optimization settings
* @param maxchannels Channel count to be mixed before fmusic starts to drop channels from the song
* @param minvolume If maxchannels is exceeded, then music channels with volumes below this value will not be played. Range is 0-64. This is the value the tracker displays. All trackers use 0-64
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_OptimizeChannels(FMusicModule module, int maxchannels, int minvolume) {
return nFMUSIC_OptimizeChannels(module.moduleHandle, maxchannels, minvolume);
}
private static native boolean nFMUSIC_OptimizeChannels(long module, int maxchannels, int minvolume);
/**
* Turns on reverb for MIDI/RMI files.
* <p>
* <b>Remarks</b>
* Reverb may be enabled through software emulation in the future for MOD based formats.
* </p>
* @param reverb Set to true to turn MIDI reverb on, false to turn MIDI reverb off
* @return On success, true is returned. On failure, false is returned
*/
public static native boolean FMUSIC_SetReverb(boolean reverb);
/**
* Sets looping mode for midi and mod files
* <p>
* <b>Remarks</b>
* Defaults to TRUE. To disable looping you must call this function using FALSE as the parameter.
* For midi files this only takes effect before FMUSIC_PlaySong is called. For mod files this
* can be called at any time including during playback.
* </p>
* @param module Module to set looping for
* @param looping Set to true to make it loop forever, or false to only have it play once
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetLooping(FMusicModule module, boolean looping) {
return nFMUSIC_SetLooping(module.moduleHandle, looping);
}
private static native boolean nFMUSIC_SetLooping(long module, boolean looping);
/**
* Sets a songs order position / current playing position.
* <p>
* <b>Remarks</b>
* Note : This function is not supported with the MIDI format.
* </p>
* @param module Module to have its order changed
* @param order Order number to jump to
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetOrder(FMusicModule module, int order) {
return nFMUSIC_SetOrder(module.moduleHandle, order);
}
private static native boolean nFMUSIC_SetOrder(long module, int order);
/**
* Pauses a song
* @param module Module to be paused/unpaused
* @param pause true - song should be PAUSED, false - song should be UNPAUSED
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetPaused(FMusicModule module, boolean pause) {
return nFMUSIC_SetPaused(module.moduleHandle, pause);
}
private static native boolean nFMUSIC_SetPaused(long module, boolean pause);
/**
* Sets a songs master volume.
* @param module Module to have its master volume set
* @param volume value from 0-256. 0 = silence, 256 = full volume
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetMasterVolume(FMusicModule module, int volume) {
return nFMUSIC_SetMasterVolume(module.moduleHandle, volume);
}
private static native boolean nFMUSIC_SetMasterVolume(long module, int volume);
/**
* Sets a songs master speed scale, so that the song can be sped up or slowed down.
* @param module Module to have its speed scale set
* @param speed Speed scale for song. 1.0 is default. Minimum is 0 (stopped), maximum is 10.0
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetMasterSpeed(FMusicModule module, float speed) {
return nFMUSIC_SetMasterSpeed(module.moduleHandle, speed);
}
private static native boolean nFMUSIC_SetMasterSpeed(long module, float speed);
/**
* Sets the master pan seperation for a module
* @param module Module to set pan seperation for
* @param pansep The pan scale. 1.0 means full pan seperation, 0 means mono
* @return On success, true is returned. On failure, false is returned
*/
public static boolean FMUSIC_SetPanSeperation(FMusicModule module, float pansep) {
return nFMUSIC_SetPanSeperation(module.moduleHandle, pansep);
}
private static native boolean nFMUSIC_SetPanSeperation(long module, float pansep);
/**
* Returns the name of the song set by the composer. With MIDI format, the filename is returned
* @param module Module to retrieve name from
* @return On success, the name of the song is returned. On failure, Null is returned
*/
public static String FMUSIC_GetName(FMusicModule module) {
return nFMUSIC_GetName(module.moduleHandle);
}
private static native String nFMUSIC_GetName(long module);
/**
* Returns the format type a song
* @param module Module to retrieve type from
* @return FMusicType constant, FMUSIC_TYPE_NONE on failure
*/
public static int FMUSIC_GetType(FMusicModule module) {
return nFMUSIC_GetType(module.moduleHandle);
}
private static native int nFMUSIC_GetType(long module);
/**
* Returns the number of orders in this song
* @param module Module to retrieve number of orders from
* @return On success, the number of orders in this song is returned. On failure, 0 is returned
*/
public static int FMUSIC_GetNumOrders(FMusicModule module) {
return nFMUSIC_GetNumOrders(module.moduleHandle);
}
private static native int nFMUSIC_GetNumOrders(long module);
/**
* Returns the number of patterns contained in this song.
* @param module Module to retrieve number of patterns from
* @return On success, the number of patterns contained in this song is returned. On failure, 0 is returned
*/
public static int FMUSIC_GetNumPatterns(FMusicModule module) {
return nFMUSIC_GetNumPatterns(module.moduleHandle);
}
private static native int nFMUSIC_GetNumPatterns(long module);
/**
* Returns the number of instruments contained in this song.
* @param module Module to retrieve number of instruments from
* @return On success, the number of instruments contained in this song is returned. On failure, 0 is returned.
*/
public static int FMUSIC_GetNumInstruments(FMusicModule module) {
return nFMUSIC_GetNumInstruments(module.moduleHandle);
}
private static native int nFMUSIC_GetNumInstruments(long module);
/**
* Returns the number of samples contained in this song.
* @param module Module to retrieve number of samples
* @return Number of samples contained in this song. On failure, 0 is returned.
*/
public static int FMUSIC_GetNumSamples(FMusicModule module) {
return nFMUSIC_GetNumSamples(module.moduleHandle);
}
private static native int nFMUSIC_GetNumSamples(long module);
/**
* Returns the number of channels within this songs pattern data
* @param module Module to retrieve number of channels from
* @return Number of channels within this songs pattern data. On failure, 0 is returned.
*/
public static int FMUSIC_GetNumChannels(FMusicModule module) {
return nFMUSIC_GetNumChannels(module.moduleHandle);
}
private static native int nFMUSIC_GetNumChannels(long module);
/**
* Returns a reference to a sample inside a module.
* Once you have access to the module's sample, you can do a lot of things
* to it, including locking and modifying the data within; using the
* FSOUND_Sample_ functionality
* <p>
* <b>Remarks</b>
* Because of the instrument nature of some formats like XM, this
* function lists all the samples in order of instruments and their subsamples.
* ie if instrument 1 has 2 samples and instrument 2 contains 3 samples, then
* sampno in this case would be 0 and 1 for instrument 1's samples, and 2,3 & 4
* for instrument 2's samples.
* </p>
* @param module Module to retrieve a sample handle from
* @param sampno index to sample inside module
* @return On success, a valid sample is returned. On failure, Null is returned.
*/
public static FSoundSample FMUSIC_GetSample(FMusicModule module, int sampno) {
long result = nFMUSIC_GetSample(module.moduleHandle, sampno);
if(result != 0) {
return new FSoundSample(result, null);
}
return null;
}
private static native long nFMUSIC_GetSample(long module, int sampno);
/**
* Returns the the length in rows of the pattern for the specified order number
* @param module Module to get pattern lenght from
* @param orderno pattern at specified order
* @return On success, the songs pattern length at the specified order is returned. On failure, 0 is returned
*/
public static int FMUSIC_GetPatternLength(FMusicModule module, int orderno) {
return nFMUSIC_GetPatternLength(module.moduleHandle, orderno);
}
private static native int nFMUSIC_GetPatternLength(long module, int orderno);
/**
* Returns whether the song has completed playing, or when the last order has finished playing.
* This stays set even if the song loops.
* @param module Module that you want check if finished or not
* @return true if module has finished playing. false if module has not finished playing.
*/
public static boolean FMUSIC_IsFinished(FMusicModule module) {
return nFMUSIC_IsFinished(module.moduleHandle);
}
private static native boolean nFMUSIC_IsFinished(long module);
/**
* Returns whether the song is currently playing or not.
* @param module Module to retrieve name from
* @return true Song is playing. false Song is stopped.
*/
public static boolean FMUSIC_IsPlaying(FMusicModule module) {
return nFMUSIC_IsPlaying(module.moduleHandle);
}
private static native boolean nFMUSIC_IsPlaying(long module);
/**
* Returns the song's current master volume
* @param module Module to retrieve song master volume from
* @return On success, the song's current master volume, from 0 (silence) to 256 (full volume) is returned. On failure, -1 is returned.
*/
public static int FMUSIC_GetMasterVolume(FMusicModule module) {
return nFMUSIC_GetMasterVolume(module.moduleHandle);
}
private static native int nFMUSIC_GetMasterVolume(long module);
/**
* Returns the song's current global volume
* <p>
* <b>Remarks</b>
* GLOBAL volume is not the same as MASTER volume. GLOBAL volume is an internal
* overall volume which can be altered by the song itself (ie there might be commands
* to fade in a particular part of the song by scaling all the volumes in the song
* up slowly from nothing).
* GLOBAL volume is different to MASTER volume in that the song can modify without
* your permission, whereas MASTER volume is an overall scalar that you can control.
* For general use, MASTER volume is more useful, but you may want to reset a song's
* GLOBAL volume at certain times in the song. (for example the song might have faded
* out by using GLOBAL volume and you want to reset it)
* </p>
* @param module Module to retrieve song global volume from
* @return Songs current global volume, from 0 (silence) to the maximum value determined by the music format. Global volume
* maximums are different in respect to each format, they range from 64 to 256. On failure, -1 is returned.
*/
public static int FMUSIC_GetGlobalVolume(FMusicModule module) {
return nFMUSIC_GetGlobalVolume(module.moduleHandle);
}
private static native int nFMUSIC_GetGlobalVolume(long module);
/**
* Returns the song's current order number
* @param module Module to retrieve current order number from
* @return On success, the song's current order number is returned.On failure, -1 is returned
*/
public static int FMUSIC_GetOrder(FMusicModule module) {
return nFMUSIC_GetOrder(module.moduleHandle);
}
private static native int nFMUSIC_GetOrder(long module);
/**
* Returns the song's current pattern number
* @param module Module to retrieve current pattern number from
* @return On success, The song's current pattern number is returned. On failure, -1 is returned
*/
public static int FMUSIC_GetPattern(FMusicModule module) {
return nFMUSIC_GetPattern(module.moduleHandle);
}
private static native int nFMUSIC_GetPattern(long module);
/**
* Returns the song's current speed.
* @param module Module to retrieve current song speed from
* @return On success, The song's current speed is returned. On failure, -1 is returned
*/
public static int FMUSIC_GetSpeed(FMusicModule module) {
return nFMUSIC_GetSpeed(module.moduleHandle);
}
private static native int nFMUSIC_GetSpeed(long module);
/**
* Returns the song's current BPM.
* @param module Module to retrieve current song BPM from
* @return On success, song's current BPM is returned. On failure, -1 is returned
*/
public static int FMUSIC_GetBPM(FMusicModule module) {
return nFMUSIC_GetBPM(module.moduleHandle);
}
private static native int nFMUSIC_GetBPM(long module);
/**
* Returns the song's current row number
* <p>
* <b>Remarks</b>
* This value is latency adjusted by default, and returns the number you are hearing, not the 'mix-time' value.
* Use FSOUND_INIT_DONTLATENCYADJUST if you want the value at mix time, which is useful if you want to control the music interactively, or from a DSP callback.
* </p>
* @param module Module to retrieve current row from
* @return On success, the song's current row number is returned. On failure, -1 is returned
*/
public static int FMUSIC_GetRow(FMusicModule module) {
return nFMUSIC_GetRow(module.moduleHandle);
}
private static native int nFMUSIC_GetRow(long module);
/**
* Returns whether song is currently paused or not
* @param module Module to get paused flag from
* @return On success, true is returned to say the song is currently paused. On failure, false is returned to say the song is NOT currently paused
*/
public static boolean FMUSIC_GetPaused(FMusicModule module) {
return nFMUSIC_GetPaused(module.moduleHandle);
}
private static native boolean nFMUSIC_GetPaused(long module);
/**
* Returns the time in milliseconds since the song was started. This is useful for
* synchronizing purposes becuase it will be exactly the same every time, and it is
* reliably retriggered upon starting the song. Trying to synchronize using other
* windows timers can lead to varying results, and inexact performance. This fixes that
* problem by actually using the number of samples sent to the soundcard as a reference
* <p>
* <b>Remarks</b>
* This value is latency adjusted by default, and returns the number you are hearing, not the 'mix-time' value.
* Use FSOUND_INIT_DONTLATENCYADJUST if you want the value at mix time, which is useful if you want to control the music interactively, or from a DSP callback
* </p>
* @param module Module to the song to get time from
* @return On success, the time played in milliseconds is returned. On failure, -1 is returned
*/
public static int FMUSIC_GetTime(FMusicModule module) {
return nFMUSIC_GetTime(module.moduleHandle);
}
private static native int nFMUSIC_GetTime(long module);
/**
* Returns the real FSOUND channel playing based on the mod's FMUSIC channel
* <p>
* <b>Remarks</b>
* Note FMUSIC mod playback only allocates a real channel on a mod channel the first time an instrument is played.
* NNA's will not register. This function only returns the primary real channel for the mod channel.
* </p>
* @param module Module to the song
* @param modchannel channel index, to query the real channel from
* @return On success, the channel index for the respective mod channel is returned. On failure, -1 is returned
*/
public static int FMUSIC_GetRealChannel(FMusicModule module, int modchannel) {
return nFMUSIC_GetRealChannel(module.moduleHandle, modchannel);
}
private static native int nFMUSIC_GetRealChannel(long module, int modchannel);
/**
* Retrieves the data set by FMUSIC_SetUserData
* @param module Module to get the open state from
* @return On success, userdata set by FMUSIC_SetUserData is returned. On failure, Null is returned.
*/
public static ByteBuffer FMUSIC_GetUserData(FMusicModule module, int capacity) {
ByteBuffer buffer = nFMUSIC_GetUserData(module.moduleHandle, capacity);
buffer.order(ByteOrder.nativeOrder());
return buffer;
}
private static native ByteBuffer nFMUSIC_GetUserData(long module, int capacity);
/**
* This is the callback rutine called by the native implementation whenever a
* register callback is notified.
*
* @param handle Handle to native object being monitored
* @param param parameter passed to callback
*/
public static void music_instcallback(long modulehandle, int param) {
// we got a callback - notify everybody
ArrayList handlers = FMOD.getCallbacks(FMOD.FMUSIC_INSTCALLBACK, modulehandle);
for(int i=0; i<handlers.size(); i++) {
FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i);
FMusicCallback callback = (FMusicCallback) wCallback.callback;
callback.FMUSIC_CALLBACK((FMusicModule) wCallback.handled, param);
}
}
/**
* This is the callback rutine called by the native implementation whenever a
* register callback is notified.
*
* @param handle Handle to native object being monitored
* @param param parameter passed to callback
*/
public static void music_ordercallback(long modulehandle, int param) {
// we got a callback - notify everybody
ArrayList handlers = FMOD.getCallbacks(FMOD.FMUSIC_ORDERCALLBACK, modulehandle);
for(int i=0; i<handlers.size(); i++) {
FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i);
FMusicCallback callback = (FMusicCallback) wCallback.callback;
callback.FMUSIC_CALLBACK((FMusicModule) wCallback.handled, param);
}
}
/**
* This is the callback rutine called by the native implementation whenever a
* register callback is notified.
*
* @param handle Handle to native object being monitored
* @param param parameter passed to callback
*/
public static void music_rowcallback(long modulehandle, int param) {
// we got a callback - notify everybody
ArrayList handlers = FMOD.getCallbacks(FMOD.FMUSIC_ROWCALLBACK, modulehandle);
for(int i=0; i<handlers.size(); i++) {
FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i);
FMusicCallback callback = (FMusicCallback) wCallback.callback;
callback.FMUSIC_CALLBACK((FMusicModule) wCallback.handled, param);
}
}
/**
* This is the callback rutine called by the native implementation whenever a
* register callback is notified.
*
* @param handle Handle to native object being monitored
* @param param parameter passed to callback
*/
public static void music_zxxcallback(long modulehandle, int param) {
// we got a callback - notify everybody
ArrayList handlers = FMOD.getCallbacks(FMOD.FMUSIC_ZXXCALLBACK, modulehandle);
for(int i=0; i<handlers.size(); i++) {
FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get(i);
FMusicCallback callback = (FMusicCallback) wCallback.callback;
callback.FMUSIC_CALLBACK((FMusicModule) wCallback.handled, param);
}
}
}

View File

@ -1,70 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.Buffer;
/**
* This class is a representation of a Module in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FMusicModule {
/** Handle to module */
long moduleHandle;
/** Handle to buffer containing module data */
Buffer moduleData;
/** Handle to buffer containing user data */
Buffer userData;
/**
* Creates a new FMusicModule
*
* @param moduleHandle
*/
FMusicModule(long moduleHandle, Buffer moduleData) {
this.moduleHandle = moduleHandle;
this.moduleData = moduleData;
}
/**
* Releases the reference to any data contained
*/
void release() {
this.moduleData = null;
this.userData = null;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.ByteBuffer;
/**
* This class is a representation of a DSPUnit in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundDSPUnit {
/** Opaque handle to dsp unit */
ByteBuffer dspHandle;
/** DSP id, used for tracking which dsp needs to call which
* object (when entering from native side) */
ByteBuffer dspTrackingID;
/** ID for next dsp unit */
static long nextDspTrackingID;
/**
* Creates a new FSoundDSPUnit
*
* @param dspHandle handle to dsp unit
*/
FSoundDSPUnit(ByteBuffer dspHandle) {
this.dspHandle = dspHandle;
}
/**
* Creates a new FSoundDSPUnit
*
* @param dspHandle handle to dsp unit
*/
FSoundDSPUnit(ByteBuffer dspHandle, ByteBuffer dspTrackingID) {
this.dspHandle = dspHandle;
this.dspTrackingID = dspTrackingID;
}
/**
* @return Next dsp id
*/
static long getNextId() {
// To infinity and beyond!... well almost
if(nextDspTrackingID == Long.MAX_VALUE) {
nextDspTrackingID = 0;
}
return nextDspTrackingID++;
}
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
/**
* This class is a representation of a Reverb channel property object in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundReverbChannelProperties {
/** Handle to stream */
long reverbHandle;
/**
* Creates a new FSoundStream
*
* @param streamHandle handle to stream
*/
FSoundReverbChannelProperties(long reverbHandle) {
this.reverbHandle = reverbHandle;
}
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
/**
* This class is a representation of a Reverb property object in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundReverbProperties {
/** Handle to stream */
long reverbHandle;
/**
* Creates a new FSoundStream
*
* @param streamHandle handle to stream
*/
FSoundReverbProperties(long reverbHandle) {
this.reverbHandle = reverbHandle;
}
}

View File

@ -1,66 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.Buffer;
/**
* This class is a representation of a Sound Sample in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundSample {
/** Handle to sample */
long sampleHandle;
/** Handle to buffer containing sample data */
Buffer sampleData;
/**
* Creates a new FSoundSample
*
* @param sampleHandle handle to sample
*/
FSoundSample(long sampleHandle, Buffer sampleData) {
this.sampleHandle = sampleHandle;
this.sampleData = sampleData;
}
/**
* Releases the reference to any data contained
*/
void release() {
this.sampleData = null;
}
}

View File

@ -1,106 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.ByteBuffer;
/**
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundSampleLock {
/** ByteBuffer that will point to the first part of the locked data */
private ByteBuffer ptr1;
/**
* ByteBuffer that will point to the second part of the locked data.
* This will be null if the data locked hasnt wrapped at the end of the buffer
*/
private ByteBuffer ptr2;
/** Length of data in BYTES that was locked for ptr1 */
private int len1;
/**
* Length of data in BYTES that was locked for ptr2.
* This will be 0 if the data locked hasnt wrapped at the end of the buffer
*/
private int len2;
/**
* Creates a new FSoundSampleLock
*/
public FSoundSampleLock() {
}
/**
* Creates a new SampleLock
*
* @param ptr1 ByteBuffer that will point to the first part of the locked data
* @param ptr2 ByteBuffer that will point to the second part of the locked data
* @param len1 Length of data in BYTES that was locked for ptr1
* @param len2 Length of data in BYTES that was locked for ptr2
*/
void set(ByteBuffer ptr1, ByteBuffer ptr2, int len1, int len2) {
this.ptr1 = ptr1;
this.ptr2 = ptr2;
this.len1 = len1;
this.len2 = len2;
}
/**
* @return Returns the len1.
*/
public int getLen1() {
return len1;
}
/**
* @return Returns the len2.
*/
public int getLen2() {
return len2;
}
/**
* @return Returns the ptr1.
*/
public ByteBuffer getPtr1() {
return ptr1;
}
/**
* @return Returns the ptr2.
*/
public ByteBuffer getPtr2() {
return ptr2;
}
}

View File

@ -1,66 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.Buffer;
/**
* This class is a representation of a Sound stream in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundStream {
/** Handle to stream */
long streamHandle;
/** Handle to buffer containing sample data */
Buffer streamData;
/**
* Creates a new FSoundStream
*
* @param streamHandle handle to stream
*/
FSoundStream(long streamHandle, Buffer streamData) {
this.streamHandle = streamHandle;
this.streamData = streamData;
}
/**
* Releases the reference to any data contained
*/
void release() {
this.streamData = null;
}
}

View File

@ -1,55 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.ByteBuffer;
/**
* This class is a representation of a SyncPoint in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundSyncPoint {
/** Opaque handle to syncpoint */
ByteBuffer syncpointHandle;
/**
* Creates a new FSoundSyncPoint
*
* @param syncpointHandle handle to syncpoint
*/
FSoundSyncPoint(ByteBuffer syncpointHandle) {
this.syncpointHandle = syncpointHandle;
}
}

View File

@ -1,121 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
import java.nio.ByteBuffer;
/**
* This class defines attributes in a tag field
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundTagField {
/** Name of tagfield */
String name;
/** ByteBuffer that will point to the tagfield data */
ByteBuffer value;
/** Length of tagfield data */
int length;
/** Type of tagfield */
int type;
/**
* Creates a new FSoundTagField
*/
public FSoundTagField() {
}
/**
* Creates a new FSoundTagField
*/
public FSoundTagField(int type, String name) {
this.type = type;
this.name = name;
}
/**
* Sets the name value and type
* @param name name of tagfield
* @param value value of tagfield
* @param type type of tagfield
*/
void set(String name, ByteBuffer value, int type) {
this.name = name;
this.value = value;
this.length = value.capacity();
this.type = type;
}
/**
* @return Returns the length.
*/
public int getLength() {
return length;
}
/**
* @return Returns the name.
*/
public String getName() {
return name;
}
/**
* @return Returns the type.
*/
public int getType() {
return type;
}
/**
* @return Returns the value.
*/
public ByteBuffer getValue() {
return value.asReadOnlyBuffer();
}
/**
* @return value as a <b>trimmed</b> string
*/
public String getValueAsString() {
byte[] buffer = new byte[value.capacity()];
value.get(buffer);
value.rewind();
return new String(buffer).trim();
}
}

View File

@ -1,61 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3;
/**
* This class is a representation of a FSOUND_TOC_TAG property object in FMod.
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class FSoundTocTag {
/** Handle to toc */
long tocHandle;
/*
char name[4] // The string "TOC", just in case this structure is accidentally treated as a string
int numtracks // The number of tracks on the CD
int min[100] // The start offset of each track in minutes
int sec[100] // The start offset of each track in seconds
int frame[100] // The start offset of each track in frames
*/
/**
* Creates a new FSoundTocTag
*
* @param tocHandle handle to TOC
*/
FSoundTocTag(long tocHandle) {
this.tocHandle = tocHandle;
}
}

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
import org.lwjgl.fmod3.FMusicModule;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FMusicCallback {
public void FMUSIC_CALLBACK(FMusicModule module, int param);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundCloseCallback {
public void FSOUND_CLOSECALLBACK(int handle);
}

View File

@ -1,53 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
import java.nio.ByteBuffer;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundDSPCallback {
/**
*
* @param originalbuffer
* @param newbuffer
* @param length
* @return
*/
public ByteBuffer FSOUND_DSPCALLBACK(ByteBuffer originalbuffer, ByteBuffer newbuffer, int length);
}

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
import java.nio.ByteBuffer;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundMetaDataCallback {
public void FSOUND_METADATACALLBACK(ByteBuffer name, ByteBuffer value);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundOpenCallback {
public int FSOUND_OPENCALLBACK(String name);
}

View File

@ -1,45 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
import java.nio.ByteBuffer;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundReadCallback {
public int FSOUND_READCALLBACK(ByteBuffer buffer, int size, int handle);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundSeekCallback {
public int FSOUND_SEEKCALLBACK(int handle, int pos, int mode);
}

View File

@ -1,47 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
import java.nio.ByteBuffer;
import org.lwjgl.fmod3.FSoundStream;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundStreamCallback {
public void FSOUND_STREAMCALLBACK(FSoundStream stream, ByteBuffer buff, int len);
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.fmod3.callbacks;
/**
* This interface describes a callback interface to Fmod music
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public interface FSoundTellCallback {
public int FSOUND_TELLCALLBACK(int handle);
}

View File

@ -1,238 +0,0 @@
/*
* Copyright (c) 2006 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.applet;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.devil.IL;
import org.lwjgl.devil.ILU;
import org.lwjgl.devil.ILUT;
import org.lwjgl.devil.ILinfo;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMusic;
import org.lwjgl.fmod3.FMusicModule;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.opengl.AWTGLCanvas;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
public class Optional extends AWTGLCanvas implements Test {
float angle = 0;
FMusicModule module = null;
public Optional() throws LWJGLException {
try {
FMOD.create();
} catch (Exception e) {
System.out.println("Unable to create FMOD.\nPlease make sure that FMOD is available on this system. Exception: " + e);
return;
}
try {
IL.create();
} catch (Exception e) {
System.out.println("Unable to load IL");
return;
}
try {
ILU.create();
} catch (Exception e) {
System.out.println("Unable to load ILU");
return;
}
try {
ILUT.create();
} catch (Exception e) {
System.out.println("Unable to load ILUT");
return;
}
Thread t = new Thread() {
public void run() {
while (true) {
if (isVisible())
repaint();
Display.sync(60);
}
}
};
t.setDaemon(true);
t.start();
}
private void playFMOD() {
FSound.FSOUND_Init(44100, 32, 0);
ByteBuffer data = getData("Missing_you.mod");
module = FMusic.FMUSIC_LoadSongEx(data, FSound.FSOUND_LOADMEMORY, null);
FMusic.FMUSIC_PlaySong(module);
}
private ByteBuffer getData(String filename) {
ByteBuffer buffer = null;
System.out.println("Attempting to load: " + filename);
try {
BufferedInputStream bis = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream(filename));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int bufferLength = 4096;
byte[] readBuffer = new byte[bufferLength];
int read = -1;
while ((read = bis.read(readBuffer, 0, bufferLength)) != -1) {
baos.write(readBuffer, 0, read);
}
//done reading, close
bis.close();
// place it in a buffer
buffer = ByteBuffer.allocateDirect(baos.size());
buffer.order(ByteOrder.nativeOrder());
buffer.put(baos.toByteArray());
buffer.flip();
System.out.println("loaded " + buffer.remaining() + " bytes");
} catch (Exception ioe) {
ioe.printStackTrace();
}
return buffer;
}
public void paintGL() {
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
GL11.glMatrixMode(GL11.GL_PROJECTION_MATRIX);
GL11.glLoadIdentity();
GL11.glOrtho(0, 640, 0, 480, 1, -1);
GL11.glMatrixMode(GL11.GL_MODELVIEW_MATRIX);
GL11.glPushMatrix();
GL11.glTranslatef(320, 240, 0.0f);
GL11.glRotatef(angle, 0, 0, 1.0f);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2i(-50, -50);
GL11.glVertex2i(50, -50);
GL11.glVertex2i(50, 50);
GL11.glVertex2i(-50, 50);
GL11.glEnd();
GL11.glPopMatrix();
angle += 1;
try {
swapBuffers();
} catch (Exception e) {/*OK*/
}
}
public void start() {
playFMOD();
testDevil();
}
private void testDevil() {
IntBuffer im = BufferUtils.createIntBuffer(1);
IL.ilGenImages(im);
System.out.println("ilBindImage");
IL.ilBindImage(im.get(0));
IL.ilEnable(IL.IL_ORIGIN_SET);
IL.ilOriginFunc(IL.IL_ORIGIN_UPPER_LEFT);
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
try {
System.out.println("load lump = " + IL.ilLoadFromStream(getClass().getResourceAsStream("/ILtest.tga"), IL.IL_TGA));
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
int newIm = IL.ilCloneCurImage();
IL.ilCopyImage(im.get(0));
IL.ilBindImage(newIm);
ByteBuffer buf = IL.ilGetData();
System.out.println("ilGetData");
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
int limit = buf.limit();
System.out.println("limit = " + limit);
for (int i = 0; i < buf.limit(); i += 3) {
System.out.println(buf.get(i) + " " + buf.get(i + 1) + " " + buf.get(i + 2));
}
System.out.println("current image = " + im.get(0) + " IL.ilGetInteger(IL.IL_ACTIVE_IMAGE) = "
+ IL.ilGetInteger(IL.IL_ACTIVE_IMAGE));
System.out.println("Version: " + IL.ilGetInteger(IL.IL_VERSION_NUM));
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
ILinfo info = new ILinfo();
ILU.iluGetImageInfo(info);
System.out.println("info.id = " + info.id);
System.out.println("info.width = " + info.width);
System.out.println("info.height = " + info.height);
System.out.println("info.depth = " + info.depth);
System.out.println("info.bpp = " + info.bpp);
System.out.println("info.sizeOfData = " + info.sizeOfData);
System.out.println("info.format = " + info.format);
System.out.println("info.type = " + info.type);
System.out.println("info.origin = " + info.origin);
System.out.println("info.palType = " + info.palType);
System.out.println("info.palSize = " + info.palSize);
System.out.println("info.numNext = " + info.numNext);
System.out.println("info.numMips = " + info.numMips);
System.out.println("info.numLayers = " + info.numLayers);
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
System.out.println("ILUT Vendor: " + ILUT.ilutGetString(ILUT.ILUT_VENDOR));
}
public void stop() {
FMusic.FMUSIC_StopSong(module);
FMusic.FMUSIC_FreeSong(module);
FSound.FSOUND_Close();
FMOD.destroy();
ILUT.destroy();
ILU.destroy();
IL.destroy();
module = null;
}
}

View File

@ -1,128 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.devil;
import java.net.URL;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.devil.IL;
import org.lwjgl.devil.ILU;
import org.lwjgl.devil.ILUT;
import org.lwjgl.devil.ILinfo;
/**
* <p>The core DevIL and ILU API.</p>
*
* @author Mark Bernard <captainjester@users.sourceforge.net>
* @version $Revision$
* $Id$
*/
public class BasicTest {
public static void main(String args[]) {
try {
org.lwjgl.opengl.Display.create();
IL.create();
ILU.create();
ILUT.create();
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
System.out.println("ilGenImages");
IntBuffer im = BufferUtils.createIntBuffer(1);
IL.ilGenImages(im);
System.out.println("ilBindImage");
IL.ilBindImage(im.get(0));
IL.ilEnable(IL.IL_ORIGIN_SET);
IL.ilOriginFunc(IL.IL_ORIGIN_UPPER_LEFT);
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
URL imageURL = BasicTest.class.getResource("/res/ILtest.tga");
System.out.println("ilLoadFromURL " + imageURL);
try {
System.out.println("load lump = " + IL.ilLoadFromURL(imageURL));
} catch (Exception e) {
e.printStackTrace();
System.exit(0);
}
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
int newIm = IL.ilCloneCurImage();
IL.ilCopyImage(im.get(0));
IL.ilBindImage(newIm);
ByteBuffer buf = IL.ilGetData();
System.out.println("ilGetData");
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
int limit = buf.limit();
System.out.println("limit = " + limit);
for (int i = 0; i < buf.limit(); i += 3) {
System.out.println(buf.get(i) + " " + buf.get(i + 1) + " " + buf.get(i + 2));
}
System.out.println("current image = " + im.get(0) + " IL.ilGetInteger(IL.IL_ACTIVE_IMAGE) = "
+ IL.ilGetInteger(IL.IL_ACTIVE_IMAGE));
System.out.println("Version: " + IL.ilGetInteger(IL.IL_VERSION_NUM));
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
ILinfo info = new ILinfo();
ILU.iluGetImageInfo(info);
System.out.println("info.id = " + info.id);
System.out.println("info.width = " + info.width);
System.out.println("info.height = " + info.height);
System.out.println("info.depth = " + info.depth);
System.out.println("info.bpp = " + info.bpp);
System.out.println("info.sizeOfData = " + info.sizeOfData);
System.out.println("info.format = " + info.format);
System.out.println("info.type = " + info.type);
System.out.println("info.origin = " + info.origin);
System.out.println("info.palType = " + info.palType);
System.out.println("info.palSize = " + info.palSize);
System.out.println("info.numNext = " + info.numNext);
System.out.println("info.numMips = " + info.numMips);
System.out.println("info.numLayers = " + info.numLayers);
System.out.println("error = " + ILU.iluErrorString(IL.ilGetError()));
System.out.println("ILUT Vendor: " + ILUT.ilutGetString(ILUT.ILUT_VENDOR));
try {
ILUT.destroy();
ILU.destroy();
IL.destroy();
org.lwjgl.opengl.Display.destroy();
} catch (Exception e) {
e.printStackTrace();
}
System.exit(0);
}
}

View File

@ -1,123 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.FSoundStream;
/**
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class CDDAPlayer {
public static void main(String[] args) {
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
System.out.println("Initializing FMOD");
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.exit(0);
}
boolean running = true;
String token = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
FSoundStream stream = null;
do {
System.out.println(FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
System.out.println("FMOD CD Player test. Press a key corresponding to action");
System.out.println("1: FSOUND_Stream_Open \"<drive>:\"");
System.out.println("2: FSOUND_Stream_Open \"<drive>:?\"");
System.out.println("3: FSOUND_Stream_Open \"<drive>:!\"");
System.out.println("4: FSOUND_Stream_SetSubStream <position>");
System.out.println("5: FSOUND_Stream_GetNumSubStreams");
System.out.println("6: Enumerate tag fields");
System.out.println("0: Exit");
try {
StringTokenizer st = new StringTokenizer(br.readLine().trim());
token = st.nextToken();
switch (Integer.parseInt(token)) {
case 0:
running = false;
break;
case 1:
stream = FSound.FSOUND_Stream_Open(st.nextToken() + ":", FSound.FSOUND_NORMAL, 0, 0);
break;
case 2:
stream = FSound.FSOUND_Stream_Open(st.nextToken() + ":*?", 0, 0, 0);
break;
case 3:
stream = FSound.FSOUND_Stream_Open(st.nextToken() + ":*!", 0, 0, 0);
break;
case 4:
FSound.FSOUND_Stream_SetSubStream(stream, Integer.parseInt(st.nextToken()));
break;
case 5:
System.out.println(FSound.FSOUND_Stream_GetNumSubStreams(stream));
break;
case 6:
//
break;
default:
System.out.println("No entry");
}
System.out.println("Stream: " + stream);
} catch (Exception e) {
}
} while (running);
if(stream != null) {
FSound.FSOUND_Stream_Close(stream);
}
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
}

View File

@ -1,137 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
/**
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class CDPlayer {
public static void main(String[] args) {
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
System.out.println("Initializing FMOD");
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.exit(0);
}
boolean running = true;
String token = null;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
do {
System.out.println("FMOD CD Player test. Press a key corresponding to action");
System.out.println("1: FSOUND_CD_Eject <drive>");
System.out.println("2: FSOUND_CD_Play <drive> <track>");
System.out.println("3: FSOUND_CD_Stop <drive>");
System.out.println("4: FSOUND_CD_GetNumTracks <drive>");
System.out.println("5: FSOUND_CD_GetPaused <drive>");
System.out.println("6: FSOUND_CD_GetTrack <drive>");
System.out.println("7: FSOUND_CD_GetTrackLength <drive> <track>");
System.out.println("8: FSOUND_CD_GetTrackTime <drive>");
System.out.println("9: FSOUND_CD_SetPaused <drive>");
System.out.println("10: FSOUND_CD_SetPlayMode <drive> <mode>");
System.out.println("11: FSOUND_CD_SetTrackTime <drive> <milliseconds>");
System.out.println("12: FSOUND_CD_SetVolume <drive> <volume>");
System.out.println("0: Exit");
try {
StringTokenizer st = new StringTokenizer(br.readLine().trim());
token = st.nextToken();
switch (Integer.parseInt(token)) {
case 0:
running = false;
break;
case 1:
FSound.FSOUND_CD_OpenTray(st.nextToken().charAt(0), true);
break;
case 2:
FSound.FSOUND_CD_Play(st.nextToken().charAt(0), Integer.parseInt(st.nextToken()));
break;
case 3:
FSound.FSOUND_CD_Stop(st.nextToken().charAt(0));
break;
case 4:
System.out.println(FSound.FSOUND_CD_GetNumTracks(st.nextToken().charAt(0)));
break;
case 5:
System.out.println(FSound.FSOUND_CD_GetPaused(st.nextToken().charAt(0)));
break;
case 6:
System.out.println(FSound.FSOUND_CD_GetTrack(st.nextToken().charAt(0)));
break;
case 7:
System.out.println(FSound.FSOUND_CD_GetTrackLength(st.nextToken().charAt(0), Integer.parseInt(st.nextToken())));
break;
case 8:
System.out.println(FSound.FSOUND_CD_GetTrackTime(st.nextToken().charAt(0)));
break;
case 9:
FSound.FSOUND_CD_SetPaused(st.nextToken().charAt(0), Boolean.valueOf(st.nextToken()).booleanValue());
break;
case 10:
FSound.FSOUND_CD_SetPlayMode(st.nextToken().charAt(0), Integer.parseInt(st.nextToken()));
break;
case 11:
FSound.FSOUND_CD_SetTrackTime(st.nextToken().charAt(0), Integer.parseInt(st.nextToken()));
break;
case 12:
FSound.FSOUND_CD_SetVolume(st.nextToken().charAt(0), Integer.parseInt(st.nextToken()));
break;
default:
System.out.println("No entry");
}
} catch (Exception e) {
}
} while (running);
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
}

View File

@ -1,189 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.FSoundDSPUnit;
import org.lwjgl.fmod3.FSoundStream;
import org.lwjgl.fmod3.callbacks.FSoundDSPCallback;
import org.lwjgl.fmod3.callbacks.FSoundStreamCallback;
/**
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$ <br>
*/
public class DSPTest {
public static int bytesPerSample;
public static int channels;
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage:\n DSPTest <file>");
// default to phero.mp3
args = new String[] { "res" + File.separator + "phero.mp3"};
System.out.println("Using default: " + args[0]);
}
File file = new File(args[0]);
if (!file.exists()) {
System.out.println("No such file: " + args[0]);
System.exit(0);
}
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
System.out.println("Initializing FMOD");
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
System.exit(0);
}
System.out.println("Loading " + args[0]);
FSoundStream stream = FSound.FSOUND_Stream_Open(args[0], FSound.FSOUND_NORMAL, 0, 0);
if (stream != null) {
System.out.println("Creating dsp unit");
FSoundDSPUnit unit = FSound.FSOUND_Stream_CreateDSP(stream, new DSPTest().new TestDspCallback("1"), 1);
FSound.FSOUND_DSP_SetActive(unit, true);
System.out.println("Created: " + unit);
switch (FSound.FSOUND_GetMixer()) {
case FSound.FSOUND_MIXER_AUTODETECT:
case FSound.FSOUND_MIXER_BLENDMODE:
case FSound.FSOUND_MIXER_QUALITY_AUTODETECT:
case FSound.FSOUND_MIXER_QUALITY_FPU:
case FSound.FSOUND_MIXER_MONO:
case FSound.FSOUND_MIXER_QUALITY_MONO:
case FSound.FSOUND_MIXER_MAX:
bytesPerSample = 8;
break;
default:
bytesPerSample = 4;
break;
}
channels = FSound.FSOUND_Stream_GetMode(stream);
if ((channels & FSound.FSOUND_STEREO) == FSound.FSOUND_STEREO) {
channels = 2;
} else {
channels = 1;
}
FSound.FSOUND_Stream_SetEndCallback(stream, new FSoundStreamCallback() {
public void FSOUND_STREAMCALLBACK(FSoundStream stream, ByteBuffer buff, int len) {
System.out.println("Done");
}
});
FSound.FSOUND_Stream_SetSyncCallback(stream, new FSoundStreamCallback() {
public void FSOUND_STREAMCALLBACK(FSoundStream stream, ByteBuffer buff, int len) {
System.out.println("SYNCPOINT");
try {
byte[] data = new byte[buff.capacity()];
buff.get(data);
System.out.println("Syncpoint @ " + len + ": " + new String(data));
} catch (Exception e) {
e.printStackTrace();
}
}
});
FSound.FSOUND_Stream_Play(0, stream);
System.out.println("Press enter to stop playing");
try {
System.in.read();
} catch (IOException ioe) {
}
System.out.println("Done playing. Cleaning up");
FSound.FSOUND_Stream_Stop(stream);
FSound.FSOUND_Stream_Close(stream);
FSound.FSOUND_DSP_Free(unit);
//FSound.FSOUND_DSP_Free(unit2);
} else {
System.out.println("Unable to play: " + args[0]);
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
}
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
public class TestDspCallback implements FSoundDSPCallback {
private String name;
public TestDspCallback(String name) {
this.name = name;
}
/*
* @see org.lwjgl.fmod3.callbacks.FSoundDSPCallback#FSOUND_DSPCALLBACK(java.nio.ByteBuffer, java.nio.ByteBuffer, int)
*/
public ByteBuffer FSOUND_DSPCALLBACK(ByteBuffer originalbuffer, ByteBuffer newbuffer, int length) {
short leftChannel;
short rightChannel;
for (int i = 0; i < length; i++) {
leftChannel = originalbuffer.getShort();
rightChannel = originalbuffer.getShort();
// mute right channel
newbuffer.putShort(leftChannel);
newbuffer.putShort((short) 0);
}
newbuffer.rewind();
return newbuffer;
}
}
}

View File

@ -1,106 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.File;
import java.io.IOException;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FMusic;
import org.lwjgl.fmod3.FMusicModule;
import org.lwjgl.fmod3.FSound;
/**
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$
*/
public class MusicPlayer {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage:\n MusicPlayer <file>");
// default to Missing_you.mod
args = new String[] { "res" + File.separator + "Missing_you.mod"};
System.out.println("Using default: " + args[0]);
}
File file = new File(args[0]);
if (!file.exists()) {
System.out.println("No such file: " + args[0]);
System.exit(0);
}
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
System.out.println("Initializing FMOD");
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
return;
}
System.out.println("Loading " + args[0]);
// using name (path)
FMusicModule module = FMusic.FMUSIC_LoadSong(args[0]);
if (module != null) {
System.out.println("Loaded. Playing module of type: " + FMusic.FMUSIC_GetType(module));
FMusic.FMUSIC_PlaySong(module);
System.out.println("Press enter to stop playing");
try {
System.in.read();
} catch (IOException ioe) {
}
FMusic.FMUSIC_StopSong(module);
System.out.println("Done playing. Cleaning up");
FMusic.FMUSIC_FreeSong(module);
} else {
System.out.println("Unable to play: " + args[0]);
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
}
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
}

View File

@ -1,150 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FMusic;
import org.lwjgl.fmod3.FMusicModule;
import org.lwjgl.fmod3.FSound;
/**
* <br>
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision: 2286 $
* $Id: MusicPlayer.java 2286 2006-03-23 19:32:21Z matzon $
*/
public class MusicPlayerMemory {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage:\n MusicPlayer <file>");
// default to Missing_you.mod
args = new String[] { "res" + File.separator + "Missing_you.mod"};
System.out.println("Using default: " + args[0]);
}
File file = new File(args[0]);
if (!file.exists()) {
System.out.println("No such file: " + args[0]);
System.exit(0);
}
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
System.out.println("Initializing FMOD");
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
return;
}
System.out.println("Loading " + args[0]);
// using name (path)
ByteBuffer data = getData(args[0]);
FMusicModule module = FMusic.FMUSIC_LoadSongEx(data, FSound.FSOUND_LOADMEMORY, null);
if (module != null) {
System.out.println("Loaded. Playing module of type: " + FMusic.FMUSIC_GetType(module));
FMusic.FMUSIC_PlaySong(module);
System.out.println("Press enter to stop playing");
try {
System.in.read();
} catch (IOException ioe) {
}
FMusic.FMUSIC_StopSong(module);
System.out.println("Done playing. Cleaning up");
FMusic.FMUSIC_FreeSong(module);
} else {
System.out.println("Unable to play: " + args[0]);
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
}
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
/**
* Reads the file into a ByteBuffer
*
* @param filename Name of file to load
* @return ByteBuffer containing file data
*/
static protected ByteBuffer getData(String filename) {
ByteBuffer buffer = null;
System.out.println("Attempting to load: " + filename);
try {
BufferedInputStream bis = new BufferedInputStream(StreamPlayerMemory.class.getClassLoader()
.getResourceAsStream(filename));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int bufferLength = 4096;
byte[] readBuffer = new byte[bufferLength];
int read = -1;
while ((read = bis.read(readBuffer, 0, bufferLength)) != -1) {
baos.write(readBuffer, 0, read);
}
//done reading, close
bis.close();
// place it in a buffer
buffer = ByteBuffer.allocateDirect(baos.size());
buffer.order(ByteOrder.nativeOrder());
buffer.put(baos.toByteArray());
buffer.flip();
System.out.println("loaded " + buffer.remaining() + " bytes");
} catch (Exception ioe) {
ioe.printStackTrace();
}
return buffer;
}
}

View File

@ -1,445 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.awt.Button;
import java.awt.Canvas;
import java.awt.Choice;
import java.awt.Color;
import java.awt.Dialog;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Label;
import java.awt.Panel;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import javax.swing.BoxLayout;
import org.lwjgl.BufferUtils;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.FSoundStream;
/**
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$ <br>
*/
public class NetTest {
/** Main frame */
private Frame frame;
/** Whether we're initialized */
private boolean initialized;
/** Audio thread */
private Thread fmodThread;
/** Whether we're running */
private volatile boolean running;
/** Channel we'll be playing on */
private int channel = -1;
/** Canvas with fancy stuff */
public static Canvas spectrumCanvas;
/** Buffer containing the spectrum (512 floats) */
public static FloatBuffer spectrum;
/** List of known urls (monkeyradio, di streams) */
public static String[] urls = new String[] { "http://www.scenemusic.eu:8002/live.mp3",
"http://basu.cockos.com:6969/"};
/**
* Creates a new NetTest
* @param frame parent frame
*/
public NetTest(Frame frame) {
this.frame = frame;
}
/**
* Disposes NetTest
*/
private void dispose() {
if (initialized) {
stop();
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
}
/**
* Plays the supplied URL
*
* @param url URK to play
*/
protected void play(final String url) {
// do initialize if needed
if (!initialized) {
frame.setTitle("Initializing...");
if (!initialize()) {
frame.setTitle("LWJGL Fmod streaming player");
return;
}
}
// if already running, stop
if (fmodThread != null) {
stop();
}
// actual audi thread that starts playing
fmodThread = new Thread() {
public void run() {
// Open the url and prepare to play
// ============================================
frame.setTitle("Opening [" + url + "]");
running = true;
FSoundStream stream = FSound.FSOUND_Stream_Open(url, FSound.FSOUND_NORMAL | FSound.FSOUND_NONBLOCKING, 0, 0);
// --------------------------------------------
// With a stream in hand, loop untill we're told to stop
// ============================================
if (stream != null) {
IntBuffer status = BufferUtils.createIntBuffer(4);
while (running) {
// get channel, if we haven't got one already
if (channel < 0) {
channel = FSound.FSOUND_Stream_PlayEx(FSound.FSOUND_FREE, stream, null, false);
}
// query open state of stream
int openstate = FSound.FSOUND_Stream_GetOpenState(stream);
if ((openstate == -1) || (openstate == -3)) {
error("failed to open stream!: " + FSound.FSOUND_Stream_Net_GetLastServerStatus());
break;
}
// get status of stream
FSound.FSOUND_Stream_Net_GetStatus(stream, status);
frame.setTitle("Playing [state: " + getNameFor(status.get(0)) + ", buffer: " + status.get(1)
+ ", bitrate: " + status.get(2) + "]");
// repaint spectrum
spectrumCanvas.repaint();
// dont use all resources!
pause(25);
}
// exiting. spin on stop/close since we're non-blocking
while (!FSound.FSOUND_Stream_Stop(stream)) {
pause(10);
}
while (!FSound.FSOUND_Stream_Close(stream)) {
pause(10);
}
channel = -1;
} else {
error("Unable to play: " + url + ". Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
}
// --------------------------------------------
// we're done, nuke leftovers
spectrumCanvas.repaint();
}
};
fmodThread.start();
}
/**
* @return enum name for supplied stream open state
*/
protected String getNameFor(int i) {
switch (i) {
case FSound.FSOUND_STREAM_NET_NOTCONNECTED:
return "FSOUND_STREAM_NET_NOTCONNECTED";
case FSound.FSOUND_STREAM_NET_CONNECTING:
return "FSOUND_STREAM_NET_CONNECTING";
case FSound.FSOUND_STREAM_NET_BUFFERING:
return "FSOUND_STREAM_NET_BUFFERING";
case FSound.FSOUND_STREAM_NET_READY:
return "FSOUND_STREAM_NET_READY";
case FSound.FSOUND_STREAM_NET_ERROR:
return "FSOUND_STREAM_NET_ERROR";
}
return "";
}
/**
* Stops the playing
*/
protected void stop() {
// update title
if (frame.isVisible()) {
frame.setTitle("LWJGL Fmod streaming player: stopping...");
}
// nuke the thread, but wait for it to finish!
running = false;
if (fmodThread != null) {
try {
fmodThread.join();
} catch (InterruptedException inte) {
}
fmodThread = null;
}
// update title
if (frame.isVisible()) {
frame.setTitle("LWJGL Fmod streaming player");
}
}
/**
* Initializes the test
*
* @return true if initialization was successfull
*/
protected boolean initialize() {
if (!initialized) {
// create FMOD first!
try {
FMOD.create();
} catch (FMODException fmode) {
error(fmode.getMessage());
fmode.printStackTrace();
return false;
}
// initialize fsound
if (!FSound.FSOUND_Init(44100, 32, 0)) {
error("Failed to initialize FMOD: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
return false;
}
// get fft unit and activate it (else, we can't get the spectrum)
FSound.FSOUND_DSP_SetActive(FSound.FSOUND_DSP_GetFFTUnit(), true);
// get the spectrum
spectrum = FSound.FSOUND_DSP_GetSpectrum();
// setup buffers
FSound.FSOUND_Stream_SetBufferSize(100);
FSound.FSOUND_Stream_Net_SetBufferProperties(64000, 95, 95);
initialized = true;
}
return initialized;
}
/**
* @param string
*/
private void error(String string) {
final Dialog dialog = new Dialog(frame, "Error", true);
dialog.add(new Label(string));
dialog.pack();
dialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dialog.dispose();
}
});
// setup dialog
int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() - dialog.getWidth()) / 2;
int y = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() - dialog.getHeight()) / 2;
dialog.setLocation(x, y);
dialog.setVisible(true);
}
/**
* Pause calling thread for i milliseconds
*
* @param i how long time to pause
*/
private static void pause(long i) {
try {
Thread.sleep(i);
} catch (InterruptedException inte) {
}
}
/**
* Executes the NetTest
* @param args
*/
public static void main(String[] args) {
// UI and instance stuff
final Frame frame = new Frame("LWJGL Fmod streaming player");
final Choice choice;
final Button btnPlay;
final Button btnStop;
final boolean playing = false;
final NetTest netTest = new NetTest(frame);
// main panel
frame.setLayout(new BoxLayout(frame, BoxLayout.PAGE_AXIS));
final Panel panel[] = { new Panel(), new Panel()};
panel[0].setLayout(new FlowLayout());
panel[0].add(new Label("URL:"));
panel[0].add(choice = new Choice());
panel[0].add(btnPlay = new Button("Play"));
panel[0].add(btnStop = new Button("Stop"));
panel[1].add(spectrumCanvas = netTest.new SpectrumCanvas());
panel[0].setBackground(new Color(0x99, 0x99, 0x99));
panel[1].setBackground(new Color(0x99, 0x99, 0x99));
// add list of known urls
for (int i = 0; i < urls.length; i++) {
choice.add(urls[i]);
}
// add spectrum panel, set size and pack
frame.add(panel[0]);
spectrumCanvas.setSize(512, 100);
frame.pack();
// Add listeners
// =====================================================
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
frame.dispose();
netTest.dispose();
}
});
btnPlay.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.add(panel[1]);
frame.pack();
netTest.play(choice.getSelectedItem());
}
});
btnStop.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.remove(panel[1]);
frame.pack();
netTest.stop();
}
});
// -----------------------------------------------------
// setup frame
int x = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() - frame.getWidth()) / 2;
int y = (int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() - frame.getHeight()) / 2;
frame.setLocation(x, y);
frame.setResizable(false);
frame.setVisible(true);
}
/**
* Simplish spectrum
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
*/
class SpectrumCanvas extends Canvas {
/** Offscreen image for that flickerless feel! (TM) */
Image bufferImage;
/** Graphics context for buffer */
Graphics2D bufferGraphics;
/** Background color */
Color bgColor = new Color(0x99, 0x99, 0x99);
/** Gradient paint */
GradientPaint gp;
/**
* Called to paint the canvas
*/
public void paint(Graphics g) {
// create offscreen
if (bufferImage == null) {
gp = new GradientPaint(0, 0, Color.RED, 0, getHeight(), Color.GREEN);
bufferImage = createImage(getWidth(), getHeight());
bufferGraphics = (Graphics2D) bufferImage.getGraphics();
}
// clear old
bufferGraphics.setColor(bgColor);
bufferGraphics.fillRect(0, 0, getWidth(), getHeight());
// if we have a spectrum, draw it
if (spectrum != null && NetTest.this.fmodThread != null) {
int x = 0;
// for each spectrum value, draw a line according to its
// value (times 4, since we want higher frequencies to show up)
bufferGraphics.setPaint(gp);
for (int i = 0; i < 256; i++) {
int height = (int) (getHeight() * 4.0 * spectrum.get(i));
bufferGraphics.fillRect(x, getHeight() - height, 2, height);
x += 2;
}
}
// map offscreen onscreen
g.drawImage(bufferImage, 0, 0, this);
}
/**
* Just draw the sucker instead of default update
*/
public void update(Graphics g) {
paint(g);
}
}
}

View File

@ -1,103 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.File;
import java.io.IOException;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.FSoundStream;
/**
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$ <br>
*/
public class StreamPlayer {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage:\n StreamPlayer <file>");
// default to phero.mp3
args = new String[] { "res" + File.separator + "phero.mp3"};
System.out.println("Using default: " + args[0]);
}
File file = new File(args[0]);
if (!file.exists()) {
System.out.println("No such file: " + args[0]);
System.exit(0);
}
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
System.out.println("Initializing FMOD");
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
System.exit(0);
}
System.out.println("Loading " + args[0]);
FSoundStream stream = FSound.FSOUND_Stream_Open(args[0], FSound.FSOUND_NORMAL, 0, 0);
if (stream != null) {
FSound.FSOUND_Stream_Play(0, stream);
System.out.println("Press enter to stop playing");
try {
System.in.read();
} catch (IOException ioe) {
}
System.out.println("Done playing. Cleaning up");
FSound.FSOUND_Stream_Stop(stream);
FSound.FSOUND_Stream_Close(stream);
} else {
System.out.println("Unable to play: " + args[0]);
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
}
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
}

View File

@ -1,142 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.FSoundStream;
/**
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$ <br>
*/
public class StreamPlayerMemory {
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage:\n StreamPlayerMemory <file>");
// default to phero.mp3
args = new String[] { "res" + File.separator + "phero2.ogg"};
System.out.println("Using default: " + args[0]);
}
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
System.out.println("Initializing FMOD");
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
System.exit(0);
}
ByteBuffer data = getData(args[0]);
FSoundStream stream = FSound.FSOUND_Stream_Open(data, FSound.FSOUND_LOADMEMORY);
if (stream != null) {
FSound.FSOUND_Stream_Play(0, stream);
// busy wait until done
int length = FSound.FSOUND_Stream_GetLengthMs(stream);
String time = ((length / 1000) / 60) + "m " + ((length / 1000) % 60) + "s";
System.out.println("Waiting " + time + ", for song to finish");
try {
Thread.sleep(length);
} catch (InterruptedException inte) {
}
FSound.FSOUND_Stream_Stop(stream);
FSound.FSOUND_Stream_Close(stream);
} else {
System.out.println("Unable to play: " + args[0]);
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
}
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
/**
* Reads the file into a ByteBuffer
*
* @param filename Name of file to load
* @return ByteBuffer containing file data
*/
static protected ByteBuffer getData(String filename) {
ByteBuffer buffer = null;
System.out.println("Attempting to load: " + filename);
try {
BufferedInputStream bis = new BufferedInputStream(StreamPlayerMemory.class.getClassLoader()
.getResourceAsStream(filename));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int bufferLength = 4096;
byte[] readBuffer = new byte[bufferLength];
int read = -1;
while ((read = bis.read(readBuffer, 0, bufferLength)) != -1) {
baos.write(readBuffer, 0, read);
}
//done reading, close
bis.close();
// place it in a buffer
buffer = ByteBuffer.allocateDirect(baos.size());
buffer.order(ByteOrder.nativeOrder());
buffer.put(baos.toByteArray());
buffer.flip();
System.out.println("loaded " + buffer.remaining() + " bytes");
} catch (Exception ioe) {
ioe.printStackTrace();
}
return buffer;
}
}

View File

@ -1,85 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
/**
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$ <br>
*/
public class StreamTest {
public static void main(String[] args) {
try {
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
IntBuffer caps = BufferUtils.createIntBuffer(1);
FSound.FSOUND_SetOutput(FSound.FSOUND_OUTPUT_DSOUND);
int count = FSound.FSOUND_GetNumDrivers();
System.out.println("Found: " + count + " drivers");
for (int i = 0; i < count; i++) {
FSound.FSOUND_GetDriverCaps(i, caps);
System.out.println(i + " (" + FSound.FSOUND_GetDriverName(i) + ") = " + caps.get(0));
}
// init
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
System.exit(0);
}
IntBuffer mem = BufferUtils.createIntBuffer(2);
FSound.FSOUND_GetMemoryStats(mem);
System.out.println("Allocated: " + mem.get(0) + ", Max: " + mem.get(1));
IntBuffer hwChannels = BufferUtils.createIntBuffer(3);
FSound.FSOUND_GetNumHWChannels(hwChannels);
System.out.println("2d: " + hwChannels.get(0) + ", 3d: " + hwChannels.get(1) + ", total: " + hwChannels.get(2));
FSound.FSOUND_Close();
FMOD.destroy();
}
}

View File

@ -1,259 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FMusic;
import org.lwjgl.fmod3.FMusicModule;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.callbacks.FMusicCallback;
/**
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$ <br>
*/
public class SyncTest {
/** Path to file to play */
private String filePath;
/** Module instance loaded */
private FMusicModule module;
/** Whether test is running */
private boolean running = true;
/** Current row */
private int row;
/** Current order */
private int order;
/** Number of orders in the song */
private int numOrders;
/**
* Creates a new SyncTest
* @param string
*/
public SyncTest(String filePath) {
this.filePath = filePath;
// create thread to exit when a key has been pressed
Thread t = new Thread() {
public void run() {
try {
System.in.read();
} catch (IOException ioe) {
}
running = false;
}
};
t.setDaemon(true);
t.start();
}
/**
*
* @param args
*/
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage:\n SyncTest <file>");
// default to Missing_you.mod
args = new String[] { "res" + File.separator + "Missing_you.mod"};
System.out.println("Using default: " + args[0]);
}
// check for file existance
File file = new File(args[0]);
if (!file.exists()) {
System.out.println("No such file: " + args[0]);
System.exit(0);
}
// initialize FMOD
try {
System.out.println("Initializing FMOD");
FMOD.create();
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
// start actual test
SyncTest sync = new SyncTest(args[0]);
sync.executeTest();
}
/**
* Executes the test
*/
public void executeTest() {
// do setup
setup();
// if we have a module - get going
if (module != null) {
// go go go!
run();
}
// we're done - clean up
destroy();
}
/**
* Setup FMOD
*/
private void setup() {
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
return;
}
// load module
System.out.println("Loading " + filePath);
module = FMusic.FMUSIC_LoadSong(filePath);
if (module == null) {
System.out.println("Unable to load " + filePath + ": " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
return;
}
// get number of orders
numOrders = FMusic.FMUSIC_GetNumOrders(module);
// install order callback
FMusic.FMUSIC_SetOrderCallback(module, new FMusicCallback() {
public void FMUSIC_CALLBACK(FMusicModule module, int param) {
order = param;
}
}, 1);
// install row callback
// will be called once PER CHANNEL! - but since we only set the row
// no harm is done :)
FMusic.FMUSIC_SetRowCallback(module, new FMusicCallback() {
public void FMUSIC_CALLBACK(FMusicModule module, int param) {
row = param;
}
}, 1);
// try to add some userdata
ByteBuffer buffer = BufferUtils.createByteBuffer(24);
buffer.putInt(1).putInt(2).putInt(3).putInt(4).putInt(5).putInt(6).rewind();
FMusic.FMUSIC_SetUserData(module, buffer);
}
/**
* Update status of module - spew it out in console
*/
private void update() {
// mark as not running when finished
if (FMusic.FMUSIC_IsFinished(module)) {
running = false;
}
int patternLength = FMusic.FMUSIC_GetPatternLength(module, order);
int time = FMusic.FMUSIC_GetTime(module) / 1000;
int time2 = FMusic.FMUSIC_GetTime(module) % 1000 / 10;
double cpu = Math.round(FSound.FSOUND_GetCPUUsage() * 100.0) / 100.0;
System.out.println("O: " + ((order < 10) ? "0" : "") + order + "/" + numOrders + " | R: " + ((row < 10) ? "0" : "")
+ row + "/" + patternLength + " | T: " + time + "." + ((time2 < 10) ? "0" : "") + time2 + " | BPM: "
+ FMusic.FMUSIC_GetBPM(module) + " | Play: " + FMusic.FMUSIC_IsFinished(module) + " | C: "
+ FSound.FSOUND_GetChannelsPlaying() + " | CPU: " + cpu);
}
/**
* Runs the actual test - that is, play | update ad nausea
*/
private void run() {
// play
FMusic.FMUSIC_PlaySong(module);
// loop, printing update, if we actually changed row
int lastRow = row;
while (running) {
if (lastRow != row) {
lastRow = row;
update();
} else {
pause(5);
}
}
}
/**
* @param i
*/
private void pause(long i) {
try {
Thread.sleep(i);
} catch (InterruptedException inte) {
}
}
// clean up our own mess
private void destroy() {
if (module != null) {
// retrieve userdata
ByteBuffer buffer = FMusic.FMUSIC_GetUserData(module, 24);
// should contain 1,2,3,4,5,6
for (int i = 0; i < 6; i++) {
System.out.println(buffer.getInt());
}
FMusic.FMUSIC_FreeSong(module);
}
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
}

View File

@ -1,155 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
package org.lwjgl.test.fmod3;
import java.io.File;
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
import org.lwjgl.fmod3.FMOD;
import org.lwjgl.fmod3.FMODException;
import org.lwjgl.fmod3.FSound;
import org.lwjgl.fmod3.FSoundStream;
import org.lwjgl.fmod3.FSoundTagField;
/**
*
* @author Brian Matzon <brian@matzon.dk>
* @version $Revision$
* $Id$ <br>
*/
public class TagFieldTest {
/** Scratch buffer */
static IntBuffer scratch = BufferUtils.createIntBuffer(16);
/**
* Main entry point
*
* @param args arguments for app
*/
public static void main(String[] args) {
if (args.length < 1) {
System.out.println("Usage:\n TagFieldTest <file|dir>");
// default to .
args = new String[] { "."};
System.out.println("Using default: " + args[0]);
}
// initialize fmod
try {
System.out.println("Initializing FMOD");
FMOD.create();
if (!FSound.FSOUND_Init(44100, 32, 0)) {
System.out.println("Failed to initialize FMOD");
System.out.println("Error: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
FMOD.destroy();
System.exit(0);
}
} catch (FMODException fmode) {
fmode.printStackTrace();
System.exit(0);
}
// scan the supplied arg
System.out.println("Starting recursive scan from: " + args[0]);
scanPath(new File(args[0]));
// shutdown
FSound.FSOUND_Close();
FMOD.destroy();
System.exit(0);
}
/**
* Scans a path for files
*
* @param path Path to scan
*/
private static void scanPath(File path) {
// if we got supplied a file - scan it
if (path.isFile()) {
scanFile(path);
return;
}
// if we got a dir scan it for files and subfolders
if (path.isDirectory()) {
File[] files = path.listFiles();
if (files != null) {
// scan each entry, recursively calling scanPath
for (int i = 0; i < files.length; i++) {
scanPath(files[i]);
}
}
return;
}
System.out.println("Ignoring: " + path.getAbsolutePath());
}
/**
* Scans a file for tag fields
* @param file file to scan for tags
*/
private static void scanFile(File file) {
// if we got an mp3 or an ogg file, open it
if (file.getName().indexOf(".mp3") != -1 || file.getName().indexOf(".ogg") != -1) {
System.out.println("Opening " + file.getAbsolutePath());
FSoundStream stream = FSound.FSOUND_Stream_Open(file.getAbsolutePath(), FSound.FSOUND_NORMAL, 0, 0);
if(stream == null) {
System.out.println("Unable to open file: " + FMOD.FMOD_ErrorString(FSound.FSOUND_GetError()));
return;
}
FSound.FSOUND_Stream_GetNumTagFields(stream, scratch);
int tagCount = scratch.get(0);
// print each name value pair
if (tagCount > 0) {
System.out.println("The following list of tags were found:");
FSoundTagField field;
for (int i = 0; i < tagCount; i++) {
field = new FSoundTagField();
if (FSound.FSOUND_Stream_GetTagField(stream, i, field)) {
System.out.println(" " + field.getName() + " = '" + field.getValueAsString() + "'");
}
}
} else {
System.out.println("Unable to locates any tags");
}
System.out.println();
FSound.FSOUND_Stream_Close(stream);
}
}
}

View File

@ -1,19 +0,0 @@
CC=gcc
LINKER=gcc
STRIP=strip
CFLAGS_LINK=-shared -Wall
LIBS=-lpthread
CFLAGS_O=-fPIC -O2 -D_X11 -Wall -pthread -c -I.. -I. -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
SRC=$(wildcard *.c) ../common_tools.c
OBJECTS=$(subst .c,.o,$(SRC))
LIBRARY=liblwjgl-devil.so
$(LIBRARY): $(OBJECTS)
$(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(LIBS)
$(STRIP) $@
.c.o:
$(CC) $(CFLAGS_O) $< -o $@
clean:
rm -f $(OBJECTS) $(LIBRARY)

View File

@ -1,19 +0,0 @@
CC=gcc
LINKER=gcc
STRIP=strip
CFLAGS_LINK=-dynamiclib -Wall -framework JavaVM
LIBS=-lpthread
CFLAGS_O=-fPIC -O2 -D_MACOSX -Wall -c -I.. -I. -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
SRC=$(wildcard *.c) ../common_tools.c
OBJECTS=$(subst .c,.o,$(SRC))
LIBRARY=liblwjgl-devil.jnilib
$(LIBRARY): $(OBJECTS)
$(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(LIBS)
$(STRIP) -S -X $@
.c.o:
$(CC) $(CFLAGS_O) $< -o $@
clean:
rm -f $(OBJECTS) $(LIBRARY)

View File

@ -1,147 +0,0 @@
#ifndef __DEVIL_COMMON_H__
#define __DEVIL_COMMON_H__
#include <jni.h>
#include <stdio.h>
#include <string.h>
#include "common_tools.h"
#ifdef _X11
#include <dlfcn.h>
#endif
/*-----------------------------------------*/
typedef unsigned int GLuint;
#ifdef _UNICODE
#ifndef _WIN32_WCE
#include <wchar.h>
#endif
typedef wchar_t* ILstring;
#else
typedef char* ILstring;
#endif//_UNICODE
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
#define ILAPIENTRY __stdcall
#define IL_PACKSTRUCT
//#elif defined(linux) || defined(MACOSX) || defined(__CYGWIN__) //fix bug 840364
#elif defined( __GNUC__ )
// this should work for any of the above commented platforms
// plus any platform using GCC
#define ILAPIENTRY
#define IL_PACKSTRUCT __attribute__ ((packed))
#else
#define ILAPIENTRY
#define IL_PACKSTRUCT
#endif
// This is from Win32's <wingdi.h> and <winnt.h>
#if defined(__LCC__)
#define ILAPI __stdcall
#elif defined(_WIN32) //changed 20031221 to fix bug 840421
#ifdef IL_STATIC_LIB
#define ILAPI
#else
#ifdef _IL_BUILD_LIBRARY
#define ILAPI __declspec(dllexport)
#else
#define ILAPI __declspec(dllimport)
#endif
#endif
#elif __APPLE__
#define ILAPI extern
#else
#define ILAPI
#endif
typedef void* ILHANDLE;
typedef unsigned int ILenum;
typedef unsigned char ILboolean;
typedef unsigned int ILbitfield;
typedef char ILbyte;
typedef short ILshort;
typedef int ILint;
typedef int ILsizei;
typedef unsigned char ILubyte;
typedef unsigned short ILushort;
typedef unsigned int ILuint;
typedef float ILfloat;
typedef float ILclampf;
typedef double ILdouble;
typedef double ILclampd;
typedef void ILvoid;
typedef struct ILinfo
{
ILuint Id; // the image's id
ILubyte *Data; // the image's data
ILuint Width; // the image's width
ILuint Height; // the image's height
ILuint Depth; // the image's depth
ILubyte Bpp; // bytes per pixel (not bits) of the image
ILuint SizeOfData; // the total size of the data (in bytes)
ILenum Format; // image format (in IL enum style)
ILenum Type; // image type (in IL enum style)
ILenum Origin; // origin of the image
ILubyte *Palette; // the image's palette
ILenum PalType; // palette type
ILuint PalSize; // palette size
ILenum CubeFlags; // flags for what cube map sides are present
ILuint NumNext; // number of images following
ILuint NumMips; // number of mipmaps
ILuint NumLayers; // number of layers
} ILinfo;
typedef struct ILpointf
{
ILfloat x, y;
} ILpointf;
typedef struct ILpointi
{
ILint x, y;
} ILpointi;
#define IL_IMAGE_WIDTH 0x0DE4
#define IL_IMAGE_HEIGHT 0x0DE5
#define IL_IMAGE_BYTES_PER_PIXEL 0x0DE8
// Callback functions for file reading
typedef ILvoid (ILAPIENTRY *fCloseRProc)(ILHANDLE);
typedef ILboolean (ILAPIENTRY *fEofProc) (ILHANDLE);
typedef ILint (ILAPIENTRY *fGetcProc) (ILHANDLE);
typedef ILHANDLE (ILAPIENTRY *fOpenRProc) (const ILstring);
typedef ILint (ILAPIENTRY *fReadProc) (void*, ILuint, ILuint, ILHANDLE);
typedef ILint (ILAPIENTRY *fSeekRProc) (ILHANDLE, ILint, ILint);
typedef ILint (ILAPIENTRY *fTellRProc) (ILHANDLE);
// Callback functions for file writing
typedef ILvoid (ILAPIENTRY *fCloseWProc)(ILHANDLE);
typedef ILHANDLE (ILAPIENTRY *fOpenWProc) (const ILstring);
typedef ILint (ILAPIENTRY *fPutcProc) (ILubyte, ILHANDLE);
typedef ILint (ILAPIENTRY *fSeekWProc) (ILHANDLE, ILint, ILint);
typedef ILint (ILAPIENTRY *fTellWProc) (ILHANDLE);
typedef ILint (ILAPIENTRY *fWriteProc) (const void*, ILuint, ILuint, ILHANDLE);
// Callback functions for allocation and deallocation
typedef ILvoid* (ILAPIENTRY *mAlloc)(ILuint);
typedef ILvoid (ILAPIENTRY *mFree) (ILvoid*);
// Registered format procedures
typedef ILenum (ILAPIENTRY *IL_LOADPROC)(const ILstring);
typedef ILenum (ILAPIENTRY *IL_SAVEPROC)(const ILstring);
/*-----------------------------------------*/
#if defined(_WIN32) && !defined(APIENTRY)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#endif /* __EXTIL_H__ */

View File

@ -1,115 +0,0 @@
/* Handle to devil Library */
#ifdef _WIN32
#include "extil.h"
static HMODULE devILhandle;
#else
#include <dlfcn.h>
#include "extil.h"
static void* devILhandle;
#endif
#include "org_lwjgl_devil_ILNative.h"
/*
* Class: org_lwjgl_devil_ILNative
* Method: getNativeLibraryVersion
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_devil_ILNative_getNativeLibraryVersion(JNIEnv *env, jclass clazz) {
return org_lwjgl_devil_ILNative_JNI_VERSION;
}
/**
* Retrieves a function pointer from the devil library
* @param function Name of function to retrieve
*/
static void *NativeGetFunctionPointer(const char *function) {
#ifdef _WIN32
return GetProcAddress(devILhandle, function);
#else
return dlsym(devILhandle, function);
#endif
}
/**
* Retrieves a pointer to the named function
*
* @param function Name of function
* @return pointer to named function, or NULL if not found
*/
static void* extil_GetProcAddress(const char* function) {
void *p = NativeGetFunctionPointer(function);
if (p == NULL) {
printfDebug("Could not locate symbol %s\n", function);
}
return p;
}
/**
* Initializes all functions for class
*/
void extil_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) {
ext_InitializeClass(env, clazz, &extil_GetProcAddress, num_functions, functions);
}
/**
* Opens the native library
*/
bool extil_Open(JNIEnv *env, jobjectArray ilPaths) {
jsize pathcount = (*env)->GetArrayLength(env, ilPaths);
int i;
jstring path;
char *path_str;
printfDebug("Found %d devil paths\n", (int)pathcount);
for(i=0;i<pathcount;i++) {
path = (jstring) (*env)->GetObjectArrayElement(env, ilPaths, i);
path_str = GetStringNativeChars(env, path);
printfDebug("Testing '%s'\n", path_str);
#ifdef _WIN32
devILhandle = LoadLibrary(path_str);
#elif __APPLE__ && __MACH__
char* directoryName = dirname(path_str);
char* fileName = basename(path_str);
char* currentDirectory = getwd(NULL);
if(directoryName != NULL) {
chdir(directoryName);
}
devILhandle = dlopen(fileName, RTLD_LAZY);
if(devILhandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
chdir(currentDirectory);
free(currentDirectory);
#else
devILhandle = dlopen(path_str, RTLD_LAZY);
if(devILhandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
#endif
if (devILhandle != NULL) {
printfDebug("Found IL at '%s'\n", path_str);
}
free(path_str);
if (devILhandle != NULL) {
return true;
}
}
throwException(env, "Could not load devil library.");
return false;
}
/**
* Closes the native library
*/
void extil_Close(void) {
#ifdef _WIN32
FreeLibrary(devILhandle);
#else
if (devILhandle != NULL) {
dlclose(devILhandle);
}
#endif
devILhandle = NULL;
}

View File

@ -1,11 +0,0 @@
#ifndef __EXTIL_H__
#define __EXTIL_H__
#include "devil-common.h"
extern bool extil_Open(JNIEnv *env, jobjectArray ilPaths);
extern void extil_Close(void);
extern void extil_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
#endif

View File

@ -1,104 +0,0 @@
/* Handle to ilu Library */
#ifdef _WIN32
#include "extilu.h"
static HMODULE devILUhandle;
#else
#include <dlfcn.h>
#include "extilu.h"
static void* devILUhandle;
#endif
/**
* Retrieves a function pointer from the ilu library
* @param function Name of function to retrieve
*/
static void *NativeGetFunctionPointer(const char *function) {
#ifdef _WIN32
return GetProcAddress(devILUhandle, function);
#else
return dlsym(devILUhandle, function);
#endif
}
/**
* Retrieves a pointer to the named function
*
* @param function Name of function
* @return pointer to named function, or NULL if not found
*/
static void* extilu_GetProcAddress(const char* function) {
void *p = NativeGetFunctionPointer(function);
if (p == NULL) {
printfDebug("Could not locate symbol %s\n", function);
}
return p;
}
/**
* Initializes all functions for class
*/
void extilu_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) {
ext_InitializeClass(env, clazz, &extilu_GetProcAddress, num_functions, functions);
}
/**
* Opens the native library
*/
bool extilu_Open(JNIEnv *env, jobjectArray ilPaths) {
jsize pathcount = (*env)->GetArrayLength(env, ilPaths);
int i;
jstring path;
char *path_str;
printfDebug("Found %d ilu paths\n", (int)pathcount);
for(i=0;i<pathcount;i++) {
path = (jstring) (*env)->GetObjectArrayElement(env, ilPaths, i);
path_str = GetStringNativeChars(env, path);
printfDebug("Testing '%s'\n", path_str);
#ifdef _WIN32
devILUhandle = LoadLibrary(path_str);
#elif __APPLE__ && __MACH__
char* directoryName = dirname(path_str);
char* fileName = basename(path_str);
char* currentDirectory = getwd(NULL);
if(directoryName != NULL) {
chdir(directoryName);
}
devILUhandle = dlopen(fileName, RTLD_LAZY);
if(devILUhandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
chdir(currentDirectory);
free(currentDirectory);
#else
devILUhandle = dlopen(path_str, RTLD_LAZY);
if(devILUhandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
#endif
if (devILUhandle != NULL) {
printfDebug("Found ILU at '%s'\n", path_str);
}
free(path_str);
if (devILUhandle != NULL) {
return true;
}
}
throwException(env, "Could not load ilu library.");
return false;
}
/**
* Closes the native library
*/
void extilu_Close(void) {
#ifdef _WIN32
FreeLibrary(devILUhandle);
#else
if (devILUhandle != NULL) {
dlclose(devILUhandle);
}
#endif
devILUhandle = NULL;
}

View File

@ -1,11 +0,0 @@
#ifndef __EXTILU_H__
#define __EXTILU_H__
#include "devil-common.h"
extern bool extilu_Open(JNIEnv *env, jobjectArray ilPaths);
extern void extilu_Close(void);
extern void extilu_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
#endif

View File

@ -1,105 +0,0 @@
/* Handle to ilut Library */
#ifdef _WIN32
#include "extilut.h"
static HMODULE devILUThandle;
#else
#include <dlfcn.h>
#include "extilut.h"
static void* devILUThandle;
#endif
/**
* Retrieves a function pointer from the ilut library
* @param function Name of function to retrieve
*/
static void *NativeGetFunctionPointer(const char *function) {
#ifdef _WIN32
return GetProcAddress(devILUThandle, function);
#else
return dlsym(devILUThandle, function);
#endif
}
/**
* Retrieves a pointer to the named function
*
* @param function Name of function
* @return pointer to named function, or NULL if not found
*/
static void* extilut_GetProcAddress(const char* function) {
void *p = NativeGetFunctionPointer(function);
if (p == NULL) {
printfDebug("Could not locate symbol %s\n", function);
}
return p;
}
/**
* Initializes all functions for class
*/
void extilut_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) {
ext_InitializeClass(env, clazz, &extilut_GetProcAddress, num_functions, functions);
}
/**
* Opens the native library
*/
bool extilut_Open(JNIEnv *env, jobjectArray ilPaths) {
jsize pathcount = (*env)->GetArrayLength(env, ilPaths);
int i;
jstring path;
char *path_str;
printfDebug("Found %d ilut paths\n", (int)pathcount);
for(i=0;i<pathcount;i++) {
path = (jstring) (*env)->GetObjectArrayElement(env, ilPaths, i);
path_str = GetStringNativeChars(env, path);
printfDebug("Testing '%s'\n", path_str);
#ifdef _WIN32
devILUThandle = LoadLibrary(path_str);
#elif __APPLE__ && __MACH__
char* directoryName = dirname(path_str);
char* fileName = basename(path_str);
char* currentDirectory = getwd(NULL);
if(directoryName != NULL) {
chdir(directoryName);
}
devILUThandle = dlopen(fileName, RTLD_LAZY);
if(devILUThandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
chdir(currentDirectory);
free(currentDirectory);
#else
devILUThandle = dlopen(path_str, RTLD_LAZY);
if(devILUThandle == NULL) {
printfDebug("dlopen failure: %s\n", dlerror());
}
#endif
if (devILUThandle != NULL) {
printfDebug("Found ILUT at '%s'\n", path_str);
}
free(path_str);
if (devILUThandle != NULL) {
return true;
}
}
throwException(env, "Could not load ilut library.");
return false;
}
/**
* Closes the native library
*/
void extilut_Close(void) {
#ifdef _WIN32
FreeLibrary(devILUThandle);
#else
if (devILUThandle != NULL) {
dlclose(devILUThandle);
}
#endif
devILUThandle = NULL;
}

View File

@ -1,11 +0,0 @@
#ifndef __EXTILUT_H__
#define __EXTILUT_H__
#include "devil-common.h"
extern bool extilut_Open(JNIEnv *env, jobjectArray ilPaths);
extern void extilut_Close(void);
extern void extilut_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,597 +0,0 @@
#include "extilu.h"
#include "org_lwjgl_devil_ILNative.h"
typedef ILboolean (ILAPIENTRY *iluAlienifyPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluBlurAvgPROC) (ILuint Iter);
typedef ILboolean (ILAPIENTRY *iluBlurGaussianPROC) (ILuint Iter);
typedef ILboolean (ILAPIENTRY *iluBuildMipmapsPROC) (ILvoid);
typedef ILuint (ILAPIENTRY *iluColoursUsedPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluCompareImagePROC) (ILuint Comp);
typedef ILboolean (ILAPIENTRY *iluContrastPROC) (ILfloat Contrast);
typedef ILboolean (ILAPIENTRY *iluCropPROC) (ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth);
typedef ILvoid (ILAPIENTRY *iluDeleteImagePROC) (ILuint Id);
typedef ILboolean (ILAPIENTRY *iluEdgeDetectEPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluEdgeDetectPPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluEdgeDetectSPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluEmbossPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluEnlargeCanvasPROC) (ILuint Width, ILuint Height, ILuint Depth);
typedef ILboolean (ILAPIENTRY *iluEnlargeImagePROC) (ILfloat XDim, ILfloat YDim, ILfloat ZDim);
typedef ILboolean (ILAPIENTRY *iluEqualizePROC) (ILvoid);
typedef const ILstring (ILAPIENTRY *iluErrorStringPROC) (ILenum Error);
typedef ILboolean (ILAPIENTRY *iluFlipImagePROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluGammaCorrectPROC) (ILfloat Gamma);
typedef ILuint (ILAPIENTRY *iluGenImagePROC) (ILvoid);
typedef ILvoid (ILAPIENTRY *iluGetImageInfoPROC) (ILinfo *Info);
typedef ILint (ILAPIENTRY *iluGetIntegerPROC) (ILenum Mode);
typedef ILvoid (ILAPIENTRY *iluGetIntegervPROC) (ILenum Mode, ILint *Param);
typedef const ILstring (ILAPIENTRY *iluGetStringPROC) (ILenum StringName);
typedef ILvoid (ILAPIENTRY *iluImageParameterPROC) (ILenum PName, ILenum Param);
typedef ILvoid (ILAPIENTRY *iluInitPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluInvertAlphaPROC) (ILvoid);
typedef ILuint (ILAPIENTRY *iluLoadImagePROC) (const ILstring FileName);
typedef ILboolean (ILAPIENTRY *iluMirrorPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluNegativePROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluNoisifyPROC) (ILclampf Tolerance);
typedef ILboolean (ILAPIENTRY *iluPixelizePROC) (ILuint PixSize);
typedef ILboolean (ILAPIENTRY *iluReplaceColourPROC) (ILubyte Red, ILubyte Green, ILubyte Blue, ILfloat Tolerance);
typedef ILboolean (ILAPIENTRY *iluRotatePROC) (ILfloat Angle);
typedef ILboolean (ILAPIENTRY *iluSaturate1fPROC) (ILfloat Saturation);
typedef ILboolean (ILAPIENTRY *iluSaturate4fPROC) (ILfloat r, ILfloat g, ILfloat b, ILfloat Saturation);
typedef ILboolean (ILAPIENTRY *iluScalePROC) (ILuint Width, ILuint Height, ILuint Depth);
typedef ILboolean (ILAPIENTRY *iluScaleColoursPROC) (ILfloat r, ILfloat g, ILfloat b);
typedef ILboolean (ILAPIENTRY *iluSharpenPROC) (ILfloat Factor, ILuint Iter);
typedef ILboolean (ILAPIENTRY *iluSwapColoursPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *iluWavePROC) (ILfloat Angle);
// not bound
//typedef ILvoid (ILAPIENTRY *iluRegionfvPROC) (ILpointf *Points, ILuint n);
//typedef ILvoid (ILAPIENTRY *iluRegionivPROC) (ILpointi *Points, ILuint n);
//typedef ILboolean (ILAPIENTRY *iluRotate3DPROC) (ILfloat x, ILfloat y, ILfloat z, ILfloat Angle);
static iluAlienifyPROC iluAlienify;
static iluBlurAvgPROC iluBlurAvg;
static iluBlurGaussianPROC iluBlurGaussian;
static iluBuildMipmapsPROC iluBuildMipmaps;
static iluColoursUsedPROC iluColoursUsed;
static iluCompareImagePROC iluCompareImage;
static iluContrastPROC iluContrast;
static iluCropPROC iluCrop;
static iluDeleteImagePROC iluDeleteImage;
static iluEdgeDetectEPROC iluEdgeDetectE;
static iluEdgeDetectPPROC iluEdgeDetectP;
static iluEdgeDetectSPROC iluEdgeDetectS;
static iluEmbossPROC iluEmboss;
static iluEnlargeCanvasPROC iluEnlargeCanvas;
static iluEnlargeImagePROC iluEnlargeImage;
static iluEqualizePROC iluEqualize;
static iluErrorStringPROC iluErrorString;
static iluFlipImagePROC iluFlipImage;
static iluGammaCorrectPROC iluGammaCorrect;
static iluGenImagePROC iluGenImage;
static iluGetImageInfoPROC iluGetImageInfo;
static iluGetIntegerPROC iluGetInteger;
static iluGetIntegervPROC iluGetIntegerv;
static iluGetStringPROC iluGetString;
static iluImageParameterPROC iluImageParameter;
static iluInitPROC iluInit;
static iluInvertAlphaPROC iluInvertAlpha;
static iluLoadImagePROC iluLoadImage;
static iluMirrorPROC iluMirror;
static iluNegativePROC iluNegative;
static iluNoisifyPROC iluNoisify;
static iluPixelizePROC iluPixelize;
static iluReplaceColourPROC iluReplaceColour;
static iluRotatePROC iluRotate;
static iluSaturate1fPROC iluSaturate1f;
static iluSaturate4fPROC iluSaturate4f;
static iluScalePROC iluScale;
static iluScaleColoursPROC iluScaleColours;
static iluSharpenPROC iluSharpen;
static iluSwapColoursPROC iluSwapColours;
static iluWavePROC iluWave;
// not bound
//static iluRegionfvPROC iluRegionfv;
//static iluRegionivPROC iluRegioniv;
//static iluRotate3DPROC iluRotate3D;
/*
* Class: org_lwjgl_devil_ILU
* Method: iluAlienify
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluAlienify(JNIEnv *env, jclass clazz) {
return iluAlienify();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluBlurAvg
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluBlurAvg(JNIEnv *env, jclass clazz, jint iter) {
return iluBlurAvg((ILuint)iter);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluBlurGaussian
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluBlurGaussian(JNIEnv *env, jclass clazz, jint iter) {
return iluBlurGaussian((ILuint)iter);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluBuildMipmaps
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluBuildMipmaps(JNIEnv *env, jclass clazz) {
return iluBuildMipmaps();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluColoursUsed
* Signature: ()I
*/
static jint JNICALL Java_org_lwjgl_devil_ILU_iluColoursUsed(JNIEnv *env, jclass clazz) {
return iluColoursUsed();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluCompareImage
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluCompareImage(JNIEnv *env, jclass clazz, jint comp) {
return iluCompareImage((ILuint)comp);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluContrast
* Signature: (F)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluContrast(JNIEnv *env, jclass clazz, jfloat contrast) {
return iluContrast((ILfloat)contrast);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluCrop
* Signature: (IIIIII)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluCrop(JNIEnv *env, jclass clazz, jint xOff, jint yOff, jint zOff, jint width, jint height, jint depth) {
return iluCrop((ILuint)xOff, (ILuint)yOff, (ILuint)zOff, (ILuint)width, (ILuint)height, (ILuint)depth);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluDeleteImage
* Signature: (I)V
*/
static void JNICALL Java_org_lwjgl_devil_ILU_iluDeleteImage(JNIEnv *env, jclass clazz, jint id) {
iluDeleteImage((ILuint)id);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluEdgeDetectE
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluEdgeDetectE(JNIEnv *env, jclass clazz) {
return iluEdgeDetectE();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluEdgeDetectP
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluEdgeDetectP(JNIEnv *env, jclass clazz) {
return iluEdgeDetectP();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluEdgeDetectS
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluEdgeDetectS(JNIEnv *env, jclass clazz) {
return iluEdgeDetectS();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluEmboss
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluEmboss(JNIEnv *env, jclass clazz) {
return iluEmboss();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluEnlargeCanvas
* Signature: (III)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluEnlargeCanvas(JNIEnv *env, jclass clazz, jint width, jint height, jint depth) {
return iluEnlargeCanvas((ILuint)width, (ILuint)height, (ILuint)depth);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluEnlargeImage
* Signature: (FFF)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluEnlargeImage(JNIEnv *env, jclass clazz, jfloat xDim, jfloat yDim, jfloat zDim) {
return iluEnlargeImage((ILfloat)xDim, (ILfloat)yDim, (ILfloat)zDim);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluEqualize
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluEqualize(JNIEnv *env, jclass clazz) {
return iluEqualize();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluErrorString
* Signature: (I)Ljava/lang/String;
*/
static jstring JNICALL Java_org_lwjgl_devil_ILU_iluErrorString(JNIEnv *env, jclass clazz, jint error) {
char * errorstring = iluErrorString((ILenum)error);
return NewStringNativeWithLength(env, errorstring, strlen(errorstring));
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluFlipImage
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluFlipImage(JNIEnv *env, jclass clazz) {
return iluFlipImage();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluGammaCorrect
* Signature: (F)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluGammaCorrect(JNIEnv *env, jclass clazz, jfloat gamma) {
return iluGammaCorrect((ILfloat)gamma);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluGenImage
* Signature: ()I
*/
static jint JNICALL Java_org_lwjgl_devil_ILU_iluGenImage(JNIEnv *env, jclass clazz) {
return iluGenImage();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluGetImageInfo
* Signature: (Lorg/lwjgl/devil/ILinfo;)V
*/
static void JNICALL Java_org_lwjgl_devil_ILU_iluGetImageInfo(JNIEnv *env, jclass clazz, jobject info) {
jfieldID fieldId;
ILinfo *imageInfo;
if(info == 0) {
throwException(env, "ILinfo object must not be null.");
}
imageInfo = (ILinfo *)malloc(sizeof(ILinfo));
iluGetImageInfo(imageInfo);
clazz = (*env)->GetObjectClass(env, info);
fieldId = (*env)->GetFieldID(env, clazz, "id", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->Id);
fieldId = (*env)->GetFieldID(env, clazz, "width", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->Width);
fieldId = (*env)->GetFieldID(env, clazz, "height", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->Height);
fieldId = (*env)->GetFieldID(env, clazz, "depth", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->Depth);
fieldId = (*env)->GetFieldID(env, clazz, "bpp", "B");
(*env)->SetByteField(env, info, fieldId, (jbyte)imageInfo->Bpp);
fieldId = (*env)->GetFieldID(env, clazz, "sizeOfData", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->SizeOfData);
fieldId = (*env)->GetFieldID(env, clazz, "format", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->Format);
fieldId = (*env)->GetFieldID(env, clazz, "type", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->Type);
fieldId = (*env)->GetFieldID(env, clazz, "origin", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->Origin);
fieldId = (*env)->GetFieldID(env, clazz, "palType", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->PalType);
fieldId = (*env)->GetFieldID(env, clazz, "palSize", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->PalSize);
fieldId = (*env)->GetFieldID(env, clazz, "cubeFlags", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->CubeFlags);
fieldId = (*env)->GetFieldID(env, clazz, "numNext", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->NumNext);
fieldId = (*env)->GetFieldID(env, clazz, "numMips", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->NumMips);
fieldId = (*env)->GetFieldID(env, clazz, "numLayers", "I");
(*env)->SetIntField(env, info, fieldId, (jint)imageInfo->NumLayers);
free(imageInfo);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluGetInteger
* Signature: (I)I
*/
static jint JNICALL Java_org_lwjgl_devil_ILU_iluGetInteger(JNIEnv *env, jclass clazz, jint mode) {
return iluGetInteger((ILenum)mode);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluGetIntegerv
* Signature: (ILjava/nio/IntBuffer;)V
*/
static void JNICALL Java_org_lwjgl_devil_ILU_niluGetIntegerv(JNIEnv *env, jclass clazz, jint mode, jobject param_buffer, jint param_offset) {
ILbyte *lists = (ILbyte *) safeGetBufferAddress(env, param_buffer) + param_offset;
iluGetIntegerv((ILsizei)mode, (ILuint *)lists);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluGetString
* Signature: (I)Ljava/lang/String;
*/
static jstring JNICALL Java_org_lwjgl_devil_ILU_iluGetString(JNIEnv *env, jclass clazz, jint stringName) {
char * name = iluGetString((ILenum)stringName);
return NewStringNativeWithLength(env, name, strlen(name));
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluImageParameter
* Signature: (II)V
*/
static void JNICALL Java_org_lwjgl_devil_ILU_iluImageParameter(JNIEnv *env, jclass clazz, jint pName, jint param) {
iluImageParameter((ILenum)pName, (ILenum)param);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluInit
* Signature: ()V
*/
static void JNICALL Java_org_lwjgl_devil_ILU_iluInit(JNIEnv *env, jclass clazz) {
iluInit();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluInvertAlpha
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluInvertAlpha(JNIEnv *env, jclass clazz) {
return iluInvertAlpha();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluLoadImage
* Signature: (Ljava/lang/String;)I
*/
static jint JNICALL Java_org_lwjgl_devil_ILU_iluLoadImage(JNIEnv *env, jclass clazz, jstring fileName) {
char *strFileName = GetStringNativeChars(env, fileName);
jint result = iluLoadImage((const ILstring)strFileName);
free(strFileName);
return result;
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluMirror
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluMirror(JNIEnv *env, jclass clazz) {
return iluMirror();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluNegative
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluNegative(JNIEnv *env, jclass clazz) {
return iluNegative();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluNoisify
* Signature: (F)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluNoisify(JNIEnv *env, jclass clazz, jfloat factor) {
return iluNoisify((ILclampf)factor);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluPixelize
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluPixelize(JNIEnv *env, jclass clazz, jint pixSize) {
return iluPixelize((ILuint)pixSize);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluReplaceColour
* Signature: (BBBF)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluReplaceColour(JNIEnv *env, jclass clazz, jbyte red, jbyte green, jbyte blue, jfloat tolerence) {
return false;
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluRotate
* Signature: (F)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluRotate(JNIEnv *env, jclass clazz, jfloat angle) {
return iluRotate((ILfloat)angle);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluSaturate1f
* Signature: (F)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluSaturate1f(JNIEnv *env, jclass clazz, jfloat saturation) {
return iluSaturate1f((ILfloat)saturation);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluSaturate4f
* Signature: (FFFF)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluSaturate4f(JNIEnv *env, jclass clazz, jfloat r, jfloat g, jfloat b, jfloat saturation) {
return iluSaturate4f((ILfloat)r, (ILfloat)g, (ILfloat)b, (ILfloat)saturation);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluScale
* Signature: (III)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluScale(JNIEnv *env, jclass clazz, jint width, jint height, jint depth) {
return iluScale((ILuint)width, (ILuint)height, (ILuint)depth);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluScaleColours
* Signature: (FFF)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluScaleColours(JNIEnv *env, jclass clazz, jfloat r, jfloat g, jfloat b) {
return iluScaleColours((ILfloat)r, (ILfloat)g, (ILfloat)b);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluSharpen
* Signature: (FI)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluSharpen(JNIEnv *env, jclass clazz, jfloat factor, jint iter) {
return iluSharpen((ILfloat)factor, (ILuint)iter);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluSwapColours
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluSwapColours(JNIEnv *env, jclass clazz) {
return iluSwapColours();
}
/*
* Class: org_lwjgl_devil_ILU
* Method: iluWave
* Signature: (F)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILU_iluWave(JNIEnv *env, jclass clazz, jfloat wave) {
return iluWave((ILfloat)wave);
}
/*
* Class: org_lwjgl_devil_ILU
* Method: nCreate
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_nCreateILU(JNIEnv *env, jclass clazz, jobjectArray iluPaths) {
if (!extilu_Open(env, iluPaths)) {
throwException(env, "Failed to load ILU library");
return;
}
}
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_nDestroyILU(JNIEnv *env, jclass clazz) {
extilu_Close();
}
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_resetNativeStubsILU(JNIEnv *env, jclass clazz, jclass ilu_class) {
(*env)->UnregisterNatives(env, ilu_class);
}
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_initNativeStubsILU(JNIEnv *env, jclass clazz, jclass ilu_class) {
JavaMethodAndExtFunction functions[] = {
{"iluAlienify", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluAlienify, "iluAlienify", (void*)&iluAlienify},
{"iluBlurAvg", "(I)Z", (void*)&Java_org_lwjgl_devil_ILU_iluBlurAvg, "iluBlurAvg", (void*)&iluBlurAvg},
{"iluBlurGaussian", "(I)Z", (void*)&Java_org_lwjgl_devil_ILU_iluBlurGaussian, "iluBlurGaussian", (void*)&iluBlurGaussian},
{"iluBuildMipmaps", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluBuildMipmaps, "iluBuildMipmaps", (void*)&iluBuildMipmaps},
{"iluColoursUsed", "()I", (void*)&Java_org_lwjgl_devil_ILU_iluColoursUsed, "iluColoursUsed", (void*)&iluColoursUsed},
{"iluCompareImage", "(I)Z", (void*)&Java_org_lwjgl_devil_ILU_iluCompareImage, "iluCompareImage", (void*)&iluCompareImage},
{"iluContrast", "(F)Z", (void*)&Java_org_lwjgl_devil_ILU_iluContrast, "iluContrast", (void*)&iluContrast},
{"iluCrop", "(IIIIII)Z", (void*)&Java_org_lwjgl_devil_ILU_iluCrop, "iluCrop", (void*)&iluCrop},
{"iluDeleteImage", "(I)V", (void*)&Java_org_lwjgl_devil_ILU_iluDeleteImage, "iluDeleteImage", (void*)&iluDeleteImage},
{"iluEdgeDetectE", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluEdgeDetectE, "iluEdgeDetectE", (void*)&iluEdgeDetectE},
{"iluEdgeDetectP", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluEdgeDetectP, "iluEdgeDetectP", (void*)&iluEdgeDetectP},
{"iluEdgeDetectS", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluEdgeDetectS, "iluEdgeDetectS", (void*)&iluEdgeDetectS},
{"iluEmboss", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluEmboss, "iluEmboss", (void*)&iluEmboss},
{"iluEnlargeCanvas", "(III)Z", (void*)&Java_org_lwjgl_devil_ILU_iluEnlargeCanvas, "iluEnlargeCanvas", (void*)&iluEnlargeCanvas},
{"iluEnlargeImage", "(FFF)Z", (void*)&Java_org_lwjgl_devil_ILU_iluEnlargeImage, "iluEnlargeImage", (void*)&iluEnlargeImage},
{"iluEqualize", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluEqualize, "iluEqualize", (void*)&iluEqualize},
{"iluErrorString", "(I)Ljava/lang/String;", (void*)&Java_org_lwjgl_devil_ILU_iluErrorString, "iluErrorString", (void*)&iluErrorString},
{"iluFlipImage", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluFlipImage, "iluFlipImage", (void*)&iluFlipImage},
{"iluGammaCorrect", "(F)Z", (void*)&Java_org_lwjgl_devil_ILU_iluGammaCorrect, "iluGammaCorrect", (void*)&iluGammaCorrect},
{"iluGenImage", "()I", (void*)&Java_org_lwjgl_devil_ILU_iluGenImage, "iluGenImage", (void*)&iluGenImage},
{"iluGetImageInfo", "(Lorg/lwjgl/devil/ILinfo;)V", (void*)&Java_org_lwjgl_devil_ILU_iluGetImageInfo, "iluGetImageInfo", (void*)&iluGetImageInfo},
{"iluGetInteger", "(I)I", (void*)&Java_org_lwjgl_devil_ILU_iluGetInteger, "iluGetInteger", (void*)&iluGetInteger},
{"niluGetIntegerv", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_devil_ILU_niluGetIntegerv, "iluGetIntegerv", (void*)&iluGetIntegerv},
{"iluGetString", "(I)Ljava/lang/String;", (void*)&Java_org_lwjgl_devil_ILU_iluGetString, "iluGetString", (void*)&iluGetString},
{"iluImageParameter", "(II)V", (void*)&Java_org_lwjgl_devil_ILU_iluImageParameter, "iluImageParameter", (void*)&iluImageParameter},
{"iluInit", "()V", (void*)&Java_org_lwjgl_devil_ILU_iluInit, "iluInit", (void*)&iluInit},
{"iluInvertAlpha", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluInvertAlpha, "iluInvertAlpha", (void*)&iluInvertAlpha},
{"iluLoadImage", "(Ljava/lang/String;)I", (void*)&Java_org_lwjgl_devil_ILU_iluLoadImage, "iluLoadImage", (void*)&iluLoadImage},
{"iluMirror", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluMirror, "iluMirror", (void*)&iluMirror},
{"iluNegative", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluNegative, "iluNegative", (void*)&iluNegative},
{"iluNoisify", "(F)Z", (void*)&Java_org_lwjgl_devil_ILU_iluNoisify, "iluNoisify", (void*)&iluNoisify},
{"iluPixelize", "(I)Z", (void*)&Java_org_lwjgl_devil_ILU_iluPixelize, "iluPixelize", (void*)&iluPixelize},
{"iluReplaceColour", "(BBBF)Z", (void*)&Java_org_lwjgl_devil_ILU_iluReplaceColour, "iluReplaceColour", (void*)&iluReplaceColour},
{"iluRotate", "(F)Z", (void*)&Java_org_lwjgl_devil_ILU_iluRotate, "iluRotate", (void*)&iluRotate},
{"iluSaturate1f", "(F)Z", (void*)&Java_org_lwjgl_devil_ILU_iluSaturate1f, "iluSaturate1f", (void*)&iluSaturate1f},
{"iluSaturate4f", "(FFFF)Z", (void*)&Java_org_lwjgl_devil_ILU_iluSaturate4f, "iluSaturate4f", (void*)&iluSaturate4f},
{"iluScale", "(III)Z", (void*)&Java_org_lwjgl_devil_ILU_iluScale, "iluScale", (void*)&iluScale},
{"iluScaleColours", "(FFF)Z", (void*)&Java_org_lwjgl_devil_ILU_iluScaleColours, "iluScaleColours", (void*)&iluScaleColours},
{"iluSharpen", "(FI)Z", (void*)&Java_org_lwjgl_devil_ILU_iluSharpen, "iluSharpen", (void*)&iluSharpen},
{"iluSwapColours", "()Z", (void*)&Java_org_lwjgl_devil_ILU_iluSwapColours, "iluSwapColours", (void*)&iluSwapColours},
{"iluWave", "(F)Z", (void*)&Java_org_lwjgl_devil_ILU_iluWave, "iluWave", (void*)&iluWave},
};
int num_functions = NUMFUNCTIONS(functions);
extilu_InitializeClass(env, ilu_class, num_functions, functions);
}

View File

@ -1,317 +0,0 @@
#include "extilut.h"
#include "org_lwjgl_devil_ILNative.h"
typedef ILboolean (ILAPIENTRY *ilutRendererPROC) (ILenum Renderer);
typedef ILboolean (ILAPIENTRY *ilutDisablePROC) (ILenum Mode);
typedef ILboolean (ILAPIENTRY *ilutEnablePROC) (ILenum Mode);
typedef ILboolean (ILAPIENTRY *ilutGetBooleanPROC) (ILenum Mode);
typedef ILint (ILAPIENTRY *ilutGetIntegerPROC) (ILenum Mode);
typedef void (ILAPIENTRY *ilutGetBooleanvPROC) (ILenum Mode, ILboolean *Param);
typedef void (ILAPIENTRY *ilutGetIntegervPROC) (ILenum Mode, ILint *Param);
typedef const ILstring (ILAPIENTRY *ilutGetStringPROC) (ILenum StringName);
typedef ILvoid (ILAPIENTRY *ilutInitPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *ilutIsDisabledPROC) (ILenum Mode);
typedef ILboolean (ILAPIENTRY *ilutIsEnabledPROC) (ILenum Mode);
typedef ILvoid (ILAPIENTRY *ilutPopAttribPROC) (ILvoid);
typedef ILvoid (ILAPIENTRY *ilutPushAttribPROC) (ILuint Bits);
typedef ILvoid (ILAPIENTRY *ilutSetIntegerPROC) (ILenum Mode, ILint Param);
typedef GLuint (ILAPIENTRY *ilutGLBindTexImagePROC) ();
typedef GLuint (ILAPIENTRY *ilutGLBindMipmapsPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *ilutGLBuildMipmapsPROC) (ILvoid);
typedef GLuint (ILAPIENTRY *ilutGLLoadImagePROC) (const ILstring FileName);
typedef ILboolean (ILAPIENTRY *ilutGLScreenPROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *ilutGLScreeniePROC) (ILvoid);
typedef ILboolean (ILAPIENTRY *ilutGLSaveImagePROC) (const ILstring FileName, GLuint TexID);
typedef ILboolean (ILAPIENTRY *ilutGLSetTexPROC) (GLuint TexID);
typedef ILboolean (ILAPIENTRY *ilutGLTexImagePROC) (GLuint Level);
static ilutRendererPROC ilutRenderer;
static ilutDisablePROC ilutDisable;
static ilutEnablePROC ilutEnable;
static ilutGetBooleanPROC ilutGetBoolean;
static ilutGetIntegerPROC ilutGetInteger;
static ilutGetBooleanvPROC ilutGetBooleanv;
static ilutGetIntegervPROC ilutGetIntegerv;
static ilutGetStringPROC ilutGetString;
static ilutInitPROC ilutInit;
static ilutIsDisabledPROC ilutIsDisabled;
static ilutIsEnabledPROC ilutIsEnabled;
static ilutPopAttribPROC ilutPopAttrib;
static ilutPushAttribPROC ilutPushAttrib;
static ilutSetIntegerPROC ilutSetInteger;
static ilutGLBindTexImagePROC ilutGLBindTexImage;
static ilutGLBindMipmapsPROC ilutGLBindMipmaps;
static ilutGLBuildMipmapsPROC ilutGLBuildMipmaps;
static ilutGLLoadImagePROC ilutGLLoadImage;
static ilutGLScreenPROC ilutGLScreen;
static ilutGLScreeniePROC ilutGLScreenie;
static ilutGLSaveImagePROC ilutGLSaveImage;
static ilutGLSetTexPROC ilutGLSetTex;
static ilutGLTexImagePROC ilutGLTexImage;
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutRenderer
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutRenderer(JNIEnv *env, jclass clazz, jint renderer){
return ilutRenderer((ILenum)renderer);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutDisable
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutDisable(JNIEnv *env, jclass clazz, jint mode){
return ilutDisable((ILenum)mode);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutEnable
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutEnable(JNIEnv *env, jclass clazz, jint mode){
return ilutEnable((ILenum)mode);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGetBoolean
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutGetBoolean(JNIEnv *env, jclass clazz, jint mode){
return ilutGetBoolean((ILenum)mode);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGetInteger
* Signature: (I)I
*/
static jint JNICALL Java_org_lwjgl_devil_ILUT_ilutGetInteger(JNIEnv *env, jclass clazz, jint mode){
return ilutGetInteger((ILenum)mode);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGetBooleanv
* Signature: (ILjava/nio/CharBuffer;)V
*/
static void JNICALL Java_org_lwjgl_devil_ILUT_ilutGetBooleanv(JNIEnv *env, jclass clazz, jint mode, jobject param) {
ILboolean* destination = (ILboolean*) safeGetBufferAddress(env, param);
ilutGetBooleanv(mode, destination);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGetIntegerv
* Signature: (ILjava/nio/IntBuffer;)V
*/
static void JNICALL Java_org_lwjgl_devil_ILUT_ilutGetIntegerv(JNIEnv *env, jclass clazz, jint mode, jobject param) {
ILint* destination = (ILint*) safeGetBufferAddress(env, param);
ilutGetIntegerv(mode, destination);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGetString
* Signature: (I)Ljava/lang/String;
*/
static jstring JNICALL Java_org_lwjgl_devil_ILUT_ilutGetString(JNIEnv *env, jclass clazz, jint stringName){
char * name = ilutGetString((ILenum)stringName);
return NewStringNativeWithLength(env, name, strlen(name));
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutInit
* Signature: ()V
*/
static void JNICALL Java_org_lwjgl_devil_ILUT_ilutInit(JNIEnv *env, jclass clazz){
ilutInit();
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutIsDisabled
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutIsDisabled(JNIEnv *env, jclass clazz, jint mode){
return ilutIsDisabled((ILenum)mode);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutIsEnabled
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutIsEnabled(JNIEnv *env, jclass clazz, jint mode){
return ilutIsEnabled((ILenum)mode);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutPopAttrib
* Signature: ()V
*/
static void JNICALL Java_org_lwjgl_devil_ILUT_ilutPopAttrib(JNIEnv *env, jclass clazz){
ilutPopAttrib();
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutPushAttrib
* Signature: (I)V
*/
static void JNICALL Java_org_lwjgl_devil_ILUT_ilutPushAttrib(JNIEnv *env, jclass clazz, jint bits){
ilutPushAttrib((ILuint)bits);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutSetInteger
* Signature: (II)V
*/
static void JNICALL Java_org_lwjgl_devil_ILUT_ilutSetInteger(JNIEnv *env, jclass clazz, jint mode, jint param){
ilutSetInteger((ILenum)mode, (ILint)param);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLBindTexImage
* Signature: ()I
*/
static jint JNICALL Java_org_lwjgl_devil_ILUT_ilutGLBindTexImage(JNIEnv *env, jclass clazz){
return ilutGLBindTexImage();
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLBindMipmaps
* Signature: ()I
*/
static jint JNICALL Java_org_lwjgl_devil_ILUT_ilutGLBindMipmaps(JNIEnv *env, jclass clazz){
return ilutGLBindMipmaps();
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLBuildMipmaps
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutGLBuildMipmaps(JNIEnv *env, jclass clazz){
return ilutGLBuildMipmaps();
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLLoadImage
* Signature: (Ljava/lang/String;)I
*/
static jint JNICALL Java_org_lwjgl_devil_ILUT_ilutGLLoadImage(JNIEnv *env, jclass clazz, jstring fileName){
char *strFileName = GetStringNativeChars(env, fileName);
jint result = ilutGLLoadImage((const ILstring)strFileName);
free(strFileName);
return result;
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLScreen
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutGLScreen(JNIEnv *env, jclass clazz){
return ilutGLScreen();
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLScreenie
* Signature: ()Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutGLScreenie(JNIEnv *env, jclass clazz){
return ilutGLScreenie();
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLSaveImage
* Signature: (Ljava/lang/String;I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutGLSaveImage(JNIEnv *env, jclass clazz, jstring fileName, jint texID){
char *strFileName = GetStringNativeChars(env, fileName);
jboolean result = ilutGLSaveImage((const ILstring)strFileName, texID);
free(strFileName);
return result;
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLSetTex
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutGLSetTex(JNIEnv *env, jclass clazz, jint texID){
return ilutGLSetTex(texID);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: ilutGLTexImage
* Signature: (I)Z
*/
static jboolean JNICALL Java_org_lwjgl_devil_ILUT_ilutGLTexImage(JNIEnv *env, jclass clazz, jint level){
return ilutGLTexImage(level);
}
/*
* Class: org_lwjgl_devil_ILUT
* Method: nCreate
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_nCreateILUT(JNIEnv *env, jclass clazz, jobjectArray ilutPaths){
if (!extilut_Open(env, ilutPaths)) {
throwException(env, "Failed to load ILUT library");
return;
}
}
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_nDestroyILUT(JNIEnv *env, jclass clazz) {
extilut_Close();
}
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_resetNativeStubsILUT(JNIEnv *env, jclass clazz, jclass ilut_class) {
(*env)->UnregisterNatives(env, ilut_class);
}
JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_initNativeStubsILUT(JNIEnv *env, jclass clazz, jclass ilut_class){
JavaMethodAndExtFunction functions[] = {
{"ilutRenderer", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutRenderer, "ilutRenderer", (void*)&ilutRenderer},
{"ilutDisable", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutDisable, "ilutDisable", (void*)&ilutDisable},
{"ilutEnable", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutEnable, "ilutEnable", (void*)&ilutEnable},
{"ilutGetBoolean", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutGetBoolean, "ilutGetBoolean", (void*)&ilutGetBoolean},
{"ilutGetInteger", "(I)I", (void*)&Java_org_lwjgl_devil_ILUT_ilutGetInteger, "ilutGetInteger", (void*)&ilutGetInteger},
{"ilutGetBooleanv", "(ILjava/nio/ByteBuffer;)V", (void*)&Java_org_lwjgl_devil_ILUT_ilutGetBooleanv, "ilutGetBooleanv", (void*)&ilutGetBooleanv},
{"ilutGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void*)&Java_org_lwjgl_devil_ILUT_ilutGetIntegerv, "ilutGetIntegerv", (void*)&ilutGetIntegerv},
{"ilutGetString", "(I)Ljava/lang/String;", (void*)&Java_org_lwjgl_devil_ILUT_ilutGetString, "ilutGetString", (void*)&ilutGetString},
{"ilutInit", "()V", (void*)&Java_org_lwjgl_devil_ILUT_ilutInit, "ilutInit", (void*)&ilutInit},
{"ilutIsDisabled", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutIsDisabled, "ilutIsDisabled", (void*)&ilutIsDisabled},
{"ilutIsEnabled", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutIsDisabled, "ilutIsDisabled", (void*)&ilutIsDisabled},
{"ilutPopAttrib", "()V", (void*)&Java_org_lwjgl_devil_ILUT_ilutPopAttrib, "ilutPopAttrib", (void*)&ilutPopAttrib},
{"ilutPushAttrib", "(I)V", (void*)&Java_org_lwjgl_devil_ILUT_ilutPushAttrib, "ilutPushAttrib", (void*)&ilutPushAttrib},
{"ilutSetInteger", "(II)V", (void*)&Java_org_lwjgl_devil_ILUT_ilutSetInteger, "ilutSetInteger", (void*)&ilutSetInteger},
{"ilutGLBindTexImage", "()I", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLBindTexImage, "ilutGLBindTexImage", (void*)&ilutGLBindTexImage},
{"ilutGLBindMipmaps", "()I", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLBindMipmaps, "ilutGLBindMipmaps", (void*)&ilutGLBindMipmaps},
{"ilutGLBuildMipmaps", "()Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLBuildMipmaps, "ilutGLBuildMipmaps", (void*)&ilutGLBuildMipmaps},
{"ilutGLLoadImage", "(Ljava/lang/String;)I", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLLoadImage, "ilutGLLoadImage", (void*)&ilutGLLoadImage},
{"ilutGLScreen", "()Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLScreen, "ilutGLScreen", (void*)&ilutGLScreen},
{"ilutGLScreenie", "()Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLScreenie, "ilutGLScreenie", (void*)&ilutGLScreenie},
{"ilutGLSaveImage", "(Ljava/lang/String;I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLSaveImage, "ilutGLSaveImage", (void*)&ilutGLSaveImage},
{"ilutGLSetTex", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLSetTex, "ilutGLSetTex", (void*)&ilutGLSetTex},
{"ilutGLTexImage", "(I)Z", (void*)&Java_org_lwjgl_devil_ILUT_ilutGLTexImage, "ilutGLTexImage", (void*)&ilutGLTexImage},
};
int num_functions = NUMFUNCTIONS(functions);
extilut_InitializeClass(env, ilut_class, num_functions, functions);
}

View File

@ -1,19 +0,0 @@
CC=gcc
LINKER=gcc
STRIP=strip
CFLAGS_LINK=-shared -Wall
LIBS=-lpthread
CFLAGS_O=-fPIC -O2 -D_X11 -Wall -pthread -c -I${FMOD}/api/inc -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
SRC=$(wildcard *.c) ../common_tools.c
OBJECTS=$(subst .c,.o,$(SRC))
LIBRARY=liblwjgl-fmod3.so
$(LIBRARY): $(OBJECTS)
$(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(LIBS)
$(STRIP) $@
.c.o:
$(CC) $(CFLAGS_O) $< -o $@
clean:
rm -f $(OBJECTS) $(LIBRARY)

View File

@ -1,19 +0,0 @@
CC=gcc
LINKER=gcc
STRIP=strip
CFLAGS_LINK=-dynamiclib -framework JavaVM -framework Carbon
STATIC_LIBS=${FMOD}/api/lib/libfmod.a
CFLAGS_O=-fPIC -O2 -D_MACOSX -Wall -c -I.. -I${FMOD}/api/inc -I. -I/System/Library/Frameworks/JavaVM.framework/Versions/A/Headers
SRC=$(wildcard *.c) ../common_tools.c
OBJECTS=$(subst .c,.o,$(SRC))
LIBRARY=liblwjgl-fmod3.jnilib
$(LIBRARY): $(OBJECTS)
$(LINKER) $(CFLAGS_LINK) -o $@ $(OBJECTS) $(STATIC_LIBS)
$(STRIP) -S -X $@
.c.o:
$(CC) $(CFLAGS_O) $< -o $@
clean:
rm -f $(OBJECTS) $(LIBRARY)

View File

@ -1,128 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
#include <stdio.h>
#include "extfmod3.h"
/** Instance of fmod */
FMOD_INSTANCE * fmod_instance = NULL;
// jnienvs
JNIEnv *mixer_jnienv = NULL;
JNIEnv *stream_jnienv = NULL;
// FMusic cached fields
jmethodID music_instcallback = NULL;
jmethodID music_ordercallback = NULL;
jmethodID music_rowcallback = NULL;
jmethodID music_zxxcallback= NULL;
jclass fmusic = NULL;
// FSound cached fields
jmethodID sound_dspcallback = NULL;
jmethodID sound_stream_endcallback = NULL;
jmethodID sound_stream_synccallback = NULL;
jmethodID sound_stream_callback = NULL;
jmethodID sound_metadata_callback = NULL;
jclass fsound = NULL;
// size of dsp buffer (in bytes)
int fsound_dsp_buffer_size = 0;
#ifdef _WIN32
/**
* DLL entry point for Windows. Called when Java loads the .dll
*/
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
return true;
}
#endif
/**
* Creates and loads the FMOD instance
*
* @param path path to try to load dll
*/
void fmod_create(JNIEnv *env, const char* path) {
// try to create an instance using the supplied path
fmod_instance = FMOD_CreateInstance((char *)path);
// if we got one, we need to locate and cache jni stuff used for callbacks
if (fmod_instance != NULL) {
// fmusic specific callbacks
fmusic = (*env)->FindClass(env, "org/lwjgl/fmod3/FMusic");
music_instcallback = (*env)->GetStaticMethodID(env, fmusic, "music_instcallback", "(JI)V");
music_ordercallback = (*env)->GetStaticMethodID(env, fmusic, "music_ordercallback", "(JI)V");
music_rowcallback = (*env)->GetStaticMethodID(env, fmusic, "music_rowcallback", "(JI)V");
music_zxxcallback = (*env)->GetStaticMethodID(env, fmusic, "music_zxxcallback", "(JI)V");
// fsound specefic callbacks
fsound = (*env)->FindClass(env, "org/lwjgl/fmod3/FSound");
sound_dspcallback = (*env)->GetStaticMethodID(env, fsound, "dsp_callback", "(JLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;I)Ljava/nio/ByteBuffer;");
sound_stream_endcallback = (*env)->GetStaticMethodID(env, fsound, "end_callback", "(J)V");
sound_stream_synccallback = (*env)->GetStaticMethodID(env, fsound, "sync_callback", "(JLjava/nio/ByteBuffer;I)V");
sound_stream_callback = (*env)->GetStaticMethodID(env, fsound, "stream_callback", "(JLjava/nio/ByteBuffer;I)V");
sound_metadata_callback = (*env)->GetStaticMethodID(env, fsound, "meta_callback", "(JLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;)V");
// we need the size of the mix buffer, so we start out by caching it and
// update it accordingly on changes
switch(fmod_instance->FSOUND_GetMixer()) {
case FSOUND_MIXER_AUTODETECT:
case FSOUND_MIXER_BLENDMODE:
case FSOUND_MIXER_QUALITY_AUTODETECT:
case FSOUND_MIXER_QUALITY_FPU:
case FSOUND_MIXER_MONO:
case FSOUND_MIXER_QUALITY_MONO:
case FSOUND_MIXER_MAX:
fsound_dsp_buffer_size = 8;
break;
default:
fsound_dsp_buffer_size = 4;
break;
}
}
}
/**
* Destroys the fmod instance
*/
void fmod_destroy() {
if (fmod_instance != NULL) {
FMOD_FreeInstance(fmod_instance);
}
}

View File

@ -1,84 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
#ifndef _EXT_FMOD_H
#define _EXT_FMOD_H
#include <jni.h>
#include "../common_tools.h"
#ifdef __APPLE__ && __MACH__
#include "fmoddyn_mac.h"
#else
#include "fmoddyn.h"
#endif
#include "fmod_errors.h"
// Called to create an FMOD instance
void fmod_create(JNIEnv *env, const char*);
// Called to destroy our FMOD instance
void fmod_destroy();
// Actual FMOD instance to invoke methods on
extern FMOD_INSTANCE * fmod_instance;
// Setup for callback. The callbacks don't have access to a JNIEnv pointer, so we have to provide
// one. Unfortunately we cannot cache one, since JNIEnv are thread local copies. We can however
// aquire one, using AttachCurrent<ThreadAsDaemon>. However we need a VM instance for that.
// so we supply 1 VM instance for use by threads (in common_tools) (VM instances are shared across threads), and
// 1 JNIEnv pointer per thread. At this time, 2 threads have been identified - the Stream thread
// and the Mixer thread.
extern void attachMixerThread();
extern void attachStreamThread();
extern JNIEnv *mixer_jnienv;
extern JNIEnv *stream_jnienv;
// FMusic cached fields
extern jmethodID music_instcallback;
extern jmethodID music_ordercallback;
extern jmethodID music_rowcallback;
extern jmethodID music_zxxcallback;
extern jclass fmusic;
// FSound cached fields
extern jmethodID sound_dspcallback;
extern jmethodID sound_stream_endcallback;
extern jmethodID sound_stream_synccallback;
extern jmethodID sound_stream_callback;
extern jmethodID sound_metadata_callback;
extern jclass fsound;
// size of dsp buffer (in bytes)
extern int fsound_dsp_buffer_size;
#endif

View File

@ -1,14 +0,0 @@
Missing implementations:
FSOUND_File_SetCallbacks
FSOUND_Stream_Create
FSOUND_Stream_FindTagField
FSOUND_Stream_GetTagField
FSOUND_Stream_SetSubStreamSentence
FSOUND_Reverb_SetProperties
FSOUND_Reverb_GetProperties
FSOUND_Reverb_SetChannelProperties
FSOUND_Reverb_GetChannelProperties
- all create methods needs to be verified
- dynamic binding to vm
- cleanup with opaque pointers/handles

View File

@ -1,479 +0,0 @@
#include "fmod.h"
#ifndef _LWJGL_FMOD_DYN_H_
#define _LWJGL_FMOD_DYN_H_
typedef struct {
void *module;
signed char (F_API *FSOUND_SetOutput)(int outputtype);
signed char (F_API *FSOUND_SetDriver)(int driver);
signed char (F_API *FSOUND_SetMixer)(int mixer);
signed char (F_API *FSOUND_SetBufferSize)(int len_ms);
signed char (F_API *FSOUND_SetHWND)(void *hwnd);
signed char (F_API *FSOUND_SetMinHardwareChannels)(int min);
signed char (F_API *FSOUND_SetMaxHardwareChannels)(int max);
signed char (F_API *FSOUND_SetMemorySystem)(void *pool, int poollen, FSOUND_ALLOCCALLBACK useralloc, FSOUND_REALLOCCALLBACK userrealloc, FSOUND_FREECALLBACK userfree);
signed char (F_API *FSOUND_Init)(int mixrate, int maxsoftwarechannels, unsigned int flags);
void (F_API *FSOUND_Close)();
void (F_API *FSOUND_Update)(); /* you must call this once a frame */
void (F_API *FSOUND_SetSpeakerMode)(unsigned int speakermode);
void (F_API *FSOUND_SetSFXMasterVolume)(int volume);
void (F_API *FSOUND_SetPanSeperation)(float pansep);
void (F_API *FSOUND_File_SetCallbacks)(FSOUND_OPENCALLBACK useropen, FSOUND_CLOSECALLBACK userclose, FSOUND_READCALLBACK userread, FSOUND_SEEKCALLBACK userseek, FSOUND_TELLCALLBACK usertell);
int (F_API *FSOUND_GetError)();
float (F_API *FSOUND_GetVersion)();
int (F_API *FSOUND_GetOutput)();
void * (F_API *FSOUND_GetOutputHandle)();
int (F_API *FSOUND_GetDriver)();
int (F_API *FSOUND_GetMixer)();
int (F_API *FSOUND_GetNumDrivers)();
const char * (F_API *FSOUND_GetDriverName)(int id);
signed char (F_API *FSOUND_GetDriverCaps)(int id, unsigned int *caps);
int (F_API *FSOUND_GetOutputRate)();
int (F_API *FSOUND_GetMaxChannels)();
int (F_API *FSOUND_GetMaxSamples)();
int (F_API *FSOUND_GetSFXMasterVolume)();
signed char (F_API *FSOUND_GetNumHWChannels)(int *num2d, int *num3d, int *total);
int (F_API *FSOUND_GetChannelsPlaying)();
float (F_API *FSOUND_GetCPUUsage)();
void (F_API *FSOUND_GetMemoryStats)(unsigned int *currentalloced, unsigned int *maxalloced);
FSOUND_SAMPLE * (F_API *FSOUND_Sample_Load)(int index, const char *name_or_data, unsigned int mode, int offset, int length);
FSOUND_SAMPLE * (F_API *FSOUND_Sample_Alloc)(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri);
void (F_API *FSOUND_Sample_Free)(FSOUND_SAMPLE *sptr);
signed char (F_API *FSOUND_Sample_Upload)(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode);
signed char (F_API *FSOUND_Sample_Lock)(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2);
signed char (F_API *FSOUND_Sample_Unlock)(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2);
signed char (F_API *FSOUND_Sample_SetMode)(FSOUND_SAMPLE *sptr, unsigned int mode);
signed char (F_API *FSOUND_Sample_SetLoopPoints)(FSOUND_SAMPLE *sptr, int loopstart, int loopend);
signed char (F_API *FSOUND_Sample_SetDefaults)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri);
signed char (F_API *FSOUND_Sample_SetDefaultsEx)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan);
signed char (F_API *FSOUND_Sample_SetMinMaxDistance)(FSOUND_SAMPLE *sptr, float min, float max);
signed char (F_API *FSOUND_Sample_SetMaxPlaybacks)(FSOUND_SAMPLE *sptr, int max);
FSOUND_SAMPLE * (F_API *FSOUND_Sample_Get)(int sampno);
const char * (F_API *FSOUND_Sample_GetName)(FSOUND_SAMPLE *sptr);
unsigned int (F_API *FSOUND_Sample_GetLength)(FSOUND_SAMPLE *sptr);
signed char (F_API *FSOUND_Sample_GetLoopPoints)(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend);
signed char (F_API *FSOUND_Sample_GetDefaults)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri);
signed char (F_API *FSOUND_Sample_GetDefaultsEx)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan);
unsigned int (F_API *FSOUND_Sample_GetMode)(FSOUND_SAMPLE *sptr);
signed char (F_API *FSOUND_Sample_GetMinMaxDistance)(FSOUND_SAMPLE *sptr, float *min, float *max);
int (F_API *FSOUND_PlaySound)(int channel, FSOUND_SAMPLE *sptr);
int (F_API *FSOUND_PlaySoundEx)(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused);
signed char (F_API *FSOUND_StopSound)(int channel);
signed char (F_API *FSOUND_SetFrequency)(int channel, int freq);
signed char (F_API *FSOUND_SetVolume)(int channel, int vol);
signed char (F_API *FSOUND_SetVolumeAbsolute)(int channel, int vol);
signed char (F_API *FSOUND_SetPan)(int channel, int pan);
signed char (F_API *FSOUND_SetSurround)(int channel, signed char surround);
signed char (F_API *FSOUND_SetMute)(int channel, signed char mute);
signed char (F_API *FSOUND_SetPriority)(int channel, int priority);
signed char (F_API *FSOUND_SetReserved)(int channel, signed char reserved);
signed char (F_API *FSOUND_SetPaused)(int channel, signed char paused);
signed char (F_API *FSOUND_SetLoopMode)(int channel, unsigned int loopmode);
signed char (F_API *FSOUND_SetCurrentPosition)(int channel, unsigned int offset);
signed char (F_API *FSOUND_3D_SetAttributes)(int channel, const float *pos, const float *vel);
signed char (F_API *FSOUND_3D_SetMinMaxDistance)(int channel, float min, float max);
signed char (F_API *FSOUND_IsPlaying)(int channel);
int (F_API *FSOUND_GetFrequency)(int channel);
int (F_API *FSOUND_GetVolume)(int channel);
int (F_API *FSOUND_GetAmplitude)(int channel);
int (F_API *FSOUND_GetPan)(int channel);
signed char (F_API *FSOUND_GetSurround)(int channel);
signed char (F_API *FSOUND_GetMute)(int channel);
int (F_API *FSOUND_GetPriority)(int channel);
signed char (F_API *FSOUND_GetReserved)(int channel);
signed char (F_API *FSOUND_GetPaused)(int channel);
unsigned int (F_API *FSOUND_GetLoopMode)(int channel);
unsigned int (F_API *FSOUND_GetCurrentPosition)(int channel);
FSOUND_SAMPLE * (F_API *FSOUND_GetCurrentSample)(int channel);
signed char (F_API *FSOUND_GetCurrentLevels)(int channel, float *l, float *r);
int (F_API *FSOUND_GetNumSubChannels)(int channel);
int (F_API *FSOUND_GetSubChannel)(int channel, int subchannel);
signed char (F_API *FSOUND_3D_GetAttributes)(int channel, float *pos, float *vel);
signed char (F_API *FSOUND_3D_GetMinMaxDistance)(int channel, float *min, float *max);
void (F_API *FSOUND_3D_SetDopplerFactor)(float scale);
void (F_API *FSOUND_3D_SetDistanceFactor)(float scale);
void (F_API *FSOUND_3D_SetRolloffFactor)(float scale);
void (F_API *FSOUND_3D_Listener_SetCurrent)(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */
void (F_API *FSOUND_3D_Listener_SetAttributes)(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz);
void (F_API *FSOUND_3D_Listener_GetAttributes)(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz);
int (F_API *FSOUND_FX_Enable)(int channel, unsigned int fx); /* See FSOUND_FX_MODES */
signed char (F_API *FSOUND_FX_Disable)(int channel);
signed char (F_API *FSOUND_FX_SetChorus)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
signed char (F_API *FSOUND_FX_SetCompressor)(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay);
signed char (F_API *FSOUND_FX_SetDistortion)(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff);
signed char (F_API *FSOUND_FX_SetEcho)(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay);
signed char (F_API *FSOUND_FX_SetFlanger)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase);
signed char (F_API *FSOUND_FX_SetGargle)(int fxid, int RateHz, int WaveShape);
signed char (F_API *FSOUND_FX_SetI3DL2Reverb)(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference);
signed char (F_API *FSOUND_FX_SetParamEQ)(int fxid, float Center, float Bandwidth, float Gain);
signed char (F_API *FSOUND_FX_SetWavesReverb)(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio);
signed char (F_API *FSOUND_Stream_SetBufferSize)(int ms); /* call this before opening streams, not after */
FSOUND_STREAM * (F_API *FSOUND_Stream_Open)(const char *name_or_data, unsigned int mode, int offset, int length);
FSOUND_STREAM * (F_API *FSOUND_Stream_Create)(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata);
signed char (F_API *FSOUND_Stream_Close)(FSOUND_STREAM *stream);
int (F_API *FSOUND_Stream_Play)(int channel, FSOUND_STREAM *stream);
int (F_API *FSOUND_Stream_PlayEx)(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused);
signed char (F_API *FSOUND_Stream_Stop)(FSOUND_STREAM *stream);
signed char (F_API *FSOUND_Stream_SetPosition)(FSOUND_STREAM *stream, unsigned int position);
unsigned int (F_API *FSOUND_Stream_GetPosition)(FSOUND_STREAM *stream);
signed char (F_API *FSOUND_Stream_SetTime)(FSOUND_STREAM *stream, int ms);
int (F_API *FSOUND_Stream_GetTime)(FSOUND_STREAM *stream);
int (F_API *FSOUND_Stream_GetLength)(FSOUND_STREAM *stream);
int (F_API *FSOUND_Stream_GetLengthMs)(FSOUND_STREAM *stream);
signed char (F_API *FSOUND_Stream_SetMode)(FSOUND_STREAM *stream, unsigned int mode);
unsigned int (F_API *FSOUND_Stream_GetMode)(FSOUND_STREAM *stream);
signed char (F_API *FSOUND_Stream_SetLoopPoints)(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm);
signed char (F_API *FSOUND_Stream_SetLoopCount)(FSOUND_STREAM *stream, int count);
int (F_API *FSOUND_Stream_GetOpenState)(FSOUND_STREAM *stream);
FSOUND_SAMPLE * (F_API *FSOUND_Stream_GetSample)(FSOUND_STREAM *stream); /* every stream contains a sample to playback on */
FSOUND_DSPUNIT * (F_API *FSOUND_Stream_CreateDSP)(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata);
signed char (F_API *FSOUND_Stream_SetEndCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata);
signed char (F_API *FSOUND_Stream_SetSyncCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata);
FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_AddSyncPoint)(FSOUND_STREAM *stream, unsigned int pcmoffset, const char *name);
signed char (F_API *FSOUND_Stream_DeleteSyncPoint)(FSOUND_SYNCPOINT *point);
int (F_API *FSOUND_Stream_GetNumSyncPoints)(FSOUND_STREAM *stream);
FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_GetSyncPoint)(FSOUND_STREAM *stream, int index);
char * (F_API *FSOUND_Stream_GetSyncPointInfo)(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset);
signed char (F_API *FSOUND_Stream_SetSubStream)(FSOUND_STREAM *stream, int index);
int (F_API *FSOUND_Stream_GetNumSubStreams)(FSOUND_STREAM *stream);
signed char (F_API *FSOUND_Stream_SetSubStreamSentence)(FSOUND_STREAM *stream, const int *sentencelist, int numitems);
signed char (F_API *FSOUND_Stream_GetNumTagFields)(FSOUND_STREAM *stream, int *num);
signed char (F_API *FSOUND_Stream_GetTagField)(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length);
signed char (F_API *FSOUND_Stream_FindTagField)(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length);
signed char (F_API *FSOUND_Stream_Net_SetProxy)(const char *proxy);
char * (F_API *FSOUND_Stream_Net_GetLastServerStatus)();
signed char (F_API *FSOUND_Stream_Net_SetBufferProperties)(int buffersize, int prebuffer_percent, int rebuffer_percent);
signed char (F_API *FSOUND_Stream_Net_GetBufferProperties)(int *buffersize, int *prebuffer_percent, int *rebuffer_percent);
signed char (F_API *FSOUND_Stream_Net_SetMetadataCallback)(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata);
signed char (F_API *FSOUND_Stream_Net_GetStatus)(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags);
signed char (F_API *FSOUND_CD_Play)(char drive, int track);
void (F_API *FSOUND_CD_SetPlayMode)(char drive, signed char mode);
signed char (F_API *FSOUND_CD_Stop)(char drive);
signed char (F_API *FSOUND_CD_SetPaused)(char drive, signed char paused);
signed char (F_API *FSOUND_CD_SetVolume)(char drive, int volume);
signed char (F_API *FSOUND_CD_SetTrackTime)(char drive, unsigned int ms);
// Not available on Mac
//signed char (F_API *FSOUND_CD_OpenTray)(char drive, signed char open);
signed char (F_API *FSOUND_CD_GetPaused)(char drive);
int (F_API *FSOUND_CD_GetTrack)(char drive);
int (F_API *FSOUND_CD_GetNumTracks)(char drive);
int (F_API *FSOUND_CD_GetVolume)(char drive);
int (F_API *FSOUND_CD_GetTrackLength)(char drive, int track);
int (F_API *FSOUND_CD_GetTrackTime)(char drive);
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_Create)(FSOUND_DSPCALLBACK callback, int priority, void *userdata);
void (F_API *FSOUND_DSP_Free)(FSOUND_DSPUNIT *unit);
void (F_API *FSOUND_DSP_SetPriority)(FSOUND_DSPUNIT *unit, int priority);
int (F_API *FSOUND_DSP_GetPriority)(FSOUND_DSPUNIT *unit);
void (F_API *FSOUND_DSP_SetActive)(FSOUND_DSPUNIT *unit, signed char active);
signed char (F_API *FSOUND_DSP_GetActive)(FSOUND_DSPUNIT *unit);
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClearUnit)();
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetSFXUnit)();
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetMusicUnit)();
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetFFTUnit)();
FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClipAndCopyUnit)();
signed char (F_API *FSOUND_DSP_MixBuffers)(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode);
void (F_API *FSOUND_DSP_ClearMixBuffer)();
int (F_API *FSOUND_DSP_GetBufferLength)(); /* Length of each DSP update */
int (F_API *FSOUND_DSP_GetBufferLengthTotal)(); /* Total buffer length due to FSOUND_SetBufferSize */
float * (F_API *FSOUND_DSP_GetSpectrum)(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */
signed char (F_API *FSOUND_Reverb_SetProperties)(const FSOUND_REVERB_PROPERTIES *prop);
signed char (F_API *FSOUND_Reverb_GetProperties)(FSOUND_REVERB_PROPERTIES *prop);
signed char (F_API *FSOUND_Reverb_SetChannelProperties)(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop);
signed char (F_API *FSOUND_Reverb_GetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop);
signed char (F_API *FSOUND_Record_SetDriver)(int outputtype);
int (F_API *FSOUND_Record_GetNumDrivers)();
const char * (F_API *FSOUND_Record_GetDriverName)(int id);
int (F_API *FSOUND_Record_GetDriver)();
signed char (F_API *FSOUND_Record_StartSample)(FSOUND_SAMPLE *sptr, signed char loop);
signed char (F_API *FSOUND_Record_Stop)();
int (F_API *FSOUND_Record_GetPosition)();
FMUSIC_MODULE * (F_API *FMUSIC_LoadSong)(const char *name);
FMUSIC_MODULE * (F_API *FMUSIC_LoadSongEx)(const char *name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum);
int (F_API *FMUSIC_GetOpenState)(FMUSIC_MODULE *mod);
signed char (F_API *FMUSIC_FreeSong)(FMUSIC_MODULE *mod);
signed char (F_API *FMUSIC_PlaySong)(FMUSIC_MODULE *mod);
signed char (F_API *FMUSIC_StopSong)(FMUSIC_MODULE *mod);
void (F_API *FMUSIC_StopAllSongs)();
signed char (F_API *FMUSIC_SetZxxCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback);
signed char (F_API *FMUSIC_SetRowCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep);
signed char (F_API *FMUSIC_SetOrderCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep);
signed char (F_API *FMUSIC_SetInstCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument);
signed char (F_API *FMUSIC_SetSample)(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr);
signed char (F_API *FMUSIC_SetUserData)(FMUSIC_MODULE *mod, void *userdata);
signed char (F_API *FMUSIC_OptimizeChannels)(FMUSIC_MODULE *mod, int maxchannels, int minvolume);
signed char (F_API *FMUSIC_SetReverb)(signed char reverb); /* MIDI only */
signed char (F_API *FMUSIC_SetLooping)(FMUSIC_MODULE *mod, signed char looping);
signed char (F_API *FMUSIC_SetOrder)(FMUSIC_MODULE *mod, int order);
signed char (F_API *FMUSIC_SetPaused)(FMUSIC_MODULE *mod, signed char pause);
signed char (F_API *FMUSIC_SetMasterVolume)(FMUSIC_MODULE *mod, int volume);
signed char (F_API *FMUSIC_SetMasterSpeed)(FMUSIC_MODULE *mode, float speed);
signed char (F_API *FMUSIC_SetPanSeperation)(FMUSIC_MODULE *mod, float pansep);
const char * (F_API *FMUSIC_GetName)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetType)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetNumOrders)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetNumPatterns)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetNumInstruments)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetNumSamples)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetNumChannels)(FMUSIC_MODULE *mod);
FSOUND_SAMPLE * (F_API *FMUSIC_GetSample)(FMUSIC_MODULE *mod, int sampno);
int (F_API *FMUSIC_GetPatternLength)(FMUSIC_MODULE *mod, int orderno);
signed char (F_API *FMUSIC_IsFinished)(FMUSIC_MODULE *mod);
signed char (F_API *FMUSIC_IsPlaying)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetMasterVolume)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetGlobalVolume)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetOrder)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetPattern)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetSpeed)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetBPM)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetRow)(FMUSIC_MODULE *mod);
signed char (F_API *FMUSIC_GetPaused)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetTime)(FMUSIC_MODULE *mod);
int (F_API *FMUSIC_GetRealChannel)(FMUSIC_MODULE *mod, int modchannel);
void* (F_API *FMUSIC_GetUserData)(FMUSIC_MODULE *mod);
} FMOD_INSTANCE;
static FMOD_INSTANCE *FMOD_CreateInstance(char *dllName) {
FMOD_INSTANCE *instance;
instance = (FMOD_INSTANCE *)calloc(sizeof(FMOD_INSTANCE), 1);
if(instance) {
instance->FSOUND_SetOutput = &FSOUND_SetOutput;
instance->FSOUND_SetDriver = &FSOUND_SetDriver;
instance->FSOUND_SetMixer = &FSOUND_SetMixer;
instance->FSOUND_SetBufferSize = &FSOUND_SetBufferSize;
instance->FSOUND_SetHWND = &FSOUND_SetHWND;
instance->FSOUND_SetMinHardwareChannels = &FSOUND_SetMinHardwareChannels;
instance->FSOUND_SetMaxHardwareChannels = &FSOUND_SetMaxHardwareChannels;
instance->FSOUND_SetMemorySystem = &FSOUND_SetMemorySystem;
instance->FSOUND_Init = &FSOUND_Init;
instance->FSOUND_Close = &FSOUND_Close;
instance->FSOUND_Update = &FSOUND_Update;
instance->FSOUND_SetSpeakerMode = &FSOUND_SetSpeakerMode;
instance->FSOUND_SetSFXMasterVolume = &FSOUND_SetSFXMasterVolume;
instance->FSOUND_SetPanSeperation = &FSOUND_SetPanSeperation;
instance->FSOUND_File_SetCallbacks = &FSOUND_File_SetCallbacks;
instance->FSOUND_GetError = &FSOUND_GetError;
instance->FSOUND_GetVersion = &FSOUND_GetVersion;
instance->FSOUND_GetOutput = &FSOUND_GetOutput;
instance->FSOUND_GetOutputHandle = &FSOUND_GetOutputHandle;
instance->FSOUND_GetDriver = &FSOUND_GetDriver;
instance->FSOUND_GetMixer = &FSOUND_GetMixer;
instance->FSOUND_GetNumDrivers = &FSOUND_GetNumDrivers;
instance->FSOUND_GetDriverName = &FSOUND_GetDriverName;
instance->FSOUND_GetDriverCaps = &FSOUND_GetDriverCaps;
instance->FSOUND_GetOutputRate = &FSOUND_GetOutputRate;
instance->FSOUND_GetMaxChannels = &FSOUND_GetMaxChannels;
instance->FSOUND_GetMaxSamples = &FSOUND_GetMaxSamples;
instance->FSOUND_GetSFXMasterVolume = &FSOUND_GetSFXMasterVolume;
instance->FSOUND_GetNumHWChannels = &FSOUND_GetNumHWChannels;
instance->FSOUND_GetChannelsPlaying = &FSOUND_GetChannelsPlaying;
instance->FSOUND_GetCPUUsage = &FSOUND_GetCPUUsage;
instance->FSOUND_GetMemoryStats = &FSOUND_GetMemoryStats;
instance->FSOUND_Sample_Load = &FSOUND_Sample_Load;
instance->FSOUND_Sample_Alloc = &FSOUND_Sample_Alloc;
instance->FSOUND_Sample_Free = &FSOUND_Sample_Free;
instance->FSOUND_Sample_Upload = &FSOUND_Sample_Upload;
instance->FSOUND_Sample_Lock = &FSOUND_Sample_Lock;
instance->FSOUND_Sample_Unlock = &FSOUND_Sample_Unlock;
instance->FSOUND_Sample_SetMode = &FSOUND_Sample_SetMode;
instance->FSOUND_Sample_SetLoopPoints = &FSOUND_Sample_SetLoopPoints;
instance->FSOUND_Sample_SetDefaults = &FSOUND_Sample_SetDefaults;
instance->FSOUND_Sample_SetDefaultsEx = &FSOUND_Sample_SetDefaultsEx;
instance->FSOUND_Sample_SetMinMaxDistance = &FSOUND_Sample_SetMinMaxDistance;
instance->FSOUND_Sample_SetMaxPlaybacks = &FSOUND_Sample_SetMaxPlaybacks;
instance->FSOUND_Sample_Get = &FSOUND_Sample_Get;
instance->FSOUND_Sample_GetName = &FSOUND_Sample_GetName;
instance->FSOUND_Sample_GetLength = &FSOUND_Sample_GetLength;
instance->FSOUND_Sample_GetLoopPoints = &FSOUND_Sample_GetLoopPoints;
instance->FSOUND_Sample_GetDefaults = &FSOUND_Sample_GetDefaults;
instance->FSOUND_Sample_GetDefaultsEx = &FSOUND_Sample_GetDefaultsEx;
instance->FSOUND_Sample_GetMode = &FSOUND_Sample_GetMode;
instance->FSOUND_Sample_GetMinMaxDistance = &FSOUND_Sample_GetMinMaxDistance;
instance->FSOUND_PlaySound = &FSOUND_PlaySound;
instance->FSOUND_PlaySoundEx = &FSOUND_PlaySoundEx;
instance->FSOUND_StopSound = &FSOUND_StopSound;
instance->FSOUND_SetFrequency = &FSOUND_SetFrequency;
instance->FSOUND_SetVolume = &FSOUND_SetVolume;
instance->FSOUND_SetVolumeAbsolute = &FSOUND_SetVolumeAbsolute;
instance->FSOUND_SetPan = &FSOUND_SetPan;
instance->FSOUND_SetSurround = &FSOUND_SetSurround;
instance->FSOUND_SetMute = &FSOUND_SetMute;
instance->FSOUND_SetPriority = &FSOUND_SetPriority;
instance->FSOUND_SetReserved = &FSOUND_SetReserved;
instance->FSOUND_SetPaused = &FSOUND_SetPaused;
instance->FSOUND_SetLoopMode = &FSOUND_SetLoopMode;
instance->FSOUND_SetCurrentPosition = &FSOUND_SetCurrentPosition;
instance->FSOUND_3D_SetAttributes = &FSOUND_3D_SetAttributes;
instance->FSOUND_3D_SetMinMaxDistance = &FSOUND_3D_SetMinMaxDistance;
instance->FSOUND_IsPlaying = &FSOUND_IsPlaying;
instance->FSOUND_GetFrequency = &FSOUND_GetFrequency;
instance->FSOUND_GetVolume = &FSOUND_GetVolume;
instance->FSOUND_GetAmplitude = &FSOUND_GetAmplitude;
instance->FSOUND_GetPan = &FSOUND_GetPan;
instance->FSOUND_GetSurround = &FSOUND_GetSurround;
instance->FSOUND_GetMute = &FSOUND_GetMute;
instance->FSOUND_GetPriority = &FSOUND_GetPriority;
instance->FSOUND_GetReserved = &FSOUND_GetReserved;
instance->FSOUND_GetPaused = &FSOUND_GetPaused;
instance->FSOUND_GetLoopMode = &FSOUND_GetLoopMode;
instance->FSOUND_GetCurrentPosition = &FSOUND_GetCurrentPosition;
instance->FSOUND_GetCurrentSample = &FSOUND_GetCurrentSample;
instance->FSOUND_GetCurrentLevels = &FSOUND_GetCurrentLevels;
instance->FSOUND_GetNumSubChannels = &FSOUND_GetNumSubChannels;
instance->FSOUND_GetSubChannel = &FSOUND_GetSubChannel;
instance->FSOUND_3D_GetAttributes = &FSOUND_3D_GetAttributes;
instance->FSOUND_3D_GetMinMaxDistance = &FSOUND_3D_GetMinMaxDistance;
instance->FSOUND_3D_SetDopplerFactor = &FSOUND_3D_SetDopplerFactor;
instance->FSOUND_3D_SetDistanceFactor = &FSOUND_3D_SetDistanceFactor;
instance->FSOUND_3D_SetRolloffFactor = &FSOUND_3D_SetRolloffFactor;
instance->FSOUND_3D_Listener_SetCurrent = &FSOUND_3D_Listener_SetCurrent;
instance->FSOUND_3D_Listener_SetAttributes = &FSOUND_3D_Listener_SetAttributes;
instance->FSOUND_3D_Listener_GetAttributes = &FSOUND_3D_Listener_GetAttributes;
instance->FSOUND_FX_Enable = &FSOUND_FX_Enable;
instance->FSOUND_FX_Disable = &FSOUND_FX_Disable;
instance->FSOUND_FX_SetChorus = &FSOUND_FX_SetChorus;
instance->FSOUND_FX_SetCompressor = &FSOUND_FX_SetCompressor;
instance->FSOUND_FX_SetDistortion = &FSOUND_FX_SetDistortion;
instance->FSOUND_FX_SetEcho = &FSOUND_FX_SetEcho;
instance->FSOUND_FX_SetFlanger = &FSOUND_FX_SetFlanger;
instance->FSOUND_FX_SetGargle = &FSOUND_FX_SetGargle;
instance->FSOUND_FX_SetI3DL2Reverb = &FSOUND_FX_SetI3DL2Reverb;
instance->FSOUND_FX_SetParamEQ = &FSOUND_FX_SetParamEQ;
instance->FSOUND_FX_SetWavesReverb = &FSOUND_FX_SetWavesReverb;
instance->FSOUND_Stream_SetBufferSize = &FSOUND_Stream_SetBufferSize;
instance->FSOUND_Stream_Open = &FSOUND_Stream_Open;
instance->FSOUND_Stream_Create = &FSOUND_Stream_Create;
instance->FSOUND_Stream_Close = &FSOUND_Stream_Close;
instance->FSOUND_Stream_Play = &FSOUND_Stream_Play;
instance->FSOUND_Stream_PlayEx = &FSOUND_Stream_PlayEx;
instance->FSOUND_Stream_Stop = &FSOUND_Stream_Stop;
instance->FSOUND_Stream_SetPosition = &FSOUND_Stream_SetPosition;
instance->FSOUND_Stream_GetPosition = &FSOUND_Stream_GetPosition;
instance->FSOUND_Stream_SetTime = &FSOUND_Stream_SetTime;
instance->FSOUND_Stream_GetTime = &FSOUND_Stream_GetTime;
instance->FSOUND_Stream_GetLength = &FSOUND_Stream_GetLength;
instance->FSOUND_Stream_GetLengthMs = &FSOUND_Stream_GetLengthMs;
instance->FSOUND_Stream_SetMode = &FSOUND_Stream_SetMode;
instance->FSOUND_Stream_GetMode = &FSOUND_Stream_GetMode;
instance->FSOUND_Stream_SetLoopPoints = &FSOUND_Stream_SetLoopPoints;
instance->FSOUND_Stream_SetLoopCount = &FSOUND_Stream_SetLoopCount;
instance->FSOUND_Stream_GetOpenState = &FSOUND_Stream_GetOpenState;
instance->FSOUND_Stream_GetSample = &FSOUND_Stream_GetSample;
instance->FSOUND_Stream_CreateDSP = &FSOUND_Stream_CreateDSP;
instance->FSOUND_Stream_SetEndCallback = &FSOUND_Stream_SetEndCallback;
instance->FSOUND_Stream_SetSyncCallback = &FSOUND_Stream_SetSyncCallback;
instance->FSOUND_Stream_AddSyncPoint = &FSOUND_Stream_AddSyncPoint;
instance->FSOUND_Stream_DeleteSyncPoint = &FSOUND_Stream_DeleteSyncPoint;
instance->FSOUND_Stream_GetNumSyncPoints = &FSOUND_Stream_GetNumSyncPoints;
instance->FSOUND_Stream_GetSyncPoint = &FSOUND_Stream_GetSyncPoint;
instance->FSOUND_Stream_GetSyncPointInfo = &FSOUND_Stream_GetSyncPointInfo;
instance->FSOUND_Stream_SetSubStream = &FSOUND_Stream_SetSubStream;
instance->FSOUND_Stream_GetNumSubStreams = &FSOUND_Stream_GetNumSubStreams;
instance->FSOUND_Stream_SetSubStreamSentence = &FSOUND_Stream_SetSubStreamSentence;
instance->FSOUND_Stream_GetNumTagFields = &FSOUND_Stream_GetNumTagFields;
instance->FSOUND_Stream_GetTagField = &FSOUND_Stream_GetTagField;
instance->FSOUND_Stream_FindTagField = &FSOUND_Stream_FindTagField;
instance->FSOUND_Stream_Net_SetProxy = &FSOUND_Stream_Net_SetProxy;
instance->FSOUND_Stream_Net_GetLastServerStatus = &FSOUND_Stream_Net_GetLastServerStatus;
instance->FSOUND_Stream_Net_SetBufferProperties = &FSOUND_Stream_Net_SetBufferProperties;
instance->FSOUND_Stream_Net_GetBufferProperties = &FSOUND_Stream_Net_GetBufferProperties;
instance->FSOUND_Stream_Net_SetMetadataCallback = &FSOUND_Stream_Net_SetMetadataCallback;
instance->FSOUND_Stream_Net_GetStatus = &FSOUND_Stream_Net_GetStatus;
instance->FSOUND_CD_Play = &FSOUND_CD_Play;
instance->FSOUND_CD_SetPlayMode = &FSOUND_CD_SetPlayMode;
instance->FSOUND_CD_Stop = &FSOUND_CD_Stop;
instance->FSOUND_CD_SetPaused = &FSOUND_CD_SetPaused;
instance->FSOUND_CD_SetVolume = &FSOUND_CD_SetVolume;
instance->FSOUND_CD_SetTrackTime = &FSOUND_CD_SetTrackTime;
// Not available on mac
//instance->FSOUND_CD_OpenTray = &FSOUND_CD_OpenTray_noop;
instance->FSOUND_CD_GetPaused = &FSOUND_CD_GetPaused;
instance->FSOUND_CD_GetTrack = &FSOUND_CD_GetTrack;
instance->FSOUND_CD_GetNumTracks = &FSOUND_CD_GetNumTracks;
instance->FSOUND_CD_GetVolume = &FSOUND_CD_GetVolume;
instance->FSOUND_CD_GetTrackLength = &FSOUND_CD_GetTrackLength;
instance->FSOUND_CD_GetTrackTime = &FSOUND_CD_GetTrackTime;
instance->FSOUND_DSP_Create = &FSOUND_DSP_Create;
instance->FSOUND_DSP_Free = &FSOUND_DSP_Free;
instance->FSOUND_DSP_SetPriority = &FSOUND_DSP_SetPriority;
instance->FSOUND_DSP_GetPriority = &FSOUND_DSP_GetPriority;
instance->FSOUND_DSP_SetActive = &FSOUND_DSP_SetActive;
instance->FSOUND_DSP_GetActive = &FSOUND_DSP_GetActive;
instance->FSOUND_DSP_GetClearUnit = &FSOUND_DSP_GetClearUnit;
instance->FSOUND_DSP_GetSFXUnit = &FSOUND_DSP_GetSFXUnit;
instance->FSOUND_DSP_GetMusicUnit = &FSOUND_DSP_GetMusicUnit;
instance->FSOUND_DSP_GetFFTUnit = &FSOUND_DSP_GetFFTUnit;
instance->FSOUND_DSP_GetClipAndCopyUnit = &FSOUND_DSP_GetClipAndCopyUnit;
instance->FSOUND_DSP_MixBuffers = &FSOUND_DSP_MixBuffers;
instance->FSOUND_DSP_ClearMixBuffer = &FSOUND_DSP_ClearMixBuffer;
instance->FSOUND_DSP_GetBufferLength = &FSOUND_DSP_GetBufferLength;
instance->FSOUND_DSP_GetBufferLengthTotal = &FSOUND_DSP_GetBufferLengthTotal;
instance->FSOUND_DSP_GetSpectrum = &FSOUND_DSP_GetSpectrum;
instance->FSOUND_Reverb_SetProperties = &FSOUND_Reverb_SetProperties;
instance->FSOUND_Reverb_GetProperties = &FSOUND_Reverb_GetProperties;
instance->FSOUND_Reverb_SetChannelProperties = &FSOUND_Reverb_SetChannelProperties;
instance->FSOUND_Reverb_GetChannelProperties = &FSOUND_Reverb_GetChannelProperties;
instance->FSOUND_Record_SetDriver = &FSOUND_Record_SetDriver;
instance->FSOUND_Record_GetNumDrivers = &FSOUND_Record_GetNumDrivers;
instance->FSOUND_Record_GetDriverName = &FSOUND_Record_GetDriverName;
instance->FSOUND_Record_GetDriver = &FSOUND_Record_GetDriver;
instance->FSOUND_Record_StartSample = &FSOUND_Record_StartSample;
instance->FSOUND_Record_Stop = &FSOUND_Record_Stop;
instance->FSOUND_Record_GetPosition = &FSOUND_Record_GetPosition;
instance->FMUSIC_LoadSong = &FMUSIC_LoadSong;
instance->FMUSIC_LoadSongEx = &FMUSIC_LoadSongEx;
instance->FMUSIC_GetOpenState = &FMUSIC_GetOpenState;
instance->FMUSIC_FreeSong = &FMUSIC_FreeSong;
instance->FMUSIC_PlaySong = &FMUSIC_PlaySong;
instance->FMUSIC_StopSong = &FMUSIC_StopSong;
instance->FMUSIC_StopAllSongs = &FMUSIC_StopAllSongs;
instance->FMUSIC_SetZxxCallback = &FMUSIC_SetZxxCallback;
instance->FMUSIC_SetRowCallback = &FMUSIC_SetRowCallback;
instance->FMUSIC_SetOrderCallback = &FMUSIC_SetOrderCallback;
instance->FMUSIC_SetInstCallback = &FMUSIC_SetInstCallback;
instance->FMUSIC_SetSample = &FMUSIC_SetSample;
instance->FMUSIC_SetUserData = &FMUSIC_SetUserData;
instance->FMUSIC_OptimizeChannels = &FMUSIC_OptimizeChannels;
instance->FMUSIC_SetReverb = &FMUSIC_SetReverb;
instance->FMUSIC_SetLooping = &FMUSIC_SetLooping;
instance->FMUSIC_SetOrder = &FMUSIC_SetOrder;
instance->FMUSIC_SetPaused = &FMUSIC_SetPaused;
instance->FMUSIC_SetMasterVolume = &FMUSIC_SetMasterVolume;
instance->FMUSIC_SetMasterSpeed = &FMUSIC_SetMasterSpeed;
instance->FMUSIC_SetPanSeperation = &FMUSIC_SetPanSeperation;
instance->FMUSIC_GetName = &FMUSIC_GetName;
instance->FMUSIC_GetType = &FMUSIC_GetType;
instance->FMUSIC_GetNumOrders = &FMUSIC_GetNumOrders;
instance->FMUSIC_GetNumPatterns = &FMUSIC_GetNumPatterns;
instance->FMUSIC_GetNumInstruments = &FMUSIC_GetNumInstruments;
instance->FMUSIC_GetNumSamples = &FMUSIC_GetNumSamples;
instance->FMUSIC_GetNumChannels = &FMUSIC_GetNumChannels;
instance->FMUSIC_GetSample = &FMUSIC_GetSample;
instance->FMUSIC_GetPatternLength = &FMUSIC_GetPatternLength;
instance->FMUSIC_IsFinished = &FMUSIC_IsFinished;
instance->FMUSIC_IsPlaying = &FMUSIC_IsPlaying;
instance->FMUSIC_GetMasterVolume = &FMUSIC_GetMasterVolume;
instance->FMUSIC_GetGlobalVolume = &FMUSIC_GetGlobalVolume;
instance->FMUSIC_GetOrder = &FMUSIC_GetOrder;
instance->FMUSIC_GetPattern = &FMUSIC_GetPattern;
instance->FMUSIC_GetSpeed = &FMUSIC_GetSpeed;
instance->FMUSIC_GetBPM = &FMUSIC_GetBPM;
instance->FMUSIC_GetRow = &FMUSIC_GetRow;
instance->FMUSIC_GetPaused = &FMUSIC_GetPaused;
instance->FMUSIC_GetTime = &FMUSIC_GetTime;
instance->FMUSIC_GetRealChannel = &FMUSIC_GetRealChannel;
instance->FMUSIC_GetUserData = &FMUSIC_GetUserData;
}
return instance;
}
static void FMOD_FreeInstance(FMOD_INSTANCE *instance) {
if (instance) {
free(instance);
instance = NULL;
}
}
#endif

View File

@ -1,87 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
#include "org_lwjgl_fmod3_FMOD.h"
#include "extfmod3.h"
/*
* Class: org_lwjgl_fmod3_FMOD
* Method: getNativeLibraryVersion
* Signature: ()I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMOD_getNativeLibraryVersion(JNIEnv * env, jclass clazz) {
return org_lwjgl_fmod3_FMOD_JNI_VERSION;
}
/*
* Class: org_lwjgl_fmod3_FMOD
* Method: nCreate
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FMOD_nCreate(JNIEnv *env, jclass clazz, jobjectArray paths) {
jsize pathcount = (*env)->GetArrayLength(env, paths);
int i;
jstring path;
char *path_str;
for(i=0;i<pathcount;i++) {
path = (jstring) (*env)->GetObjectArrayElement(env, paths, i);
path_str = GetStringNativeChars(env, path);
printfDebug("Testing '%s'\n", path_str);
fmod_create(env, path_str);
free(path_str);
if(fmod_instance != NULL) {
return;
}
}
throwFMODException(env, "Unable to load fmod library");
}
/*
* Class: org_lwjgl_fmod3_FMOD
* Method: nDestroy
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FMOD_nDestroy(JNIEnv *env, jclass clazz) {
fmod_destroy();
}
/*
* Class: org_lwjgl_fmod3_FMOD
* Method: FMOD_ErrorString
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FMOD_FMOD_1ErrorString(JNIEnv *env, jclass clazz, jint errorcode) {
char * error = FMOD_ErrorString(errorcode);
return NewStringNativeWithLength(env, error, strlen(error));
}

View File

@ -1,549 +0,0 @@
/*
* Copyright (c) 2002-2004 LWJGL Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* * 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.
*
* * Neither the name of 'LWJGL' nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "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 THE COPYRIGHT OWNER 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.
*/
#include "org_lwjgl_fmod3_FMusic.h"
#include "extfmod3.h"
// callback
void F_CALLBACKAPI fmusic_instcallback(FMUSIC_MODULE *mod, unsigned char param);
void F_CALLBACKAPI fmusic_ordercallback(FMUSIC_MODULE *mod, unsigned char param);
void F_CALLBACKAPI fmusic_rowcallback(FMUSIC_MODULE *mod, unsigned char param);
void F_CALLBACKAPI fmusic_zxxcallback(FMUSIC_MODULE *mod, unsigned char param);
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_LoadSong
* Signature: (Ljava/lang/String;)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1LoadSong(JNIEnv *env, jclass clazz, jstring name) {
jlong result;
char* filename = GetStringNativeChars(env, name);
result = (jlong) fmod_instance->FMUSIC_LoadSong(filename);
free(filename);
return result;
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_LoadSongEx
* Signature: (Ljava/nio/ByteBuffer;IIILjava/nio/IntBuffer;I)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1LoadSongEx__Ljava_nio_ByteBuffer_2IIILjava_nio_IntBuffer_2II
(JNIEnv *env, jclass clazz, jobject data, jint offset, jint length, jint mode, jobject sampleList, jint sampleListOffset, jint samplelistnum){
int *sampleData = NULL;
const char *songData = offset + (char *) (*env)->GetDirectBufferAddress(env, data);
if(sampleList != NULL) {
sampleData = sampleListOffset + (int *) (*env)->GetDirectBufferAddress(env, sampleList);
}
return (jlong) fmod_instance->FMUSIC_LoadSongEx(songData, 0, length, mode, sampleData, samplelistnum);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_LoadSongEx
* Signature: (Ljava/nio/ByteBuffer;IIILjava/nio/IntBuffer;I)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1LoadSongEx__Ljava_lang_String_2IIILjava_nio_IntBuffer_2II
(JNIEnv *env, jclass clazz, jstring name, jint offset, jint length, jint mode, jobject sampleList, jint sampleListOffset, jint samplelistnum){
jlong result;
int *sampleData = NULL;
char* filename = GetStringNativeChars(env, name);
if(sampleList != NULL) {
sampleData = sampleListOffset + (int *) (*env)->GetDirectBufferAddress(env, sampleList);
}
result = (jlong) fmod_instance->FMUSIC_LoadSongEx(filename, offset, length, mode, sampleData, samplelistnum);
free(filename);
return result;
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetOpenState
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetOpenState
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetOpenState((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_FreeSong
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1FreeSong
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_FreeSong((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_PlaySong
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1PlaySong
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_PlaySong((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_StopSong
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1StopSong
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_StopSong((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: FMUSIC_StopAllSongs
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FMusic_FMUSIC_1StopAllSongs
(JNIEnv *env, jclass clazz){
fmod_instance->FMUSIC_StopAllSongs();
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetZxxCallback
* Signature: (JLorg/lwjgl/fmod_instance/FMusicCallback;)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetZxxCallback(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_SetZxxCallback((FMUSIC_MODULE*)module, fmusic_zxxcallback);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetRowCallback
* Signature: (JLorg/lwjgl/fmod_instance/FMusicCallback;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetRowCallback(JNIEnv *env, jclass clazz, jlong module, jint row) {
return fmod_instance->FMUSIC_SetRowCallback((FMUSIC_MODULE*)module, fmusic_rowcallback, row);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetOrderCallback
* Signature: (JLorg/lwjgl/fmod_instance/FMusicCallback;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetOrderCallback(JNIEnv *env, jclass clazz, jlong module, jint order) {
return fmod_instance->FMUSIC_SetOrderCallback((FMUSIC_MODULE*)module, fmusic_ordercallback, order);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetInstCallback
* Signature: (JLorg/lwjgl/fmod_instance/FMusicCallback;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetInstCallback(JNIEnv *env, jclass clazz, jlong module, jint inst){
return fmod_instance->FMUSIC_SetInstCallback((FMUSIC_MODULE*)module, fmusic_instcallback, inst);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetSample
* Signature: (JIJ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetSample
(JNIEnv *env, jclass clazz, jlong module, jint sampno, jlong sample){
return fmod_instance->FMUSIC_SetSample((FMUSIC_MODULE *) module, sampno, (FSOUND_SAMPLE *) sample);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetUserData
* Signature: (JLjava/nio/ByteBuffer;I)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetUserData(JNIEnv *env, jclass clazz, jlong module, jobject data, jint offset) {
void *userdata = offset + (char*) (*env)->GetDirectBufferAddress(env, data);
return fmod_instance->FMUSIC_SetUserData((FMUSIC_MODULE *) module, userdata);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_OptimizeChannels
* Signature: (JII)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1OptimizeChannels
(JNIEnv *env, jclass clazz, jlong module, jint max, jint min){
return fmod_instance->FMUSIC_OptimizeChannels((FMUSIC_MODULE *) module, max, min);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: FMUSIC_SetReverb
* Signature: (Z)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_FMUSIC_1SetReverb
(JNIEnv *env, jclass clazz, jboolean reverb){
return fmod_instance->FMUSIC_SetReverb(reverb);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetLooping
* Signature: (JZ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetLooping
(JNIEnv *env, jclass clazz, jlong module, jboolean looping){
return fmod_instance->FMUSIC_SetLooping((FMUSIC_MODULE *) module, looping);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetOrder
* Signature: (JI)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetOrder
(JNIEnv *env, jclass clazz, jlong module, jint order){
return fmod_instance->FMUSIC_SetOrder((FMUSIC_MODULE *) module, order);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetPaused
* Signature: (JZ)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetPaused
(JNIEnv *env, jclass clazz, jlong module, jboolean paused){
return fmod_instance->FMUSIC_SetPaused((FMUSIC_MODULE *) module, paused);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetMasterVolume
* Signature: (JI)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetMasterVolume
(JNIEnv *env, jclass clazz, jlong module, jint volume){
return fmod_instance->FMUSIC_SetMasterVolume((FMUSIC_MODULE *) module, volume);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetMasterSpeed
* Signature: (JF)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetMasterSpeed
(JNIEnv *env, jclass clazz, jlong module, jfloat speed){
return fmod_instance->FMUSIC_SetMasterSpeed((FMUSIC_MODULE *) module, speed);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_SetPanSeperation
* Signature: (JF)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1SetPanSeperation
(JNIEnv *env, jclass clazz, jlong module, jfloat pan){
return fmod_instance->FMUSIC_SetPanSeperation((FMUSIC_MODULE *) module, pan);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetName
* Signature: (J)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetName
(JNIEnv *env, jclass clazz, jlong module) {
const char * name = fmod_instance->FMUSIC_GetName((FMUSIC_MODULE *) module);
return NewStringNativeWithLength(env, name, strlen(name));
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetType
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetType
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetType((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetNumOrders
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetNumOrders
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetNumOrders((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetNumPatterns
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetNumPatterns
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetNumPatterns((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetNumInstruments
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetNumInstruments
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetNumInstruments((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetNumSamples
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetNumSamples
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetNumSamples((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetNumChannels
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetNumChannels
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetNumChannels((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetSample
* Signature: (JI)J
*/
JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetSample
(JNIEnv *env, jclass clazz, jlong module, jint sampleno){
return (jlong) fmod_instance->FMUSIC_GetSample((FMUSIC_MODULE *) module, sampleno);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetPatternLength
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetPatternLength
(JNIEnv *env, jclass clazz, jlong module, jint orderno){
return fmod_instance->FMUSIC_GetPatternLength((FMUSIC_MODULE *) module, orderno);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_IsFinished
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1IsFinished
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_IsFinished((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_IsPlaying
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1IsPlaying
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_IsPlaying((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetMasterVolume
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetMasterVolume
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetMasterVolume((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetGlobalVolume
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetGlobalVolume
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetGlobalVolume((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetOrder
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetOrder
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetOrder((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetPattern
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetPattern
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetPattern((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetSpeed
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetSpeed
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetSpeed((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetBPM
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetBPM
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetBPM((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetRow
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetRow
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetRow((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetPaused
* Signature: (J)Z
*/
JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetPaused
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetPaused((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetTime
* Signature: (J)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetTime
(JNIEnv *env, jclass clazz, jlong module){
return fmod_instance->FMUSIC_GetTime((FMUSIC_MODULE *) module);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetRealChannel
* Signature: (JI)I
*/
JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetRealChannel
(JNIEnv *env, jclass clazz, jlong module, jint modchannel){
return fmod_instance->FMUSIC_GetRealChannel((FMUSIC_MODULE *) module, modchannel);
}
/*
* Class: org_lwjgl_fmod3_FMusic
* Method: nFMUSIC_GetUserData
* Signature: (J)Ljava/nio/ByteBuffer;
*/
JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FMusic_nFMUSIC_1GetUserData(JNIEnv *env, jclass clazz, jlong module, jint capacity) {
void* data = (void*) fmod_instance->FMUSIC_GetUserData((FMUSIC_MODULE *) module);
return (*env)->NewDirectByteBuffer(env, data, capacity);
}
/**
* This attaches the mixer thread as a daemon thread, and sets its
* priority to max value
*/
void attachMixerThread() {
jclass threadClass;
jmethodID currentThread;
jobject myThread;
jfieldID highPriority;
jint highPriorityValue;
jmethodID priority;
JavaVM *jvm = getJVM();
(*jvm)->AttachCurrentThreadAsDaemon(jvm, (void*)&mixer_jnienv, NULL);
// set to high priority
// ==============================
// get current thread
threadClass = (*mixer_jnienv)->FindClass(mixer_jnienv, "java/lang/Thread");
currentThread = (*mixer_jnienv)->GetStaticMethodID(mixer_jnienv, threadClass, "currentThread", "()Ljava/lang/Thread;");
myThread = (*mixer_jnienv)->CallStaticObjectMethod(mixer_jnienv, threadClass, currentThread);
// get value of high priority
highPriority = (*mixer_jnienv)->GetStaticFieldID(mixer_jnienv, threadClass, "MAX_PRIORITY", "I");
highPriorityValue = (*mixer_jnienv)->GetStaticIntField(mixer_jnienv, threadClass, highPriority);
// call set priority
priority = (*mixer_jnienv)->GetMethodID(mixer_jnienv, threadClass, "setPriority", "(I)V");
(*mixer_jnienv)->CallVoidMethod(mixer_jnienv, myThread, priority, highPriorityValue);
// ------------------------------
}
// FMusic callbacks
// =======================================
void F_CALLBACKAPI fmusic_instcallback(FMUSIC_MODULE *mod, unsigned char param) {
if (mixer_jnienv == NULL) { attachMixerThread(); }
(*mixer_jnienv)->CallStaticVoidMethod(mixer_jnienv, fmusic, music_instcallback, (jlong) mod, (jint) param);
}
void F_CALLBACKAPI fmusic_ordercallback(FMUSIC_MODULE *mod, unsigned char param) {
if (mixer_jnienv == NULL) { attachMixerThread(); }
(*mixer_jnienv)->CallStaticVoidMethod(mixer_jnienv, fmusic, music_ordercallback, (jlong) mod, (jint) param);
}
void F_CALLBACKAPI fmusic_rowcallback(FMUSIC_MODULE *mod, unsigned char param) {
if (mixer_jnienv == NULL) { attachMixerThread(); }
(*mixer_jnienv)->CallStaticVoidMethod(mixer_jnienv, fmusic, music_rowcallback, (jlong) mod, (jint) param);
}
void F_CALLBACKAPI fmusic_zxxcallback(FMUSIC_MODULE *mod, unsigned char param) {
if (mixer_jnienv == NULL) { attachMixerThread(); }
(*mixer_jnienv)->CallStaticVoidMethod(mixer_jnienv, fmusic, music_zxxcallback, (jlong) mod, (jint) param);
}
// ------------------------------------------

File diff suppressed because it is too large Load Diff