diff --git a/build.xml b/build.xml index f1832879..4267f013 100644 --- a/build.xml +++ b/build.xml @@ -24,10 +24,8 @@ - - @@ -62,18 +60,6 @@ - - - - - - - - - - - - @@ -108,15 +94,6 @@ - - - - - - - - - @@ -124,15 +101,6 @@ - - - - - - - - - @@ -141,15 +109,6 @@ - - - - - - - - - @@ -160,40 +119,18 @@ - - - - - - - - - - - - - - - - - - - - - - @@ -211,16 +148,6 @@ - - - - - - - - - - @@ -232,8 +159,6 @@ - - @@ -310,6 +235,7 @@ + @@ -346,22 +272,6 @@ - - - - - - - - - - - - - - - - @@ -420,8 +330,6 @@ - - @@ -429,8 +337,6 @@ - - @@ -438,8 +344,6 @@ - - @@ -460,8 +364,6 @@ - - @@ -469,8 +371,6 @@ - - @@ -483,19 +383,16 @@ - - - @@ -506,13 +403,6 @@ - - - - - - - @@ -547,8 +437,6 @@ - - @@ -608,18 +496,6 @@ - - - - - - - - - - - - @@ -670,7 +546,7 @@ - + @@ -706,7 +582,7 @@ - + @@ -727,37 +603,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - @@ -766,32 +617,11 @@ - - - - - - - - - - - - - - - - - - - - - @@ -818,22 +648,14 @@ - - - - - - - - @@ -851,8 +673,6 @@ - - diff --git a/doc/3rdparty/openil_license.txt b/doc/3rdparty/openil_license.txt deleted file mode 100644 index 30c8ca21..00000000 --- a/doc/3rdparty/openil_license.txt +++ /dev/null @@ -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. - - - Copyright (C) - - 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. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - - - diff --git a/platform_build/linux_ant/build_devil.xml b/platform_build/linux_ant/build_devil.xml deleted file mode 100644 index 16889b17..00000000 --- a/platform_build/linux_ant/build_devil.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform_build/linux_ant/build_fmod3.xml b/platform_build/linux_ant/build_fmod3.xml deleted file mode 100644 index c7974505..00000000 --- a/platform_build/linux_ant/build_fmod3.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform_build/macosx_ant/build_devil.xml b/platform_build/macosx_ant/build_devil.xml deleted file mode 100755 index b86ea187..00000000 --- a/platform_build/macosx_ant/build_devil.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform_build/macosx_ant/build_fmod3.xml b/platform_build/macosx_ant/build_fmod3.xml deleted file mode 100755 index 2c9ab101..00000000 --- a/platform_build/macosx_ant/build_fmod3.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform_build/windows_ant/build_devil.xml b/platform_build/windows_ant/build_devil.xml deleted file mode 100644 index 98e234e5..00000000 --- a/platform_build/windows_ant/build_devil.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/platform_build/windows_ant/build_fmod3.xml b/platform_build/windows_ant/build_fmod3.xml deleted file mode 100644 index dcab4005..00000000 --- a/platform_build/windows_ant/build_fmod3.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/java/org/lwjgl/devil/IL.java b/src/java/org/lwjgl/devil/IL.java deleted file mode 100644 index d60e06b5..00000000 --- a/src/java/org/lwjgl/devil/IL.java +++ /dev/null @@ -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; - -/** - *

- * The core DevIL API. - *

- * - * @author captainjester - * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/devil/ILNative.java b/src/java/org/lwjgl/devil/ILNative.java deleted file mode 100644 index 2ddea570..00000000 --- a/src/java/org/lwjgl/devil/ILNative.java +++ /dev/null @@ -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; - -/** - *

- * Native interface for DevIL - *

- * - * @author Brian Matzon - * @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(); - } - // ----------------------------------------------------------- -} diff --git a/src/java/org/lwjgl/devil/ILU.java b/src/java/org/lwjgl/devil/ILU.java deleted file mode 100644 index a0fb2df2..00000000 --- a/src/java/org/lwjgl/devil/ILU.java +++ /dev/null @@ -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; - -/** - *

- * The DevIL ILU API. - *

- * - * @author captainjester - * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/devil/ILUT.java b/src/java/org/lwjgl/devil/ILUT.java deleted file mode 100644 index 2d89eaee..00000000 --- a/src/java/org/lwjgl/devil/ILUT.java +++ /dev/null @@ -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; - -/** - *

- * The DevIL ILUT API. - *

- * - * @author captainjester - * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/devil/ILinfo.java b/src/java/org/lwjgl/devil/ILinfo.java deleted file mode 100644 index 758a5199..00000000 --- a/src/java/org/lwjgl/devil/ILinfo.java +++ /dev/null @@ -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 - * @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 -} diff --git a/src/java/org/lwjgl/devil/ILpointf.java b/src/java/org/lwjgl/devil/ILpointf.java deleted file mode 100644 index 49f7399a..00000000 --- a/src/java/org/lwjgl/devil/ILpointf.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$ - */ -public class ILpointf { - public float x; - public float y; -} diff --git a/src/java/org/lwjgl/devil/ILpointi.java b/src/java/org/lwjgl/devil/ILpointi.java deleted file mode 100644 index ec4d5e15..00000000 --- a/src/java/org/lwjgl/devil/ILpointi.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$ - */ -public class ILpointi { - public int x; - public int y; -} diff --git a/src/java/org/lwjgl/fmod3/FMOD.java b/src/java/org/lwjgl/fmod3/FMOD.java deleted file mode 100644 index f73560cd..00000000 --- a/src/java/org/lwjgl/fmod3/FMOD.java +++ /dev/null @@ -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; - -/** - *
- * @author Brian Matzon - * @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 - * @author Brian Matzon - * @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); - } -} diff --git a/src/java/org/lwjgl/fmod3/FMusic.java b/src/java/org/lwjgl/fmod3/FMusic.java deleted file mode 100644 index 6aa0da5a..00000000 --- a/src/java/org/lwjgl/fmod3/FMusic.java +++ /dev/null @@ -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; - -/** - *
- * @author Brian Matzon - * @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) - *

- * - * 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. - * - *

- * - * @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. - *

- * Remarks - * 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. - *

- * Remarks - * 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 - *

- * Remarks - * 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. - *

- * Remarks - * 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. - *

- * Remarks - * 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. - *

- * @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). - *

- * Remarks - * 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. - *

- * @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. - *

- * Remarks - * Reverb may be enabled through software emulation in the future for MOD based formats. - *

- * @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 - *

- * Remarks - * 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. - *

- * @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. - *

- * Remarks - * Note : This function is not supported with the MIDI format. - *

- * @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 - *

- * Remarks - * 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. - *

- * @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 - *

- * Remarks - * 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) - *

- * @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 - *

- * Remarks - * 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. - *

- * @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 - *

- * Remarks - * 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 - *

- * @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 - *

- * Remarks - * 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. - *

- * @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 - * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/fmod3/FSound.java b/src/java/org/lwjgl/fmod3/FSound.java deleted file mode 100644 index dc606c9b..00000000 --- a/src/java/org/lwjgl/fmod3/FSound.java +++ /dev/null @@ -1,3805 +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.FloatBuffer; -import java.nio.IntBuffer; -import java.util.ArrayList; - -import org.lwjgl.BufferUtils; -import org.lwjgl.fmod3.callbacks.FSoundCloseCallback; -import org.lwjgl.fmod3.callbacks.FSoundDSPCallback; -import org.lwjgl.fmod3.callbacks.FSoundMetaDataCallback; -import org.lwjgl.fmod3.callbacks.FSoundOpenCallback; -import org.lwjgl.fmod3.callbacks.FSoundReadCallback; -import org.lwjgl.fmod3.callbacks.FSoundSeekCallback; -import org.lwjgl.fmod3.callbacks.FSoundStreamCallback; -import org.lwjgl.fmod3.callbacks.FSoundTellCallback; - -/** - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public class FSound { - - /** CE/PS2/GC Only - Non interpolating/low quality mixer. */ - public static final int FSOUND_MIXER_AUTODETECT = 0; - - /** Removed / obsolete. */ - public static final int FSOUND_MIXER_BLENDMODE = 1; - - /** Removed / obsolete. */ - public static final int FSOUND_MIXER_MMXP5 = 2; - - /** Removed / obsolete. */ - public static final int FSOUND_MIXER_MMXP6 = 3; - - /** All platforms - Autodetect the fastest quality mixer based on your cpu. */ - public static final int FSOUND_MIXER_QUALITY_AUTODETECT = 4; - - /** Win32/Linux only - Interpolating/volume ramping FPU mixer. */ - public static final int FSOUND_MIXER_QUALITY_FPU = 5; - - /** Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. */ - public static final int FSOUND_MIXER_QUALITY_MMXP5 = 6; - - /** Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. */ - public static final int FSOUND_MIXER_QUALITY_MMXP6 = 7; - - /** CE/PS2/GC only - MONO non interpolating/low quality mixer. For speed */ - public static final int FSOUND_MIXER_MONO = 8; - - /** CE/PS2/GC only - MONO Interpolating mixer. For speed */ - public static final int FSOUND_MIXER_QUALITY_MONO = 9; - - public static final int FSOUND_MIXER_MAX = 10; - - /** NoSound driver, all calls to this succeed but do nothing. */ - public static final int FSOUND_OUTPUT_NOSOUND = 0; - - /** Windows Multimedia driver. */ - public static final int FSOUND_OUTPUT_WINMM = 1; - - /** DirectSound driver. You need this to get EAX or EAX2 support, or FX api support. */ - public static final int FSOUND_OUTPUT_DSOUND = 2; - - /** A3D driver. not supported any more. */ - public static final int FSOUND_OUTPUT_A3D = 3; - - /** Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */ - public static final int FSOUND_OUTPUT_OSS = 4; - - /** Linux/Unix ESD (Enlightment Sound Daemon) driver.*/ - public static final int FSOUND_OUTPUT_ESD = 5; - - /** Linux Alsa driver. */ - public static final int FSOUND_OUTPUT_ALSA = 6; - - /** Low latency ASIO driver */ - public static final int FSOUND_OUTPUT_ASIO = 7; - - /** Xbox driver */ - public static final int FSOUND_OUTPUT_XBOX = 8; - - /** PlayStation 2 driver */ - public static final int FSOUND_OUTPUT_PS2 = 9; - - /** Mac SoundMager driver */ - public static final int FSOUND_OUTPUT_MAC = 10; - - /** Gamecube driver */ - public static final int FSOUND_OUTPUT_GC = 11; - - /** This is the same As nosound, but the sound generation is driven by FSOUND_Update */ - public static final int FSOUND_OUTPUT_NOSOUND_NONREALTIME = 12; - - /** DSP CLEAR unit - done first */ - public static final int FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT = 0; - - /** DSP SFX unit - done second */ - public static final int FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT = 100; - - /** DSP MUSIC unit - done third */ - public static final int FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT = 200; - - /** User priority, use this as reference */ - public static final int FSOUND_DSP_DEFAULTPRIORITY_USER = 300; - - /** This reads data for FSOUND_DSP_GetSpectrum, so it comes after user units */ - public static final int FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT = 900; - - /** DSP CLIP AND COPY unit - last */ - public static final int FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT = 1000; - - /** This driver supports hardware accelerated 3d sound. */ - public static final int FSOUND_CAPS_HARDWARE = 0x1; - - /** This driver supports EAX2 reverb */ - public static final int FSOUND_CAPS_EAX2 = 0x2; - - /** This driver supports EAX3 reverb */ - public static final int FSOUND_CAPS_EAX3 = 0x10; - - /** For non looping samples. */ - public static final int FSOUND_LOOP_OFF = 0x00000001; - - /** For forward looping samples. */ - public static final int FSOUND_LOOP_NORMAL = 0x00000002; - - /** For bidirectional looping samples. (no effect if in hardware). */ - public static final int FSOUND_LOOP_BIDI = 0x00000004; - - /** For 8 bit samples. */ - public static final int FSOUND_8BITS = 0x00000008; - - /** For 16 bit samples. */ - public static final int FSOUND_16BITS = 0x00000010; - - /** For mono samples. */ - public static final int FSOUND_MONO = 0x00000020; - - /** For stereo samples. */ - public static final int FSOUND_STEREO = 0x00000040; - - /** For user created source data containing unsigned samples. */ - public static final int FSOUND_UNSIGNED = 0x00000080; - - /** For user created source data containing signed data. */ - public static final int FSOUND_SIGNED = 0x00000100; - - /** For user created source data stored as delta values. */ - public static final int FSOUND_DELTA = 0x00000200; - - /** For user created source data stored using IT214 compression. */ - public static final int FSOUND_IT214 = 0x00000400; - - /** For user created source data stored using IT215 compression. */ - public static final int FSOUND_IT215 = 0x00000800; - - /** Attempts to make samples use 3d hardware acceleration. (if the card supports it) */ - public static final int FSOUND_HW3D = 0x00001000; - - /** Tells software (not hardware) based sample not to be included in 3d processing. */ - public static final int FSOUND_2D = 0x00002000; - - /** For a streamimg sound where you feed the data to it. */ - public static final int FSOUND_STREAMABLE = 0x00004000; - - /** "name" will be interpreted as a pointer to data for streaming and samples. */ - public static final int FSOUND_LOADMEMORY = 0x00008000; - - /** Will ignore file format and treat as raw pcm. */ - public static final int FSOUND_LOADRAW = 0x00010000; - - /** For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. */ - public static final int FSOUND_MPEGACCURATE = 0x00020000; - - /** For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams */ - public static final int FSOUND_FORCEMONO = 0x00040000; - - /** 2D hardware sounds. allows hardware specific effects */ - public static final int FSOUND_HW2D = 0x00080000; - - /** Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency */ - public static final int FSOUND_ENABLEFX = 0x00100000; - - /** For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution */ - public static final int FSOUND_MPEGHALFRATE = 0x00200000; - - /** Contents are stored compressed as IMA ADPCM */ - public static final int FSOUND_IMAADPCM = 0x00400000; - - /** For PS2 only - Contents are compressed as Sony VAG format */ - public static final int FSOUND_VAG = 0x00800000; - - /** For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. */ - public static final int FSOUND_NONBLOCKING = 0x01000000; - - /** For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format */ - public static final int FSOUND_GCADPCM = 0x02000000; - - /** For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format */ - public static final int FSOUND_MULTICHANNEL = 0x04000000; - - /** For PS2 only - Sample/Stream is forced to use hardware voices 00-23 */ - public static final int FSOUND_USECORE0 = 0x08000000; - - /** For PS2 only - Sample/Stream is forced to use hardware voices 24-47 */ - public static final int FSOUND_USECORE1 = 0x10000000; - - /** For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address */ - public static final int FSOUND_LOADMEMORYIOP = 0x20000000; - - /** Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) */ - public static final int FSOUND_IGNORETAGS = 0x40000000; - - /** Specifies an internet stream */ - public static final int FSOUND_STREAM_NET = 0x80000000; - - public static final int FSOUND_NORMAL = (FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO); - - /* Starts from the current track and plays to end of CD. */ - public static final int FSOUND_CD_PLAYCONTINUOUS = 0; - - /* Plays the specified track then stops. */ - public static final int FSOUND_CD_PLAYONCE = 1; - - /* Plays the specified track looped, forever until stopped manually. */ - public static final int FSOUND_CD_PLAYLOOPED = 2; - - /* Plays tracks in random order */ - public static final int FSOUND_CD_PLAYRANDOM = 3; - - /* value to play on any free channel, or to allocate a sample in a free sample slot. */ - public static final int FSOUND_FREE = -1; - - /* value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. */ - public static final int FSOUND_UNMANAGED = -2; - - /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */ - public static final int FSOUND_ALL = -3; - - /* value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. */ - public static final int FSOUND_STEREOPAN = -1; - - /* special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel */ - public static final int FSOUND_SYSTEMCHANNEL = -1000; - - /* special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample */ - public static final int FSOUND_SYSTEMSAMPLE = -1000; - - /* 'EnvSize' affects reverberation decay time */ - public static final int FSOUND_REVERB_FLAGS_DECAYTIMESCALE = 0x00000001; - - /* 'EnvSize' affects reflection level */ - public static final int FSOUND_REVERB_FLAGS_REFLECTIONSSCALE = 0x00000002; - - /* 'EnvSize' affects initial reflection delay time */ - public static final int FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE = 0x00000004; - - /* 'EnvSize' affects reflections level */ - public static final int FSOUND_REVERB_FLAGS_REVERBSCALE = 0x00000008; - - /* 'EnvSize' affects late reverberation delay time */ - public static final int FSOUND_REVERB_FLAGS_REVERBDELAYSCALE = 0x00000010; - - /* AirAbsorptionHF affects DecayHFRatio */ - public static final int FSOUND_REVERB_FLAGS_DECAYHFLIMIT = 0x00000020; - - /* 'EnvSize' affects echo time */ - public static final int FSOUND_REVERB_FLAGS_ECHOTIMESCALE = 0x00000040; - - /* 'EnvSize' affects modulation time */ - public static final int FSOUND_REVERB_FLAGS_MODULATIONTIMESCALE = 0x00000080; - - /* PS2 Only - Reverb is applied to CORE0 (hw voices 0-23) */ - public static final int FSOUND_REVERB_FLAGS_CORE0 = 0x00000100; - - /* PS2 Only - Reverb is applied to CORE1 (hw voices 24-47) */ - public static final int FSOUND_REVERB_FLAGS_CORE1 = 0x00000200; - - public static final int FSOUND_REVERB_FLAGS_DEFAULT = (FSOUND_REVERB_FLAGS_DECAYTIMESCALE - | FSOUND_REVERB_FLAGS_REFLECTIONSSCALE - | FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE - | FSOUND_REVERB_FLAGS_REVERBSCALE - | FSOUND_REVERB_FLAGS_REVERBDELAYSCALE - | FSOUND_REVERB_FLAGS_DECAYHFLIMIT - | FSOUND_REVERB_FLAGS_CORE0 | FSOUND_REVERB_FLAGS_CORE1); - - /** A vorbis comment */ - public static final int FSOUND_TAGFIELD_VORBISCOMMENT = 0; - - /** Part of an ID3v1 tag */ - public static final int FSOUND_TAGFIELD_ID3V1 = 1; - - /** An ID3v2 frame */ - public static final int FSOUND_TAGFIELD_ID3V2 = 2; - - /** A SHOUTcast header line */ - public static final int FSOUND_TAGFIELD_SHOUTCAST = 3; - - /** An Icecast header line */ - public static final int FSOUND_TAGFIELD_ICECAST = 4; - - /** An Advanced Streaming Format header line */ - public static final int FSOUND_TAGFIELD_ASF = 5; - - /** Stream hasn't connected yet */ - public static final int FSOUND_STREAM_NET_NOTCONNECTED = 0; - - /** Stream is connecting to remote host */ - public static final int FSOUND_STREAM_NET_CONNECTING = 1; - - /** Stream is buffering data */ - public static final int FSOUND_STREAM_NET_BUFFERING = 2; - - /** Stream is ready to play */ - public static final int FSOUND_STREAM_NET_READY = 3; - - /** Stream has suffered a fatal error */ - public static final int FSOUND_STREAM_NET_ERROR = 4; - - public static final int FSOUND_FX_CHORUS = 0; - public static final int FSOUND_FX_COMPRESSOR = 1; - public static final int FSOUND_FX_DISTORTION = 2; - public static final int FSOUND_FX_ECHO = 3; - public static final int FSOUND_FX_FLANGER = 4; - public static final int FSOUND_FX_GARGLE = 5; - public static final int FSOUND_FX_I3DL2REVERB = 6; - public static final int FSOUND_FX_PARAMEQ = 7; - public static final int FSOUND_FX_WAVES_REVERB = 8; - public static final int FSOUND_FX_MAX = 9; - - /** Dolby Digital Output (XBOX or PC only). */ - public static final int FSOUND_SPEAKERMODE_DOLBYDIGITAL = 0; - - /** The speakers are headphones. */ - public static final int FSOUND_SPEAKERMODE_HEADPHONES = 1; - - /** The speakers are monaural. */ - public static final int FSOUND_SPEAKERMODE_MONO = 2; - - /** The speakers are quadraphonic. */ - public static final int FSOUND_SPEAKERMODE_QUAD = 3; - - /** The speakers are stereo (default value). */ - public static final int FSOUND_SPEAKERMODE_STEREO = 4; - - /** The speakers are surround sound. */ - public static final int FSOUND_SPEAKERMODE_SURROUND = 5; - - /** DTS output (XBOX only). */ - public static final int FSOUND_SPEAKERMODE_DTS = 6; - - /** Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 doesnt support interior panning, but supports 48 voices simultaneously. */ - public static final int FSOUND_SPEAKERMODE_PROLOGIC2 = 7; - - /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 does support interior panning, but only supports 24 voices simultaneously. */ - public static final int FSOUND_SPEAKERMODE_PROLOGIC2_INTERIOR = 8; - - /** Win32 only - Causes MIDI playback to force software decoding. */ - public static final int FSOUND_INIT_USEDEFAULTMIDISYNTH = 0x0001; - - /** Win32 only - For DirectSound output - sound is not muted when window is out of focus. */ - public static final int FSOUND_INIT_GLOBALFOCUS = 0x0002; - - /** Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) */ - public static final int FSOUND_INIT_ENABLESYSTEMCHANNELFX = 0x0004; - - /** This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit */ - public static final int FSOUND_INIT_ACCURATEVULEVELS = 0x0008; - - /** PS2 only - Disable reverb on CORE 0 to regain SRAM */ - public static final int FSOUND_INIT_PS2_DISABLECORE0REVERB = 0x0010; - - /** PS2 only - Disable reverb on CORE 1 to regain SRAM */ - public static final int FSOUND_INIT_PS2_DISABLECORE1REVERB = 0x0020; - - /** PS2 only - By default FMOD uses DMA CH0 for mixing, CH1 for uploads, this flag swaps them around */ - public static final int FSOUND_INIT_PS2_SWAPDMACORES = 0x0040; - - /** Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate */ - public static final int FSOUND_INIT_DONTLATENCYADJUST = 0x0080; - - /** GC only - Initializes GC audio libraries */ - public static final int FSOUND_INIT_GC_INITLIBS = 0x0100; - - /** Turns off fmod streamer thread, and makes streaming update from FSOUND_Update called by the user */ - public static final int FSOUND_INIT_STREAM_FROM_MAIN_THREAD = 0x0200; - - /** PS2 only - Turns on volume ramping system to remove hardware clicks. */ - public static final int FSOUND_INIT_PS2_USEVOLUMERAMPING = 0x0400; - - /** Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. */ - public static final int FSOUND_INIT_DSOUND_DEFERRED = 0x0800; - - /** Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. */ - public static final int FSOUND_INIT_DSOUND_HRTF_LIGHT = 0x1000; - - /** Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. */ - public static final int FSOUND_INIT_DSOUND_HRTF_FULL = 0x2000; - - public static final int FSOUND_PROTOCOL_SHOUTCAST = 0x00000001; - public static final int FSOUND_PROTOCOL_ICECAST = 0x00000002; - public static final int FSOUND_PROTOCOL_HTTP = 0x00000004; - public static final int FSOUND_FORMAT_MPEG = 0x00010000; - public static final int FSOUND_FORMAT_OGGVORBIS = 0x00020000; - - - - // Pre Initialization / Initialization / Enumeration - // ====================================================== - /** - * Shuts down the WHOLE FMOD Sound System - *

- * Remarks - * This also closes down the sample management system, freeing all MANAGED samples loaded (unless they were allocated with the FSOUND_UNMANAGED flag). - * Streams are not freed. You must close them yourself. - * CD Tracks are stopped. - *

- */ - public static native void FSOUND_Close(); - - /** - * Specify user callbacks for FMOD's internal file manipulation functions. - * If ANY of these parameters are NULL, then FMOD will switch back to its own file routines. - * You can replace this with memory routines (ie name can be cast to a memory address for example, then open sets up - * a handle based on this information), or alternate file routines, ie a WAD file reader. - *

- * Remarks - * Memory loader FMOD functions are not affected, such as FMUSIC_LoadSongMemory etc. - * WARNING : This function is dangerous in the wrong hands. You must return the right values, and each command must work properly, or FMOD will not function, or it may even crash if you give it invalid data. - * You must support SEEK_SET, SEEK_CUR and SEEK_END properly, or FMOD will not work properly. See standard I/O help files on how these work under fseek(). - * Read the documentation in REMARKS and do exactly what it says. See the "simple" example for how it is used properly. - * The MIDI loader does not support user file callbacks. For WAD type data structures with embedded MIDI files FMUSIC_LoadSongMemory will have to be used. - * -------------- - * PlayStation 2 NOTE! This function takes IOP function pointers, not EE pointers! It is for custom IOP file systems not EE based ones. - * This function can only be called after FSOUND_Init on PlayStation 2, not before - *

- * @param open Open callback - * @param close Close callback - * @param read Read callback - * @param seek Seek callback - * @param tell Tell callback - */ - public static void FSOUND_File_SetCallbacks( - FSoundOpenCallback open, FSoundCloseCallback close, FSoundReadCallback read, - FSoundSeekCallback seek, FSoundTellCallback tell) { - - if(open != null && close != null && read != null && seek != null && tell != null) { - FMOD.registerCallback(FMOD.FSOUND_OPENCALLBACK, -1, null, open); - FMOD.registerCallback(FMOD.FSOUND_CLOSECALLBACK, -1, null, open); - FMOD.registerCallback(FMOD.FSOUND_READCALLBACK, -1, null, open); - FMOD.registerCallback(FMOD.FSOUND_SEEKCALLBACK, -1, null, open); - FMOD.registerCallback(FMOD.FSOUND_TELLCALLBACK, -1, null, open); - - nFSOUND_File_SetCallbacks(); - } else { - throw new IllegalArgumentException("Cannot supply null callback"); - } - } - private static native void nFSOUND_File_SetCallbacks(); - - /** - * Initializes the FMOD Sound System. - *

- * Remarks - * You do not have control over how many hardware channels are available to you. In a lot of - * cases it may be 0 (the sound card does not have the ability to supply hardware channels). - * This is why it is usually a good idea to supply FSOUND_Init with a good number of software - * channels to fall back onto, for example 32. - * Hardware channels are 3D hardware channels only. There is no benefit in supporting hardware - * for 2d playback of sound effects. With todays machines and FMOD's superior mixing routines, - * FMOD's software engine can sometimes be faster than the driver's hardware support! - * - * @param mixrate Output rate in hz between 4000 and 65535. Any thing outside this will cause - * the function to fail and return false. - * PS2 Note. Only rates of 24000 and 48000 are supported. - * SmartPhone Note. Use 22050 or the operating system may crash outside of the control of fmod. - * @param channels Maximum number of SOFTWARE channels available. - * The number of HARDWARE channels is autodetected. The total number of channels available (hardware and software) after initialization can be found with FSOUND_GetMaxChannels. - * Having a large number of maxchannels does not adversely affect cpu usage, but it means it has the POTENTIAL to mix a large number of channels, which can have an adverse effect on cpu usage. - * 1024 is the highest number that can be set. Anything higher will return an error. - * @param flags See FSOUND_INIT_FLAGS. Controls some global or initialization time aspects of playback - * @return On success, true is returned. On failure, false is returned - */ - public static native boolean FSOUND_Init(int mixrate, int channels, int flags); - - /** - * Sets the FMOD internal mixing buffer size. - * It is configurable because low buffersizes use less memory, but are more instable. - * More importantly, increasing buffer size will increase sound output stability, but - * on the other hand increases latency, and to some extent, CPU usage. - * FMOD chooses the most optimal size by default for best stability, depending on the - * output type - and if the drivers are emulated or not (NT). - * It is not recommended changing this value unless you really need to. You may get worse - * performance than the default settings chosen by FMOD. - *

- * Remarks - * This function cannot be called after FMOD is already activated with FSOUND_Init. - * It must be called before FSOUND_Init, or after FSOUND_Close. - * --------- - * The buffersize seting defaults to 50ms if it is not called for DSOUND. - * It defaults to 200ms for Windows Multimedia wave-out or for emulated DirectSound drivers (such as NT drivers). - * When the output is FSOUND_OUTPUT_ASIO the buffersize is ignored. The buffersize should be configured using the ASIO driver which can be done with the supplied asioconfig.exe in the FMOD SDK. - * --------- - * Buffer sizes lower than 50 are clamped at 50. - * Buffer sizes are also rounded DOWN to the nearest multiple of 25. This is because FMOD mixes in blocks of 25ms. - * Due to this buffersize command latency on software channels will be between 25 and 50ms on average (37.5ms) when the buffersize is set to 50. - * --------- - * Macintosh, PlayStation 2 and GameCube do not support this as they already achieve minimal latency and are forced to 25ms. - * - * @param len_ms buffer size in milliseconds. - * @return On success, true is returned. On failure, (ie if FMOD is already active) false is returned - */ - public static native boolean FSOUND_SetBufferSize(int len_ms); - - /** - * Selects a soundcard driver. - * It is used when an output mode has enumerated more than one output device, and you need to select between them. - *

- * Remarks - * This function cannot be called after FMOD is already activated with FSOUND_Init. - * It must be called before FSOUND_Init, or after FSOUND_Close. - *

- * @param driver Driver number to select. 0 will select the DEFAULT sound driver. - * >0 will select an INVALID driver which will case the DEVICE to be set - * to a null (nosound) driver. - * <0 Selects other valid drivers that can be listed with FSOUND_GetDriverName. - * @return On success, TRUE is returned. On failure, (ie if FMOD is already active) FALSE is returned. - */ - public static native boolean FSOUND_SetDriver(int driver); - - /** - * This is an optional function to set the window handle of the application - * you are writing, so Directsound can tell if it is in focus or not. - *

- * Remarks - * This function cannot be called after FMOD is already activated with FSOUND_Init. - * It must be called before FSOUND_Init, or after FSOUND_Close. - * --------- - * FMOD uses GetForegroundWindow if this function is not called. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - //public static native boolean FSOUND_SetHWND(); - - /** - * This sets the maximum allocatable channels on a hardware card. FMOD automatically - * detects and allocates the maximum number of 3d hardware channels, so calling this - * will limit that number if it becomes too much - *

- * Remarks - * This function cannot be called after FMOD is already activated with FSOUND_Init. - * It must be called before FSOUND_Init, or after FSOUND_Close. - * --------- - * This function has nothing to do with FSOUND_SetMinHardwareChannels, in that this is not a function that forces FMOD into software mixing if a card has a certain number of channels. - * This function only sets a limit on hardware channels, so if you card has 96 hardware channels, and you set FSOUND_SetMaxHardwareChannels(10), then you will only have 10 hardware channels to use. - * @param max maximum number of hardware channels to allocate, even if the soundcard supports more - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetMaxHardwareChannels(int max); - - //public static native boolean FSOUND_FSOUND_SetMemorySystem(FSoundCallback callback); - - /** - * This sets the minimum allowable hardware channels before FMOD drops back to 100 percent software. - * This is helpful for minimum spec cards, and not having to guess how many hardware channels - * they might have. This way you can guarantee and assume a certain number of channels for - * your application and place them all in FSOUND_HW3D without fear of the playsound failing - * because it runs out of channels on a low spec card. - *

- * Remarks - * As an example, if you set your minimum to 16, you can now safely guarantee that 16 sounds can be played at once that are created with FSOUND_HW3D. - * This way if you do come across a card that only supports 4 channels, it will just drop back to playing ALL sounds in software mode. - * It may sound worse, but at least it doesnt fail on the playsound. (which could sound even worse!) - * --------- - * @param min minimum number of hardware channels allowable on a card before it uses the software engine 1004562604f the time - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetMinHardwareChannels(int min); - - /** - * Sets a digital mixer type. - *

- * Remarks - * This function cannot be called after FMOD is already activated with FSOUND_Init. - * It must be called before FSOUND_Init, or after FSOUND_Close. - * This function does not nescessarily need to be called, autodetection will select the - * fastest mixer for your machine. It is here if you need to test all mixer types for - * debugging purposes, or a mixer has a feature that the autodetected one doesnt. - * (ie low quality mixers or volume ramping) - * @param mixer mixer type, see FSOUND_MIXERTYPES for valid parameters and descriptions - * @return On success, TRUE is returned. On failure, (ie if FMOD is already active) FALSE is returned - */ - public static native boolean FSOUND_SetMixer(int mixer); - - /** - * Sets up the soundsystem output mode - *

- * Remarks - * This function cannot be called after FMOD is already activated with FSOUND_Init. - * It must be called before FSOUND_Init, or after FSOUND_Close. - * ------- - * Under Windows NT - Waveout is FASTER than DirectSound, achieves LOWER latency, AND - * is LESS buggy. DirectSound under NT is achieved by emulating waveout, and therefore is - * inferior to waveout. Use WAVEOUT under NT. - * Under Windows 9x and W2K - DirectSound is faster than waveout and can achieve lower latency. - * Use DIRECTSOUND under Win9x and W2K. - * ------- - * If you dont call FSOUND_SetOutput, FMOD will now autodetect DSOUND or WINMM based on the operating system. - *

- * @param output The output system to be used. See FSOUND_OUTPUTTYPES for valid parameters and descriptions. -1 Is autodetect based on operating system - * @return On success, TRUE is returned. On failure, (ie if FMOD is already active) FALSE is returned - */ - public static native boolean FSOUND_SetOutput(int output); - - // ------------------------------------------------------------ - - // Global runtime update fucntions - // ============================================================ - - /** - * Sets the master pan seperation for 2d sound effects - * @param pansep The pan scalar. 1.0 means full pan seperation, 0 means mono - */ - public static native void FSOUND_SetPanSeperation(float pansep); - - /** - * Sets the master volume for any sound effects played. Does not affect music or CD output. - * @param volume The volume to set. Valid ranges are from 0 (silent) to 255 (full volume) - */ - public static native void FSOUND_SetSFXMasterVolume(int volume); - - /** - * Sets the mode for the users speaker setup - *

- * Remarks - * Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. - * ---------------------------------- - * To get true 5.1 dolby digital or DTS output you will need a soundcard that can encode it, and a receiver that can decode it. - * If not the results can be unpredictable. - * ---------------------------------- - * Calling this will reset the pan separation setting. It sets it to 0 if FSOUND_SPEAKERMODE_MONO is chosen, and 1 otherwise. - * You will need to reset the pan separation if required afterwards. - * Note that some soundcard drivers may ignore this call. - * ---------------------------------- - * XBOX only - This function MUST be called before FSOUND_Init to change the default speaker mode. To change on the fly, you must close down FMOD with FSOUND_Close then re-initialize it with FSOUND_Init. - * If it is called after FSOUND_Init, only headphone speakermode is interpreted to switch headphone mode on and off. - * ---------------------------------- - * PlayStation 2 only - This function must be called before playing sounds. Calling this after playing a sound will not make that existing sound work in Prologic 2. - * - * @param speakermode enum describing the users speaker setup - */ - public static native void FSOUND_SetSpeakerMode(int speakermode); - - /** - * This updates the 3d sound engine and DMA engine (only on some platforms), and should be called once a game frame. - * This function will also update the software mixer if you have selected FSOUND_OUTPUT_NOSOUND_NONREALTIME as your output mode - */ - public static native void FSOUND_Update(); - - // ------------------------------------------------------------- - - // Global runtime informaton functions - // ============================================================= - /** - * Returns in percent of cpu time the amount of cpu usage that FSOUND/FMUSIC mixing is taking - *

- * Remarks - * This value represents the cpu usage used by streams, the software mixer, and subsequent calls to dsound waveout etc. - * MIDI playback is not counted as it is performed by directx. - *

- * - * @return percent of cpu time the amount of cpu usage that FSOUND/FMUSIC mixing is taking - */ - public static native float FSOUND_GetCPUUsage(); - - /** - * Returns the number of active channels in FSOUND, or ones that are playing - * @return number of active channels in FSOUND, or ones that are playing - */ - public static native int FSOUND_GetChannelsPlaying(); - - /** - * Returns the currently selected driver number. Drivers are enumerated when selecting a driver - * with FSOUND_SetDriver or other driver related functions such as FSOUND_GetNumDrivers or - * FSOUND_GetDriverName - * @return currently selected driver number. - */ - public static native int FSOUND_GetDriver(); - - /** - * Returns information on capabilities of the current output mode - * - * @param driverid Enumerated driver ID. This must be in a valid range delimited by FSOUND_GetNumDrivers - * @param caps IntBuffer to have the caps bits stored - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_GetDriverCaps(int driverid, IntBuffer caps) { - return nFSOUND_GetDriverCaps(driverid, caps, caps.position()); - } - private static native boolean nFSOUND_GetDriverCaps(int driverid, IntBuffer caps, int offset); - - /** - * Returns the name of the selected driver. Drivers are enumerated when selecting a driver with - * FSOUND_SetDriver or other driver related functions such as FSOUND_GetNumDrivers or - * FSOUND_GetDriver - *

- * Remarks - * If no driver is selected, the default driver is used. - *

- * - * @param driverid Enumerated driver ID. This must be in a valid range delimited by FSOUND_GetNumDrivers - * @return On success, a String containing the name of the specified device is returned. - * The number of drivers enumerated can be found with FSOUND_GetNumDrivers. On failure, NULL is returned. - */ - public static native String FSOUND_GetDriverName(int driverid); - - /** - * Returns an error code set by FMOD - * - * @return error code, see FMOD_ERRORS - */ - public static native int FSOUND_GetError(); - - /** - * Returns the current maximum index for a sample. This figure grows as you allocate more - * samples (in blocks) - * @return Maximum sample index - */ - public static native int FSOUND_GetMaxSamples(); - - /** - * Returns the total number of channels allocated - * @return Number of channels allocated - */ - public static native int FSOUND_GetMaxChannels(); - - /** - * Returns information on the memory usage of fmod. This is useful for determining a fixed memory size to - * make FMOD work within for fixed memory machines such as pocketpc and consoles - *

- * Remarks - * Note that if using FSOUND_SetMemorySystem, the memory usage will be slightly higher than without it, as fmod has to have a small amount of memory overhead to manage the available memory. - *

- * @param currentallocated_maxallocated IntBuffer to store Currently allocated memory at time of call and - * Maximum allocated memory since FSOUND_Init or FSOUND_SetMemorySystem - */ - public static void FSOUND_GetMemoryStats(IntBuffer currentallocated_maxallocated) { - nFSOUND_GetMemoryStats(currentallocated_maxallocated, currentallocated_maxallocated.position()); - } - private static native void nFSOUND_GetMemoryStats(IntBuffer currentallocated_maxallocated, int offset); - - /** - * Returns the number of sound cards or devices enumerated for the current output type. (Direct - * Sound, WaveOut etc - * @return Total number of enumerated sound devices - */ - public static native int FSOUND_GetNumDrivers(); - - /** - * Returns the number of available hardware mixed 2d and 3d channels - * @param twoD_threeD_channels_total IntBuffer to store number of available hardware mixed 2d channels, - * number of available hardware mixed 3d channels and the total (Usually num2d + num3d, but on some - * platforms like PS2 and GameCube, this will be the same as num2d and num3d (and not the sum) because 2d and 3d voices share the same pool) - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_GetNumHWChannels(IntBuffer twoD_threeD_channels_total) { - return nFSOUND_GetNumHWChannels(twoD_threeD_channels_total, twoD_threeD_channels_total.position()); - } - private static native boolean nFSOUND_GetNumHWChannels(IntBuffer twoD_threeD_channels_total, int offset); - - /** - * Returns the current id to the output type. - * See FSOUND_OUTPUTTYPES for valid parameters and descriptions - * @return id to output type - */ - public static native int FSOUND_GetOutput(); - - //public static native int FSOUND_GetOutPutHandle(); - - /** - * Returns the current mixing rate - * @return Currently set output rate in Hz - */ - public static native int FSOUND_GetOutputRate(); - - /** - * Returns the master volume for any sound effects played. - * It specifically has SFX in the function name, as it does not affect music or CD volume. - * This must also be altered with FMUSIC_SetMasterVolume - * @return On success, the SFX master volume is returned. Valid ranges are from 0 (silent) to 255 (full volume) - */ - public static native int FSOUND_GetSFXMasterVolume(); - - /** - * Returns the FMOD version number - *

- * Remarks - * Use this to compare the header you are using against the compiled DLL version to make sure your - * DLL is up to date. - *

- * @return FMOD version number - */ - public static native float FSOUND_GetVersion(); - - // ---------------------------------------------------------- - - // Sample functions - // ========================================================== - /** - * Allocates a new empty sample. Used if you want to create a sample from scratch and fill the databuffer with your own data (using FSOUND_Sample_Lock or FSOUND_Sample_Upload), instead of just loading a file with FSOUND_Sample_Load. - *

- * Remarks - * FMOD has a sample management system that holds onto any samples loaded or allocated, and - * frees them all when you call FSOUND_Close. It takes the hassle out of having to keep hold - * of a lot of sample handles and remember to free them all at the end of your application. - * It is basically an expandle array of handles that holds each sample until FMOD closes down where it does - * a cleanup. FSOUND_UNMANAGED can be used NOT to use the sample management system. - * ------------ - * FSOUND_Sample_Alloc is only nescessary for lower level operations with sample data. Usually - * FSOUND_Load does the work for you. lower level operations mean such things as uploading data from memory or - * your own compressed data for example. - * You can create a new sample from scratch by doing the following operations - * 1. Allocate a new sample with FSOUND_Sample_Alloc - * 2. Write data to the sample buffer with FSOUND_Sample_Lock and FSOUND_Sample_Unlock, or - * FSOUND_Sample_Upload. - * Note FSOUND_Sample_Lock only returns a pointer to the sample data, whereas - * FSOUND_Sample_Upload does a copy from data you give it, with format conversion to the - * correct format. - * - * @param index Sample pool index. See remarks for more on the sample pool. - * 0 or above - The absolute index into fsounds sample pool. The pool will grow as - * the index gets larger. If a slot is already used it will be replaced. - * FSOUND_FREE - Let FSOUND select an arbitrary sample slot. - * FSOUND_UNMANAGED - Dont have fsound free this sample upon FSOUND_Close - * @param length The length in of the sample buffer in SAMPLES - * @param mode Bitfield describing various characteristics of the sample. Valid parameters are - * described in FSOUND_MODES - * @param deffreq Default frequency for this sample - * @param defvol Default volume for this sample - * @param defpan Default pan for this sample - * @param defpri Default priority for this sample - * @return On success, a reference to an allocated sample is returned. On failure, NULL is returned - */ - public static FSoundSample FSOUND_Sample_Alloc(int index, int length, int mode, int deffreq, int defvol, int defpan, int defpri) { - long result = nFSOUND_Sample_Alloc(index, length, mode, deffreq, defvol, defpan, defpri); - return (result != 0) ? new FSoundSample(result, null) : null; - } - private static native long nFSOUND_Sample_Alloc(int index, int length, int mode, int deffreq, int defvol, int defpan, int defpri); - - /** - * Removes a sample from memory and makes its slot available again - * @param sample sample definition to be freed - */ - public static void FSOUND_Sample_Free(FSoundSample sample) { - sample.release(); - nFSOUND_Sample_Free(sample.sampleHandle); - } - private static native void nFSOUND_Sample_Free(long sample); - - /** - * Returns a reference to a managed sample based on the index passed - *

- * Remarks - * Samples that are not created with FSOUND_UNMANAGED are stored in a table inside FMOD. - * This way when FMOD can free all samples when FSOUND_Close is called and the user doesnt have to worry about cleaning up memory. - * - * @param sampno index in the sample management pool of the requested sample - * @return Reference to a sample - */ - public static FSoundSample FSOUND_Sample_Get(int sampno) { - long result = nFSOUND_Sample_Get(sampno); - return (result != 0) ? new FSoundSample(result, null) : null; - } - - private static native long nFSOUND_Sample_Get(int sampno); - - /** - * Returns the default volume, frequency, pan and priority values for the specified sample - *

- * Remarks - * Passing NULL in any of these parameters will result in the value being ignored - *

- * - * @param sample sample to get the default information from - * @param deffreq IntBuffer to be filled with the sample default frequency. Can be NULL - * @param defvol IntBuffer to be filled with the sample default volume. Can be NULL - * @param defpan IntBuffer to be filled with the sample default pan. Can be NULL - * @param defpri IntBuffer to be filled with the sample default priority. Can be NULL - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Sample_GetDefaults(FSoundSample sample, IntBuffer deffreq, IntBuffer defvol, - IntBuffer defpan, IntBuffer defpri) { - return nFSOUND_Sample_GetDefaults(sample.sampleHandle, deffreq, (deffreq == null) ? 0 : deffreq.position(), defvol, - (defvol == null) ? 0 : defvol.position(), defpan, (defpan == null) ? 0 : defpan.position(), defpri, - (defpri == null) ? 0 : defpri.position()); - } - - private static native boolean nFSOUND_Sample_GetDefaults(long sample, IntBuffer deffreq, int deffreqOffset, - IntBuffer defvol, int defvolOffset, IntBuffer defpan, int defpanOffset, IntBuffer defpri, int defpriOffset); - - /** - * Returns the default volume, frequency, pan, priority and random playback variations for the specified sample - *

- * Remarks - * Passing NULL in any of these parameters will result in the value being ignored - *

- * - * @param sample sample to get the default information from - * @param deffreq IntBuffer to be filled with the sample default frequency. Can be NULL - * @param defvol IntBuffer to be filled with the sample default volume. Can be NULL - * @param defpan IntBuffer to be filled with the sample default pan. Can be NULL - * @param defpri IntBuffer to be filled with the sample default priority. Can be NULL - * @param varfreq IntBuffer to be filled with the sample random frequency variance. Can be NULL - * @param varvol IntBuffer to be filled with the sample random volume variance. Can be NULL - * @param varpan IntBuffer to be filled with the sample random pan variance. Can be NULL. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Sample_GetDefaultsEx(FSoundSample sample, IntBuffer deffreq, IntBuffer defvol, - IntBuffer defpan, IntBuffer defpri, IntBuffer varfreq, IntBuffer varvol, IntBuffer varpan) { - return nFSOUND_Sample_GetDefaultsEx(sample.sampleHandle, deffreq, (deffreq == null) ? 0 : deffreq.position(), - defvol, (defvol == null) ? 0 : defvol.position(), defpan, (defpan == null) ? 0 : defpan.position(), defpri, - (defpri == null) ? 0 : defpri.position(), varfreq, (varfreq == null) ? 0 : varfreq.position(), varvol, - (varvol == null) ? 0 : varvol.position(), varpan, (varpan == null) ? 0 : varpan.position()); - } - private static native boolean nFSOUND_Sample_GetDefaultsEx(long sample, IntBuffer deffreq, int deffreqOffset, - IntBuffer defvol, int defvolOffset, IntBuffer defpan, int defpanOffset, IntBuffer defpri, int defpriOffset, - IntBuffer varfreq, int varfreqOffset, IntBuffer varvol, int varvolOffset, IntBuffer varpan, int varpanOffset); - - /** - * Returns the length of the sample in SAMPLES - * @param sample sample to get the length from - * @return On success, the length of sample in SAMPLES is returned. On failure, 0 is returned - */ - public static int FSOUND_Sample_GetLength(FSoundSample sample) { - return nFSOUND_Sample_GetLength(sample.sampleHandle); - } - private static native int nFSOUND_Sample_GetLength(long sample); - - /** - * Returns the start and end positions of the specified sample loop - * in SAMPLES (not bytes) - *

- * Remarks - * Passing NULL in any of these parameters will result in the value being ignored. - * @param sample sample to get the loop point information from - * @param loopstart IntBuffer to be filled with the sample loop start point. Can be NULL - * @param loopend IntBuffer to be filled with the sample loop end point. Can be NULL - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static int FSOUND_Sample_GetLoopPoints(FSoundSample sample, IntBuffer loopstart, IntBuffer loopend) { - return nFSOUND_Sample_GetLoopPoints(sample.sampleHandle, loopstart, (loopstart == null) ? 0 : loopstart.position(), loopend, (loopend == null) ? 0 : loopend.position()); - } - private static native int nFSOUND_Sample_GetLoopPoints(long sample, IntBuffer loopstart, int loopstartOffset, IntBuffer loopend, int loopendOffset); - - /** - * Get the minimum and maximum audible distance for a sample - *

- * Remarks - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - * The default units for minimum and maximum distances are 1.0 and 1000000000.0f. - * Volume drops off at mindistance / distance. - * - * @param sample sample to get the distance information from - * @param min FloatBuffer to be filled with the sample loop start point. Can be NULL - * @param max FloatBuffer to be filled with the sample loop end point. Can be NULL - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static int FSOUND_Sample_GetMinMaxDistance(FSoundSample sample, FloatBuffer min, FloatBuffer max) { - return nFSOUND_Sample_GetMinMaxDistance(sample.sampleHandle, min, (min == null) ? 0 : min.position(), max, (max == null) ? 0 : max.position()); - } - private static native int nFSOUND_Sample_GetMinMaxDistance(long sample, FloatBuffer min, int minOffset, FloatBuffer max, int maxOffset); - - /** - * Returns a bitfield containing information about the specified sample. - * The values can be bitwise AND'ed with the values contained in FSOUND_MODES to see if certain criteria are true or not. - * Information that can be retrieved from the same in this field are loop type, bitdepth and stereo/mono. - * - * @param sample sample to get the mode information from - * @return On success, the sample mode is returned. On failure, 0 is returned. - */ - public static int FSOUND_Sample_GetMode(FSoundSample sample) { - return nFSOUND_Sample_GetMode(sample.sampleHandle); - } - private static native int nFSOUND_Sample_GetMode(long sample); - - /** - * Returns a string containing the sample's name - * - * @param sample sample to get the loop point information from - * @return On success, the name of the sample is returned. On failure, NULL is returned. - */ - public static String FSOUND_Sample_GetName(FSoundSample sample) { - return nFSOUND_Sample_GetName(sample.sampleHandle); - } - private static native String nFSOUND_Sample_GetName(long sample); - - /** - * Loads and decodes a static soundfile into memory. - * This includes such files as .WAV, .MP2, .MP3, .OGG, .RAW and others. - *

- * Remarks - * FMOD has a sample management system that holds onto any samples loaded or allocated, and frees them all when you call FSOUND_Close. - * It takes the hassle out of having to keep hold of a lot of sample handles and remember to free them all at the end of your application. - * It is basically an expandle array of handles that holds each sample until FMOD closes down where it does a cleanup. - * FSOUND_UNMANAGED can be used so FMOD does NOT use the sample management system. You have to make sure they are freed yourself. - * -------- - * Specify FSOUND_LOADMEMORY to load a file from a memory image. - * The pointer you pass to name must be the actual image of the data you want to load. - * The length parameter is to be filled out if FSOUND_LOADMEMORY is specified, otherwise if you do not specify memory loading, can be safely ignored and should be set to 0. - * -------- - * Compressed formats are expanded into memory. If the file is quite large, it could take a while to load. - * -------- - * If FSOUND_8BITS is specified and the file decodes to 16bit normally, FMOD will downgrade the sample to 8bit. - * -------- - * On PlayStation 2, the name_or_data pointer and length variables must be 16 byte aligned, for DMA reasons. - * -------- - * Note that FSOUND_NONBLOCKING is NOT supported with this function. - *

- * @param index Sample pool index. See remarks for more on the sample pool. - * 0 or above - The absolute index into the sample pool. The pool will grow as the index gets larger. If a slot is already used it will be replaced. - * FSOUND_FREE - Let FSOUND select an arbitrary sample slot. - * FSOUND_UNMANAGED - Dont have this sample managed within fsounds sample management system - * @param data ByteBuffer of memory image to load. - * @param inputmode Description of the data format, OR in the bits defined in FSOUND_MODES to describe the data being loaded. - * @return On success, a sample is returned. On failure, NULL is returned. - */ - public static FSoundSample FSOUND_Sample_Load(int index, ByteBuffer data, int inputmode) { - long result = nFSOUND_Sample_Load(index, data, inputmode, data.position(), data.remaining()); - if(result != 0) { - return new FSoundSample(result, data); - } - return null; - } - - /** - * @see #FSOUND_Sample_Load(int, ByteBuffer, int, int, int) - * @param index Sample pool index. See remarks for more on the sample pool. - * 0 or above - The absolute index into the sample pool. The pool will grow as the index gets larger. If a slot is already used it will be replaced. - * FSOUND_FREE - Let FSOUND select an arbitrary sample slot. - * FSOUND_UNMANAGED - Dont have this sample managed within fsounds sample management system - * @param name Name of sound file. - * @param inputmode Description of the data format, OR in the bits defined in FSOUND_MODES to describe the data being loaded. - * @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. length must also be specified if this value is used. - * @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. - * @return On success, a sample is returned. On failure, NULL is returned. - */ - public static FSoundSample FSOUND_Sample_Load(int index, String name, int inputmode, int offset, int length) { - long result = nFSOUND_Sample_Load(index, name, inputmode, offset, length); - if(result != 0) { - return new FSoundSample(result, null); - } - return null; - } - private static native long nFSOUND_Sample_Load(int index, ByteBuffer data, int inputmode, int offset, int length); - private static native long nFSOUND_Sample_Load(int index, String name, int inputmode, int offset, int length); - - /** - * Returns a reference to the beginning of the sample data for a sample. - * Data written must be signed. - * NOTE: This method creates 2 direct buffers on the native side, that maps to - * the sample data. Calling this method excessively might hurt performance. - *

- * Remarks - * You must always unlock the data again after you have finished with it, using FSOUND_Sample_Unlock. - * For PCM based samples, data must be signed 8 or 16bit. For compressed samples such as those created with FSOUND_IMAADPCM, FSOUND_VAG, FSOUND_GCADPCM, the data must be in its original compressed format. - * On PlayStation 2, with FSOUND_HW2D or FSOUND_HW3D based samples, this function does not return a readable or writable buffer, it returns the SPU2 address of the sample. To send data to it you must call FSOUND_SendData. - * On GameCube, with FSOUND_HW2D or FSOUND_HW3D based samples, this function will not return the data contained within the sample. It is for upload purposes only. - *

- * - * @param sample sample definition - * @param offset Offset in BYTES to the position you want to lock in the sample buffer. - * @param length Number of BYTES you want to lock in the sample buffer. - * @param lock lock object to contain lock info - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_Lock(FSoundSample sample, int offset, int length, FSoundSampleLock lock) { - // reset before entering lock - lock.set(null, null, 0, 0); - - return nFSOUND_Sample_Lock(sample.sampleHandle, offset, length, lock); - } - private static native boolean nFSOUND_Sample_Lock(long sample, int offset, int length, FSoundSampleLock lock); - - /** - * Sets a sample's default attributes, so when it is played it uses these values without having to specify them later. - * - * @param sample sample to have its attributes set - * @param deffreq Default sample frequency. The value here is specified in hz. -1 to ignore. - * @param defvol Default sample volume. This is a value from 0 to 255. -1 to ignore. - * @param defpan Default sample pan position. This is a value from 0 to 255 or FSOUND_STEREOPAN. - * @param defpri Default sample priority. This is a value from 0 to 255. -1 to ignore. - * - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_SetDefaults(FSoundSample sample, int deffreq, int defvol, int defpan, int defpri) { - return nFSOUND_Sample_SetDefaults(sample.sampleHandle, deffreq, defvol, defpan, defpri); - } - private static native boolean nFSOUND_Sample_SetDefaults(long sample, int deffreq, int defvol, int defpan, int defpri); - - /** - * Sets a sample's default attributes, so when it is played it uses these values without having to specify them later. - *

- * Remarks - * Frequency, volume and pan variation values specify a +/- variation to the - * specified default frequency, volume and pan values i.e. with deffreq=44100, - * varfreq=2000 the actual frequency value used will be in the range 42100 -> 46100. - *

- * - * @param sample sample to have its attributes set - * @param deffreq Default sample frequency. The value here is specified in hz. -1 to ignore. - * @param defvol Default sample volume. This is a value from 0 to 255. -1 to ignore. - * @param defpan Default sample pan position. This is a value from 0 to 255 or FSOUND_STEREOPAN. - * @param defpri Default sample priority. This is a value from 0 to 255. -1 to ignore. - * @param varfreq Frequency variation in hz to apply to deffreq each time this sample is played. -1 to ignore. - * @param varvol Volume variation to apply to defvol each time this sample is played. -1 to ignore. - * @param varpan Pan variation to apply to defpan each time this sample is played. -1 to ignore. - * - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_SetDefaultsEx(FSoundSample sample, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan) { - return nFSOUND_Sample_SetDefaultsEx(sample.sampleHandle, deffreq, defvol, defpan, defpri, varfreq, varvol, varpan); - } - private static native boolean nFSOUND_Sample_SetDefaultsEx(long sample, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); - - /** - * Sets the maximum number of times a sample can play back at once - * - * @param sample sample to have its playback behaviour changed - * @param max maximum number of times a sample can play back at once - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_SetMaxPlaybacks(FSoundSample sample, int max) { - return nFSOUND_Sample_SetMaxPlaybacks(sample.sampleHandle, max); - } - private static native boolean nFSOUND_Sample_SetMaxPlaybacks(long sample, int max); - - /** - * Sets the minimum and maximum audible distance for a sample. - * MinDistance is the minimum distance that the sound emitter will cease to continue growing - * louder at (as it approaches the listener). Within the mindistance it stays at the constant loudest volume possible. Outside of this mindistance it begins to attenuate. - * MaxDistance is the distance a sound stops attenuating at. Beyond this point it will stay at the volume it would be at maxdistance units from the listener and will not attenuate any more. - * MinDistance is useful to give the impression that the sound is loud or soft in 3d space. An example of this is a small quiet object, such as a bumblebee, which you could set a mindistance of to 0.1 for example, which would cause it to attenuate quickly and dissapear when only a few meters away from the listener. - * Another example is a jumbo jet, which you could set to a mindistance of 100.0, which would keep the sound volume at max until the listener was 100 meters away, then it would be hundreds of meters more before it would fade out. - * ------- - * In summary, increase the mindistance of a sound to make it 'louder' in a 3d world, and - * decrease it to make it 'quieter' in a 3d world. - * maxdistance is effectively obsolete unless you need the sound to stop fading out at a certain point. Do not adjust this from the default if you dont need to. - * Some people have the confusion that maxdistance is the point the sound will fade out to, this is not the case - *

- * Remarks - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - * The default units for minimum and maximum distances are 1.0 and 1000000000.0f. - * Volume drops off at mindistance / distance. - *

- * - * @param sample sample to have its minimum and maximum distance set - * @param min The samples minimum volume distance in "units". See remarks for more on units. - * @param max The samples maximum volume distance in "units". See remarks for more on units. - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_SetMinMaxDistance(FSoundSample sample, float min, float max) { - return nFSOUND_Sample_SetMinMaxDistance(sample.sampleHandle, min, max); - } - private static native boolean nFSOUND_Sample_SetMinMaxDistance(long sample, float min, float max); - - /** - * Sets a sample's mode. This can only be FSOUND_LOOP_OFF,FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI or FSOUND_2D. - * You cannot change the description of the contents of a sample or its location. FSOUND_2D will be ignored on the Win32 platform if FSOUND_HW3D was used to create the sample. - * - *

- * Remarks - * Only the following modes are accepted, others will be filtered out. - * FSOUND_LOOP_BIDI, FSOUND_LOOP_NORMAL, FSOUND_LOOP_OFF, FSOUND_2D. - * Normally FSOUND_2D is accepted only if the sound is software mixed. If this is not set, the mode is set for the sample to be 3D processed. - * ------------------- - * On Playstation 2, XBox and GameCube, FSOUND_HW2D and FSOUND_HW3D are supported, so you can change between the 2 at runtime. - * ------------------- - * On Windows, samples created with FSOUND_HW3D or FSOUND_HW2D do not support FSOUND_LOOP_BIDI. This is a limitation of Direct X. *

- * - * @param sample sample to have the mode set - * @param mode mode bits to set from FSOUND_MODES - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_SetMode(FSoundSample sample, int mode) { - return nFSOUND_Sample_SetMode(sample.sampleHandle, mode); - } - private static native boolean nFSOUND_Sample_SetMode(long sample, int mode); - - /** - * Sets a sample's loop points, specified in SAMPLES, not bytes - *

- * Remarks - * Samples created with FSOUND_HW3D and FSOUND_HW2D under the FSOUND_OUTPUT_DSOUND output mode do not support this function. - * Loop points set on such a sample with be ignored, and the sample will loop in its entirety. This is a limitation of DirectSound. - * On XBOX, GameCube and Playstation 2 hardware voices using compressed data (ie XADPCM, VAG or GCADPCM), these values will not be sample accurate, but will be rounded to the nearest compression block size. - * On PlayStation 2, the loopend is ignored. The hardware cannot change the end address, so the loopend is always equivalent to length - 1 no matter what you set. * - * @param sample sample to have its loop points set - * @param loopstart The starting position of the sample loop - * @param loopend The end position of the sample loop - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean nFSOUND_Sample_SetLoopPoints(FSoundSample sample, int loopstart, int loopend) { - return nFSOUND_Sample_SetLoopPoints(sample.sampleHandle, loopstart, loopend); - } - private static native boolean nFSOUND_Sample_SetLoopPoints(long sample, int loopstart, int loopend); - - /** - * Releases previous sample data lock from FSOUND_Sample_Lock - * - * @param sample sample definition - * @param lock lock object that contains lock info - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_Unlock(FSoundSample sample, FSoundSampleLock lock) { - return nFSOUND_Sample_Unlock(sample.sampleHandle, lock.getPtr1(), lock.getPtr2(), lock.getLen1(), lock.getLen2()); - } - private static native boolean nFSOUND_Sample_Unlock(long sample, ByteBuffer ptr1, ByteBuffer ptr2, int len1, int len2); - - - /** - * This function uploads new sound data from memory to a preallocated/existing sample and does conversion based on the specified source mode. - * If sample data already exists at this handle then it is replaced with the new data being uploaded - *

- * Remarks - * Note that on PlayStation 2 the source data address is an IOP address not an EE address. - * To get data from EE RAM to the sample you must allocate some IOP memory, dma it to IOP memory then call upload. There are helper functions in fmodps2.h to achieve this. - *

- * - * @param sample the destination sample - * @param srcdata ByteBuffer to the source data to be uploaded. On PlayStation 2 this is an IOP address not an EE address. - * @param mode Description of the source data format. Bitwise OR in these bits to describe the data being passed in. - * See FSOUND_MODES for valid parameters and descriptions. - * FSOUND_HW3D, FSOUND_HW2D and FSOUND_LOOP modes are ignored, the mode describes the source format, not the destination format. - * - * @return On success, true is is returned. On failure, false is returned. - */ - public static boolean FSOUND_Sample_Upload(FSoundSample sample, ByteBuffer srcdata, int mode) { - return nFSOUND_Sample_Upload(sample.sampleHandle, srcdata, srcdata.position(), mode); - } - private static native boolean nFSOUND_Sample_Upload(long sample, ByteBuffer srcdata, int srcdataOffset, int mode); - // ---------------------------------------------------------- - - // Channel functions - // ========================================================== - /** - * Plays a sample in a specified channel, using the sample's default frequency, volume - * and pan settings. - *

- * Remarks - * If you play a FSOUND_HW3D declared sample with this function, then the position and velocity - * are set to those of the listener. Other attributes such as volume, frequency and pan are taken - * from the sample's default volume, frequency, pan etc. - * ---------- - * The channel handle : - * The return value is reference counted. This stops the user from updating a stolen channel. - * Basically it means the only sound you can change the attributes (ie volume/pan/frequency/3d position) for are the one you specifically called playsound for. If another sound steals that channel, and you keep trying to change its attributes (ie volume/pan/frequency/3d position), it will do nothing. - * This is great if you have sounds being updated from tasks and you just forget about it. - * You can keep updating the sound attributes and if another task steals that channel, your original task wont change the attributes of the new sound!!! - * The lower 12 bits contain the channel number. (yes this means a 4096 channel limit for FMOD :) - * The upper 19 bits contain the reference count. - * The top 1 bit is the sign bit. - * ie - * S RRRRRRRRRRRRRRRRRRR CCCCCCCCCCCC - * ---------- - * Remember if not using FSOUND_FREE, then the channel pool is split up into software and hardware channels. - * Software channels occupy the first n indicies specified by the value passed into FSOUND_Init. - * Hardware channels occupy the next n indicies after this, and can be a variable amount, depending on the hardware. - * Use FSOUND_GetNumHardwareChannels to query how many channels are available in hardware. - *

- * - * @param channel 0+ - * The absolute channel number in the channel pool. - * Remember software channels come first, followed by hardware channels. - * You cannot play a software sample on a hardware channel and vice versa. - * FSOUND_FREE - * Chooses a free channel to play in. If all channels are used then it - * selects a channel with a sample playing that has an EQUAL or LOWER priority - * than the sample to be played. - * FSOUND_ALL - * Passing this will cause ALL channels to play. (note this will make things - * VERY noisy!) - * If FSOUND_ALL is used the last channel success flag will be returned. - * @param sample to be played - * - * @return On success, the channel handle that was selected is returned. On failure, -1 is returned. - */ - public static int FSOUND_PlaySound(int channel, FSoundSample sample) { - return nFSOUND_PlaySound(channel, sample.sampleHandle); - } - private static native int nFSOUND_PlaySound(int channel, long sample); - - /** - * Extended featured version of FSOUND_PlaySound. - * New functionality includes the ability to start the sound paused. - * This allows attributes of a channel to be set freely before the sound actually starts playing, until FSOUND_SetPaused(FALSE) is used. - * Also added is the ability to associate the channel to a specified DSP unit. This allows the user to 'group' channels into seperate DSP units, which allows effects to be inserted between these 'groups', and allow various things like having one group affected by reverb (wet mix) and another group of channels unaffected (dry). - * This is useful to seperate things like music from being affected by DSP effects, while other sound effects are. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will cause ALL channels to play. (note this could make things VERY noisy!) - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - * ---------- - * The channel handle : - * The return value is reference counted. This stops the user from updating a stolen channel. - * This means the only sound you can change the attributes (ie volume/pan/frequency/3d position) for are the - * one you specifically called playsound for. If another sound steals that channel, and you keep trying to - * change its attributes (ie volume/pan/frequency/3d position), it will do nothing. - * This is great if you have sounds being updated from tasks and you just forget about it. - * You can keep updating the sound attributes and if another task steals that channel, your original task - * wont change the attributes of the new sound!!! - * The lower 12 bits contain the channel number. (yes this means a 4096 channel limit for FMOD :) - * The upper 19 bits contain the reference count. - * The top 1 bit is the sign bit. - * ie - * S RRRRRRRRRRRRRRRRRRR CCCCCCCCCCCC - * ---------- - * Remember if not using FSOUND_FREE, then the channel pool is split up into software and hardware channels. - * Software channels occupy the first n indicies specified by the value passed into FSOUND_Init. - * Hardware channels occupy the next n indicies after this, and can be a variable amount, depending on the hardware. - * Use FSOUND_GetNumHardwareChannels to query how many channels are available in hardware. - * ---------- - * If you attach a sound to a DSP unit (for grouping purposes), the callback for the DSP unit will be overwritten with fmod's internal mixer callback, so the callback the user supplied is rendered obsolete and is not called. - * Also, do not attach sounds to system DSP units, the assignment will be ignored if you do. - *

- * - * @param channel 0+ - * The absolute channel number in the channel pool. - * Remember software channels come first, followed by hardware channels. - * You cannot play a software sample on a hardware channel and vice versa. - * FSOUND_FREE - * Chooses a free channel to play in. If all channels are used then it - * selects a channel with a sample playing that has an EQUAL or LOWER priority - * than the sample to be played. - * FSOUND_ALL - * Passing this will cause ALL channels to play. (note this will make things - * VERY noisy!) - * If FSOUND_ALL is used the last channel success flag will be returned. - * @param sample to be played - * @param dspunit Optional. NULL by default. Pointer to a dsp unit to attach the channel to for channel grouping. Only attach a sound to a user created DSP unit, and not a system DSP unit. - * @param startpaused Start the sound paused or not. Pausing the sound allows attributes to be set before the sound starts - * @return On success, the channel handle that was selected is returned. On failure, -1 is returned. - */ - public static int nFSOUND_PlaySoundEx(int channel, FSoundSample sample, FSoundDSPUnit dspunit, boolean startpaused) { - return nFSOUND_PlaySoundEx(channel, sample.sampleHandle, dspunit.dspHandle, startpaused); - } - private static native int nFSOUND_PlaySoundEx(int channel, long sample, ByteBuffer dspunit, boolean startpaused); - - /** - * Stops a specified sound channel from playing, and frees it up for re-use - *

- * Remarks - * FSOUND_ALL is supported. Passing this will cause ALL channels to stop. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - *

- * - * @param channel The channel number/handle to stop. FSOUND_ALL can also be used (see remarks) - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_StopSound(int channel); - - /** - * Sets a channels frequency or playback rate, in Hz. - *

- * Remarks - * FSOUND_ALL is supported here. Passing this will set ALL channels to specified frequency. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - * Negative frequencies make the sound play backwards, so FSOUND_SetCurrentPosition would be needed to set the sound to the right position. - *

- * - * @param channel The channel number/handle to stop. FSOUND_ALL can also be used (see remarks) - * @param freq The frequency to set. Valid ranges are from 100 to 705600, and -100 to -705600 - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetFrequency(int channel, int freq); - - /** - * XBox Only - For surround sound systems, this function allows each surround speaker level to be set individually for this channel - *

- * Remarks - * FSOUND_ALL is supported. Passing this will set the pan of ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - * ---------- - * FSOUND_SYSTEMCHANNEL is supported. You can set the mix levels for the FMOD software engine, and ALL software mixed sounds will be affected. *

- * - * @param channel The channel number/handle to change the output levels for. FSOUND_ALL and FSOUND_SYSTEMCHANNEL can also be used (see remarks) - * @param frontleft Value from 0 to 255 inclusive, specifying a linear level for the front left speaker. - * @param center Value from 0 to 255 inclusive, specifying a linear level for the center. - * @param frontright Value from 0 to 255 inclusive, specifying a linear level for the front right speaker. - * @param backleft Value from 0 to 255 inclusive, specifying a linear level for the back left speaker. - * @param backright Value from 0 to 255 inclusive, specifying a linear level for the back right speaker. - * @param lfe Value from 0 to 255 inclusive, specifying a linear level for the subwoofer speaker. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetLevels( - int channel, int frontleft, int center, int frontright, int backleft, int backright, int lfe); - - /** - * Sets the loop mode for a particular CHANNEL, not sample - *

- * Remarks - * FSOUND_ALL is supported. Passing this will set loop modes for all channels available. - * Note, this does not work for hardware sounds played on hardware channels while they are playing. The function has to be called when the channel is paused. - * Software based sounds do not have this limitation, and can have their loop mode changed during playback, but for compatibility it is best to use the pause method, else you may get different behaviour if hardware voices do not exist. - *

- * @param channel The channel number/handle to change the output levels for. FSOUND_ALL and FSOUND_SYSTEMCHANNEL can also be used (see remarks) - * @param loopmode The loopmode to set. This can be FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI or FSOUND_LOOP_OFF. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetLoopMode(int channel, int loopmode); - - /** - * Mutes and un-mutes a channel - *

- * Remarks - * FSOUND_ALL is supported. Passing this will mute/unmute ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - *

- * @param channel The channel number/handle to change the output levels for. FSOUND_ALL and FSOUND_SYSTEMCHANNEL can also be used (see remarks) - * @param mute Toggle value - TRUE mutes out the channel, FALSE reenables it. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetMute(int channel, boolean mute); - - /** - * Sets a channels pan position linearly - *

- * Remarks - * FSOUND_ALL is supported. Passing this will set the pan of ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - * ---------- - * Important : If you are playing a STEREO sample, and using normal middle panning, it will only come out at half the volume - * they are supposed to. To avoid this use FSOUND_STEREO pan. - * Panning works in the following manner: - * full left : 100to left, 0to right - * full right : 0to left, 100to right - * middle : 71to left, 71to right - * FMOD Uses 'constant power' panning. The center position is 71 4738960n each channel as it keeps an even RMS output level when - * moving the sound from left to right. Placing 50 4738960n each channel for a middle position is incorrect. - * The pan graph for constant power panning resembles a curve instead of straight lines. *

- * @param channel The channel number/handle to change the output levels for. FSOUND_ALL and FSOUND_SYSTEMCHANNEL can also be used (see remarks) - * @param pan The panning position for this channel to set. - * parameters are: - * - from 0 (full left) to 255 (full right) - * - FSOUND_STEREOPAN. This is meant for stereo samples, but will work on mono - * samples as well. It makes both left and right FULL volume instead of 50/50 - * as middle panning does. See remarks section for more information on this - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetPan(int channel, int pan); - - /** - * Pauses or unpauses a sound channel - *

- * Remarks - * FSOUND_ALL is supported. Passing this will pause/unpause ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - *

- * @param channel The channel number/handle to change the output levels for. FSOUND_ALL and FSOUND_SYSTEMCHANNEL can also be used (see remarks) - * @param paused TRUE pauses this channel, FALSE unpauses it. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetPaused(int channel, boolean paused); - - /** - * Sets a channels priority. Higher priority means it is less likely to get discarded when - * FSOUND_FREE is used to select a channel, when all channels are being used, and one has to - * be rejected. If a channel has an equal priority then it will be replaced. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will pause/unpause ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - *

- * @param channel The channel number/handle to change the output levels for. FSOUND_ALL and FSOUND_SYSTEMCHANNEL can also be used (see remarks) - * @param priority The priority to set. Valid ranges are from 0 (lowest) to 255 (highest) - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetPriority(int channel, int priority); - - /** - * This sets the reserved status of a channel. Reserving a channel is related to setting its - * priority, but reserving a channel means it can NEVER be stolen by a channel request. It - * could be thought of as an extra high priority, but is different in that reserved channels do - * not steal from each other, whereas channels with equal priorities do (unless there are - * channels with lower priorities that it can steal from). If all channels were reserved and - * another request for came in for a channel, it would simply fail and the sound would not be - * played. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will pause/unpause ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - *

- * @param channel The channel number/handle to change the priority for. - * FSOUND_ALL can also be used (see remarks). - * FSOUND_FREE is NOT accepted. - * @param reserved Reserved flag. Values accepted are TRUE, to reserve a channel, and FALSE to - * un-reserve a channel. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetReserved(int channel, boolean reserved); - - /** - * Sets a channels surround sound status. This surround sound is a fake dolby trick that - * effectively pans the channel to the center, but inverts the waveform in one speaker to - * make it sound fuller or spacier, or like it is coming out of space between the 2 speakers. - * Panning is ignored while surround is in effect. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will pause/unpause ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - *

- * @param channel The channel number/handle to change the surround for. FSOUND_ALL can also be used (see remarks). - * @param surround Toggle value - TRUE enables surround sound on the channel, FALSE disables it. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetSurround(int channel, boolean surround); - - /** - * Sets a channels volume linearly. - * This function IS affected by FSOUND_SetSFXMasterVolume. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will pause/unpause ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - *

- * @param channel The channel number/handle to change the volume for. FSOUND_ALL can also be used (see remarks) - * @param vol The volume to set. Valid ranges are from 0 (silent) to 255 (full volume) - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetVolume(int channel, int vol); - - /** - * Sets a channels volume linearly. - * This function is NOT affected by master volume. - * This function is used when you want to quiet everything down using FSOUND_SetSFXMasterVolume, but make - * a channel prominent. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will set the absolute volume of ALL channels available. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value is not useful in most circumstances. - * ------------- - * A good example of this function being used for a game needing a voice over. - * If all the background sounds were too loud and drowned out the voice over, there is no way to - * feasibly go through all the sfx channels and lower the background noise volumes (some might be allocated by music). - * Simply lower the background noise with FSOUND_SetSFXMasterVolume, and use FSOUND_SetVolumeAbsolute to bring - * up the volume of the voice over to full, and you will get one channel standing out amongst the rest. *

- * @param channel The channel number/handle to change the volume for. FSOUND_ALL can also be used (see remarks) - * @param vol The volume to set. Valid ranges are from 0 (silent) to 255 (full volume) - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_SetVolumeAbsolute(int channel, int vol); - - /** - * Returns the linear volume of the specified channel between 0 and 255 - * @param channel Channel to get volume from - * @return On success, the following values are returned : 0 = silent to 255 = full volume. - * On failure, 0 is returned. To quailfy if this is a real error, call FSOUND_GetError. - */ - public static native int FSOUND_GetVolume(int channel); - - /** - * Returns the volume of the channel based on all combinations of set volume, mastervolume and 3d position. - * Works on software and hardware voices. - *

- * Remarks - * This is not the same as FSOUND_GetCurrentLevels, as that function takes the actual waveform data into account. - * This function simply gives a final volume based on 3d position and volume settings. - *

- * @param channel Channel to get amplitude from - * @return On success, the following values are returned : 0 = silent to 255 = full volume. - * On failure, 0 is returned. To quailfy if this is a real error, call FSOUND_GetError. - */ - public static native int FSOUND_GetAmplitude(int channel); - - /** - * This updates the position and velocity of a 3d sound playing on a channel - *

- * Remarks - * FSOUND treats +X as right, +Y as up, and +Z as forwards. - * --------- - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - * --------- - * FSOUND vectors expect 3 floats representing x y and z in that order. I.e. a typical definition - *

- * @param channel Channel you want to apply 3d positioning to. - * @param pos Pointer to a position vector (xyz float triplet) of the emitter in world space, measured in distance units. - * This can be NULL to ignore it. - * @param vel Pointer to a velocity vector (xyz float triplet), of the emitter measured in distance units PER SECOND. - * This can be NULL to ignore it. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_3D_SetAttributes(int channel, FloatBuffer pos, FloatBuffer vel) { - return nFSOUND_3D_SetAttributes(channel, pos, (pos != null) ? pos.position() : 0, vel, (vel != null) ? vel.position() : 0); - } - private static native boolean nFSOUND_3D_SetAttributes(int channel, FloatBuffer pos, int posOffset, FloatBuffer vel, int velOffset); - - /** - * Sets the minimum and maximum audible distance for a channel. - * MinDistance is the minimum distance that the sound emitter will cease to continue growing - * louder at (as it approaches the listener). Within the mindistance it stays at the constant loudest volume possible. Outside of this mindistance it begins to attenuate. - * MaxDistance is the distance a sound stops attenuating at. Beyond this point it will stay at the volume it would be at maxdistance units from the listener and will not attenuate any more. - * MinDistance is useful to give the impression that the sound is loud or soft in 3d space. An example of this is a small quiet object, such as a bumblebee, which you could set a mindistance of to 0.1 for example, which would cause it to attenuate quickly and dissapear when only a few meters away from the listener. - * Another example is a jumbo jet, which you could set to a mindistance of 100.0, which would keep the sound volume at max until the listener was 100 meters away, then it would be hundreds of meters more before it would fade out. - * ------- - * In summary, increase the mindistance of a sound to make it 'louder' in a 3d world, and - * decrease it to make it 'quieter' in a 3d world. - * maxdistance is effectively obsolete unless you need the sound to stop fading out at a certain point. Do not adjust this from the default if you dont need to. - * Some people have the confusion that maxdistance is the point the sound will fade out to, this is not the case. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will set the min/max distance on ALL channels available. - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - * The default units for minimum and maximum distances are 1.0 and 1000000000.0f. - * Volume drops off at mindistance / distance. - * To define the min and max distance per sound and not per channel use FSOUND_Sample_SetMinMaxDistance. - *

- * @param channel The channel to have its minimum and maximum distance set. - * @param min The channels minimum volume distance in "units". See remarks for more on units. - * @param max The channels maximum volume distance in "units". See remarks for more on units. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_3D_SetMinMaxDistance(int channel, float min, float max); - - /** - * Sets the current position of the sound in SAMPLES not bytes - *

- * Remarks - * FSOUND_ALL is supported. Passing this set the current position for the sound on ALL channels available. - * On XBOX, GameCube and Playstation 2 hardware voices using compressed data (ie XADPCM, VAG or GCADPCM), - * this value will not be sample accurate, but will be rounded to the nearest compression block size. - *

- * @param channel The channel number/handle to have its offset or position set. - * @param offset The offset in SAMPLES from the start of the sound for the position to be set to. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_SetCurrentPosition(int channel, int offset); - - /** - * Returns the current playcursor position of the specified channel - * @param channel Channel number/handle to get the current position from. - * @return On success, the play cursor position in SAMPLES is returned for the specified channel. - * On failure, 0 is returned. - */ - public static native int FSOUND_GetCurrentPosition(int channel); - - /** - * Returns the current sample being played on the specified channel - *

- * Remarks - * Note that current sample does not return to NULL when a sound has ended. - *

- * @param channel Channel number/handle to get the currently playing sample from. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static FSoundSample FSOUND_GetCurrentSample(int channel) { - long result = nFSOUND_GetCurrentSample(channel); - if(result != 0) { - return new FSoundSample(result, null); - } - return null; - } - private static native long nFSOUND_GetCurrentSample(int channel); - - /** - * Returns a left and right VU/Level reading at the current position of the specified channel. - * Levels are are only supported for software channels. - *

- * Remarks - * By default this function is only point sampled and not latency adjusted (it will appear to trigger ahead of when you hear the sound). - * To fix this and get a 'perfect' set of levels in realtime, use FSOUND_INIT_ACCURATEVULEVELS with FSOUND_Init. - * ------------------- - * To get an overall VU reading for all sounds, add all VU values for each channel together, and then clip at 1.0. - * Another (harder) way is to write a dsp unit that reads from the mixbuffer being passed into it. - * Note: A true 'VU' should be smoothed, but in case people were after more accuracy than a smoothed value, it was decided to return the raw amplitude, and let the user smooth the result in their own way. - *

- * @param channel Channel number/handle to retrieve left and right level from. - * @param l_r FloatBuffer to store left and right level, each between 0 and 1. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_GetCurrentLevels(int channel, FloatBuffer l_r) { - return nFSOUND_GetCurrentLevels(channel, l_r, l_r.position()); - } - private static native boolean nFSOUND_GetCurrentLevels(int channel, FloatBuffer l_r, int l_rOffset); - - /** - * Returns the frequency in HZ of the specified channel - * @param channel The number/handle to get the frequency from. - * @return On success, the frequency in HZ of the specified channel is returned. - * On failure, 0 is returned. To quailfy if this is a real error, call FSOUND_GetError. - */ - public static native int FSOUND_GetFrequency(int channel); - - /** - * Gets the loop mode for a particular channel - *

- * Remarks - * This works for all channel types, whereas setting it will not work. - *

- * @param channel The channel number/handle to get the loop mode from. - * @return On success, the loop mode is returned. On failure, 0 is returned. - */ - public static native int FSOUND_GetLoopMode(int channel); - - /** - * Returns the currently used mixer type - * @return FSOUND_GetMixer returns a defenition from FSOUND_MIXERTYPES. See FSOUND_MIXERTYPES for valid parameters and descriptions. - */ - public static native int FSOUND_GetMixer(); - - /** - * Returns if the channel specified is muted or not - * @param channel The channel number/handle to get the mute status from - * @return TRUE - The channel has mute turned ON. FALSE - The channel has mute turned OFF - */ - public static native boolean FSOUND_GetMute(int channel); - - /** - * This function returns the number of sub-channels stored in a multi-channel channel handle, which is only possible when playing back a multichannel .FSB file. - *

- * Remarks - * A multichannel sound, only possible with the .FSB format, can contain multiple subchannels. When a multichannel sound is played, multiple channels are allocated at the same time. - * For example, a 8 sounds/streams can be interleaved into a multichannel FSB. This function would return 8, as 8 real hardware/software voices are used during playback. - * FSOUND_GetSubChannel can be used to get access to the secondary channels. - *

- * @param channel The value returned by FSOUND_Stream_Play, FSOUND_Stream_PlayEx, FSOUND_PlaySound, FSOUND_PlaySoundEx. - * @return On success, the number of subchannels is returned. On failure, 0 is returned. - */ - public static native int FSOUND_GetNumSubChannels(int channel); - - /** - * Returns the linear pan position of the specified channel between 0 and 255 - * @param channel The channel number/handle to get the pan from. - * @return On success, the following values are returned : 0 = full left to 128 = middle to 255 = full right, FSOUND_STEREOPAN - * On failure, 0 is returned. To quailfy if this is a real error, call FSOUND_GetError. - */ - public static native int FSOUND_GetPan(int channel); - - /** - * Gets current pause status of the channel - *

- * Remarks - * This function is useful for games that have a pause mode, and you dont want the sounds - * to continue playing, but you would like them to continue on from where they left off - * when you unpause. - *

- * @param channel The channel number/handle to get the paused status from. - * @return TRUE - The channel is currently paused. - * FALSE - The channel is running. - */ - public static native boolean FSOUND_GetPaused(int channel); - - /** - * Gets a sound channels priority. Priority is used to determine if soundeffects should - * replace other sound effects when the channel limit has been reached. See - * FSOUND_SetPriority for more information. - * @param channel The channel number/handle to get the priority from. - * @return On success, the priority of the channel is returned. Ranges between 0 and 255. - * On failure, 0 is returned. To quailfy if this is a real error, call FSOUND_GetError. - */ - public static native int FSOUND_GetPriority(int channel); - - /** - * Gets a sound channels reserved status. priority is used to determine if soundeffects should muscle - * out other sound effects when the channel limit has been reached. - * @param channel The channel number/handle to get the reserved status from. - * @return TRUE Channel is reserved and cannot be selected. - * FALSE Channel is reserved and can be selected. - */ - public static native int FSOUND_GetReserved(int channel); - - /** - * This function returns a channel handle from a subchannel within a multichannel FSB file, so that it can be maniuplated seperately, instead of controlling the whole multichannel array with the parent channel that the user retrieves from FSOUND_PlaySound etc. - *

- * Remarks - * A multichannel sound, only possible with the .FSB format, can contain multiple subchannels. When a multichannel sound is played, multiple channels are allocated at the same time. - * Normally you can just use the parent handle, and things like FSOUND_SetVolume will affect all subchannels at the same time. With this function, you can get access to the raw subchannels to allow manipulation of each voice seperately within the multichannel array. - * For example, a 8 sounds/streams can be interleaved into a multichannel FSB. If you specified a subchannel of 7, it would return a channel handle to the last channel in the multichannel array. - * A subchannel index of 0 is the parent channel, and the same as the voice passed in is a parameter. - * The number of subchannels within a multichannel voice can be determined with FSOUND_GetNumSubChannels. - *

- * - * @param channel The value returned by FSOUND_Stream_Play, FSOUND_Stream_PlayEx, FSOUND_PlaySound, FSOUND_PlaySoundEx. - * @param subchannel Offset from the parent channel into the multichannel array. - * @return On success, a raw channel handle is returned. On failure, -1 is returned. - */ - public static native int FSOUND_GetSubChannel(int channel, int subchannel); - - /** - * Returns the surround sound status of the specified channel. - *

- * Remarks - * Surround sound only works on software channels. - *

- * @param channel The channel number/handle to get the surround sound status from - * @return On success, TRUE is returned meaning the channel has surround sound turned ON - * On failure, FALSE is returned meaning the channel has surround sound turned OFF - */ - public static native int FSOUND_GetSurround(int channel); - - /** - * Returns if the channel is currently playing or not. - * @param channel Channel number/handle to get the playing status from. - * @return TRUE channel is currently active and playing. FALSE channel is currently idle. - */ - public static native boolean FSOUND_IsPlaying(int channel); - - /** - *

- * Remarks - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - *

- * - * @param channel Channel you want to get 3d information from - * @param pos Pointer to a position vector (xyz float triplet) of the emitter in world space, measured in distance units. - * This can be NULL to ignore it. - * @param vel Pointer to a velocity vector (xyz float triplet), of the emitter measured in distance units PER SECOND. - * This can be NULL to ignore it. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_3D_GetAttributes(int channel, FloatBuffer pos, FloatBuffer vel) { - return nFSOUND_3D_GetAttributes(channel, pos, (pos != null) ? pos.position() : 0, vel, (vel != null) ? vel.position() : 0); - } - private static native boolean nFSOUND_3D_GetAttributes(int channel, FloatBuffer pos, int posOffset, FloatBuffer vel, int velOffset); - - /** - * Returns the current min and max distance for a channel - * - * @param channel Channel number/handle to retrieve min and max distance from. - * @param minmax FloatBuffer to store min/max -distance. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_3D_GetMinMaxDistance(int channel, FloatBuffer minmax) { - return nFSOUND_3D_GetMinMaxDistance(channel, minmax, (minmax != null) ? minmax.position() : 0); - } - private static native boolean nFSOUND_3D_GetMinMaxDistance(int channel, FloatBuffer minmax, int minmaxOffset); - // ---------------------------------------------------------- - - // 3D sound functions - // ========================================================== - /** - * This retreives the position, velocity and orientation of a 3d sound listener - *

- * Remarks - * FSOUND treats +X as right, +Y as up, and +Z as forwards. (left handed) - * To map to your own coordinate system, flip and exchange these values. For example if you wanted to use right handed coordinates, you would negate the Z value of your own direction vector. - * Orientation vectors are expected to be of UNIT length. This means the magnitude of the vector should be 1.0f. - * --------- - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - * --------- - * Please remember to use units PER SECOND, NOT PER FRAME as this is a common mistake. - * Do not just use (pos - lastpos) from the last frame's data for velocity, as this is not correct. - * You need to time compensate it so it is given in units per SECOND. - * You could alter your pos - lastpos calculation to something like this. - * vel = (pos-lastpos) / (time taken since last frame in seconds). - * I.e. at 60fps the formula would look like this - * vel = (pos-lastpos) / 0.0166667. - *

- * - * @param pos Pointer to a position vector (xyz float triplet), of the listener in world space, - * measured in distance units. - * This can be NULL to ignore it. - * @param vel Pointer to a velocity vector (xyz float triplet), of the listener measured in - * distance units PER SECOND. - * This can be NULL to ignore it. - * @param fx pointer to x component of a FORWARD unit length orientation vector - * This can be NULL to ignore it. - * @param fy pointer to y component of a FORWARD unit length orientation vector - * This can be NULL to ignore it. - * @param fz pointer to z component of a FORWARD unit length orientation vector - * This can be NULL to ignore it. - * @param tx pointer to x component of a TOP or upwards facing unit length orientation vector - * This can be NULL to ignore it. - * @param ty pointer to y component of a TOP or upwards facing unit length orientation vector - * This can be NULL to ignore it. - * @param tz pointer to z component of a TOP or upwards facing unit length orientation vector - * This can be NULL to ignore it. - */ - public static void FSOUND_3D_Listener_GetAttributes( - FloatBuffer pos, FloatBuffer vel, FloatBuffer fx, FloatBuffer fy, FloatBuffer fz, - FloatBuffer tx, FloatBuffer ty, FloatBuffer tz) { - nFSOUND_3D_Listener_GetAttributes( - pos, (pos != null) ? pos.position() : 0, - vel, (vel != null) ? vel.position() : 0, - fx, (fx != null) ? fx.position() : 0, - fy, (fy != null) ? fy.position() : 0, - fz, (fz != null) ? fz.position() : 0, - tx, (tx != null) ? tx.position() : 0, - ty, (ty != null) ? ty.position() : 0, - tz, (tz != null) ? tz.position() : 0); - } - private static native void nFSOUND_3D_Listener_GetAttributes( - FloatBuffer pos, int posOffset, FloatBuffer vel, int velOffset, - FloatBuffer fx, int fxOffset, FloatBuffer fy, int fyOffset, FloatBuffer fz, int fzOffset, - FloatBuffer tx, int txOffset, FloatBuffer ty, int tyOffset, FloatBuffer tz, int tzOffset); - - /** - * This updates the position, velocity and orientation of a 3d sound listener - *

- * Remarks - * FSOUND treats +X as right, +Y as up, and +Z as forwards. (left handed) - * To map to your own coordinate system, flip and exchange these values. For example if you wanted to use - * right handed coordinates, you would negate the Z value of your own direction vector. - * Orientation vectors are expected to be of UNIT length. This means the magnitude of the vector - * should be 1.0f. - * --------- - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - * --------- - * Please remember to use units PER SECOND, NOT PER FRAME as this is a common mistake. - * Do not just use (pos - lastpos) from the last frame's data for velocity, as this is not - * correct. You need to time compensate it so it is given in units per SECOND. - * You could alter your pos - lastpos calculation to something like this. - * vel = (pos-lastpos) / (time taken since last frame in seconds). Ie at 60fps the formula - * would look like this vel = (pos-lastpos) / 0.0166667. - *

- * - * @param pos Pointer to a position vector (xyz float triplet), of the listener in world space, measured in distance units. - * This can be NULL to ignore it. - * @param vel Pointer to a velocity vector (xyz float triplet), of the listener measured in distance units PER SECOND. - * This can be NULL to ignore it. - * @param fx x component of a FORWARD unit length orientation vector - * @param fy y component of a FORWARD unit length orientation vector - * @param fz z component of a FORWARD unit length orientation vector - * @param tx x component of a TOP or upwards facing unit length orientation vector - * @param ty y component of a TOP or upwards facing unit length orientation vector - * @param tz z component of a TOP or upwards facing unit length orientation vector - */ - public static void FSOUND_3D_Listener_SetAttributes( - FloatBuffer pos, FloatBuffer vel, - float fx, float fy, float fz, float tx, float ty, float tz) { - - nFSOUND_3D_Listener_SetAttributes( - pos, (pos != null) ? pos.position() : 0, - vel, (vel != null) ? vel.position() : 0, - fx, fy, fz, tx, ty, tz); - } - private static native void nFSOUND_3D_Listener_SetAttributes( - FloatBuffer pos, int posOffset, FloatBuffer vel, int velOffset, - float fx, float fy, float fz, float tx, float ty, float tz); - - /** - * Sets the current listener number and number of listeners, if the user wants to simulate multiple listeners at once. - * This is usually for the case in a game where there is a splitscreen and multiple players playing the game at once - *

- * Remarks - * Only affects FSOUND_3D_Listener_SetAttributes and FSOUND_3D_Listener_GetAttributes. - * Setting more than 1 listener will turn off doppler and cause all panning to be ignored and 3d sound will come from the center (mono). - * ------------- - * For WIN32 FSOUND_HW3D based sounds, channels must have their attributes set after this function is called, otherwise unexpected audible results may occur. - * For example you cannot update your channels with FSOUND_3D_SetAttributes, call FSOUND_3D_Listener_SetCurrent, and then call FSOUND_Update and expect all the voices to update correctly. - * The correct order is to call FSOUND_3D_Listener_SetCurrent first, then update all channels with FSOUND_3D_SetAttributes, then call FSOUND_Update. - * This is due to DirectSound not supporting multiple listeners, so FMOD has to do inverse transforms on the positions to simulate it with one listener, at the time FSOUND_3D_SetAttributes is called. - *

- * - * @param current Current listener number. Listener commands following this function call will affect this listener number. (default: 0) - * @param numlisteners Number of listeners active. (default: 1) - */ - public static native void FSOUND_3D_Listener_SetCurrent(int current, int numlisteners); - - /** - * Sets FMOD's 3d engine relative distance factor, compared to 1.0 meters. It equates to - * 'how many units per meter' does your engine have - *

- * Remarks - * By default this value is set at 1.0, or meters - *

- * - * @param scale 1.0 = 1 meter units. If you are using feet then scale would equal 3.28. - */ - public static native void FSOUND_3D_SetDistanceFactor(float scale); - - /** - * Sets the doppler shift scale factor. - *

- * Remarks - * This is a general scaling factor for how much the pitch varies due to doppler shifting. - * Increasing the value above 1.0 exaggerates the effect, whereas lowering it reduces the effect. - * 0 removes the effect all together. - * FMOD's speed of sound at a DopplerFactor of 1.0 is 340 m/s. - *

- * - * @param scale Doppler shift scale. Default value for FSOUND is 1.0f - */ - public static native void FSOUND_3D_SetDopplerFactor(float scale); - - /** - * Sets the global attenuation rolloff factor. - * Normally volume for a sample will scale at 1 / distance. This gives a logarithmic attenuation of volume as the source gets further away (or closer). - * Setting this value makes the sound drop off faster or slower. The higher the value, the faster volume will fall off. - * The lower the value, the slower it will fall off. - * For example a rolloff factor of 1 will simulate the real world, where as a value of 2 will make sounds attenuate 2 times quicker - *

- * Remarks - * --------- - * A 'distance unit' is specified by FSOUND_3D_SetDistanceFactor. - * By default this is set to meters which is a distance scale of 1.0. - * See FSOUND_3D_SetDistanceFactor for more on this. - * --------- - * The default rolloff factor is 1.0. - *

- * - * @param rolloff The rolloff factor to set for this sample. Valid ranges are 0 to 10. - */ - public static native void FSOUND_3D_SetRolloffFactor(float rolloff); - // ---------------------------------------------------------- - - // Stream functions - // ========================================================== - /** - * Opens an audio file/url/cd ready for streaming. - * This opens the file in preparation for playback in real-time, without needing to decode the whole file into memory first - *

- * Remarks - * WAV support supports windows codec compressed WAV files. - * -------------- - * FSOUND_MPEGACCURATE is to be used cautiously. To open a file with this mode turned on, it has to scan the whole MP3 first. This can take several seconds if the file is big, or the harddisk/cpu is slow. - * A way to speed up this process would be to load the compressed mp3 into memory first, and use the FSOUND_LOADMEMORY flag with this function. - * -------------- - * NOTE : Internet stream limitations - * - URLs must start with "http://". - * - The only supported formats for HTTP streams are MP3 (must have .mp3 extension) and OggVorbis (must have .ogg extension). - * -------------- - * FSB streaming is not supported if the format from FSBank is 'Retain original format'. On PC platforms, only PCM and ADPCM FSB files are allowed. - * -------------- - * Note, on PlayStation 2 you cannot use FSOUND_LOADMEMORY, you may use FSOUND_LOADMEMORYIOP though. - * -------------- - * When opening with the FSOUND_NONBLOCKING flag, this function always succeeds at the point of being called. - * It will always return a valid channel handle, even though the file might fail to open. To determine any error in non blocking mode use FSOUND_Stream_GetOpenState. - * -------------- - * NOTE: CDDA Streaming (Win32 only!) - * To open a CD for CDDA streaming, specify the drive letter of a CD drive e.g. FSOUND_Stream_Open("d:", 0, 0, 0); FSOUND_Stream_Open will create a stream with multiple substreams, one for each CD track. Use FSOUND_Stream_SetSubStream to select which CD track to play. - * A number of options can be passed to FSOUND_Stream_Open along with the drive letter. They are : - * ? e.g. FSOUND_Stream_Open("d:*?", 0, 0, 0); This option will cause a tag field called "CD_DEVICE_INFO" to be attached to the stream. This tag field contains information on the specified CD device. - * ! e.g. FSOUND_Stream_Open("d:*!", 0, 0, 0); This option will cause the stream to be opened in "quick open" mode. When a stream is opened in this mode, calls to FSOUND_Stream_SetSubStream will return immediately making it quick to select each substream in turn and get the length of each CD track. Note that a stream in quick open mode cannot be played! Use quick open mode to get track lengths and then re-open the stream without quick open mode to actually play it. - * j e.g. FSOUND_Stream_Open("d:*j", 0, 0, 0); This option turns jitter correction OFF. - * Options can be combined like so: FSOUND_Stream_Open("d:*?!j", 0, 0, 0); - * If a nonblocking CDDA stream fails to open, a tag field called "CD_ERROR" will be attached to the stream. This tag field contains a textual description of why the stream failed to open. - * NOTE: FMOD will always try to use native NTSCSI support to communicate with CD devices before trying to use ASPI. If FMOD is using ASPI then it can only access the first CD device it finds. - *

- * - * @param name Name of the file to open, or pointer to data if FSOUND_LOADMEMORY is used. - * @param mode Simple description of how to play the file. For all formats except raw PCM, - * FSOUND_LOOP*, FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_NONBLOCKING flags are the only ones supported. - * @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. length must also be specified if this value is used. - * @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. - * @return On success, a reference to an opened stream is returned. On failure, NULL is returned. - */ - public static FSoundStream FSOUND_Stream_Open(String name, int mode, int offset, int length) { - long result = nFSOUND_Stream_Open(name, mode, offset, length); - if(result != 0) { - return new FSoundStream(result, null); - } - return null; - } - - /** - * @see #FSOUND_Stream_Open(String, int, int, int) - * @param data data when FSOUND_LOADMEMORY is used. - * @param mode Simple description of how to play the file. For all formats except raw PCM, - * FSOUND_LOOP*, FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_NONBLOCKING flags are the only ones supported. - * @return On success, a reference to an opened stream is returned. On failure, NULL is returned. - */ - public static FSoundStream FSOUND_Stream_Open(ByteBuffer data, int mode) { - long result = nFSOUND_Stream_Open(data, mode, data.position(), data.remaining()); - if(result != 0) { - return new FSoundStream(result, data); - } - return null; - } - private static native long nFSOUND_Stream_Open(ByteBuffer data, int mode, int offset, int length); - private static native long nFSOUND_Stream_Open(String name, int mode, int offset, int length); - - /** - * Starts a pre-opened stream playing - *

- * Remarks - * When a stream starts to play, it inherits a special high priority (256). - * It cannot be rejected by other sound effect channels in the normal fashion as the user can never set a priority above 255 normally. - * -------------- - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. - * -------------- - * FSB streaming is not supported if the format from FSBank is 'Retain original format'. On PC platforms, only PCM and ADPCM FSB files are allowed. - * -------------- - * FSOUND_STEREOPAN is recommended for stereo streams if you call FSOUND_SetPan. This puts the left and right channel to full volume. - * Otherwise a normal pan will give half volume for left and right. See FSOUND_SetPan for more information on this. - * -------------- - * You can use normal channel based commands (such as FSOUND_SetVolume etc) on the return handle, as it is a channel handle. - *

- * - * @param channel 0+ The channel index in the channel pool. This must not exceed the maximum number of channels allocated with FSOUND_Init - * FSOUND_FREE - * Chooses a free channel to play in. If all channels are used then it - * selects a channel with a sample playing that has a lower priority than the - * sample to be played. - * @param stream FSoundStream to be played. - * @return On success, the channel handle the stream is playing in is returned. On failure, -1 is returned. - */ - public static int FSOUND_Stream_Play(int channel, FSoundStream stream) { - return nFSOUND_Stream_Play(channel, stream.streamHandle); - } - private static native int nFSOUND_Stream_Play(int channel, long streamhandle); - - /** - * Stops a stream from playing - *

- * Remarks - * The stream is still prepared and sitting in memory ready to go. Use FSOUND_Stream_Close on the stream to completely remove it. - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready - *

- * - * @param stream FSoundStream to be stopped - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_Stop(FSoundStream stream) { - return nFSOUND_Stream_Stop(stream.streamHandle); - } - private static native boolean nFSOUND_Stream_Stop(long streamhandle); - - /** - * Shuts down and releases an FSOUND stream - *

- * Remarks - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. - * The only exception to this rule is for internet streams - this function will successfully close an internet stream that has been opened with FSOUND_NONBLOCKING before that stream is ready. - *

- * - * @param stream FSoundStream to be closed - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_Close(FSoundStream stream) { - stream.release(); - return nFSOUND_Stream_Close(stream.streamHandle); - } - private static native boolean nFSOUND_Stream_Close(long streamhandle); - - /** - * Returns the number of substreams inside a multi-stream FSB bank file - * - * @param stream FSoundStream to get substream count from - * @return On success, the number of FSB substreams is returned. On failure, 0 is returned. - */ - public static int FSOUND_Stream_GetNumSubStreams(FSoundStream stream) { - return nFSOUND_Stream_GetNumSubStreams(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetNumSubStreams(long streamhandle); - - /** - * Seeks a stream to the substream inside a multi-stream FSB bank file, specified by its index - *

- * Remarks - * A stream will stop if this function is called, as it needs to seek and flush the buffer. - * Indicies for this function are generated as user friendly constants when compiling the FSB bank, and are available in the relevant generated header file. - * -------------- - * If the stream has been opened with FSOUND_NONBLOCKING, this function will ALWAYS succeed, but puts the stream back into a non-ready state. You then have to poll after calling this to make sure the stream is ready. - * You can either do this by calling FSOUND_Stream_Play repeatedly/once a frame until it is succeeds, or FSOUND_Stream_GetOpenState. - *

- * @param stream to have its position set - * @param index The index of the stream within the FSB file - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static int FSOUND_Stream_SetSubStream(FSoundStream stream, int index) { - return nFSOUND_Stream_SetSubStream(stream.streamHandle, index); - } - private static native int nFSOUND_Stream_SetSubStream(long streamhandle, int index); - - /** - * Adds a user synchronization callback point into a stream - *

- * Remarks - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready - *

- * @param stream The stream to add a sync point to. - * @param pcmoffset Offset in SAMPLES (not bytes). - * @param name The name of the syncpoint, which will be passed into the sync callback when it is triggered. - * @return On success, a sync point handle is returned. On failure, NULL is returned. - */ - public static FSoundSyncPoint FSOUND_Stream_AddSyncPoint(FSoundStream stream, int pcmoffset, String name) { - ByteBuffer result = nFSOUND_Stream_AddSyncPoint(stream.streamHandle, pcmoffset, name); - if(result != null) { - return new FSoundSyncPoint(result); - } - return null; - } - private static native ByteBuffer nFSOUND_Stream_AddSyncPoint(long streamhandle, int pcmoffset, String name); - - /** - * Creates a user definable stream file ready for playing. The stream is serviced through a callback - *

- * Remarks - * This method only supports SIGNED RAW streams to be written to the buffer supplied by the callback. - * They can be 8 or 16 bit, mono or stereo. - * 'lenbytes' may be rounded down to the nearest sample alignment in bytes. Ie if you specified 1001 bytes for a 16bit stereo sample stream, len would return 1000 in the callback. (250 samples * 4 bytes per sample) - * PlayStation 2 IMPORTANT! : if FSOUND_SendData is NOT called from the stream callback the IOP will hang because it is waiting for this command to be executed before it can unlock its buffer. - *

- * @param callbackHandler FSoundStreamCallback to be called back - * @param lenbytes Size of the data in BYTES the callback will require to be written to the buffer. - * @param mode Description of the raw sample data being opened. see FSOUND_MODES for a description of these modes. - * @param samplerate Rate of playback. Be careful you dont set the sample rate too high so that the stream servicer (ie the harddisk) may not keep up. - * @return On success, a sync point handle is returned. On failure, NULL is returned. - */ - public static FSoundStream FSOUND_Stream_Create(FSoundStreamCallback callbackHandler, int lenbytes, int mode, int samplerate) { - FSoundStream stream = null; - long result = nFSOUND_Stream_Create(lenbytes, mode, samplerate); - if(result != 0) { - stream = new FSoundStream(result, null); - FMOD.registerCallback(FMOD.FSOUND_STREAMCALLBACK, stream.streamHandle, stream, callbackHandler); - } - return stream; - } - private static native long nFSOUND_Stream_Create(int lenbytes, int mode, int samplerate); - - /** - * Allows the user to add a custom DSP unit to a stream - *

- * Remarks - * The priority for a stream DSP unit is not related to the priorities specified in fmod.h. - * The priorities are anything fom 0 onwards, and ALWAYS come after data is read/decoded for the stream *

- * - * @param stream The stream to have a DSP attached to. - * @param callback A standard FSoundDSPCallback callback - * @param priority The priority, or position within the streams DSP chain to place the unit. - * @return On success, a handle to the FSoundDSPUnit is returned. All DSP functions are performable on this. On failure, null is returned - */ - public static FSoundDSPUnit FSOUND_Stream_CreateDSP(FSoundStream stream, FSoundDSPCallback callback, int priority) { - ByteBuffer dspID = (ByteBuffer) BufferUtils.createByteBuffer(8).putLong(FSoundDSPUnit.getNextId()).flip(); - FSoundDSPUnit unit = null; - - ByteBuffer dspHandle = nFSOUND_Stream_CreateDSP(stream.streamHandle, priority, dspID); - - if(dspHandle != null) { - unit = new FSoundDSPUnit(dspHandle, dspID); - FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, dspID.getLong(0), unit, callback); - } - return unit; - } - private static native ByteBuffer nFSOUND_Stream_CreateDSP(long streamHandle, int priority, ByteBuffer dspID); - - /** - * Removes a user synchronization callback point from a stream. - * - * @param point The sync point to remove - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Stream_DeleteSyncPoint(FSoundSyncPoint point) { - return nFSOUND_Stream_DeleteSyncPoint(point.syncpointHandle); - } - private static native boolean nFSOUND_Stream_DeleteSyncPoint(ByteBuffer syncpointHandle); - - /** - * Find a tag field associated with an open stream by name and type - * - * @param stream The stream to get the tag field from. - * @param field FSoundTagField to find (using type, name) - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Stream_FindTagField(FSoundStream stream, FSoundTagField field) { - return nFSOUND_Stream_FindTagField(stream.streamHandle, field.type, field.name, field); - } - private static native boolean nFSOUND_Stream_FindTagField(long streamHandle, int type, String name, FSoundTagField field); - - /** - * Returns the size of the stream in BYTES - *

- * Remarks - * Position functions for streams work in bytes not samples. - * ----- - * This function is not supported for URL based streams over the internet. - *

- * @param stream The stream to have its length returned - * @return On success, the size of the stream in BYTES is returned. On failure, 0 is returned. - */ - public static int FSOUND_Stream_GetLength(FSoundStream stream) { - return nFSOUND_Stream_GetLength(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetLength(long streamHandle); - - /** - * Returns the size of the stream in MILLISECONDS - *

- * Remarks - * FSOUND_MPEGACCURATE will need to be used with mp3 files that use VBR encoding for more accuracy - *

- * @param stream The stream to have its its total duration returned. - * @return On success, the size of the stream in MILLISECONDS is returned. On failure, 0 is returned. - */ - public static int FSOUND_Stream_GetLengthMs(FSoundStream stream) { - return nFSOUND_Stream_GetLengthMs(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetLengthMs(long streamHandle); - - /** - * Retrieves the mode of the stream - *

- * Remarks - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. - *

- * @param stream The stream to get the mode from - * @return mode of stream - */ - public static int FSOUND_Stream_GetMode(FSoundStream stream) { - return nFSOUND_Stream_GetMode(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetMode(long streamHandle); - - /** - * Returns the number of substreams inside a multi-stream FSB bank file - * - * @param stream stream to query - * @return On success, the number of FSB substreams is returned. On failure, 0 is returned - */ - public static int nFSOUND_Stream_GetNumSyncPoints(FSoundStream stream) { - return nFSOUND_Stream_GetNumSyncPoints(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetNumSyncPoints(long streamHandle); - - /** - * Get the number of tag fields associated with the specified stream - * - * @param stream stream to query - * @param num IntBuffer that will receive the nubmer of tag fields associated with the specified stream. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_GetNumTagFields(FSoundStream stream, IntBuffer num) { - return nFSOUND_Stream_GetNumTagFields(stream.streamHandle, num, num.position()); - } - private static native boolean nFSOUND_Stream_GetNumTagFields(long streamHandle, IntBuffer buffer, int offset); - - /** - * If a stream is opened with FSOUND_NONBLOCKING, this function returns the state of the opening stream - *

- * Remarks - * A blocking stream will return NULL from FSOUND_Stream_Open so a return value of -3 is redundant in this case. - * A blocking stream will always return 0 if it is not NULL. - *

- * @param stream to get the open state from. - * @return 0 = stream is opened and ready. - * -1 = stream handle passed in is invalid. - * -2 = stream is still opening or performing a SetSubStream command. - * -3 = stream failed to open. (file not found, out of memory or other error). - * -4 = connecting to remote host (internet streams only) - * -5 = stream is buffering data (internet streams only) - */ - public static int FSOUND_Stream_GetOpenState(FSoundStream stream) { - return nFSOUND_Stream_GetOpenState(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetOpenState(long streamHandle); - - /** - * Returns the current FILE position of the stream of the stream in BYTES - *

- * Remarks - * Position functions for streams work in bytes not samples. - * Position information is also based on the current file position, not the actual playing - * position, so if the stream is only updated every 100ms, then the position will only be - * updated every 100ms. - * ----- - * This function is not supported for URL based streams over the internet or CDDA streams - *

- * @param stream to have its position returned - * @return On success, the current stream's position in BYTES is returned. On failure, 0 is returned. - */ - public static int FSOUND_Stream_GetPosition(FSoundStream stream) { - return nFSOUND_Stream_GetPosition(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetPosition(long streamHandle); - - /** - * Returns the FSOUND_SAMPLE definition that the stream uses internally. - * You can use this to get a variety of information like the songs name, default speed and more. - * @param stream to have its internal sample pointer returned. - * @return On success, a handle to the FSOUND_SAMPLE definition is returned. On failure, 0 is returned - */ - public static FSoundSample FSOUND_Stream_GetSample(FSoundStream stream) { - long result = nFSOUND_Stream_GetSample(stream.streamHandle); - if(result != 0) { - return new FSoundSample(result, null); - } - return null; - } - private static native long nFSOUND_Stream_GetSample(long streamHandle); - - /** - * Obtains a sync point by index. This is useful when you havent created your own, ie it came from a wav file - *

- * Remarks - * Points are loaded in order of offset, so the index will represent the smallest point to the largest. *

- * @param stream to have its position returned - * @param index The sync point offset into the stream - * @return On success, a handle to a sync point is returned. On failure, NULL is returned. - */ - public static FSoundSyncPoint FSOUND_Stream_GetSyncPoint(FSoundStream stream, int index) { - ByteBuffer result = nFSOUND_Stream_GetSyncPoint(stream.streamHandle, index); - if(result != null) { - return new FSoundSyncPoint(result); - } - return null; - } - private static native ByteBuffer nFSOUND_Stream_GetSyncPoint(long streamHandle, int index); - - /** - * Retrieves the name and pcm offset in samples for a specified sync point - *

- * Remarks - * Convert samples to time by dividing the PCM value by the default samplerate. This would give you the value in seconds. Multiply by 1000 to get milliseconds. - * @param point handle to the sync point to retrieve information from - * @param pcmoffset An IntBuffer that will receive the sync point offset in pcm SAMPLES. A value of NULL will be ignored - * @return On success, the name of the syncpoint is returned as a string. On failure, NULL is returned. - */ - public static String FSOUND_Stream_GetSyncPointInfo(FSoundSyncPoint point, IntBuffer pcmoffset) { - return nFSOUND_Stream_GetSyncPointInfo(point.syncpointHandle, pcmoffset, (pcmoffset != null) ? pcmoffset.position() : 0); - } - private static native String nFSOUND_Stream_GetSyncPointInfo(ByteBuffer pointHandle, IntBuffer pcmoffset, int bufferOffset); - - /** - * Get a tag field associated with an open stream - *

- * Remarks - * If this function returns successfully, "value" will contain a pointer to a piece of tag-field-specific data - do not assume it will always point to a null-terminated ASCII string. - * @param stream The stream to get the tag field from. - * @param num The number of the tag field to retrieve. - * @param field TagField to receive data - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_GetTagField(FSoundStream stream, int num, FSoundTagField field) { - return nFSOUND_Stream_GetTagField(stream.streamHandle, num, field); - } - private static native boolean nFSOUND_Stream_GetTagField(long streamHandle, int num, FSoundTagField field); - - /** - * Returns the current time offset in stream in milliseconds. - *

- * Remarks - * FSOUND_MPEGACCURATE will need to be used with mp3 files that use VBR encoding for more accuracy - *

- * @param stream to get the currently playing time offset - * @return On success, the current stream's position in milliseconds is returned. On failure, 0 is returned. - */ - public static int FSOUND_Stream_GetTime(FSoundStream stream) { - return nFSOUND_Stream_GetTime(stream.streamHandle); - } - private static native int nFSOUND_Stream_GetTime(long streamHandle); - - /** - * Gets buffer size and thresholds that will be used when opening new internet streams - *

- * Remarks - * This function returns the values that will be used for subsequent internet stream opens. Internet streams that already exist may have different values. - *

- * @param values IntBuffer to hold 3 int values: - * buffersize size in bytes of the streaming buffer. - * prebuffer_percent how much to prebuffer when a stream is first opened. Values are expressed as a percentage from 1 to 99. - * rebuffer_percent how much to rebuffer after a stream has suffered a buffer underrun. Values are expressed as a percentage from 1 to 99. - * @return On success, TRUE is returned. On failure, FALSE is returned. - - */ - public static boolean FSOUND_Stream_Net_GetBufferProperties(IntBuffer values) { - return nFSOUND_Stream_Net_GetBufferProperties(values, values.position()); - } - private static native boolean nFSOUND_Stream_Net_GetBufferProperties(IntBuffer values, int offset); - - /** - * This function returns a String representing the last HTTP status line that was received when connecting to an internet stream - *

- * Remarks - * The result of this function should be used for informational purposes only. - * This function provides no facility to discover which internet stream the last HTTP status pertains to when there are multiple internet streams open. - *

- * @return last HTTP status line that was received - */ - public static native String FSOUND_Stream_Net_GetLastServerStatus(); - - /** - * Get various status information for an internet stream - * - * @param stream to get status information on - * @param values IntBuffer to hold 4 int values: - * status variable that will receive a status value. See FSOUND_STREAM_NET_STATUS. - * bufferused variable that will receive the percentage of the read buffer that is currently in use. - * bitrate variable that will receive the current bitrate of the stream. - * flags variable that will receive a flags field describing protocol and format information. See FSOUND_STATUS_FLAGS. - * - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_Net_GetStatus(FSoundStream stream, IntBuffer values) { - return nFSOUND_Stream_Net_GetStatus(stream.streamHandle, values, values.position()); - } - private static native boolean nFSOUND_Stream_Net_GetStatus(long streamHandle, IntBuffer values, int offset); - - /** - * Sets buffer size and thresholds to use when opening new internet streams - *

- * Remarks - * Call this function before FSOUND_Stream_Open. This function has no effect on internet streams that are already open - *

- * @param buffersize Size in bytes of the streaming buffer. Make it bigger to avoid buffer underruns. (Default = 64000) - * @param prebuffer_percent How much to prebuffer when a stream is first opened. Values are expressed as a percentage from 1 to 99. (Default = 95) - * @param rebuffer_percent How much to rebuffer after a stream has suffered a buffer underrun. Values are expressed as a percentage from 1 to 99. (Default = 95) - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_Stream_Net_SetBufferProperties(int buffersize, int prebuffer_percent, int rebuffer_percent); - - /** - * Set a metadata callback for an internet stream - *

- * Remarks - * The supplied metadata callback function will be called each time the specified internet stream receives a chunk of metadata. - * Do not do any time-consuming processing in a metadata callback function or network subsystem performance may degrade. - * Do not attempt to modify or free any memory passed to a metadata callback function. - *

- * @param stream to set the metadata callback for - * @param callback metadata callback to attach to this stream - * - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_Net_SetMetadataCallback(FSoundStream stream, FSoundMetaDataCallback callback) { - FMOD.registerCallback(FMOD.FSOUND_METADATACALLBACK, stream.streamHandle, stream, callback); - return nFSOUND_Stream_Net_SetMetadataCallback(stream.streamHandle); - } - private static native boolean nFSOUND_Stream_Net_SetMetadataCallback(long streamHandle); - - /** - * Set a proxy server to use for all subsequent internet connections - * @param proxy The name of a proxy server in host:port format e.g. www.fmod.org:8888 (defaults to port 80 if no port is specified). - * Basic authentication is supported. To use it, this parameter must be in user:password@host:port format e.g. bob:sekrit123@www.fmod.org:8888 - * Set this parameter to NULL if no proxy is required - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_Stream_Net_SetProxy(String proxy); - - /** - * Extended featured version of FSOUND_Stream_Play. - * Added functionality includes the ability to start the stream paused. This allows attributes - * of a stream channel to be set freely before the stream actually starts playing, until FSOUND_SetPaused(FALSE) is used. - * Also added is the ability to associate the stream channel to a specified DSP unit. This allows - * the user to 'group' channels into seperate DSP units, which allows effects to be inserted - * between these 'groups', and allow various things like having one group affected by reverb (wet mix) and another group of - * channels unaffected (dry). This is useful to seperate things like music from being affected - * by DSP effects, while other sound effects are. - *

- * Remarks - * When a stream starts to play, it inherits a special high priority (256). - * It cannot be rejected by other sound effect channels in the normal fashion as the user can never set a priority above 255 normally. - * -------- - * FSOUND_STEREOPAN is recommended for stereo streams if you call FSOUND_SetPan. This puts the left and right channel to full volume. - * Otherwise a normal pan will give half volume for left and right. See FSOUND_SetPan for more information on this. - * -------- - * You can use normal channel based commands (such as FSOUND_SetVolume etc) on the return handle, as it is a channel handle. - *

- * - * @param channel 0+ The absolute channel number in the channel pool. - * Remember software channels come first, followed by hardware channels. - * You cannot play a software sample on a hardware channel and vice versa. - * FSOUND_FREE - * Chooses a free channel to play in. If all channels are used then it - * selects a channel with a sample playing that has an EQUAL or LOWER priority - * than the sample to be played. - * @param stream already opened stream to be played - * @param dspunit dsp unit to attach the channel to - * @param paused Start the stream paused or not. Pausing the stream channel allows attributes to be set before it is unpaused - * @return On success, a channel handle the stream is playing in is returned. On failure, -1 is returned. - */ - public static int FSOUND_Stream_PlayEx(int channel, FSoundStream stream, FSoundDSPUnit dspunit, boolean paused) { - int res = nFSOUND_Stream_PlayEx(channel, stream.streamHandle, (dspunit != null) ? dspunit.dspHandle : null, paused); - return res; - } - private static native int nFSOUND_Stream_PlayEx(int channel, long stream, ByteBuffer dspunit, boolean paused); - - /** - * Sets the internal file buffersize for audio streaming of data for the NEXT stream opened with FSOUND_Stream_Open. - * Larger values will consume more memory (see remarks), whereas smaller values may be subject to large delays in disk access, especially from CDROM. - *

- * Remarks - * The default setting is 200ms. Under Windows CE it is default to 100ms. - * To calculate memory usage for a stream buffer, it is a simple matter of calculating sizebytes = streambuffersize * sample rate / 1000 * (bitdepth / 8) * numchannels * 2, where numchannels is 1 for mono, - * or 2 for stereo files. It is multiplied by 2 because FSOUND stream buffers are double buffers. - * Note this function does not affect user created streams, as the buffer size is specified in FSOUND_Stream_Create. - *

- * - * @param ms Time in milliseconds between stream updates. FMOD tries to access the disk and - * decompress data every period specified. Values less than 50 result in an error - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_Stream_SetBufferSize(int ms); - - /** - * Sets a callback function for when a stream has ended - *

- * Remarks - * Only calls back when a stream stops. (not when a looping stream reaches its end point) - * Note it uses a FSOUND_STREAMCALLBACK function callback. This is normally for user streams but for - * the sake of re-usability this prototype is used. 'buff' and 'length' are NULL and 0 in this case - * when the callback occurs. The return value can be TRUE or FALSE it is ignored. - * ----------- - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. - *

- * @param stream to set the metadata callback for - * @param callback FSoundStreamCallback callback to attach to this stream - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_SetEndCallback(FSoundStream stream, FSoundStreamCallback callback) { - FMOD.registerCallback(FMOD.FSOUND_ENDCALLBACK, stream.streamHandle, stream, callback); - return nFSOUND_Stream_SetEndCallback(stream.streamHandle); - } - private static native boolean nFSOUND_Stream_SetEndCallback(long streamHandle); - - /** - * Sets the stream to loop the number of times specified by the user. If not called it loops forever - *

- * Remarks - * This specifies how many loops, not how many times to play the sound back. Therefore when you specify 0, you will hear the sound once, if you specify 1, you will hear the sound twice, and so on. - *

- * - * @param stream already opened stream to be played - * @param count Number of times to loop. 0 would be similar to having FSOUND_LOOP_OFF set. >0 is infinity - * @return On success, a channel handle the stream is playing in is returned. On failure, -1 is returned. - */ - public static int FSOUND_Stream_SetLoopCount(FSoundStream stream, int count) { - return nFSOUND_Stream_SetLoopCount(stream.streamHandle, count); - } - private static native int nFSOUND_Stream_SetLoopCount(long stream, int count); - - /** - * Sets the loop points for a stream - *

- * Remarks - * For streams, setting looppoints is reasonably accurate but should not be assumed to be perfectly sample accurate in all cases. - * It depends on the compression format in some cases as seek positions need to be rounded to the nearest compression block offset. - * FSOUND_MPEGACCURATE will need to be used with mp3 files that use VBR encoding for more accuracy. - * You cannot call this function wile the stream is playing, it has to be stopped - *

- * - * @param stream already opened stream to be played - * @param loopstart The start of the loop, specified in PCM SAMPLES. - * @param loopend The end of the loop, specified in PCM SAMPLES. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static int FSOUND_Stream_SetLoopPoints(FSoundStream stream, int loopstart, int loopend) { - return nFSOUND_Stream_SetLoopPoints(stream.streamHandle, loopstart, loopend); - } - private static native int nFSOUND_Stream_SetLoopPoints(long stream, int loopstart, int loopend); - - /** - * Set a streams mode - *

- * Remarks - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. - * Only the following modes are accepted, others will be filtered out. - * FSOUND_LOOP_BIDI, FSOUND_LOOP_NORMAL, FSOUND_LOOP_OFF, FSOUND_2D. FSOUND_LOOP_BIDI is treated as FSOUND_LOOP_NORMAL. FSOUND_2D is accepted only if the sound is not hardware. - * On playstation 2, FSOUND_HW3D and FSOUND_HW2D modes are accepted - *

- * - * @param stream to have the mode set - * @param mode The mode bits to set from FSOUND_MODES - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static int FSOUND_Stream_SetMode(FSoundStream stream, int mode) { - return nFSOUND_Stream_SetMode(stream.streamHandle, mode); - } - private static native int nFSOUND_Stream_SetMode(long stream, int mode); - - /** - * Set a streams mode - *

- * Remarks - * Position functions for streams talk in bytes and NOT samples. - * The reason for not taking the header into account is people usually want to know the offset to seek to relative to the start of their data (ie as they see it in soundforge or whatever), not from offset 0 which is almost meaningless if you dont know the format. - * -------------- - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. *

- *

- * - * @param stream to have its position set - * @param position Offset in bytes from start of actual sound data (not including any header) - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static int FSOUND_Stream_SetPosition(FSoundStream stream, int position) { - return nFSOUND_Stream_SetPosition(stream.streamHandle, position); - } - private static native int nFSOUND_Stream_SetPosition(long stream, int position); - - /** - * This function allows the user to describe the playback order of a list of substreams. The substreams will be played back in order seamlessly. - *

- * Remarks - * This feature only works with FSB files that have multiple streams stored within it. - * To remove any sentence, simply call this function with NULL and 0. - * FMOD copies the list from the supplied pointer. Once the pointer is used, the caller can discard the original array. - * This function will fail if the stream is playing. The stream must be stopped for it to work. - * ------------ - * If the stream is opened with FSOUND_NONBLOCKING, and the stream is not ready (it is still opening), then this function will return FALSE. - * When it is ready, it will return TRUE, but after this call the stream is put back into a non-ready state, because it is asynchronously seeking again. - * You then have to poll after calling this to make sure the stream is ready. - * You can either do this by calling FSOUND_Stream_Play repeatedly/once a frame until it is succeeds, or FSOUND_Stream_GetOpenState. *

- * - * @param stream stream to have its position returned. - * @param sentencelist IntBuffer describing a list of substream indicies to play back. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static int FSOUND_Stream_SetSubStreamSentence(FSoundStream stream, IntBuffer sentencelist) { - return nFSOUND_Stream_SetSubStreamSentence(stream.streamHandle, sentencelist, sentencelist.position()); - } - private static native int nFSOUND_Stream_SetSubStreamSentence(long stream, IntBuffer sentencelist, int offset); - - /** - * Sets a callback function for when a stream passes over a WAV tag/marker. These are markers that - * a sound editing program such as Sound Forge can drop into the actual wave data. FMOD will - * trigger callbacks with these markers when the stream plays, and pass in the string through the callback that the marker contains - *

- * Remarks - * Note it uses a FSOUND_STREAMCALLBACK function callback. This is normally for user streams but for - * the sake of re-usability this prototype is used. 'buff' is a null terminated string provided by - * the marker. 'len' is the offset in samples that the marker was set at. - * The return value can be TRUE or FALSE, it is ignored. - * ----------- - * Note you can save a WAV out using an MP3 wav codec (and then just rename the WAV to MP3 if you like) to get - * sync marker support for compressed MP3 files. FMOD will pick up on this and read the markers out. - * -------------- - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. - *

- * @param stream to set the SyncCallback callback for - * @param callback FSoundStreamCallback callback to attach to this stream - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_Stream_SetSyncCallback(FSoundStream stream, FSoundStreamCallback callback) { - FMOD.registerCallback(FMOD.FSOUND_SYNCCALLBACK, stream.streamHandle, stream, callback); - return FSOUND_Stream_SetSyncCallback(stream.streamHandle); - } - private static native boolean FSOUND_Stream_SetSyncCallback(long streamHandle); - - /** - * Sets the current stream's FILE position in MILLISECONDS - *

- * Remarks - * If the stream has been opened with FSOUND_NONBLOCKING, this function will not succeed until the stream is ready. - * FSOUND_MPEGACCURATE will need to be used with mp3 files that use VBR encoding for more accuracy. - *

- * - * @param stream to have its position set - * @param ms Time in milliseconds to seek to. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static int FSOUND_Stream_SetTime(FSoundStream stream, int ms) { - return nFSOUND_Stream_SetTime(stream.streamHandle, ms); - } - private static native int nFSOUND_Stream_SetTime(long stream, int ms); - // ---------------------------------------------------------- - - // CD functions - // ========================================================== - /** - * Opens/Closes the CD tray - * - * @param drive The drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @param open If open is set to true, the CD tray will be opened. If open is set to false, the CD tray will be closed. - * @return On success, true is is returned. On failure, false is returned. - */ - public static native boolean FSOUND_CD_OpenTray(char drive, boolean open); - - /** - * Returns the number of tracks on the currently inserted CD - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @return On success, the number of CD tracks on the currently inserted is returned. On failure, 0 is returned - */ - public static native int FSOUND_CD_GetNumTracks(char drive); - - /** - * Gets the pause status of the current CD audio track - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @return If the track is currently paused, TRUE is returned. if the track is currently not paused, FALSE is returned. - */ - public static native boolean FSOUND_CD_GetPaused(char drive); - - /** - * Returns the currently playing CD track number - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @return On success, the CD track number currently playing is returned. (starts from 1) On failure, 0 is returned - */ - public static native int FSOUND_CD_GetTrack(char drive); - - /** - * Gets the track length of a CD - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @param track The CD track number to query the length of. (starts from 1) - * @return On success, the length of the current track in milliseconds is returned. On failure, 0 is returned. - */ - public static native int FSOUND_CD_GetTrackLength(char drive, int track); - - /** - * Returns the current track time playing on a CD - *

- * Remarks - * This is easily one of the slowest functions in the FMOD API. Please use it sparingly. - * It seems like it shouldnt take long, but because of windows MCI API it does, and not just a little bit of time, it takes a LOT. - * It seems to poll the CD driver and cause a large delay upon completion of the command. - * Different algorithms were used to try and emulate this function such as simply using a timer, but this was very inaccurate, especially when pausing/unpausing a lot. - *

- * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @return On success, the position of the current playing track in milliseconds is returned. On failure, 0 is returned - */ - public static native int FSOUND_CD_GetTrackTime(char drive); - - /** - * Plays a CD Audio track - *

- * Remarks - * See FSOUND_CD_SetPlayMode for information on how to control playback of a CD track. - * FSOUND's CD Playback system, is a non intrusive, non polling system. - * This may not mean much to a lot of people, but a polling player (take the windows default CD player) will consistantly poll the CD device to update its status, which causes other applications to jerk, or pause consistantly. - * This would be inexcusable in a game, to have the game halt or jerk every second to few seconds or so. - * FSOUND uses timing and prediction to loop tracks and update the status of the CD, and never touches the CD device during playback, for TRUE 0% cpu usage. - *

- * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @param track The CD track number to query the length of. (starts from 1) - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_CD_Play(char drive, int track); - - /** - * Sets the pause status of the currently playing CD audio track - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @param paused TRUE to pause track, FALSE to unpause track - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_CD_SetPaused(char drive, boolean paused); - - /** - * Sets the playback mode of the CD - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @param mode See FSOUND_CDPLAYMODES for a list of valid parameters to send to this function - */ - public static native void FSOUND_CD_SetPlayMode(char drive, int mode); - - /** - * Performs a seek within a track specified by milliseconds - *

- * Remarks - * This function will start the track if it is not playing - *

- * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @param ms Time to seek into the current track in milliseconds - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_CD_SetTrackTime(char drive, int ms); - - /** - * Sets the volume of the playing CD audio - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @param volume An integer value from 0-255. 0 being the lowest volume, 255 being the highest (full). - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_CD_SetVolume(char drive, int volume); - - /** - * Stops the currently playing CD audio track - * - * @param drive the drive ID to use. 0 is the default CD drive. Using D or E in single quotes would be D: or E: for example. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_CD_Stop(char drive); - // ---------------------------------------------------------- - - // DSP functions - // ========================================================== - /** - * Clears the mixbuffer, especially handy if you are doing a large file operation which - * halts the system. - * You might try and stop all the sounds, but if you do your file operation straight after - * this, it will not have a chance to flush the mixbuffer normally, so this function is called. - * It stops the effect of stuttering looping sound while your file operation happens. - *

- * Remarks - * The best way to do it is like this. Turn off the sfx and music DSP units, clear the mix buffer, - * then when the operation that halts the machine is done, just re-enable the sfx and music DSP units. - * Disabling these units stops the timer trying to get 1 or 2 more mixes in during the file operation, - * which will cause more stuttering. - * ie. - * FSOUND_DSP_SetActive(FSOUND_DSP_GetSFXUnit(), FALSE); - * FSOUND_DSP_SetActive(FSOUND_DSP_GetMusicUnit(), FALSE); - * FSOUND_DSP_ClearMixBuffer(); - * // - * // maching halting operation here - * // - * FSOUND_DSP_SetActive(FSOUND_DSP_GetSFXUnit(), TRUE); - * FSOUND_DSP_SetActive(FSOUND_DSP_GetMusicUnit(), TRUE); - *

- */ - public static native void FSOUND_DSP_ClearMixBuffer(); - - /** - * Creates a DSP unit, and places it in the DSP chain position specified by the priority - * parameter. Read the remarks section carefully for issues regarding DSP units. - * DSP units are freed with FSOUND_DSP_Free - *

- * Remarks - * A dsp unit is NOT ACTIVE by default. You have to activate it with FSOUND_DSP_SetActive - * --------------------------------------------------------------------------------------- - * Priorities and default system units. - * --------------------------------------------------------------------------------------- - * A note on priorities. FSOUND processes DSP units in order of priority. A 0 priority - * unit gets processed first, a 1 priority unit gets processed next, and so on. - * FSOUND actually uses these DSP units to mix its sound effects and music! Yes, you have - * access to them (be careful!). It is possible to totally remove, replace or deactivate - * all of FSOUND's system units so that it does nothing at all! - * FSOUND has preinstalled default system units at the following priority locations: - * FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT (priority 0) - Clear Unit. This unit clears out - * the mixbuffer for the next units to mix into. You can disable this unit and replace - * it with something other than a clearer, such as a scaler, which fades down the mix - * buffer instead of clearing it, to produce a very rough echo effect. - * FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT (priority 100) - SFX Unit. This unit mixes sound - * effect channels into the mix buffer, which was previously cleared with the Clear - * Unit. - * FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT (priority 200) - Music Unit. This unit mixes all - * music channels into the mix buffer, which was previously mixed into with the SFX - * Unit. - * FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT (priority 1000) - Clip and Copy Unit. This - * unit takes the finally mixed buffer, and clips it to the output stream size (if it - * needs to), and then sends it off to the sound device. It is done last. If this is - * disabled you will hear no sound. - * --------------------------------------------------------------------------------------- - * Buffer Lengths. - * --------------------------------------------------------------------------------------- - * The 'length' value of the DSP callback is roughly 20ms worth of data. - * Use FSOUND_DSP_GetBufferLength to get the exact callback length. - * --------------------------------------------------------------------------------------- - * Buffer Widths - * --------------------------------------------------------------------------------------- - * Remember that FSOUND uses different buffer types depending on what type of mixer it is. - * You will have to compensate for this by writing different routines depending on the - * mixer type (ie mmx or non mmx), just like FSOUND does. - * Currently there are the 3 types of mixers and their buffer sizes. - * You can get the type of mixer being used by calling the FSOUND_GetMixer function. - * You may want to check on this inside your callback, or set up a function pointer system, - * whatever you think is suitable (it costs nothing to do a FSOUND_GetMixer every time). - * - FSOUND_MIXER_BLENDMODE : This buffer is a stereo, signed 32bit buffer (8 bytes per - * sample). The data is in integer format. - * Data written to this buffer is not clipped and passed to the output stream until the - * very end of the chain (the clip and copy unit). For this type of mixer, you dont - * have to worry about clipping becuase FSOUND does this for you. - * - FSOUND_MIXER_QUALITY_FPU / FSOUND_MIXER_QUALITY_FPU_VOLUMERAMP: This buffer is also a - * stereo, signed 32bit buffer (8 bytes per sample). This data is in floating point - * format. - * The same clip and copy rules apply here as for the above mixer. - * - Any MMX based mixer : This buffer is a stereo, signed 16bit buffer (4 bytes per sample). - * When writing to this buffer, you must make sure the result does not overflow this - * signed 16bit range. - * If you add data into to this buffer, make sure it is clipped to a signed 16bit range - * before writing it back. FSOUND only copies this data to the output stream, it does - * not clip it. - * --------------------------------------------------------------------------------------- - * Speed - * --------------------------------------------------------------------------------------- - * DSP Units are processed then and there, inside the mixing routine. Remember to make - * your process as FAST as possible, or the output device's play cursor will catch up to - * FSOUND's write cursor while your routine takes its time to complete, and make it start - * to break up. - * So basically, if it isnt fast, then FSOUND will not be able to send the data to the - * output device in time for the next mixer update, and the result will be corrupted sound. - * FSOUND_DSP_MixBuffers is available now, so if you need to mix some raw data into the output - * buffer quickly, you can use FSOUND's own optimized mixer directly to do it! - * Finally, you can see how your routine affects cpu usage, by using FSOUND_GetCPUUsage. - * The cpu usage returned by this function includes any time spent in DSP units as well. - * (this function times everything). If you are really bored, you can see how much FSOUND's - * system units take cpu-wise, by turning them on and off and seeing how they affect - * performance. - *

- * @param callbackHandler This is a reference to your DSP Unit callback, of type FSOUND_DSPCALLBACK. - * The prototype for a callback is declared in the following fashion. - * Callbacks must return a pointer to the buffer you work on, so that - * the next dsp unit can work on it. - * See the definition of FSOUND_DSPCALLBACK for more. - * @param priority Order in the priority chain. Valid numbers are 0 to 1000, 0 being - * highest priority (first), with 1000 being lowest priority (last). - * Note that FSOUNDs soundeffects mixers and copy routines are considered - * part of this DSP unit chain which you can play with. - * @return On success, a new valid DSP unit is returned. On failure, NULL is returned. - */ - public static FSoundDSPUnit FSOUND_DSP_Create(FSoundDSPCallback callbackHandler, int priority) { - FSoundDSPUnit dspUnit = null; - ByteBuffer handle = nFSOUND_DSP_Create(priority); - if(handle != null) { - ByteBuffer dspID = (ByteBuffer) BufferUtils.createByteBuffer(8).putLong(FSoundDSPUnit.getNextId()).flip(); - dspUnit= new FSoundDSPUnit(handle, dspID); - FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, dspID.getLong(0), dspUnit, callbackHandler); - } - return dspUnit; - } - private static native ByteBuffer nFSOUND_DSP_Create(int priority); - - /** - * Frees and removes a DSP unit from the DSP chain - * - * @param unit DSP unit to be freed - */ - public static void FSOUND_DSP_Free(FSoundDSPUnit unit) { - nFSOUND_DSP_Free(unit.dspHandle); - FMOD.registerCallback(FMOD.FSOUND_DSPCALLBACK, unit.dspTrackingID.get(0), unit, null); - } - private static native void nFSOUND_DSP_Free(ByteBuffer dspUnitHandle); - - /** - * Allows the user to toggle a DSP unit on or off - *

- * Remarks - * It is possible to toggle on and off FSOUNDs internal DSP units, though not recommended - *

- * @param unit DSP unit to have its active flag changed - * @param active Flag to say whether DSP unit should be rendered active or inactive. valid values are TRUE or FALSE - */ - public static void FSOUND_DSP_SetActive(FSoundDSPUnit unit, boolean active) { - nFSOUND_DSP_SetActive(unit.dspHandle, active); - } - private static native void nFSOUND_DSP_SetActive(ByteBuffer dspUnitHandle, boolean active); - - /** - * Returns if a DSP unit is active or not - *

- * Remarks - * It is possible to toggle on and off FSOUNDs internal DSP units, though not recommended - *

- * @param unit DSP unit to have its active flag returned - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_DSP_GetActive(FSoundDSPUnit unit) { - return nFSOUND_DSP_GetActive(unit.dspHandle); - } - private static native boolean nFSOUND_DSP_GetActive(ByteBuffer dspUnitHandle); - - /** - * Returns the buffer lenth passed by the DSP system to DSP unit callbacks, so you can allocate memory etc - * using this data - *

- * Remarks - * Remember this is samples not bytes. To convert to bytes you - * will have to multiply by 4 for mmx mixers, 8 for other mixers. - * (a stereo 16bit sample = 4 bytes, and a stereo 32bit sample (ie fpu) = 8 bytes) - *

- * @return The size of the DSP unit buffer in SAMPLES (not bytes) - */ - public static native int FSOUND_DSP_GetBufferLength(); - - /** - * This is the total size in samples (not bytes) of the FSOUND mix buffer. This is affected - * by FSOUND_SetBufferSize. - *

- * Remarks - * Remember this is samples not bytes. To convert to bytes you - * will have to multiply by 4 for mmx mixers, 8 for other mixers. - * (a stereo 16bit sample = 4 bytes, and a stereo 32bit sample (ie fpu) = 8 bytes) - *

- * @return The size of the FSOUND mixing buffer in SAMPLES (not bytes). - */ - public static native int FSOUND_DSP_GetBufferLengthTotal(); - - /** - * Changes a DSP Unit's priority position in the DSP chain - *

- * Remarks - * DSP units with the same priority as a previous unit already in the chain will be placed - * AFTER all like priority units - *

- * @param unit DSP unit to have its priority changed - * @param priority Order in the priority chain. Valid numbers are 0 to 1000, 0 being highest priority (first), with 1000 being lowest priority (last). - */ - public static void FSOUND_DSP_SetPriority(FSoundDSPUnit unit, int priority) { - nFSOUND_DSP_SetPriority(unit.dspHandle, priority); - } - private static native void nFSOUND_DSP_SetPriority(ByteBuffer dspUnitHandle, int priority); - - /** - * Returns the priority status in the DSP chain, of a specified unit. - *

- * Remarks - * DSP units with the same priority as a previous unit already in the chain will be placed - * AFTER all like priority units - *

- * @param unit DSP unit to get priority value from - * @return On success, the priority of the unit, from 0 to 1000. On failure, -1 is returned. - */ - public static int FSOUND_DSP_GetPriority(FSoundDSPUnit unit) { - return nFSOUND_DSP_GetPriority(unit.dspHandle); - } - private static native int nFSOUND_DSP_GetPriority(ByteBuffer dspUnitHandle); - - /** - * Returns a reference to FSOUND's system DSP clear unit - *

- * Remarks - * The FSOUND clear DSP unit simply sets the mix buffer to 0, silencing it - *

- * @return reference to the DSP unit - */ - public static FSoundDSPUnit FSOUND_DSP_GetClearUnit() { - if(FMOD.fmodClearUnit == null) { - FMOD.fmodClearUnit = new FSoundDSPUnit(nFSOUND_DSP_GetClearUnit()); - } - return FMOD.fmodClearUnit; - } - private static native ByteBuffer nFSOUND_DSP_GetClearUnit(); - - /** - * Returns a reference to FSOUND's system Clip and Copy DSP unit - *

- * Remarks - * The FSOUND ClipAndCopy DSP unit clips the 32bit buffer down to fit the soundcard's 16bit stereo output, and sends it off to the hardware. - *

- * @return reference to the DSP unit - */ - public static FSoundDSPUnit FSOUND_DSP_GetClipAndCopyUnit() { - if(FMOD.fmodClipAndCopyUnit == null) { - FMOD.fmodClipAndCopyUnit = new FSoundDSPUnit(nFSOUND_DSP_GetClipAndCopyUnit()); - } - return FMOD.fmodClipAndCopyUnit; - } - private static native ByteBuffer nFSOUND_DSP_GetClipAndCopyUnit(); - - /** - * Returns a reference to FSOUND's system DSP Music mixer unit - *

- * Remarks - * The FSOUND Music DSP executes the FMUSIC engine and mixes the sounds spawned by the music player - *

- * @return reference to the DSP unit - */ - public static FSoundDSPUnit FSOUND_DSP_GetMusicUnit() { - if(FMOD.fmodMusicUnit == null) { - FMOD.fmodMusicUnit = new FSoundDSPUnit(nFSOUND_DSP_GetMusicUnit()); - } - return FMOD.fmodMusicUnit; - } - private static native ByteBuffer nFSOUND_DSP_GetMusicUnit(); - - /** - * Returns a reference to FSOUND's system DSP SFX mixer unit - *

- * Remarks - * The FSOUND SFX DSP unit mixes sound effects together spawned by the user - *

- * @return reference to the DSP unit - */ - public static FSoundDSPUnit FSOUND_DSP_GetSFXUnit() { - if(FMOD.fmodSFXUnit == null) { - FMOD.fmodSFXUnit = new FSoundDSPUnit(nFSOUND_DSP_GetSFXUnit()); - } - return FMOD.fmodSFXUnit; - } - private static native ByteBuffer nFSOUND_DSP_GetSFXUnit(); - - /** - * Returns a reference to FSOUND's system DSP FFT processing unit - *

- * Remarks - * The FSOUND FFT DSP executes the FFT engine to allow FSOUND_DSP_GetSpectrum to be used. - * The FFT unit is off by default, due to the cpu expense incurred in running. Turn it on to use FSOUND_DSP_GetSpectrum - *

- * @return reference to the DSP unit - */ - public static FSoundDSPUnit FSOUND_DSP_GetFFTUnit() { - if(FMOD.fmodFFTUnit == null) { - FMOD.fmodFFTUnit = new FSoundDSPUnit(nFSOUND_DSP_GetFFTUnit()); - } - return FMOD.fmodFFTUnit; - } - private static native ByteBuffer nFSOUND_DSP_GetFFTUnit(); - - /** - * Function to return a FloatBuffer to the current spectrum buffer. The buffer contains 512 floating - * point values that represent each frequency band's amplitude for the current FMOD SoundSystem - * mixing buffer. The range of frequencies covered by the spectrum is 1 to the nyquist frequency - * or half of the output rate. So if the output rate is 44100, then frequencies provided are up - * to 22050. (entry 511) - *

- * Remarks - * Note that hardware sounds, MIDI, files do not register on the spectrum graph as they are not run through FMODs DSP system. - * Note that to use this you have to turn on the FSOUND FFT DSP unit. This is achieved by calling FSOUND_DSP_GetFFTUnit, then using FSOUND_DSP_SetActive to turn it on. - *

- * @return FloatBuffer containing 512 floats - */ - public static FloatBuffer FSOUND_DSP_GetSpectrum() { - return nFSOUND_DSP_GetSpectrum().order(ByteOrder.nativeOrder()).asFloatBuffer(); - } - private static native ByteBuffer nFSOUND_DSP_GetSpectrum(); - - /** - * Allows the user to mix their own data from one buffer to another, using FSOUNDs optimized - * mixer routines. This was mainly provided for DSP routines, though it can be used for - * anything. - *

- * Remarks - * 'destbuffer' should always the format of the mixing output buffer, as it will use the mixer - * currently running to do the mixing. - * For MMX it is 16bit stereo, so it is 4 bytes per output sample (word left, word right) - * For Standard Blend mode it is 32bit stereo, so it is 8 bytes per output sample (left dword, right dword) - * For FPU mixer it is 32bit float stereo, so it is 8 bytes per output sample (left float, right float) - * FSOUND_GetMixer can be used to determine which mixer is being used. - *

- * @param destbuffer Pointer to a buffer to have the data mixed into. - * @param srcbuffer Pointer to the source buffer to be mixed in. - * @param len Amount to mix in SAMPLES. - * @param freq Speed to mix data to output buffer. Remember if you mix at a rate - * different than the output rate, the buffer lengths will have to be - * different to compensate. Ie if the output rate is 44100 and you supply - * a value of 88200 to FSOUND_DSP_MixBuffers, you will only need a destbuffer - * that is half the size of srcbuffer. If you supply a value of 22050 then - * you will need a destbuffer that is twice as big as srcbuffer. If they - * are both the same size then it will only mix half of the data. - * @param vol volume scalar value of mix. Valid values are 0 (silence) to 255 - * (full volume). See FSOUND_SetVolume for more information. - * @param pan pan value for data being mixed. Valid values are 0 (full left), 128 - * (middle), 255 (full right) and FSOUND_STEREOPAN. See FSOUND_SetPan for - * more information. - * @param mode Bit settings to describe the source buffer. Valid values are found in - * FSOUND_MODES, but only 8/16bit and stereo/mono flags are interpreted, other flags are ignored. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static boolean FSOUND_DSP_MixBuffers( - ByteBuffer destbuffer, ByteBuffer srcbuffer, int len, int freq, int vol, int pan, int mode) { - return nFSOUND_DSP_MixBuffers( - destbuffer, destbuffer.position(), srcbuffer, srcbuffer.position(), len, freq, vol, pan, mode); - } - private static native boolean nFSOUND_DSP_MixBuffers( - ByteBuffer destbuffer, int destBufferOffset, ByteBuffer srcbuffer, int srcBufferOffset, - int len, int freq, int vol, int pan, int mode); - // ---------------------------------------------------------- - - // FX functions - // ========================================================== - /** - * Disables effect processing for ALL effects on the specified channel - *

- * Remarks - * FSOUND_ALL is supported. Passing this will disable fx on ALL channels available. - * This command can only be issued while the channel is paused or stopped. - *

- * - * @param channel Channel number/handle to disable all fx for - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_FX_Disable(int channel); - - /** - * Enables effect processing for the specified channel. This command continues to add effects to a channel (up to 16) until FSOUND_FX_Disable is called. - *

- * Remarks - * FSOUND_ALL is supported. Passing this will enable fx on ALL channels available. - * This command can only be issued while the channel is paused. - * If an effect is not enabled, then it will not be affected by its corresponding FSOUND_FX_Set functions. - * This function must be played after a paused PlaySoundEx (ie FSOUND_PlaySoundEx(FSOUND_FREE, sound, NULL, TRUE)), and before - * the FSOUND_SetPaused(FALSE) so that the hardware can get the resource before it starts playing. - * A total of 16 FX per channel is allowed, any more will result in an error. FX are reset to 0 after a sound is stopped or played. (but as above, before the unpausing of a play-paused sound). - * Warning : This function is expensive to call as it has to set up fx buffers etc. It is best to call it once, reserve the channel then reuse the channel index when calling playsound without calling it again. - * Note : Channels with FX enabled sounds cannot have their frequency changed. - *

- * - * @param channel Channel number/handle to disable all fx for - * @param fxtype A single fx enum value to enable certain effects. - * @return On success, an FX id is returned. On failure, -1 is returned - */ - public static native int FSOUND_FX_Enable(int channel, int fxtype); - - /** - * Sets the parameters for the chorus effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_CHORUS before using this function. - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set chorus parameters for. - * @param WetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0 through 100 (all wet). - * @param Depth Percentage by which the delay time is modulated by the low-frequency oscillator, in hundredths of a percentage point. Must be in the range from 0 through 100. The default value is 25. - * @param Feedback Percentage of output signal to feed back into the effects input, in the range from -99 to 99. The default value is 0. - * @param Frequency Frequency of the LFO, in the range from 0 to 10. The default value is 0. - * @param Waveform Waveform of the LFO. Defined values are 0 triangle. 1 sine. By default, the waveform is a sine. - * @param Delay Number of milliseconds the input is delayed before it is played back, in the range from 0 to 20. The default value is 0 ms. - * @param Phase Phase differential between left and right LFOs, in the range from 0 through 4. Possible values are defined as follows: - * 0 -180 degrees - * 1 - 90 degrees - * 2 0 degrees - * 3 90 degrees - * 4 180 degrees - * @return On success, TRUE is returned. On failure, FALSE is returned. - - */ - public static native boolean FSOUND_FX_SetChorus( - int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - - /** - * Sets the parameters for the compressor effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_COMPRESSOR before using this function - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set compressor parameters for. - * @param Gain Output gain of signal after compression, in the range from -60 to 60. The default value is 0 dB. - * @param Attack Time before compression reaches its full value, in the range from 0.01 to 500. The default value is 0.01 ms. - * @param Release Speed at which compression is stopped after input drops below fThreshold, in the range from 50 to 3000. The default value is 50 ms. - * @param Threshold Point at which compression begins, in decibels, in the range from -60 to 0. The default value is -10 dB. - * @param Ratio Compression ratio, in the range from 1 to 100. The default value is 10, which means 10:1 compression. - * @param Predelay Time after lThreshold is reached before attack phase is started, in milliseconds, in the range from 0 to 4. The default value is 0 ms. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_FX_SetCompressor( - int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); - - /** - * Sets the parameters for the distortion effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_DISTORTION before using this function - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set distortion parameters for. - * @param Gain Amount of signal change after distortion, in the range from -60 through 0. The default value is 0 dB. - * @param Edge Percentage of distortion intensity, in the range in the range from 0 through 100. The default value is 50 percent. - * @param PostEQCenterFrequency Center frequency of harmonic content addition, in the range from 100 through 8000. The default value is 4000 Hz. - * @param PostEQBandwidth Width of frequency band that determines range of harmonic content addition, in the range from 100 through 8000. The default value is 4000 Hz. - * @param PreLowpassCutoff Filter cutoff for high-frequency harmonics attenuation, in the range from 100 through 8000. The default value is 4000 Hz. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_FX_SetDistortion( - int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); - - /** - * Sets the parameters for the echo effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_Enable and FSOUND_FX_ECHO before using this function. - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set echo parameters for. - * @param WetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0 through 100 (all wet). - * @param Feedback Percentage of output fed back into input, in the range from 0 through 100. The default value is 0. - * @param LeftDelay Delay for left channel, in milliseconds, in the range from 1 through 2000. The default value is 333 ms. - * @param RightDelay Delay for right channel, in milliseconds, in the range from 1 through 2000. The default value is 333 ms. - * @param PanDelay Value that specifies whether to swap left and right delays with each successive echo. The default value is FALSE, meaning no swap. Possible values are defined as TRUE or FALSE. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_FX_SetEcho( - int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); - - /** - * Sets the parameters for the echo effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_Enable and FSOUND_FX_FLANGER before using this function. - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set flanger parameters for. - * @param WetDryMix Ratio of wet (processed) signal to dry (unprocessed) signal. Must be in the range from 0 through 100 (all wet). - * @param Depth Percentage by which the delay time is modulated by the low-frequency oscillator (LFO), in hundredths of a percentage point. Must be in the range from 0 through 100. The default value is 25. - * @param Feedback Percentage of output signal to feed back into the effects input, in the range from -99 to 99. The default value is 0. - * @param Frequency Frequency of the LFO, in the range from 0 to 10. The default value is 0. - * @param Waveform Waveform of the LFO. By default, the waveform is a sine. Possible values are defined as follows: - * 0 - Triangle. - * 1 - Sine. - * @param Delay Number of milliseconds the input is delayed before it is played back, in the range from 0 to 4. The default value is 0 ms. - * @param Phase Phase differential between left and right LFOs, in the range from 0 through 4. Possible values are defined as follows: - * 0 -180 degrees - * 1 - 90 degrees - * 2 0 degrees - * 3 90 degrees - * 4 180 degrees - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_FX_SetFlanger( - int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - - /** - * Sets the parameters for the echo effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_Enable and FSOUND_FX_GARGLE before using this function. - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set gargle parameters for. - * @param RateHz Rate of modulation, in Hertz. Must be in the range from 1 through 1000. - * @param WaveShape Shape of the modulation wave. The following values are defined. - * 0 - Triangular wave. - * 1 - Square wave. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_FX_SetGargle(int fxid, int RateHz, int WaveShape); - - /** - * Sets the parameters for the I3DL2 Reverb effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_Enable and FSOUND_FX_I3DL2REVERB before using this function. - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set I3DL2 Reverb parameters for. - * @param Room Attenuation of the room effect, in millibels (mB), in the range from -10000 to 0. The default value is -1000 mB. - * @param RoomHF Attenuation of the room high-frequency effect, in mB, in the range from -10000 to 0. The default value is 0 mB. - * @param RoomRolloffFactor Rolloff factor for the reflected signals, in the range from 0 to 10. The default value is 0.0. The rolloff factor for the direct path is controlled by the listener. - * @param DecayTime Decay time, in seconds, in the range from .1 to 20. The default value is 1.49 seconds. - * @param DecayHFRatio Ratio of the decay time at high frequencies to the decay time at low frequencies, in the range from 0.1 to 2. The default value is 0.83. - * @param Reflections Attenuation of early reflections relative to lRoom, in mB, in the range from -10000 to 1000. The default value is -2602 mB. - * @param ReflectionsDelay Delay time of the first reflection relative to the direct path, in seconds, in the range from 0 to 0.3. The default value is 0.007 seconds. - * @param Reverb Attenuation of late reverberation relative to lRoom, in mB, in the range from -10000 to 2000. The default value is 200 mB. - * @param ReverbDelay Time limit between the early reflections and the late reverberation relative to the time of the first reflection, in seconds, in the range from 0 to 0.1. The default value is 0.011 seconds. - * @param Diffusion Echo density in the late reverberation decay, in percent, in the range from 0 to 100. The default value is 100.0 percent. - * @param Density Modal density in the late reverberation decay, in percent, in the range from 0 to 100. The default value is 100.0 percent. - * @param HFReference Reference high frequency, in hertz, in the range from 20 to 20000. The default value is 5000.0 Hz. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean 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); - - /** - * Sets the parameters for the I3DL2 Reverb effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_Enable and FSOUND_FX_PARAMEQ before using this function. - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set ParamEQ parameters for. - * @param Center Center frequency, in hertz, in the range from 80 to 16000. This value cannot exceed one-third of the frequency of the buffer. Default is 8000. - * @param Bandwidth Bandwidth, in semitones, in the range from 1 to 36. Default is 12. - * @param Gain Gain, in the range from -15 to 15. Default is 0. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_FX_SetParamEQ(int fxid, float Center, float Bandwidth, float Gain); - - /** - * Sets the parameters for the Waves Reverb effect on a particular channel - *

- * Remarks - * Make sure you have enabled this effect with FSOUND_FX_Enable and FSOUND_WAVES_REVERB before using this function. - *

- * - * @param fxid fx handle generated by FSOUND_FX_Enable, to set ParamEQ parameters for. - * @param InGain Input gain of signal, in decibels (dB), in the range from -96 through 0. The default value is 0 dB. - * @param ReverbMix Reverb mix, in dB, in the range from -96 through 0. The default value is 0 dB. - * @param ReverbTime Reverb time, in milliseconds, in the range from .001 through 3000. The default value is 1000. - * @param HighFreqRTRatio In the range from .001 through .999. The default value is 0.001. - * @return On success, TRUE is returned. On failure, FALSE is returned. - */ - public static native boolean FSOUND_FX_SetWavesReverb(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); - // ---------------------------------------------------------- - - // Recording functions - // ========================================================== - /** - * Returns the currently selected recording driver number. Drivers are enumerated when selecting a driver - * with FSOUND_Record_SetDriver or other driver related functions such as FSOUND_Record_GetNumDrivers or - * FSOUND_Record_GetDriverName - * - * @return Currently selected driver id - */ - public static native int FSOUND_Record_GetDriver(); - - /** - * Returns the name of the selected recording driver. Drivers are enumerated when selecting a driver with - * FSOUND_Record_SetDriver or other driver related functions such as FSOUND_Record_GetNumDrivers or FSOUND_Record_GetDriver - * - * @param id Enumerated driver ID. This must be in a valid range delimited by FSOUND_Record_GetNumDrivers, - * @return On success, a string containing the name of the specified device is returned. - * The number of drivers enumerated can be found with FSOUND_Record_GetNumDrivers. On failure, NULL is returned - */ - public static native String FSOUND_Record_GetDriverName(int id); - - /** - * Returns the number of sound cards or devices enumerated for the current input type. (Direct - * Sound, WaveOut etc.) - * - * @return Total number of enumerated sound devices - */ - public static native int FSOUND_Record_GetNumDrivers(); - - /** - * Gets the position in the sample buffer that has been recorded to - *

- * Remarks - * Note. This is not the 'recording cursor', but rather the latest point that the input has been copied to your sample - *

- * - * @return On success, the offset in SAMPLES, for the record buffer that the input device has just written up to is returned. - * On failure (recording device hasnt been started), -1 is returned. - */ - public static native int FSOUND_Record_GetPosition(); - - /** - * Returns the name of the selected recording driver. Drivers are enumerated when selecting a driver with - * FSOUND_Record_SetDriver or other driver related functions such as FSOUND_Record_GetNumDrivers or FSOUND_Record_GetDriver - * - * @param driverno Recording driver number to select. >=0 will select the DEFAULT recording sound driver. <0 Selects other valid drivers that can be listed with FSOUND_Record_GetDriverName. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_Record_SetDriver(int driverno); - - /** - * Starts recording into a predefined sample using the sample's default playback rate as the recording rate - *

- * Remarks - * If you want to play back the sample at the same time is is recording, you will have to play the sound and try and keep it just behind the recording cursor. - * Under FSOUND_OUTPUT_OSS mode, it is single duplex, so playback will stop when recording is in progress! Try FSOUND_OUTPUT_ALSA for full duplex as they have better drivers in this respect. - * ------------- - * The recording/playback rates are slightly innacurate and are not identical (ie 44100.0 for playback, 44100.1 for recording), so one could possibly be faster or slower than the other. In this case the recording and the playback cursor could overlap, and the output will sound corrupted. - * To counter this you might adjust the playback frequency of the channel you are playing the record sample on while it plays, using FSOUND_GetCurrentPosition and FSOUND_Record_GetPosition as calibration points. - * In the recording sample there is an example of trying to play back sound as it records, and the mechanism to try and keep the 2 cursors a safe distance from each other is employed. - *

- * @param sample The sample to record into. - * @param loop TRUE or FALSE flag whether the recorder should keep recording once it has hit the end, - * and start from the start again, therefore creating a continuous recording session into that - * sample buffer. Looping the recording buffer is good for realtime processing of recorded - * information, as you can record and playback the sample at the same time. - * @return TRUE or FALSE flag whether the recorder should keep recording once it has hit the end, - * and start from the start again, therefore creating a continuous recording session into that - * sample buffer. Looping the recording buffer is good for realtime processing of recorded - * information, as you can record and playback the sample at the same time - */ - public static boolean FSOUND_Record_StartSample(FSoundSample sample, boolean loop) { - return nFSOUND_Record_StartSample(sample.sampleHandle, loop); - } - private static native boolean nFSOUND_Record_StartSample(long sampleHandle, boolean loop); - - /** - * Halts recording to the specified sample - * - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static native boolean FSOUND_Record_Stop(); - // ---------------------------------------------------------- - - // Reverb functions - // ========================================================== - /** - * Sets hardware reverb parameters for advanced tuning. - * The best way to modify these is to set everything to use pre-defined presets given in the header, and then start modifying values - *

- * Remarks - * You must be using FSOUND_OUTPUT_DSOUND as the output mode for this to work. - * In dsound, the reverb will only work if you have an EAX compatible soundcard such as the SBLive, and your sample/stream was created with the FSOUND_HW3D flag. - * For GameCube, use FSOUND_AUXFX_xxx api - *

- * @param reverb reference to a FSoundReverbProperties. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Reverb_SetProperties(FSoundReverbProperties reverb) { - return nFSOUND_Reverb_SetProperties(reverb.reverbHandle); - } - private static native boolean nFSOUND_Reverb_SetProperties(long reverbHandle); - - /** - * Returns the current hardware reverb environment. - * The best way to modify these is to set everything to use pre-defined presets given in the header, and then start modifying values - *

- * Remarks - * These values are only relevant if you are in DSOUND mode with an EAX3 compatible soundcard, or XBOX and PS2 - *

- * @param reverb reference to a FSoundReverbProperties. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Reverb_GetProperties(FSoundReverbProperties reverb) { - return nFSOUND_Reverb_GetProperties(reverb.reverbHandle); - } - private static native boolean nFSOUND_Reverb_GetProperties(long reverbHandle); - - /** - * Sets the channel specific reverb properties for hardware, including wet/dry mix (room size), and things like obstruction and occlusion properties - *

- * Remarks - * FSOUND_ALL is supported here. Passing this will set ALL channels to specified reverb properties. - * If FSOUND_ALL is used the last channel success flag will be returned. This return value not useful in most circumstances. - * ----------------- - * Under Win32, you must be using FSOUND_OUTPUT_DSOUND as the output mode for this to work. - * In DSound, the reverb will only work if you have an EAX compatible soundcard such as the SBLive, and your sample/stream was created with the FSOUND_HW3D flag. - * ----------------- - * On PlayStation2, the 'Room' parameter is the only parameter supported. The hardware only allows 'on' or 'off', so the reverb will be off when 'Room' is -10000 and on for every other value. - * ----------------- - * On XBox, it is possible to apply reverb to 2d voices using this function. By default reverb is turned off for 2d voices. - * If this 2d voice was being positioned in a 5.1 array with the xbox only function FSOUND_SetLevels, then calling this function will disable that capability in favour of enabling reverb for the 2d voice. - * It is a limitation of the xbox hardware that only one of the other of these features can be executed at one time. - *

- * @param channel The channel to have its reverb properties changed. FSOUND_ALL can also be used (see remarks) - * @param reverb reference to a FSoundReverbChannelProperties. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Reverb_SetChannelProperties(int channel, FSoundReverbChannelProperties reverb) { - return nFSOUND_Reverb_SetChannelProperties(channel, reverb.reverbHandle); - } - private static native boolean nFSOUND_Reverb_SetChannelProperties(int channel, long reverbHandle); - - /** - * This function gets the current reverb properties for this channel - * @param channel The channel to have its reverb mix returned - * @param reverb reference to a FSoundReverbChannelProperties. - * @return On success, TRUE is returned. On failure, FALSE is returned - */ - public static boolean FSOUND_Reverb_GetChannelProperties(int channel, FSoundReverbChannelProperties reverb) { - return nFSOUND_Reverb_GetChannelProperties(channel, reverb.reverbHandle); - } - private static native boolean nFSOUND_Reverb_GetChannelProperties(int channel, long reverbHandle); - // ---------------------------------------------------------- - - // Callbacks - // ========================================================== - /** - * 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 - */ - private static ByteBuffer dsp_callback(long dsp_id, ByteBuffer originalbuffer, ByteBuffer newbuffer, int length) { - // we got a callback - notify everybody - ArrayList handlers = FMOD.getCallbacks(FMOD.FSOUND_DSPCALLBACK, dsp_id); - FMOD.WrappedCallback wCallback = (FMOD.WrappedCallback) handlers.get((int)0); - FSoundDSPCallback callback = (FSoundDSPCallback) wCallback.callback; - return callback.FSOUND_DSPCALLBACK(originalbuffer, newbuffer, length); - } - - /** - * 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 - */ - private static void stream_callback(long streamHandle, ByteBuffer buff, int length) { - // we got a callback - notify everybody - ArrayList handlers = FMOD.getCallbacks(FMOD.FSOUND_STREAMCALLBACK, streamHandle); - for(int i=0; i - * @author Brian Matzon - * @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++; - } -} diff --git a/src/java/org/lwjgl/fmod3/FSoundReverbChannelProperties.java b/src/java/org/lwjgl/fmod3/FSoundReverbChannelProperties.java deleted file mode 100644 index bd9c0e59..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundReverbChannelProperties.java +++ /dev/null @@ -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. - *
- * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/fmod3/FSoundReverbProperties.java b/src/java/org/lwjgl/fmod3/FSoundReverbProperties.java deleted file mode 100644 index 4dc8ff1f..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundReverbProperties.java +++ /dev/null @@ -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. - *
- * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/fmod3/FSoundSample.java b/src/java/org/lwjgl/fmod3/FSoundSample.java deleted file mode 100644 index ad7ee2cd..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundSample.java +++ /dev/null @@ -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. - *
- * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/fmod3/FSoundSampleLock.java b/src/java/org/lwjgl/fmod3/FSoundSampleLock.java deleted file mode 100644 index 43eed217..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundSampleLock.java +++ /dev/null @@ -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; - -/** - *
- * @author Brian Matzon - * @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; - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/fmod3/FSoundStream.java b/src/java/org/lwjgl/fmod3/FSoundStream.java deleted file mode 100644 index 6669d1d0..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundStream.java +++ /dev/null @@ -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. - *
- * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/fmod3/FSoundSyncPoint.java b/src/java/org/lwjgl/fmod3/FSoundSyncPoint.java deleted file mode 100644 index 8d5be556..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundSyncPoint.java +++ /dev/null @@ -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. - *
- * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/fmod3/FSoundTagField.java b/src/java/org/lwjgl/fmod3/FSoundTagField.java deleted file mode 100644 index 90d74a00..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundTagField.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @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 trimmed string - */ - public String getValueAsString() { - byte[] buffer = new byte[value.capacity()]; - value.get(buffer); - value.rewind(); - return new String(buffer).trim(); - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/fmod3/FSoundTocTag.java b/src/java/org/lwjgl/fmod3/FSoundTocTag.java deleted file mode 100644 index bfee9668..00000000 --- a/src/java/org/lwjgl/fmod3/FSoundTocTag.java +++ /dev/null @@ -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. - *
- * @author Brian Matzon - * @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; - } -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FMusicCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FMusicCallback.java deleted file mode 100644 index 95eb7683..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FMusicCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FMusicCallback { - public void FMUSIC_CALLBACK(FMusicModule module, int param); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundCloseCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundCloseCallback.java deleted file mode 100644 index a2c4c56f..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundCloseCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundCloseCallback { - public void FSOUND_CLOSECALLBACK(int handle); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundDSPCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundDSPCallback.java deleted file mode 100644 index e03108f4..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundDSPCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundDSPCallback { - - /** - * - * @param originalbuffer - * @param newbuffer - * @param length - * @return - */ - public ByteBuffer FSOUND_DSPCALLBACK(ByteBuffer originalbuffer, ByteBuffer newbuffer, int length); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundMetaDataCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundMetaDataCallback.java deleted file mode 100644 index 56e8b3d7..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundMetaDataCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundMetaDataCallback { - public void FSOUND_METADATACALLBACK(ByteBuffer name, ByteBuffer value); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundOpenCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundOpenCallback.java deleted file mode 100644 index 5d6d75e8..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundOpenCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundOpenCallback { - public int FSOUND_OPENCALLBACK(String name); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundReadCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundReadCallback.java deleted file mode 100644 index 297d3636..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundReadCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundReadCallback { - public int FSOUND_READCALLBACK(ByteBuffer buffer, int size, int handle); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundSeekCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundSeekCallback.java deleted file mode 100644 index 36b11ba1..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundSeekCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundSeekCallback { - public int FSOUND_SEEKCALLBACK(int handle, int pos, int mode); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundStreamCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundStreamCallback.java deleted file mode 100644 index 8ddc6e0f..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundStreamCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundStreamCallback { - public void FSOUND_STREAMCALLBACK(FSoundStream stream, ByteBuffer buff, int len); -} diff --git a/src/java/org/lwjgl/fmod3/callbacks/FSoundTellCallback.java b/src/java/org/lwjgl/fmod3/callbacks/FSoundTellCallback.java deleted file mode 100644 index c33cbefb..00000000 --- a/src/java/org/lwjgl/fmod3/callbacks/FSoundTellCallback.java +++ /dev/null @@ -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 - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public interface FSoundTellCallback { - public int FSOUND_TELLCALLBACK(int handle); -} diff --git a/src/java/org/lwjgl/test/applet/Optional.java b/src/java/org/lwjgl/test/applet/Optional.java deleted file mode 100644 index 0a0c1df3..00000000 --- a/src/java/org/lwjgl/test/applet/Optional.java +++ /dev/null @@ -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; - } -} diff --git a/src/java/org/lwjgl/test/devil/BasicTest.java b/src/java/org/lwjgl/test/devil/BasicTest.java deleted file mode 100644 index ce7f9242..00000000 --- a/src/java/org/lwjgl/test/devil/BasicTest.java +++ /dev/null @@ -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; - -/** - *

The core DevIL and ILU API.

- * - * @author Mark Bernard - * @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); - } -} diff --git a/src/java/org/lwjgl/test/fmod3/CDDAPlayer.java b/src/java/org/lwjgl/test/fmod3/CDDAPlayer.java deleted file mode 100644 index 45ad55fa..00000000 --- a/src/java/org/lwjgl/test/fmod3/CDDAPlayer.java +++ /dev/null @@ -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; - -/** - *
- * @author Brian Matzon - * @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 \":\""); - System.out.println("2: FSOUND_Stream_Open \":?\""); - System.out.println("3: FSOUND_Stream_Open \":!\""); - System.out.println("4: FSOUND_Stream_SetSubStream "); - 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); - } - - -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/CDPlayer.java b/src/java/org/lwjgl/test/fmod3/CDPlayer.java deleted file mode 100644 index 9f61a4dd..00000000 --- a/src/java/org/lwjgl/test/fmod3/CDPlayer.java +++ /dev/null @@ -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; - -/** - *
- * @author Brian Matzon - * @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 "); - System.out.println("2: FSOUND_CD_Play "); - System.out.println("3: FSOUND_CD_Stop "); - System.out.println("4: FSOUND_CD_GetNumTracks "); - System.out.println("5: FSOUND_CD_GetPaused "); - System.out.println("6: FSOUND_CD_GetTrack "); - System.out.println("7: FSOUND_CD_GetTrackLength "); - System.out.println("8: FSOUND_CD_GetTrackTime "); - System.out.println("9: FSOUND_CD_SetPaused "); - System.out.println("10: FSOUND_CD_SetPlayMode "); - System.out.println("11: FSOUND_CD_SetTrackTime "); - System.out.println("12: FSOUND_CD_SetVolume "); - 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); - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/DSPTest.java b/src/java/org/lwjgl/test/fmod3/DSPTest.java deleted file mode 100644 index 1140fa16..00000000 --- a/src/java/org/lwjgl/test/fmod3/DSPTest.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$
- */ -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 "); - - // 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; - } - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/MusicPlayer.java b/src/java/org/lwjgl/test/fmod3/MusicPlayer.java deleted file mode 100644 index c7c0c4a2..00000000 --- a/src/java/org/lwjgl/test/fmod3/MusicPlayer.java +++ /dev/null @@ -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; - -/** - *
- * @author Brian Matzon - * @version $Revision$ - * $Id$ - */ -public class MusicPlayer { - - public static void main(String[] args) { - if (args.length < 1) { - System.out.println("Usage:\n MusicPlayer "); - - // 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); - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/MusicPlayerMemory.java b/src/java/org/lwjgl/test/fmod3/MusicPlayerMemory.java deleted file mode 100644 index 6d6cd944..00000000 --- a/src/java/org/lwjgl/test/fmod3/MusicPlayerMemory.java +++ /dev/null @@ -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; - -/** - *
- * @author Brian Matzon - * @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 "); - - // 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; - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/NetTest.java b/src/java/org/lwjgl/test/fmod3/NetTest.java deleted file mode 100644 index 24541e5d..00000000 --- a/src/java/org/lwjgl/test/fmod3/NetTest.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$
- */ -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 - * @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); - } - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/StreamPlayer.java b/src/java/org/lwjgl/test/fmod3/StreamPlayer.java deleted file mode 100644 index 8f6778f3..00000000 --- a/src/java/org/lwjgl/test/fmod3/StreamPlayer.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$
- */ -public class StreamPlayer { - - public static void main(String[] args) { - if (args.length < 1) { - System.out.println("Usage:\n StreamPlayer "); - - // 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); - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/StreamPlayerMemory.java b/src/java/org/lwjgl/test/fmod3/StreamPlayerMemory.java deleted file mode 100644 index 773fdd13..00000000 --- a/src/java/org/lwjgl/test/fmod3/StreamPlayerMemory.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$
- */ -public class StreamPlayerMemory { - - public static void main(String[] args) { - if (args.length < 1) { - System.out.println("Usage:\n StreamPlayerMemory "); - - // 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; - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/StreamTest.java b/src/java/org/lwjgl/test/fmod3/StreamTest.java deleted file mode 100644 index 93d29202..00000000 --- a/src/java/org/lwjgl/test/fmod3/StreamTest.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$
- */ -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(); - } -} \ No newline at end of file diff --git a/src/java/org/lwjgl/test/fmod3/SyncTest.java b/src/java/org/lwjgl/test/fmod3/SyncTest.java deleted file mode 100644 index 8dfafe01..00000000 --- a/src/java/org/lwjgl/test/fmod3/SyncTest.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$
- */ -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 "); - - // 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); - } -} diff --git a/src/java/org/lwjgl/test/fmod3/TagFieldTest.java b/src/java/org/lwjgl/test/fmod3/TagFieldTest.java deleted file mode 100644 index 9c86ab79..00000000 --- a/src/java/org/lwjgl/test/fmod3/TagFieldTest.java +++ /dev/null @@ -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 - * @version $Revision$ - * $Id$
- */ -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 "); - - // 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); - } - } -} \ No newline at end of file diff --git a/src/native/common/devil/Makefile.linux b/src/native/common/devil/Makefile.linux deleted file mode 100644 index 03e41b5e..00000000 --- a/src/native/common/devil/Makefile.linux +++ /dev/null @@ -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) diff --git a/src/native/common/devil/Makefile.macosx b/src/native/common/devil/Makefile.macosx deleted file mode 100644 index f58b7fd0..00000000 --- a/src/native/common/devil/Makefile.macosx +++ /dev/null @@ -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) diff --git a/src/native/common/devil/devil-common.h b/src/native/common/devil/devil-common.h deleted file mode 100644 index e402af18..00000000 --- a/src/native/common/devil/devil-common.h +++ /dev/null @@ -1,147 +0,0 @@ -#ifndef __DEVIL_COMMON_H__ -#define __DEVIL_COMMON_H__ - -#include -#include -#include -#include "common_tools.h" - -#ifdef _X11 -#include -#endif - -/*-----------------------------------------*/ -typedef unsigned int GLuint; - -#ifdef _UNICODE - #ifndef _WIN32_WCE - #include - #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 and -#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 -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif - -#endif /* __EXTIL_H__ */ - diff --git a/src/native/common/devil/extil.c b/src/native/common/devil/extil.c deleted file mode 100644 index 7e5edad5..00000000 --- a/src/native/common/devil/extil.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Handle to devil Library */ -#ifdef _WIN32 - #include "extil.h" - static HMODULE devILhandle; -#else - #include - #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;iGetObjectArrayElement(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; -} - diff --git a/src/native/common/devil/extil.h b/src/native/common/devil/extil.h deleted file mode 100644 index b88c4556..00000000 --- a/src/native/common/devil/extil.h +++ /dev/null @@ -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 - diff --git a/src/native/common/devil/extilu.c b/src/native/common/devil/extilu.c deleted file mode 100644 index 31a68c64..00000000 --- a/src/native/common/devil/extilu.c +++ /dev/null @@ -1,104 +0,0 @@ -/* Handle to ilu Library */ -#ifdef _WIN32 - #include "extilu.h" - static HMODULE devILUhandle; -#else - #include - #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;iGetObjectArrayElement(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; -} diff --git a/src/native/common/devil/extilu.h b/src/native/common/devil/extilu.h deleted file mode 100644 index e01e46f4..00000000 --- a/src/native/common/devil/extilu.h +++ /dev/null @@ -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 - diff --git a/src/native/common/devil/extilut.c b/src/native/common/devil/extilut.c deleted file mode 100644 index 7df964b3..00000000 --- a/src/native/common/devil/extilut.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Handle to ilut Library */ -#ifdef _WIN32 - #include "extilut.h" - static HMODULE devILUThandle; -#else - #include - #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;iGetObjectArrayElement(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; -} - diff --git a/src/native/common/devil/extilut.h b/src/native/common/devil/extilut.h deleted file mode 100644 index 382aeca3..00000000 --- a/src/native/common/devil/extilut.h +++ /dev/null @@ -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 - diff --git a/src/native/common/devil/org_lwjgl_devil_IL.c b/src/native/common/devil/org_lwjgl_devil_IL.c deleted file mode 100644 index 2f9e27de..00000000 --- a/src/native/common/devil/org_lwjgl_devil_IL.c +++ /dev/null @@ -1,1002 +0,0 @@ -#include "extil.h" -#include "org_lwjgl_devil_ILNative.h" - -typedef ILboolean (ILAPIENTRY *ilActiveImagePROC) (ILuint Number); -typedef ILboolean (ILAPIENTRY *ilActiveLayerPROC) (ILuint Number); -typedef ILboolean (ILAPIENTRY *ilActiveMipmapPROC) (ILuint Number); -typedef ILboolean (ILAPIENTRY *ilApplyPalPROC) (const ILstring FileName); -typedef ILboolean (ILAPIENTRY *ilApplyProfilePROC) (const ILstring InProfile, const ILstring OutProfile); -typedef ILvoid (ILAPIENTRY *ilBindImagePROC) (ILuint Image); -typedef ILboolean (ILAPIENTRY *ilBlitPROC) (ILuint Source, ILint DestX, ILint DestY, ILint DestZ, ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width, ILuint Height, ILuint Depth); -typedef ILvoid (ILAPIENTRY *ilClearColourPROC) (ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); -typedef ILboolean (ILAPIENTRY *ilClearImagePROC) (ILvoid); -typedef ILuint (ILAPIENTRY *ilCloneCurImagePROC) (ILvoid); -typedef ILboolean (ILAPIENTRY *ilCompressFuncPROC) (ILenum Mode); -typedef ILboolean (ILAPIENTRY *ilConvertImagePROC) (ILenum DestFormat, ILenum DestType); -typedef ILboolean (ILAPIENTRY *ilConvertPalPROC) (ILenum DestFormat); -typedef ILboolean (ILAPIENTRY *ilCopyImagePROC) (ILuint Src); -typedef ILuint (ILAPIENTRY *ilCopyPixelsPROC) (ILuint XOff, ILuint YOff, ILuint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data); -typedef ILuint (ILAPIENTRY *ilCreateSubImagePROC) (ILenum Type, ILuint Num); -typedef ILboolean (ILAPIENTRY *ilDefaultImagePROC) (ILvoid); -typedef ILvoid (ILAPIENTRY *ilDeleteImagesPROC) (ILsizei Num, const ILuint *Images); -typedef ILboolean (ILAPIENTRY *ilDisablePROC) (ILenum Mode); -typedef ILboolean (ILAPIENTRY *ilEnablePROC) (ILenum Mode); -typedef ILboolean (ILAPIENTRY *ilFormatFuncPROC) (ILenum Mode); -typedef ILvoid (ILAPIENTRY *ilGenImagesPROC) (ILsizei Num, ILuint *Images); -typedef ILubyte* (ILAPIENTRY *ilGetAlphaPROC) (ILenum Type); -typedef ILvoid (ILAPIENTRY *ilModAlphaPROC) ( ILint AlphaValue ); -typedef ILvoid (ILAPIENTRY *ilSetAlphaPROC) ( ILuint AlphaValue ); -typedef ILboolean (ILAPIENTRY *ilGetBooleanPROC) (ILenum Mode); -typedef ILvoid (ILAPIENTRY *ilGetBooleanvPROC) (ILenum Mode, ILboolean *Param); -typedef ILubyte* (ILAPIENTRY *ilGetDataPROC) (ILvoid); -typedef ILenum (ILAPIENTRY *ilGetErrorPROC) (ILvoid); -typedef ILint (ILAPIENTRY *ilGetIntegerPROC) (ILenum Mode); -typedef ILvoid (ILAPIENTRY *ilGetIntegervPROC) (ILenum Mode, ILint *Param); -typedef ILuint (ILAPIENTRY *ilGetLumpPosPROC) (ILvoid); -typedef ILubyte* (ILAPIENTRY *ilGetPalettePROC) (ILvoid); -typedef const ILstring (ILAPIENTRY *ilGetStringPROC) (ILenum StringName); -typedef ILvoid (ILAPIENTRY *ilHintPROC) (ILenum Target, ILenum Mode); -typedef ILvoid (ILAPIENTRY *ilInitPROC) (ILvoid); -typedef ILboolean (ILAPIENTRY *ilIsDisabledPROC) (ILenum Mode); -typedef ILboolean (ILAPIENTRY *ilIsEnabledPROC) (ILenum Mode); -typedef ILboolean (ILAPIENTRY *ilIsImagePROC) (ILuint Image); -typedef ILboolean (ILAPIENTRY *ilIsValidPROC) (ILenum Type, const ILstring FileName); -typedef ILboolean (ILAPIENTRY *ilIsValidLPROC) (ILenum Type, ILvoid *Lump, ILuint Size); -typedef ILvoid (ILAPIENTRY *ilKeyColourPROC) (ILclampf Red, ILclampf Green, ILclampf Blue, ILclampf Alpha); -typedef ILboolean (ILAPIENTRY *ilLoadPROC) (ILenum Type, const ILstring FileName); -typedef ILboolean (ILAPIENTRY *ilLoadImagePROC) (const ILstring FileName); -typedef ILboolean (ILAPIENTRY *ilLoadLPROC) (ILenum Type, ILvoid *Lump, ILuint Size); -typedef ILboolean (ILAPIENTRY *ilLoadPalPROC) (const ILstring FileName); -typedef ILboolean (ILAPIENTRY *ilOriginFuncPROC) (ILenum Mode); -typedef ILboolean (ILAPIENTRY *ilOverlayImagePROC) (ILuint Source, ILint XCoord, ILint YCoord, ILint ZCoord); -typedef ILvoid (ILAPIENTRY *ilPopAttribPROC) (ILvoid); -typedef ILvoid (ILAPIENTRY *ilPushAttribPROC) (ILuint Bits); -typedef ILboolean (ILAPIENTRY *ilRemoveLoadPROC) (const ILstring Ext); -typedef ILboolean (ILAPIENTRY *ilRemoveSavePROC) (const ILstring Ext); -typedef ILvoid (ILAPIENTRY *ilResetMemoryPROC) (ILvoid); -typedef ILvoid (ILAPIENTRY *ilResetReadPROC) (ILvoid); -typedef ILvoid (ILAPIENTRY *ilResetWritePROC) (ILvoid); -typedef ILboolean (ILAPIENTRY *ilSavePROC) (ILenum Type, const ILstring FileName); -typedef ILboolean (ILAPIENTRY *ilSaveImagePROC) (const ILstring FileName); -typedef ILuint (ILAPIENTRY *ilSaveLPROC) (ILenum Type, ILvoid *Lump, ILuint Size); -typedef ILboolean (ILAPIENTRY *ilSavePalPROC) (const ILstring FileName); -typedef ILboolean (ILAPIENTRY *ilSetDataPROC) (ILvoid *Data); -typedef ILboolean (ILAPIENTRY *ilSetDurationPROC) (ILuint Duration); -typedef ILvoid (ILAPIENTRY *ilSetIntegerPROC) (ILenum Mode, ILint Param); -typedef ILvoid (ILAPIENTRY *ilSetPixelsPROC) (ILint XOff, ILint YOff, ILint ZOff, ILuint Width, ILuint Height, ILuint Depth, ILenum Format, ILenum Type, ILvoid *Data); -typedef ILvoid (ILAPIENTRY *ilSetStringPROC) (ILenum Mode, const char *String); -typedef ILvoid (ILAPIENTRY *ilShutDownPROC) (ILvoid); -typedef ILboolean (ILAPIENTRY *ilTexImagePROC) (ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp, ILenum Format, ILenum Type, ILvoid *Data); -typedef ILboolean (ILAPIENTRY *ilTypeFuncPROC) (ILenum Mode); -typedef ILboolean (ILAPIENTRY *ilLoadDataPROC) (const ILstring FileName, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); -typedef ILboolean (ILAPIENTRY *ilLoadDataFPROC) (ILHANDLE File, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); -typedef ILboolean (ILAPIENTRY *ilLoadDataLPROC) (ILvoid *Lump, ILuint Size, ILuint Width, ILuint Height, ILuint Depth, ILubyte Bpp); -typedef ILboolean (ILAPIENTRY *ilSaveDataPROC) (const ILstring FileName); - -// not bound -//typedef ILuint (ILAPIENTRY *ilGetDXTCDataPROC) (ILvoid *Buffer, ILuint BufferSize, ILenum DXTCFormat); -//typedef ILboolean (ILAPIENTRY *ilIsValidFPROC) (ILenum Type, ILHANDLE File); -//typedef ILboolean (ILAPIENTRY *ilLoadFPROC) (ILenum Type, ILHANDLE File); -//typedef ILvoid (ILAPIENTRY *ilRegisterFormatPROC) (ILenum Format); -//typedef ILboolean (ILAPIENTRY *ilRegisterLoadPROC) (const ILstring Ext, IL_LOADPROC Load); -//typedef ILboolean (ILAPIENTRY *ilRegisterMipNumPROC) (ILuint Num); -//typedef ILboolean (ILAPIENTRY *ilRegisterNumImagesPROC) (ILuint Num); -//typedef ILvoid (ILAPIENTRY *ilRegisterOriginPROC) (ILenum Origin); -//typedef ILvoid (ILAPIENTRY *ilRegisterPalPROC) (ILvoid *Pal, ILuint Size, ILenum Type); -//typedef ILboolean (ILAPIENTRY *ilRegisterSavePROC) (const ILstring Ext, IL_SAVEPROC Save); -//typedef ILvoid (ILAPIENTRY *ilRegisterTypePROC) (ILenum Type); -//typedef ILuint (ILAPIENTRY *ilSaveFPROC) (ILenum Type, ILHANDLE File); -//typedef ILvoid (ILAPIENTRY *ilSetMemoryPROC) (mAlloc AllocFunc, mFree FreeFunc); -//typedef ILvoid (ILAPIENTRY *ilSetReadPROC) (fOpenRProc Open, fCloseRProc Close, fEofProc Eof, fGetcProc Getc, fReadProc Read, fSeekRProc Seek, fTellRProc Tell); -//typedef ILvoid (ILAPIENTRY *ilSetWritePROC) (fOpenWProc Open, fCloseWProc Close, fPutcProc Putc, fSeekWProc Seek, fTellWProc Tell, fWriteProc Write); - - -static ilActiveImagePROC ilActiveImage; -static ilActiveLayerPROC ilActiveLayer; -static ilActiveMipmapPROC ilActiveMipmap; -static ilApplyPalPROC ilApplyPal; -static ilApplyProfilePROC ilApplyProfile; -static ilBindImagePROC ilBindImage; -static ilBlitPROC ilBlit; -static ilClearColourPROC ilClearColour; -static ilClearImagePROC ilClearImage; -static ilCloneCurImagePROC ilCloneCurImage; -static ilCompressFuncPROC ilCompressFunc; -static ilConvertImagePROC ilConvertImage; -static ilConvertPalPROC ilConvertPal; -static ilCopyImagePROC ilCopyImage; -static ilCopyPixelsPROC ilCopyPixels; -static ilCreateSubImagePROC ilCreateSubImage; -static ilDefaultImagePROC ilDefaultImage; -static ilDeleteImagesPROC ilDeleteImages; -static ilDisablePROC ilDisable; -static ilEnablePROC ilEnable; -static ilFormatFuncPROC ilFormatFunc; -static ilGenImagesPROC ilGenImages; -static ilGetAlphaPROC ilGetAlpha; -static ilModAlphaPROC ilModAlpha; -static ilSetAlphaPROC ilSetAlpha; -static ilGetBooleanPROC ilGetBoolean; -static ilGetBooleanvPROC ilGetBooleanv; -static ilGetDataPROC ilGetData; -static ilGetErrorPROC ilGetError; -static ilGetIntegerPROC ilGetInteger; -static ilGetIntegervPROC ilGetIntegerv; -static ilGetLumpPosPROC ilGetLumpPos; -static ilGetPalettePROC ilGetPalette; -static ilGetStringPROC ilGetString; -static ilHintPROC ilHint; -static ilInitPROC ilInit; -static ilIsDisabledPROC ilIsDisabled; -static ilIsEnabledPROC ilIsEnabled; -static ilIsImagePROC ilIsImage; -static ilIsValidPROC ilIsValid; -static ilIsValidLPROC ilIsValidL; -static ilKeyColourPROC ilKeyColour; -static ilLoadPROC ilLoad; -static ilLoadImagePROC ilLoadImage; -static ilLoadLPROC ilLoadL; -static ilLoadPalPROC ilLoadPal; -static ilOriginFuncPROC ilOriginFunc; -static ilOverlayImagePROC ilOverlayImage; -static ilPopAttribPROC ilPopAttrib; -static ilPushAttribPROC ilPushAttrib; -static ilRemoveLoadPROC ilRemoveLoad; -static ilRemoveSavePROC ilRemoveSave; -static ilResetMemoryPROC ilResetMemory; -static ilResetReadPROC ilResetRead; -static ilResetWritePROC ilResetWrite; -static ilSavePROC ilSave; -static ilSaveImagePROC ilSaveImage; -static ilSaveLPROC ilSaveL; -static ilSavePalPROC ilSavePal; -static ilSetDataPROC ilSetData; -static ilSetDurationPROC ilSetDuration; -static ilSetIntegerPROC ilSetInteger; -static ilSetPixelsPROC ilSetPixels; -static ilSetStringPROC ilSetString; -static ilShutDownPROC ilShutDown; -static ilTexImagePROC ilTexImage; -static ilTypeFuncPROC ilTypeFunc; -static ilLoadDataPROC ilLoadData; -static ilLoadDataLPROC ilLoadDataL; -static ilSaveDataPROC ilSaveData; - -// not bound -//static ilGetDXTCDataPROC ilGetDXTCData; -//static ilIsValidFPROC ilIsValidF; -//static ilLoadFPROC ilLoadF; -//static ilRegisterFormatPROC ilRegisterFormat; -//static ilRegisterLoadPROC ilRegisterLoad; -//static ilRegisterMipNumPROC ilRegisterMipNum; -//static ilRegisterNumImagesPROC ilRegisterNumImages; -//static ilRegisterOriginPROC ilRegisterOrigin; -//static ilRegisterPalPROC ilRegisterPal; -//static ilRegisterSavePROC ilRegisterSave; -//static ilRegisterTypePROC ilRegisterType; -//static ilSaveFPROC ilSaveF; -//static ilSetMemoryPROC ilSetMemory; -//static ilSetReadPROC ilSetRead; -//static ilSetWritePROC ilSetWrite; -//static ilLoadDataFPROC ilLoadDataF; - -/* - * Class: org_lwjgl_devil_IL - * Method: ilActiveImage - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilActiveImage(JNIEnv *env, jclass clazz, jint number) { - return ilActiveImage((ILuint)number); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilActiveLayer - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilActiveLayer(JNIEnv *env, jclass clazz, jint number) { - return ilActiveLayer((ILuint)number); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilActiveMipmap - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilActiveMipmap(JNIEnv *env, jclass clazz, jint number) { - return ilActiveMipmap((ILuint)number); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilApplyPal - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilApplyPal(JNIEnv *env, jclass clazz, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilApplyPal((const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilApplyProfile - * Signature: (Ljava/lang/String;Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilApplyProfile(JNIEnv *env, jclass clazz, jstring inProfile, jstring outProfile) { - char *strInProfile = GetStringNativeChars(env, inProfile); - char *strOutProfile = GetStringNativeChars(env, outProfile); - jboolean result = ilApplyProfile((const ILstring)strInProfile, (const ILstring)strOutProfile); - free(strInProfile); - free(strOutProfile); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilBindImage - * Signature: (I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilBindImage(JNIEnv *env, jclass clazz, jint image) { - ilBindImage(image); -} - - -/* - * Class: org_lwjgl_devil_IL - * Method: ilBlit - * Signature: (IIIIIIIIII)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilBlit(JNIEnv *env, jclass clazz, jint source, jint destX, jint destY, jint destZ, jint srcX, jint srcY, jint srcZ, jint width, jint height, jint depth) { - return ilBlit((ILuint)source, (ILint)destX, (ILint)destY, (ILint)destZ, (ILuint)srcX, (ILuint)srcY, (ILuint)srcZ, (ILuint)width, (ILuint)height, (ILuint)depth); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilClearColour - * Signature: (FFFF)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilClearColour(JNIEnv *env, jclass clazz, jfloat red, jfloat green, jfloat blue, jfloat alpha) { - ilClearColour((ILclampf)red, (ILclampf)green, (ILclampf)blue, (ILclampf)alpha); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilClearImage - * Signature: ()Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilClearImage(JNIEnv *env, jclass clazz) { - return ilClearImage(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilCloneCurImage - * Signature: ()I - */ -static jint JNICALL Java_org_lwjgl_devil_IL_ilCloneCurImage(JNIEnv *env, jclass clazz) { - return ilCloneCurImage(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilCompressFunc - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilCompressFunc(JNIEnv *env, jclass clazz, jint mode) { - return ilCompressFunc((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilConvertImage - * Signature: (II)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilConvertImage(JNIEnv *env, jclass clazz, jint destFormat, jint destType) { - return ilConvertImage((ILenum)destFormat, (ILenum)destType); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilConvertPal - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilConvertPal(JNIEnv *env, jclass clazz, jint destFormat) { - return ilConvertPal((ILenum)destFormat); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilCopyImage - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilCopyImage(JNIEnv *env, jclass clazz, jint src) { - return ilCopyImage((ILuint)src); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilCopyPixels - * Signature: (IIIIIIIILjava/nio/ByteBuffer;I)I - */ -static jint JNICALL Java_org_lwjgl_devil_IL_nilCopyPixels(JNIEnv *env, jclass clazz, jint xOff, jint yOff, jint zOff, jint width, jint height, jint depth, jint format, jint type, jobject data_buffer, jint data_offset) { - ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); - - return ilCopyPixels((ILuint)xOff, (ILuint)yOff, (ILuint)zOff, (ILuint)width, (ILuint)height, (ILuint)depth, (ILenum)format, (ILenum)type, (ILvoid *)(data + data_offset)); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilCreateSubImage - * Signature: (II)I - */ -static jint JNICALL Java_org_lwjgl_devil_IL_ilCreateSubImage(JNIEnv *env, jclass clazz, jint type, jint num) { - return ilCreateSubImage((ILenum)type, (ILuint)num); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilDefaultImage - * Signature: ()Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilDefaultImage(JNIEnv *env, jclass clazz) { - return ilDefaultImage(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilDeleteImages - * Signature: (ILjava/nio/IntBuffer;I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_nilDeleteImages(JNIEnv * env, jclass clazz, jint num, jobject lists_buffer, jint lists_offset) { - ILbyte *lists = (ILbyte *) safeGetBufferAddress(env, lists_buffer) + lists_offset; - ilDeleteImages((ILsizei)num, (ILuint *)lists); -} - - -/* - * Class: org_lwjgl_devil_IL - * Method: ilDisable - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilDisable(JNIEnv *env, jclass clazz, jint mode) { - return ilDisable((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilEnable - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilEnable(JNIEnv *env, jclass clazz, jint mode) { - return ilEnable((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilFormatFunc - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilFormatFunc(JNIEnv *env, jclass clazz, jint mode) { - return ilFormatFunc((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilGenImages - * Signature: (ILjava/nio/IntBuffer;I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_nilGenImages(JNIEnv *env , jclass clazz, jint num, jobject lists_buffer, jint lists_offset) { - ILbyte *lists = (ILbyte *) safeGetBufferAddress(env, lists_buffer) + lists_offset; - ilGenImages((ILsizei)num, (ILuint *)lists); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetAlpha - * Signature: (I)[B - */ -static jobject JNICALL Java_org_lwjgl_devil_IL_ilGetAlpha(JNIEnv *env, jclass clazz, jint type) { - ILubyte *alpha = ilGetAlpha((ILenum)type); - - int size = sizeof(alpha); - jobject result = safeNewBuffer(env, alpha, size); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilModAlpha - * Signature: (I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilModAlpha(JNIEnv *env, jclass clazz, jint alphaValue) { - ilModAlpha((ILint)alphaValue); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSetAlpha - * Signature: (I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilSetAlpha(JNIEnv *env, jclass clazz, jint alphaValue) { - ilSetAlpha((ILuint)alphaValue); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetBoolean - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilGetBoolean(JNIEnv *env, jclass clazz, jint mode) { - return ilGetBoolean((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilGetBooleanv - * Signature: (ILjava/nio/ByteBuffer;I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_nilGetBooleanv(JNIEnv *env, jclass clazz, jint mode, jobject param, jint param_offset) { - ILboolean *nParam = (ILboolean *) safeGetBufferAddress(env, param) + param_offset; - ilGetBooleanv(mode, nParam); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilGetIntegerv - * Signature: (ILjava/nio/IntBuffer;I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_nilGetIntegerv(JNIEnv *env, jclass clazz, jint mode, jobject param, jint param_offset) { - ILint *nParam = (ILint *) safeGetBufferAddress(env, param) + param_offset; - ilGetIntegerv(mode, nParam); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetData - * Signature: ()[B - */ -static jobject JNICALL Java_org_lwjgl_devil_IL_ilGetData(JNIEnv * env, jclass clazz) { - ILubyte *data = ilGetData(); - - int size = ilGetInteger(IL_IMAGE_WIDTH) * ilGetInteger(IL_IMAGE_HEIGHT) * ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL); - jobject result = safeNewBuffer(env, data, size); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetError - * Signature: ()I - */ -static jint JNICALL Java_org_lwjgl_devil_IL_ilGetError(JNIEnv *env, jclass clazz) { - return ilGetError(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetInteger - * Signature: (I)I - */ -static jint JNICALL Java_org_lwjgl_devil_IL_ilGetInteger(JNIEnv *env, jclass clazz, jint mode) { - return ilGetInteger((ILenum)mode); -} - - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetLumpPos - * Signature: ()I - */ -static jint JNICALL Java_org_lwjgl_devil_IL_ilGetLumpPos(JNIEnv *env, jclass clazz) { - return ilGetLumpPos(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetPalette - * Signature: ()[B - */ -static jobject JNICALL Java_org_lwjgl_devil_IL_ilGetPalette(JNIEnv *env, jclass clazz) { - ILubyte *pal = ilGetPalette(); - - int size = sizeof(pal); - jobject result = safeNewBuffer(env, pal, size); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilGetString - * Signature: (I)Ljava/lang/String; - */ -static jstring JNICALL Java_org_lwjgl_devil_IL_ilGetString(JNIEnv *env, jclass clazz, jint stringName) { - char * name = ilGetString((ILenum)stringName); - return NewStringNativeWithLength(env, name, strlen(name)); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilHint - * Signature: (II)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilHint(JNIEnv *env, jclass clazz, jint target, jint mode) { - ilHint((ILenum)target, (ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilInit - * Signature: ()V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilInit(JNIEnv * env, jclass clazz) { - ilInit(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilIsDisabled - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsDisabled(JNIEnv *env, jclass clazz, jint mode) { - return ilIsDisabled((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilIsEnabled - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsEnabled(JNIEnv *env, jclass clazz, jint mode) { - return ilIsEnabled((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilIsImage - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsImage(JNIEnv *env, jclass clazz, jint image) { - return ilIsImage((ILuint)image); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilIsValid - * Signature: (ILjava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilIsValid(JNIEnv *env, jclass clazz, jint type, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilIsValid((ILuint)type, (const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilIsValidL - * Signature: (ILjava/nio/ByteBuffer;II)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_nilIsValidL(JNIEnv *env, jclass clazz, jint type, jobject lump_buffer, jint lump_offset, jint size) { - ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); - - return ilIsValidL((ILenum)type, (ILvoid *)(lump + lump_offset), (ILuint)size); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilKeyColour - * Signature: (FFFF)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilKeyColour(JNIEnv *env, jclass clazz, jfloat red, jfloat green, jfloat blue, jfloat alpha) { - ilKeyColour((ILclampf)red, (ILclampf)green, (ILclampf)blue, (ILclampf)alpha); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilLoad - * Signature: (ILjava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoad(JNIEnv *env, jclass clazz, jint type, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilLoad((ILenum)type, (const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilLoadImage - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoadImage(JNIEnv *env, jclass clazz, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilLoadImage((const ILstring)strFileName); - free(strFileName); - - return result; -} - - -/* - * Class: org_lwjgl_devil_IL - * Method: nilLoadL - * Signature: (ILjava/nio/ByteBuffer;II)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_nilLoadL(JNIEnv *env, jclass clazz, jint type, jobject lump_buffer, jint lump_offset, jint size) { - ILbyte *lump = (ILbyte *)safeGetBufferAddress(env, lump_buffer) + lump_offset; - - return ilLoadL((ILenum)type, (ILvoid *)(lump), (ILuint)size); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilLoadPal - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoadPal(JNIEnv *env, jclass clazz, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilLoadPal((const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilOriginFunc - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilOriginFunc(JNIEnv *env, jclass clazz, jint mode) { - return ilOriginFunc((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilOverlayImage - * Signature: (IIII)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilOverlayImage(JNIEnv *env, jclass clazz, jint source, jint xCoord, jint yCoord, jint zCoord) { - return ilOverlayImage((ILuint)source, (ILint)xCoord, (ILint)yCoord, (ILint)zCoord); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilPopAttrib - * Signature: ()V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilPopAttrib(JNIEnv *env, jclass clazz) { - ilPopAttrib(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilPushAttrib - * Signature: (I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilPushAttrib(JNIEnv *env, jclass clazz, jint bits) { - ilPushAttrib((ILuint)bits); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilRemoveLoad - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilRemoveLoad(JNIEnv *env, jclass clazz, jstring ext) { - char *strExt = GetStringNativeChars(env, ext); - jboolean result = ilRemoveLoad((const ILstring)strExt); - free(strExt); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilRemoveSave - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilRemoveSave(JNIEnv *env, jclass clazz, jstring ext) { - char *strExt = GetStringNativeChars(env, ext); - jboolean result = ilRemoveSave((const ILstring)strExt); - free(strExt); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilResetMemory - * Signature: ()V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilResetMemory(JNIEnv *env, jclass clazz) { - ilResetMemory(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilResetRead - * Signature: ()V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilResetRead(JNIEnv *env, jclass clazz) { - ilResetRead(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilResetWrite - * Signature: ()V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilResetWrite(JNIEnv *env, jclass clazz) { - ilResetWrite(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSave - * Signature: (ILjava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilSave(JNIEnv *env, jclass clazz, jint type, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilSave((ILenum)type, (const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSaveImage - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilSaveImage(JNIEnv *env, jclass clazz, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilSaveImage((const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilSaveL - * Signature: (ILjava/nio/ByteBuffer;II)I - */ -static jint JNICALL Java_org_lwjgl_devil_IL_nilSaveL(JNIEnv *env, jclass clazz, jint type, jobject lump_buffer, jint lump_offset, jint size) { - ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); - - return ilSaveL((ILenum)type, (ILvoid *)(lump + lump_offset), (ILuint)size); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSavePal - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilSavePal(JNIEnv *env, jclass clazz, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilSavePal((const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilSetData - * Signature: (Ljava/nio/ByteBuffer;I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_nilSetData(JNIEnv *env, jclass clazz, jobject data_buffer, jint data_offset) { - ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); - - return ilSetData((ILvoid *)(data + data_offset)); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSetDuration - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilSetDuration(JNIEnv *env, jclass clazz, jint duration) { - return ilSetDuration((ILuint)duration); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSetInteger - * Signature: (II)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilSetInteger(JNIEnv *env, jclass clazz, jint mode, jint param) { - ilSetInteger((ILenum)mode, (ILint)param); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilSetPixels - * Signature: (IIIIIIIILjava/nio/ByteBuffer;I)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_nilSetPixels(JNIEnv *env, jclass clazz, jint xOff, jint yOff, jint zOff, jint width, jint height, jint depth, jint format, jint type, jobject data_buffer, jint data_offset) { - ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); - - ilSetPixels((ILint)xOff, (ILint)yOff, (ILint)zOff, (ILuint)width, (ILuint)height, (ILuint)depth, (ILenum)format, (ILenum)type, (ILvoid *)(data + data_offset)); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSetString - * Signature: (ILjava/lang/String;)V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilSetString(JNIEnv *env, jclass clazz, jint mode, jstring string) { - char *strString = GetStringNativeChars(env, string); - - ilSetString(mode, (const ILstring)strString); - free(strString); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilShutDown - * Signature: ()V - */ -static void JNICALL Java_org_lwjgl_devil_IL_ilShutDown(JNIEnv *env, jclass clazz) { - ilShutDown(); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilTexImage - * Signature: (IIIBIILjava/nio/ByteBuffer;I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_nilTexImage(JNIEnv *env, jclass clazz, jint width, jint height, jint depth , jbyte bpp, jint format, jint type, jobject data_buffer, jint data_offset) { - ILbyte *data = (ILbyte *)(*env)->GetDirectBufferAddress(env, data_buffer); - return ilTexImage((ILuint)width, (ILuint)height, (ILuint)depth , (ILubyte)bpp, (ILenum)format, (ILenum)type, (ILvoid *)(data + data_offset)); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilTypeFunc - * Signature: (I)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilTypeFunc(JNIEnv *env, jclass clazz, jint mode) { - return ilTypeFunc((ILenum)mode); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilLoadData - * Signature: (Ljava/lang/String;IIIB)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilLoadData(JNIEnv *env, jclass clazz, jstring fileName, jint width, jint height, jint depth, jbyte bpp) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilLoadData((const ILstring)strFileName, (ILuint)width, (ILuint)height, (ILuint)depth, (ILubyte)bpp); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nilLoadDataL - * Signature: (Ljava/nio/ByteBuffer;IIIIIB)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_nilLoadDataL(JNIEnv *env, jclass clazz, jobject lump_buffer, jint lump_offset, jint size, jint width, jint height, jint depth, jbyte bpp) { - ILbyte *lump = (ILbyte *)(*env)->GetDirectBufferAddress(env, lump_buffer); - - return ilLoadDataL((ILvoid *)(lump + lump_offset), (ILuint)size, (ILuint)width, (ILuint)height, (ILuint)depth, (ILubyte)bpp); -} - -/* - * Class: org_lwjgl_devil_IL - * Method: ilSaveData - * Signature: (Ljava/lang/String;)Z - */ -static jboolean JNICALL Java_org_lwjgl_devil_IL_ilSaveData(JNIEnv *env, jclass clazz, jstring fileName) { - char *strFileName = GetStringNativeChars(env, fileName); - jboolean result = ilSaveData((const ILstring)strFileName); - free(strFileName); - - return result; -} - -/* - * Class: org_lwjgl_devil_IL - * Method: nCreate - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_nCreateIL(JNIEnv *env, jclass clazz, jobjectArray ilPaths) { - if (!extil_Open(env, ilPaths)) { - throwException(env, "Failed to load DevIL library"); - return; - } -} - -JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_nDestroyIL(JNIEnv *env, jclass clazz) { - extil_Close(); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_resetNativeStubsIL(JNIEnv *env, jclass clazz, jclass il_class) { - (*env)->UnregisterNatives(env, il_class); -} - -JNIEXPORT void JNICALL Java_org_lwjgl_devil_ILNative_initNativeStubsIL(JNIEnv *env, jclass clazz, jclass il_class) { - JavaMethodAndExtFunction functions[] = { - {"ilActiveImage", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilActiveImage, "ilActiveImage", (void*)&ilActiveImage}, - {"ilActiveLayer", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilActiveLayer, "ilActiveLayer", (void*)&ilActiveLayer}, - {"ilActiveMipmap", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilActiveMipmap, "ilActiveMipmap", (void*)&ilActiveMipmap}, - {"ilApplyPal", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilApplyPal, "ilApplyPal", (void*)&ilApplyPal}, - {"ilApplyProfile", "(Ljava/lang/String;Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilApplyProfile, "ilApplyProfile", (void*)&ilApplyProfile}, - {"ilBindImage", "(I)V", (void*)&Java_org_lwjgl_devil_IL_ilBindImage, "ilBindImage", (void*)&ilBindImage}, - {"ilBlit", "(IIIIIIIIII)Z", (void*)&Java_org_lwjgl_devil_IL_ilBlit, "ilBlit", (void*)&ilBlit}, - {"ilClearColour", "(FFFF)V", (void*)&Java_org_lwjgl_devil_IL_ilClearColour, "ilClearColour", (void*)&ilClearColour}, - {"ilClearImage", "()Z", (void*)&Java_org_lwjgl_devil_IL_ilClearImage, "ilClearImage", (void*)&ilClearImage}, - {"ilCloneCurImage", "()I", (void*)&Java_org_lwjgl_devil_IL_ilCloneCurImage, "ilCloneCurImage", (void*)&ilCloneCurImage}, - {"ilCompressFunc", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilCompressFunc, "ilCompressFunc", (void*)&ilCompressFunc}, - {"ilConvertImage", "(II)Z", (void*)&Java_org_lwjgl_devil_IL_ilConvertImage, "ilConvertImage", (void*)&ilConvertImage}, - {"ilConvertPal", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilConvertPal, "ilConvertPal", (void*)&ilConvertPal}, - {"ilCopyImage", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilCopyImage, "ilCopyImage", (void*)&ilCopyImage}, - {"nilCopyPixels", "(IIIIIIIILjava/nio/ByteBuffer;I)I", (void*)&Java_org_lwjgl_devil_IL_nilCopyPixels, "ilCopyPixels", (void*)&ilCopyPixels}, - {"ilCreateSubImage", "(II)I", (void*)&Java_org_lwjgl_devil_IL_ilCreateSubImage, "ilCreateSubImage", (void*)&ilCreateSubImage}, - {"ilDefaultImage", "()Z", (void*)&Java_org_lwjgl_devil_IL_ilDefaultImage, "ilDefaultImage", (void*)&ilDefaultImage}, - {"nilDeleteImages", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_devil_IL_nilDeleteImages, "ilDeleteImages", (void*)&ilDeleteImages}, - {"ilDisable", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilDisable, "ilDisable", (void*)&ilDisable}, - {"ilEnable", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilEnable, "ilEnable", (void*)&ilEnable}, - {"ilFormatFunc", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilFormatFunc, "ilFormatFunc", (void*)&ilFormatFunc}, - {"nilGenImages", "(ILjava/nio/IntBuffer;I)V", (void*)&Java_org_lwjgl_devil_IL_nilGenImages, "ilGenImages", (void*)&ilGenImages}, - {"ilGetAlpha", "(I)Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_devil_IL_ilGetAlpha, "ilGetAlpha", (void*)&ilGetAlpha}, - //{"ilModAlpha", "(I)V", (void*)&Java_org_lwjgl_devil_IL_ilModAlpha, "ilModAlpha", (void*)&ilModAlpha}, - //{"ilSetAlpha", "(I)V", (void*)&Java_org_lwjgl_devil_IL_ilSetAlpha, "ilSetAlpha", (void*)&ilSetAlpha}, - {"ilGetBoolean", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilGetBoolean, "ilGetBoolean", (void*)&ilGetBoolean}, - {"ilGetData", "()Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_devil_IL_ilGetData, "ilGetData", (void*)&ilGetData}, - {"ilGetError", "()I", (void*)&Java_org_lwjgl_devil_IL_ilGetError, "ilGetError", (void*)&ilGetError}, - {"ilGetInteger", "(I)I", (void*)&Java_org_lwjgl_devil_IL_ilGetInteger, "ilGetInteger", (void*)&ilGetInteger}, - {"ilGetLumpPos", "()I", (void*)&Java_org_lwjgl_devil_IL_ilGetLumpPos, "ilGetLumpPos", (void*)&ilGetLumpPos}, - {"ilGetPalette", "()Ljava/nio/ByteBuffer;", (void*)&Java_org_lwjgl_devil_IL_ilGetPalette, "ilGetPalette", (void*)&ilGetPalette}, - {"ilGetString", "(I)Ljava/lang/String;", (void*)&Java_org_lwjgl_devil_IL_ilGetString, "ilGetString", (void*)&ilGetString}, - {"ilHint", "(II)V", (void*)&Java_org_lwjgl_devil_IL_ilHint, "ilHint", (void*)&ilHint}, - {"ilInit", "()V", (void*)&Java_org_lwjgl_devil_IL_ilInit, "ilInit", (void*)&ilInit}, - {"ilIsDisabled", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilIsDisabled, "ilIsDisabled", (void*)&ilIsDisabled}, - {"ilIsEnabled", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilIsEnabled, "ilIsEnabled", (void*)&ilIsEnabled}, - {"ilIsImage", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilIsImage, "ilIsImage", (void*)&ilIsImage}, - {"ilIsValid", "(ILjava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilIsValid, "ilIsValid", (void*)&ilIsValid}, - {"nilIsValidL", "(ILjava/nio/ByteBuffer;II)Z", (void*)&Java_org_lwjgl_devil_IL_nilIsValidL, "ilIsValidL", (void*)&ilIsValidL}, - {"ilKeyColour", "(FFFF)V", (void*)&Java_org_lwjgl_devil_IL_ilKeyColour, "ilKeyColour", (void*)&ilKeyColour}, - {"ilLoad", "(ILjava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilLoad, "ilLoad", (void*)&ilLoad}, - {"ilLoadImage", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilLoadImage, "ilLoadImage", (void*)&ilLoadImage}, - {"nilLoadL", "(ILjava/nio/ByteBuffer;II)Z", (void*)&Java_org_lwjgl_devil_IL_nilLoadL, "ilLoadL", (void*)&ilLoadL}, - {"ilLoadPal", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilLoadPal, "ilLoadPal", (void*)&ilLoadPal}, - {"ilOriginFunc", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilOriginFunc, "ilOriginFunc", (void*)&ilOriginFunc}, - {"ilOverlayImage", "(IIII)Z", (void*)&Java_org_lwjgl_devil_IL_ilOverlayImage, "ilOverlayImage", (void*)&ilOverlayImage}, - {"ilPopAttrib", "()V", (void*)&Java_org_lwjgl_devil_IL_ilPopAttrib, "ilPopAttrib", (void*)&ilPopAttrib}, - {"ilPushAttrib", "(I)V", (void*)&Java_org_lwjgl_devil_IL_ilPushAttrib, "ilPushAttrib", (void*)&ilPushAttrib}, - {"ilRemoveLoad", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilRemoveLoad, "ilRemoveLoad", (void*)&ilRemoveLoad}, - {"ilRemoveSave", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilRemoveSave, "ilRemoveSave", (void*)&ilRemoveSave}, - {"ilResetMemory", "()V", (void*)&Java_org_lwjgl_devil_IL_ilResetMemory, "ilResetMemory", (void*)&ilResetMemory}, - {"ilResetRead", "()V", (void*)&Java_org_lwjgl_devil_IL_ilResetRead, "ilResetRead", (void*)&ilResetRead}, - {"ilResetWrite", "()V", (void*)&Java_org_lwjgl_devil_IL_ilResetWrite, "ilResetWrite", (void*)&ilResetWrite}, - {"ilSave", "(ILjava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilSave, "ilSave", (void*)&ilSave}, - {"ilSaveImage", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilSaveImage, "ilSaveImage", (void*)&ilSaveImage}, - {"nilSaveL", "(ILjava/nio/ByteBuffer;II)I", (void*)&Java_org_lwjgl_devil_IL_nilSaveL, "ilSaveL", (void*)&ilSaveL}, - {"ilSavePal", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilSavePal, "ilSavePal", (void*)&ilSavePal}, - {"nilSetData", "(Ljava/nio/ByteBuffer;I)Z", (void*)&Java_org_lwjgl_devil_IL_nilSetData, "ilSetData", (void*)&ilSetData}, - {"ilSetDuration", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilSetDuration, "ilSetDuration", (void*)&ilSetDuration}, - {"ilSetInteger", "(II)V", (void*)&Java_org_lwjgl_devil_IL_ilSetInteger, "ilSetInteger", (void*)&ilSetInteger}, - {"nilSetPixels", "(IIIIIIIILjava/nio/ByteBuffer;I)V", (void*)&Java_org_lwjgl_devil_IL_nilSetPixels, "ilSetPixels", (void*)&ilSetPixels}, - {"ilSetString", "(ILjava/lang/String;)V", (void*)&Java_org_lwjgl_devil_IL_ilSetString, "ilSetString", (void*)&ilSetString}, - {"ilShutDown", "()V", (void*)&Java_org_lwjgl_devil_IL_ilShutDown, "ilShutDown", (void*)&ilShutDown}, - {"nilTexImage", "(IIIBIILjava/nio/ByteBuffer;I)Z", (void*)&Java_org_lwjgl_devil_IL_nilTexImage, "ilTexImage", (void*)&ilTexImage}, - {"ilTypeFunc", "(I)Z", (void*)&Java_org_lwjgl_devil_IL_ilTypeFunc, "ilTypeFunc", (void*)&ilTypeFunc}, - {"ilLoadData", "(Ljava/lang/String;IIIB)Z", (void*)&Java_org_lwjgl_devil_IL_ilLoadData, "ilLoadData", (void*)&ilLoadData}, - {"nilLoadDataL", "(Ljava/nio/ByteBuffer;IIIIIB)Z", (void*)&Java_org_lwjgl_devil_IL_nilLoadDataL, "ilLoadDataL", (void*)&ilLoadDataL}, - {"ilSaveData", "(Ljava/lang/String;)Z", (void*)&Java_org_lwjgl_devil_IL_ilSaveData, "ilSaveData", (void*)&ilSaveData} - }; - int num_functions = NUMFUNCTIONS(functions); - extil_InitializeClass(env, il_class, num_functions, functions); -} diff --git a/src/native/common/devil/org_lwjgl_devil_ILU.c b/src/native/common/devil/org_lwjgl_devil_ILU.c deleted file mode 100644 index 2b610049..00000000 --- a/src/native/common/devil/org_lwjgl_devil_ILU.c +++ /dev/null @@ -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); -} diff --git a/src/native/common/devil/org_lwjgl_devil_ILUT.c b/src/native/common/devil/org_lwjgl_devil_ILUT.c deleted file mode 100644 index 6ce98091..00000000 --- a/src/native/common/devil/org_lwjgl_devil_ILUT.c +++ /dev/null @@ -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); -} diff --git a/src/native/common/fmod3/Makefile.linux b/src/native/common/fmod3/Makefile.linux deleted file mode 100644 index d88bfee7..00000000 --- a/src/native/common/fmod3/Makefile.linux +++ /dev/null @@ -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) diff --git a/src/native/common/fmod3/Makefile.macosx b/src/native/common/fmod3/Makefile.macosx deleted file mode 100644 index fc51985f..00000000 --- a/src/native/common/fmod3/Makefile.macosx +++ /dev/null @@ -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) diff --git a/src/native/common/fmod3/extfmod3.c b/src/native/common/fmod3/extfmod3.c deleted file mode 100644 index 46ad4d82..00000000 --- a/src/native/common/fmod3/extfmod3.c +++ /dev/null @@ -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 -#endif - -#include -#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); - } -} diff --git a/src/native/common/fmod3/extfmod3.h b/src/native/common/fmod3/extfmod3.h deleted file mode 100644 index 65ee4c13..00000000 --- a/src/native/common/fmod3/extfmod3.h +++ /dev/null @@ -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 -#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. 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 diff --git a/src/native/common/fmod3/fmod.todo b/src/native/common/fmod3/fmod.todo deleted file mode 100644 index 9c96da26..00000000 --- a/src/native/common/fmod3/fmod.todo +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/native/common/fmod3/fmoddyn_mac.h b/src/native/common/fmod3/fmoddyn_mac.h deleted file mode 100755 index 101e20e1..00000000 --- a/src/native/common/fmod3/fmoddyn_mac.h +++ /dev/null @@ -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 diff --git a/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c b/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c deleted file mode 100644 index 1571ad36..00000000 --- a/src/native/common/fmod3/org_lwjgl_fmod3_FMOD.c +++ /dev/null @@ -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;iGetObjectArrayElement(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)); -} diff --git a/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c b/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c deleted file mode 100644 index 3dd97fe9..00000000 --- a/src/native/common/fmod3/org_lwjgl_fmod3_FMusic.c +++ /dev/null @@ -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); -} -// ------------------------------------------ diff --git a/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c b/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c deleted file mode 100644 index 92180506..00000000 --- a/src/native/common/fmod3/org_lwjgl_fmod3_FSound.c +++ /dev/null @@ -1,1947 +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_FSound.h" -#include "extfmod3.h" - -void * F_CALLBACKAPI fsound_dspcallback(void *originalbuffer, void *newbuffer, int length, void *userdata); -signed char F_CALLBACKAPI fsound_stream_endcallback(FSOUND_STREAM *stream, void *buff, int len, void *param); -signed char F_CALLBACKAPI fsound_stream_synccallback(FSOUND_STREAM *stream, void *buff, int len, void *param); -signed char F_CALLBACKAPI fsound_stream_callback(FSOUND_STREAM *stream, void *buff, int len, void *param); -signed char F_CALLBACKAPI fsound_metadata_callback(char *name,char *value,void *userdata); - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Close -* Signature: ()V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Close(JNIEnv * env, jclass clazz) { - fmod_instance->FSOUND_Close(); -} - - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_File_SetCallbacks -* Signature: ()V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1File_1SetCallbacks(JNIEnv * env, jclass clazz) { - throwFMODException(env, "missing implementation"); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Init -* Signature: (III)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Init -(JNIEnv *env, jclass clazz, jint mixrate, jint channels, jint flags) { - return fmod_instance->FSOUND_Init(mixrate, channels, flags); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetBufferSize -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetBufferSize(JNIEnv * env, jclass clazz, jint len_ms) { - return fmod_instance->FSOUND_SetBufferSize(len_ms); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetDriver -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetDriver(JNIEnv * env, jclass clazz, jint driver) { - return fmod_instance->FSOUND_SetDriver(driver); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetHWND -* Signature: ()Z -*/ -//JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetHWND(JNIEnv * env, jclass clazz) { -// throwFMODException(env, "missing implementation"); -// return false; -//} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetMaxHardwareChannels -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetMaxHardwareChannels(JNIEnv * env, jclass clazz, jint max) { - return fmod_instance->FSOUND_SetMaxHardwareChannels(max); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetMinHardwareChannels -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetMinHardwareChannels(JNIEnv * env, jclass clazz, jint min) { - return fmod_instance->FSOUND_SetMinHardwareChannels(min); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetMixer -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetMixer(JNIEnv * env, jclass clazz, jint mixer) { - jboolean result = fmod_instance->FSOUND_SetMixer(mixer); - - // if we successfully changed mixer - update cached size field - if(result) { - 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; - } - } - - return result; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetOutput -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetOutput(JNIEnv * env, jclass clazz, jint outputtype) { - return fmod_instance->FSOUND_SetOutput(outputtype); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetPanSeperation -* Signature: (F)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetPanSeperation(JNIEnv * env, jclass clazz, jfloat pansep) { - fmod_instance->FSOUND_SetPanSeperation(pansep); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetSFXMasterVolume -* Signature: (I)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetSFXMasterVolume(JNIEnv * env, jclass clazz, jint volume) { - fmod_instance->FSOUND_SetSFXMasterVolume(volume); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetSpeakerMode -* Signature: (I)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetSpeakerMode(JNIEnv * env, jclass clazz, jint speakermode) { - fmod_instance->FSOUND_SetSpeakerMode(speakermode); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Update -* Signature: ()V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Update(JNIEnv * env, jclass clazz) { - fmod_instance->FSOUND_Update(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetCPUUsage -* Signature: ()F -*/ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetCPUUsage(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetCPUUsage(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetChannelsPlaying -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetChannelsPlaying(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetChannelsPlaying(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetDriver -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetDriver(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetDriver(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetDriverCaps -* Signature: (ILjava/nio/IntBuffer;)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1GetDriverCaps(JNIEnv * env, jclass clazz, jint id, jobject buffer, jint offset) { - unsigned int* caps = offset + (unsigned int *) (*env)->GetDirectBufferAddress(env, buffer); - return fmod_instance->FSOUND_GetDriverCaps(id, caps); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetDriverName -* Signature: (I)Ljava/lang/String; -*/ -JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetDriverName(JNIEnv * env, jclass clazz, jint id) { - char * driver = fmod_instance->FSOUND_GetDriverName(id); - return NewStringNativeWithLength(env, driver, strlen(driver)); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetError -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetError(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetError(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetMaxSamples -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetMaxSamples(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetMaxSamples(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetMaxChannels -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetMaxChannels(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetMaxChannels(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetMemoryStats -* Signature: (Ljava/nio/IntBuffer;)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1GetMemoryStats(JNIEnv * env, jclass clazz, jobject buffer, jint offset) { - unsigned int * memory = offset + (unsigned int *) (*env)->GetDirectBufferAddress(env, buffer); - fmod_instance->FSOUND_GetMemoryStats(&memory[0], &memory[1]); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetNumDrivers -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetNumDrivers(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetNumDrivers(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetNumHWChannels -* Signature: (Ljava/nio/IntBuffer;)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1GetNumHWChannels(JNIEnv * env, jclass clazz, jobject buffer, jint offset) { - int * memory = offset + (int *) (*env)->GetDirectBufferAddress(env, buffer); - return fmod_instance->FSOUND_GetNumHWChannels(&memory[0], &memory[1], &memory[2]); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetOutput -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetOutput(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetOutput(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetOutputRate -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetOutputRate(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetOutputRate(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetSFXMasterVolume -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetSFXMasterVolume(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetSFXMasterVolume(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetVersion -* Signature: ()F -*/ -JNIEXPORT jfloat JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetVersion(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetVersion(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Alloc -* Signature: (IIIIIII)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Alloc(JNIEnv * env, jclass clazz, jint index, jint length, jint mode, jint deffreq, jint defvol, jint defpan, jint defpri) { - return (long) fmod_instance->FSOUND_Sample_Alloc(index, length, mode, deffreq, defvol, defpan, defpri); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Free -* Signature: (J)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Free(JNIEnv * env, jclass clazz, jlong handle) { - fmod_instance->FSOUND_Sample_Free((FSOUND_SAMPLE*) handle); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Get -* Signature: (I)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Get(JNIEnv * env, jclass clazz, jint sampno) { - return (jlong) fmod_instance->FSOUND_Sample_Get(sampno); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_GetDefaults -* Signature: (JLjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetDefaults(JNIEnv * env, jclass clazz, jlong sptr, jobject deffreq, jint deffreqOffset, jobject defvol, jint defvolOffset, jobject defpan, jint defpanOffset, jobject defpri, jint defpriOffset) { - int * nDeffreq = (deffreq != NULL) ? deffreqOffset + (int *) (*env)->GetDirectBufferAddress(env, deffreq) : NULL; - int * nDefvol = (defvol != NULL) ? defvolOffset + (int *) (*env)->GetDirectBufferAddress(env, defvol) : NULL; - int * nDefpan = (defpan != NULL) ? defpanOffset + (int *) (*env)->GetDirectBufferAddress(env, defpan) : NULL; - int * nDefpri = (defpri != NULL) ? defpriOffset + (int *) (*env)->GetDirectBufferAddress(env, defpri) : NULL; - - return fmod_instance->FSOUND_Sample_GetDefaults((FSOUND_SAMPLE *) sptr, nDeffreq, nDefvol, nDefpan, nDefpri); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_GetDefaultsEx -* Signature: (JLjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetDefaultsEx(JNIEnv * env, jclass clazz, jlong sptr, jobject deffreq, jint deffreqOffset, jobject defvol, jint defvolOffset, jobject defpan, jint defpanOffset, jobject defpri, jint defpriOffset, -jobject varfreq, jint varfreqOffset, jobject varvol, jint varvolOffset, jobject varpan, jint varpanOffset) { - int * nDeffreq = (deffreq != NULL) ? deffreqOffset + (int *) (*env)->GetDirectBufferAddress(env, deffreq) : NULL; - int * nDefvol = (defvol != NULL) ? defvolOffset + (int *) (*env)->GetDirectBufferAddress(env, defvol) : NULL; - int * nDefpan = (defpan != NULL) ? defpanOffset + (int *) (*env)->GetDirectBufferAddress(env, defpan) : NULL; - int * nDefpri = (defpri != NULL) ? defpriOffset + (int *) (*env)->GetDirectBufferAddress(env, defpri) : NULL; - int * nVarfreq = (varfreq != NULL) ? varfreqOffset + (int *) (*env)->GetDirectBufferAddress(env, varfreq) : NULL; - int * nVarvol = (varvol != NULL) ? varvolOffset + (int *) (*env)->GetDirectBufferAddress(env, varvol) : NULL; - int * nVarpan = (varpan != NULL) ? varpanOffset + (int *) (*env)->GetDirectBufferAddress(env, varpan) : NULL; - - return fmod_instance->FSOUND_Sample_GetDefaultsEx((FSOUND_SAMPLE *) sptr, nDeffreq, nDefvol, nDefpan, nDefpri, nVarfreq, nVarvol, nVarpan); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_GetLength -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetLength(JNIEnv * env, jclass clazz, jlong sptr) { - return fmod_instance->FSOUND_Sample_GetLength((FSOUND_SAMPLE *) sptr); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_GetLoopPoints -* Signature: (JLjava/nio/IntBuffer;ILjava/nio/IntBuffer;I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetLoopPoints(JNIEnv * env, jclass clazz, jlong sptr, jobject loopstart, jint loopstartOffset, jobject loopend, jint loopendOffset) { - int * nLoopstart = (loopstart != NULL) ? loopstartOffset + (int *) (*env)->GetDirectBufferAddress(env, loopstart) : NULL; - int * nLoopend = (loopend != NULL) ? loopendOffset + (int *) (*env)->GetDirectBufferAddress(env, loopend) : NULL; - return fmod_instance->FSOUND_Sample_GetLoopPoints((FSOUND_SAMPLE *) sptr, nLoopstart, nLoopend); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_GetMinMaxDistance -* Signature: (JLjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetMinMaxDistance(JNIEnv * env, jclass clazz, jlong sptr, jobject min, jint minOffset, jobject max, jint maxOffset) { - float * nMin = (min != NULL) ? minOffset + (float *) (*env)->GetDirectBufferAddress(env, min) : NULL; - float * nMax = (max != NULL) ? maxOffset + (float *) (*env)->GetDirectBufferAddress(env, max) : NULL; - return fmod_instance->FSOUND_Sample_GetMinMaxDistance((FSOUND_SAMPLE *) sptr, nMin, nMax); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_GetMode -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetMode(JNIEnv * env, jclass clazz, jlong sptr) { - return fmod_instance->FSOUND_Sample_GetMode((FSOUND_SAMPLE *) sptr); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_GetName -* Signature: (J)Ljava/lang/String; -*/ -JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1GetName(JNIEnv * env, jclass clazz, jlong sptr) { - char * name = fmod_instance->FSOUND_Sample_GetName((FSOUND_SAMPLE *) sptr); - return NewStringNativeWithLength(env, name, strlen(name)); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Load -* Signature: (ILjava/nio/ByteBuffer;IIII)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Load__ILjava_nio_ByteBuffer_2III(JNIEnv * env, jclass clazz, jint index, jobject data, jint inputmode, jint offset, jint length) { - const char * nData = offset + (const char *) (*env)->GetDirectBufferAddress(env, data); - return (long) fmod_instance->FSOUND_Sample_Load(index, nData, inputmode, 0, length); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Load -* Signature: (ILjava/lang/String;III)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Load__ILjava_lang_String_2III(JNIEnv * env, jclass clazz, jint index, jstring name, jint inputmode, jint offset, jint length) { - jlong result; - char* nName = GetStringNativeChars(env, name); - result = (jlong) fmod_instance->FSOUND_Sample_Load(index, nName, inputmode, offset, length); - free(nName); - return result; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Lock -* Signature: (JIILorg/lwjgl/fmod_instance/FSoundSampleLock;)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Lock(JNIEnv * env, jclass clazz, jlong sptr, jint offset, jint length, jobject sampleLock) { - void * ptr1; - void * ptr2; - unsigned int len1; - unsigned int len2; - signed char result; - result = fmod_instance->FSOUND_Sample_Lock((FSOUND_SAMPLE *) sptr, offset, length, &ptr1, &ptr2, &len1, &len2); - - // if we got true, prime lock - if(result) { - // get class & fields - jclass lock = (*env)->GetObjectClass(env, sampleLock); - jfieldID objPtr1 = (*env)->GetFieldID(env, lock, "ptr1", "Ljava/nio/ByteBuffer"); - jfieldID objPtr2 = (*env)->GetFieldID(env, lock, "ptr2", "Ljava/nio/ByteBuffer"); - jfieldID objLen1 = (*env)->GetFieldID(env, lock, "len1", "I"); - jfieldID objLen2 = (*env)->GetFieldID(env, lock, "len2", "I"); - - // set buffers - if(len1 > 0) { - (*env)->SetObjectField(env, sampleLock, objPtr1, (*env)->NewDirectByteBuffer(env, ptr1, len1)); - } - - if(len2 > 0) { - (*env)->SetObjectField(env, sampleLock, objPtr2, (*env)->NewDirectByteBuffer(env, ptr2, len2)); - } - - // set lengths - (*env)->SetIntField(env, sampleLock, objLen1, len1); - (*env)->SetIntField(env, sampleLock, objLen2, len2); - } - - return result; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_SetDefaults -* Signature: (JIIII)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1SetDefaults(JNIEnv * env, jclass clazz, jlong sptr, jint deffreq, jint defvol, jint defpan, jint defpri) { - return fmod_instance->FSOUND_Sample_SetDefaults((FSOUND_SAMPLE *) sptr, deffreq, defvol, defpan, defpri); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_SetDefaultsEx -* Signature: (JIIIIIII)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1SetDefaultsEx(JNIEnv * env, jclass clazz, jlong sptr, jint deffreq, jint defvol, jint defpan, jint defpri, jint varfreq, jint varvol, jint varpan) { - return fmod_instance->FSOUND_Sample_SetDefaultsEx((FSOUND_SAMPLE *) sptr, deffreq, defvol, defpan, defpri, varfreq, varvol, varpan); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_SetMaxPlaybacks -* Signature: (JI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1SetMaxPlaybacks(JNIEnv * env, jclass clazz, jlong sptr, jint max) { - return fmod_instance->FSOUND_Sample_SetMaxPlaybacks((FSOUND_SAMPLE*) sptr, max); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_SetMinMaxDistance -* Signature: (JFF)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1SetMinMaxDistance(JNIEnv * env, jclass clazz, jlong sptr, jfloat min, jfloat max) { - return fmod_instance->FSOUND_Sample_SetMinMaxDistance((FSOUND_SAMPLE*) sptr, min, max); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_SetMode -* Signature: (JI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1SetMode(JNIEnv * env, jclass clazz, jlong sptr, jint mode) { - return fmod_instance->FSOUND_Sample_SetMode((FSOUND_SAMPLE*) sptr, mode); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_SetLoopPoints -* Signature: (JII)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1SetLoopPoints(JNIEnv * env, jclass clazz, jlong sptr, jint loopstart, jint loopend) { - return fmod_instance->FSOUND_Sample_SetLoopPoints((FSOUND_SAMPLE*) sptr, loopstart, loopend); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Unlock -* Signature: (JILorg/lwjgl/fmod_instance/FSoundSampleLock;)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Unlock(JNIEnv * env, jclass clazz, jlong sptr, jobject ptr1, jobject ptr2, jint len1, jint len2) { - return fmod_instance->FSOUND_Sample_Unlock((FSOUND_SAMPLE *) sptr, (*env)->GetDirectBufferAddress(env, ptr1), (*env)->GetDirectBufferAddress(env, ptr2), len1, len2); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Sample_Upload -* Signature: (JLjava/nio/ByteBuffer;II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Sample_1Upload(JNIEnv * env, jclass clazz, jlong sptr, jobject data, jint dataOffset, jint mode) { - void * nData = dataOffset + (char *) (*env)->GetDirectBufferAddress(env, data); - return fmod_instance->FSOUND_Sample_Upload((FSOUND_SAMPLE *) sptr, nData, mode); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_PlaySound -* Signature: (IJ)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1PlaySound(JNIEnv * env, jclass clazz, jint channel, jlong sptr) { - return fmod_instance->FSOUND_PlaySound(channel, (FSOUND_SAMPLE*) sptr); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_PlaySoundEx -* Signature: (IJJZ)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1PlaySoundEx(JNIEnv * env, jclass clazz, jint channel, jlong sptr, jobject dsp, jboolean startpaused) { - FSOUND_DSPUNIT* nDsp = (FSOUND_DSPUNIT*) (*env)->GetDirectBufferAddress(env, dsp); - return fmod_instance->FSOUND_PlaySoundEx(channel, (FSOUND_SAMPLE*) sptr, nDsp, startpaused); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_StopSound -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1StopSound(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_StopSound(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetFrequency -* Signature: (II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetFrequency(JNIEnv * env, jclass clazz, jint channel, jint freq) { - return fmod_instance->FSOUND_SetFrequency(channel, freq); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetLevels -* Signature: (IIIIIII)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetLevels(JNIEnv * env, jclass clazz, jint p1, jint p2, jint p3, jint p4, jint p5, jint p6, jint p7) { - //XBOX only - snowballs chance in hell we will get to support that! - return false; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetLoopMode -* Signature: (II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetLoopMode(JNIEnv * env, jclass clazz, jint channel, jint loopmode) { - return fmod_instance->FSOUND_SetLoopMode(channel, loopmode); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetMute -* Signature: (IZ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetMute(JNIEnv * env, jclass clazz, jint channel, jboolean mute) { - return fmod_instance->FSOUND_SetMute(channel, mute); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetPan -* Signature: (II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetPan(JNIEnv * env, jclass clazz, jint channel, jint pan) { - return fmod_instance->FSOUND_SetPan(channel, pan); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetPaused -* Signature: (IZ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetPaused(JNIEnv * env, jclass clazz, jint channel, jboolean paused) { - return fmod_instance->FSOUND_SetPaused(channel, paused); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetPriority -* Signature: (II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetPriority(JNIEnv * env, jclass clazz, jint channel, jint priority) { - return fmod_instance->FSOUND_SetPriority(channel, priority); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetReserved -* Signature: (IZ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetReserved(JNIEnv * env, jclass clazz, jint channel, jboolean reserved) { - return fmod_instance->FSOUND_SetReserved(channel, reserved); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetSurround -* Signature: (IZ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetSurround(JNIEnv * env, jclass clazz, jint channel, jboolean surround) { - return fmod_instance->FSOUND_SetSurround(channel, surround); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetVolume -* Signature: (II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetVolume(JNIEnv * env, jclass clazz, jint channel, jint vol) { - return fmod_instance->FSOUND_SetVolume(channel, vol); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetVolumeAbsolute -* Signature: (II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetVolumeAbsolute(JNIEnv * env, jclass clazz, jint channel, jint vol) { - return fmod_instance->FSOUND_SetVolumeAbsolute(channel, vol); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetVolume -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetVolume(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetVolume(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetAmplitude -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetAmplitude(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetAmplitude(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_3D_SetAttributes -* Signature: (ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_13D_1SetAttributes(JNIEnv * env, jclass clazz, jint channel, jobject pos, jint posOffset, jobject vel, jint velOffset) { - float* nPos = posOffset + (float *) (*env)->GetDirectBufferAddress(env, pos); - float* nVel = velOffset + (float *) (*env)->GetDirectBufferAddress(env, vel); - return fmod_instance->FSOUND_3D_SetAttributes(channel, nPos, nVel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_3D_SetMinMaxDistance -* Signature: (III)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_13D_1SetMinMaxDistance(JNIEnv * env, jclass clazz, jint channel, jfloat min, jfloat max) { - return fmod_instance->FSOUND_3D_SetMinMaxDistance(channel, min, max); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_SetCurrentPosition -* Signature: (II)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1SetCurrentPosition(JNIEnv * env, jclass clazz, jint channel, jint offset) { - return fmod_instance->FSOUND_SetCurrentPosition(channel, offset); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetCurrentPosition -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetCurrentPosition(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetCurrentPosition(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_GetCurrentSample -* Signature: (I)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1GetCurrentSample(JNIEnv * env, jclass clazz, jint channel) { - return (jlong) fmod_instance->FSOUND_GetCurrentSample(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_GetCurrentLevels -* Signature: (ILjava/nio/FloatBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1GetCurrentLevels(JNIEnv * env, jclass clazz, jint channel , jobject l_rBuffer, jint l_rBufferOffset) { - float* nL_R = l_rBufferOffset + (float *) (*env)->GetDirectBufferAddress(env, l_rBuffer); - return fmod_instance->FSOUND_GetCurrentLevels(channel, &nL_R[0], &nL_R[1]); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetFrequency -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetFrequency(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetFrequency(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetLoopMode -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetLoopMode(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetLoopMode(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetMixer -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetMixer(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_GetMixer(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetMute -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetMute(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetMute(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetNumSubChannels -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetNumSubChannels(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetNumSubChannels(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetPan -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetPan(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetPan(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetPaused -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetPaused(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetPaused(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetPriority -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetPriority(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetPriority(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetReserved -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetReserved(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetReserved(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetSubChannel -* Signature: (II)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetSubChannel(JNIEnv * env, jclass clazz, jint channel, jint subchannel) { - return fmod_instance->FSOUND_GetSubChannel(channel, subchannel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_GetSurround -* Signature: (I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1GetSurround(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_GetSurround(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_IsPlaying -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1IsPlaying(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_IsPlaying(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_3D_GetAttributes -* Signature: (ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_13D_1GetAttributes(JNIEnv * env, jclass clazz, jint channel, jobject pos, jint posOffset, jobject vel, jint velOffset) { - float* nPos = posOffset + (float *) (*env)->GetDirectBufferAddress(env, pos); - float* nVel = velOffset + (float *) (*env)->GetDirectBufferAddress(env, vel); - return fmod_instance->FSOUND_3D_GetAttributes(channel, nPos, nVel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_3D_GetMinMaxDistance -* Signature: (ILjava/nio/FloatBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_13D_1GetMinMaxDistance(JNIEnv * env, jclass clazz, jint channel, jobject minmax, jint minmaxOffset) { - float* nMinMax = minmaxOffset + (float *) (*env)->GetDirectBufferAddress(env, minmax); - return fmod_instance->FSOUND_3D_GetMinMaxDistance(channel, &nMinMax[0], &nMinMax[1]); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_3D_Listener_GetAttributes -* Signature: (Ljava/nio/FloatBuffer;ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;ILjava/nio/FloatBuffer;I)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_13D_1Listener_1GetAttributes(JNIEnv * env, jclass clazz, jobject pos, jint posOffset, jobject vel, jint velOffset, jobject fx, jint fxOffset, jobject fy, jint fyOffset, jobject fz, jint fzOffset, jobject tx, jint txOffset, jobject ty, jint tyOffset, jobject tz, jint tzOffset) { - float* nPos = (pos != NULL) ? posOffset + (float *) (*env)->GetDirectBufferAddress(env, pos) : NULL; - float* nVel = (vel != NULL) ? velOffset + (float *) (*env)->GetDirectBufferAddress(env, vel) : NULL; - float* nFx = (fx != NULL) ? fxOffset + (float *) (*env)->GetDirectBufferAddress(env, fx) : NULL; - float* nFy = (fy != NULL) ? fyOffset + (float *) (*env)->GetDirectBufferAddress(env, fy) : NULL; - float* nFz = (fz != NULL) ? fzOffset + (float *) (*env)->GetDirectBufferAddress(env, fz) : NULL; - float* nTx = (tx != NULL) ? txOffset + (float *) (*env)->GetDirectBufferAddress(env, tx) : NULL; - float* nTy = (ty != NULL) ? tyOffset + (float *) (*env)->GetDirectBufferAddress(env, ty) : NULL; - float* nTz = (tz != NULL) ? tzOffset + (float *) (*env)->GetDirectBufferAddress(env, tz) : NULL; - fmod_instance->FSOUND_3D_Listener_GetAttributes(nPos, nVel, nFx, nFy, nFz, nTx, nTy, nTz); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_3D_Listener_SetAttributes -* Signature: (Ljava/nio/FloatBuffer;ILjava/nio/FloatBuffer;IFFFFFF)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_13D_1Listener_1SetAttributes(JNIEnv * env, jclass clazz, jobject pos, jint posOffset, jobject vel, jint velOffset, jfloat fx, jfloat fy, jfloat fz, jfloat tx, jfloat ty, jfloat tz) { - float* nPos = posOffset + (float *) (*env)->GetDirectBufferAddress(env, pos); - float* nVel = velOffset + (float *) (*env)->GetDirectBufferAddress(env, vel); - fmod_instance->FSOUND_3D_Listener_SetAttributes(nPos, nVel, fx, fy, fz, tx, ty, tz); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_3D_Listener_SetCurrent -* Signature: (II)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_13D_1Listener_1SetCurrent(JNIEnv * env, jclass clazz, jint current, jint numlisteners) { - fmod_instance->FSOUND_3D_Listener_SetCurrent(current, numlisteners); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_3D_SetDistanceFactor -* Signature: (F)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_13D_1SetDistanceFactor(JNIEnv * env, jclass clazz, jfloat scale) { - fmod_instance->FSOUND_3D_SetDistanceFactor(scale); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_3D_SetDopplerFactor -* Signature: (F)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_13D_1SetDopplerFactor(JNIEnv * env, jclass clazz, jfloat scale) { - fmod_instance->FSOUND_3D_SetDopplerFactor(scale); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_3D_SetRolloffFactor -* Signature: (F)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_13D_1SetRolloffFactor(JNIEnv * env, jclass clazz, jfloat scale) { - fmod_instance->FSOUND_3D_SetRolloffFactor(scale); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Open -* Signature: (Ljava/nio/ByteBuffer;IIII)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Open__Ljava_nio_ByteBuffer_2III(JNIEnv * env, jclass clazz, jobject data, jint mode, jint offset, jint length) { - const char *streamData = offset + (char *) (*env)->GetDirectBufferAddress(env, data); - return (jlong) fmod_instance->FSOUND_Stream_Open(streamData, mode, 0, length); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Open -* Signature: (Ljava/lang/String;III)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Open__Ljava_lang_String_2III(JNIEnv * env, jclass clazz, jstring name, jint mode, jint offset, jint length) { - jlong result; - char* filename = GetStringNativeChars(env, name); - result = (jlong) fmod_instance->FSOUND_Stream_Open(filename, mode, offset, length); - free(filename); - return result; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Play -* Signature: (IJ)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Play(JNIEnv * env, jclass clazz, jint channel, jlong handle) { - return fmod_instance->FSOUND_Stream_Play(channel, (FSOUND_STREAM*) handle); -} - -/* - * Class: org_lwjgl_fmod3_FSound - * Method: nFSOUND_Stream_PlayEx - * Signature: (IJJZ)I - */ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1PlayEx(JNIEnv * env, jclass clazz, jint channel, jlong stream, jobject dsp, jboolean startpaused) { - FSOUND_DSPUNIT* nDsp = (dsp != NULL) ? (FSOUND_DSPUNIT*) (*env)->GetDirectBufferAddress(env, dsp) : NULL; - return fmod_instance->FSOUND_Stream_PlayEx(channel, (FSOUND_STREAM*) stream, nDsp, startpaused); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Stop -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Stop(JNIEnv * env, jclass clazz, jlong handle) { - return fmod_instance->FSOUND_Stream_Stop((FSOUND_STREAM*) handle); -} - - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Close -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Close(JNIEnv * env, jclass clazz, jlong handle) { - return fmod_instance->FSOUND_Stream_Close((FSOUND_STREAM*) handle); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetNumSubStreams -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetNumSubStreams(JNIEnv * env, jclass clazz, jlong handle) { - return fmod_instance->FSOUND_Stream_GetNumSubStreams((FSOUND_STREAM*) handle); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetSubStream -* Signature: (JI)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetSubStream(JNIEnv * env, jclass clazz, jlong handle, jint index) { - return fmod_instance->FSOUND_Stream_SetSubStream((FSOUND_STREAM*) handle, index); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_AddSyncPoint -* Signature: (JILjava/lang/String;)J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1AddSyncPoint(JNIEnv * env, jclass clazz, jlong stream, jint pcmOffset, jstring name) { - char * nName = GetStringNativeChars(env, name); - FSOUND_SYNCPOINT * result = fmod_instance->FSOUND_Stream_AddSyncPoint((FSOUND_STREAM*) stream, pcmOffset, (void *) nName); - free(nName); - return safeNewBuffer(env, result, 0);; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Create -* Signature: (III)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Create(JNIEnv * env, jclass clazz, jint p1, jint p2, jint p3) { - //XXX - throwFMODException(env, "missing implementation"); - return 0; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_CreateDSP -* Signature: (JI)J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1CreateDSP(JNIEnv * env, jclass clazz, jlong stream, jint priority, jobject dspID) { - long * nDspID = (long *) (*env)->GetDirectBufferAddress(env, dspID); - FSOUND_DSPUNIT* dsp = fmod_instance->FSOUND_Stream_CreateDSP((FSOUND_STREAM*) stream, fsound_dspcallback, priority, nDspID); - return safeNewBuffer(env, dsp, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_DeleteSyncPoint -* Signature: (J)Z -*/ -/* Commented out, conflicting declaration with the header */ -/*JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1DeleteSyncPoint(JNIEnv * env, jclass clazz, jlong point) { - return fmod_instance->FSOUND_Stream_DeleteSyncPoint((FSOUND_SYNCPOINT*) point); -} -*/ -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_FindTagField -* Signature: (JILjava/lang/String;Lorg/lwjgl/fmod_instance/FSoundTagField;)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1FindTagField(JNIEnv * env, jclass clazz, jlong stream, jint type, jstring name, jobject tagField) { - char * nName = GetStringNativeChars(env, name); - bool result = false; - void* value; - jint length; - - if(fmod_instance->FSOUND_Stream_FindTagField((FSOUND_STREAM*) stream, type, nName, &value, &length)) { - - // get set method and call it - jclass cls = (*env)->GetObjectClass(env, tagField); - jmethodID mid = (*env)->GetMethodID(env, cls, "set", "(Ljava/lang/String;Ljava/nio/ByteBuffer;I)V"); - (*env)->CallVoidMethod(env, tagField, mid, name, safeNewBuffer(env, value, length), type); - result = true; - } - free(nName); - return result; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetLength -* Signature: (J)Z -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetLength(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_GetLength((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetLengthMs -* Signature: (J)Z -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetLengthMs(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_GetLengthMs((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetMode -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetMode(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_GetMode((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetNumSyncPoints -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetNumSyncPoints(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_GetNumSyncPoints((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetNumTagFields -* Signature: (JLjava/nio/IntBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetNumTagFields(JNIEnv * env, jclass clazz, jlong stream, jobject num, jint numOffset) { - int* nNum = numOffset + (int*) (*env)->GetDirectBufferAddress(env, num); - return fmod_instance->FSOUND_Stream_GetNumTagFields((FSOUND_STREAM*) stream, &nNum[0]); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetOpenState -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetOpenState(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_GetOpenState((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetPosition -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetPosition(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_GetPosition((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetSample -* Signature: (J)J -*/ -JNIEXPORT jlong JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetSample(JNIEnv * env, jclass clazz, jlong stream) { - return (jlong) fmod_instance->FSOUND_Stream_GetSample((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetSyncPoint -* Signature: (JI)J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetSyncPoint(JNIEnv * env, jclass clazz, jlong stream, jint index) { - FSOUND_SYNCPOINT * point = fmod_instance->FSOUND_Stream_GetSyncPoint((FSOUND_STREAM*) stream, index); - return safeNewBuffer(env, point, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetSyncPointInfo -* Signature: (JLjava/nio/IntBuffer;I)Ljava/lang/String; -*/ -JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetSyncPointInfo(JNIEnv * env, jclass clazz, jobject point, jobject pcmOffset, jint pcmOffsetPosition) { - FSOUND_SYNCPOINT * nPoint = (FSOUND_SYNCPOINT *) (*env)->GetDirectBufferAddress(env, point); - unsigned int * nPcmOffset = pcmOffsetPosition + (unsigned int *) (*env)->GetDirectBufferAddress(env, pcmOffset); - char * result = fmod_instance->FSOUND_Stream_GetSyncPointInfo(nPoint, nPcmOffset); - if(result != NULL) { - return NewStringNativeWithLength(env, result, strlen(result)); - } - return NULL; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetTagField -* Signature: (JILorg/lwjgl/fmod_instance/FSoundTagField;)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetTagField(JNIEnv * env, jclass clazz, jlong stream, jint num, jobject tagField) { - jint type; - char* name; - void* value; - jint length; - - if(fmod_instance->FSOUND_Stream_GetTagField((FSOUND_STREAM*) stream, num, &type, &name, &value, &length)) { - // create string instance of name - jstring nName = NewStringNativeWithLength(env, name, strlen(name)); - - // get set method and call it - jclass cls = (*env)->GetObjectClass(env, tagField); - jmethodID mid = (*env)->GetMethodID(env, cls, "set", "(Ljava/lang/String;Ljava/nio/ByteBuffer;I)V"); - (*env)->CallVoidMethod(env, tagField, mid, nName, safeNewBuffer(env, value, length), type); - return true; - } - return false; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_GetTime -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1GetTime(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_GetTime((FSOUND_STREAM*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Net_GetBufferProperties -* Signature: (Ljava/nio/IntBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Net_1GetBufferProperties(JNIEnv * env, jclass clazz, jobject status, jint statusOffset) { - int* nStatus = statusOffset + (int*) (*env)->GetDirectBufferAddress(env, status); - return fmod_instance->FSOUND_Stream_Net_GetBufferProperties(&nStatus[0], &nStatus[1], &nStatus[2]); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Stream_Net_GetBufferProperties -* Signature: ()Ljava/lang/String; -*/ -JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1Net_1GetLastServerStatus(JNIEnv * env, jclass clazz) { - char * serverstatus = fmod_instance->FSOUND_Stream_Net_GetLastServerStatus(); - return NewStringNativeWithLength(env, serverstatus, strlen(serverstatus)); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Net_GetStatus -* Signature: (JLjava/nio/IntBuffer;I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Net_1GetStatus(JNIEnv * env, jclass clazz, jlong stream, jobject status, jint statusOffset) { - int* nStatus = statusOffset + (int*) (*env)->GetDirectBufferAddress(env, status); - return fmod_instance->FSOUND_Stream_Net_GetStatus((FSOUND_STREAM*) stream, &nStatus[0], &nStatus[1], &nStatus[2], (unsigned int *) &nStatus[3]); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Stream_Net_SetBufferProperties -* Signature: (III)Ljava/lang/String; -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1Net_1SetBufferProperties(JNIEnv * env, jclass clazz, jint buffersize, jint prebuffer_percent, jint rebuffer_percent) { - return fmod_instance->FSOUND_Stream_Net_SetBufferProperties(buffersize, prebuffer_percent, rebuffer_percent); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_Net_SetMetadataCallback -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1Net_1SetMetadataCallback(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_Net_SetMetadataCallback((FSOUND_STREAM*) stream, fsound_metadata_callback, (void*) stream); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Stream_Net_SetProxy -* Signature: (Ljava/lang/String;)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1Net_1SetProxy(JNIEnv * env, jclass clazz, jstring proxy) { - char * proxyString = GetStringNativeChars(env, proxy); - jboolean result = fmod_instance->FSOUND_Stream_Net_SetProxy(proxyString); - free(proxyString); - return result; -} - - - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Stream_SetBufferSize -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1SetBufferSize(JNIEnv * env, jclass clazz, jint ms) { - return fmod_instance->FSOUND_Stream_SetBufferSize(ms); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetEndCallback -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetEndCallback(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_SetEndCallback((FSOUND_STREAM*) stream, fsound_stream_endcallback, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetLoopCount -* Signature: (JI)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetLoopCount(JNIEnv * env, jclass clazz, jlong stream, jint count) { - return fmod_instance->FSOUND_Stream_SetLoopCount((FSOUND_STREAM*) stream, count); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetLoopPoints -* Signature: (JII)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetLoopPoints(JNIEnv * env, jclass clazz, jlong stream, jint loopstartpcm, jint loopendpcm) { - return fmod_instance->FSOUND_Stream_SetLoopPoints((FSOUND_STREAM*) stream, loopstartpcm, loopendpcm); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetMode -* Signature: (JI)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetMode(JNIEnv * env, jclass clazz, jlong stream, jint mode) { - return fmod_instance->FSOUND_Stream_SetMode((FSOUND_STREAM*) stream, mode); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetPosition -* Signature: (JI)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetPosition(JNIEnv * env, jclass clazz, jlong stream, jint position) { - return fmod_instance->FSOUND_Stream_SetPosition((FSOUND_STREAM*) stream, position); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetSubStreamSentence -* Signature: (JLjava/nio/IntBuffer;I)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetSubStreamSentence(JNIEnv * env, jclass clazz, jlong p1, jobject p2, jint p3) { - //XXX - throwFMODException(env, "missing implementation"); - return false; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Stream_SetSyncCallback -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Stream_1SetSyncCallback(JNIEnv * env, jclass clazz, jlong stream) { - return fmod_instance->FSOUND_Stream_SetSyncCallback((FSOUND_STREAM*) stream, fsound_stream_synccallback, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Stream_SetTime -* Signature: (JI)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Stream_1SetTime(JNIEnv * env, jclass clazz, jlong stream, jint ms) { - return fmod_instance->FSOUND_Stream_SetTime((FSOUND_STREAM*) stream, ms); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_Eject -* Signature: (C)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1OpenTray(JNIEnv * env, jclass clazz, jchar drive, jboolean open) { -#ifdef __APPLE__ && __MACH__ - return false; -#else - return fmod_instance->FSOUND_CD_OpenTray(drive, open); -#endif -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_GetNumTracks -* Signature: (C)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1GetNumTracks(JNIEnv * env, jclass clazz, jchar drive) { - return fmod_instance->FSOUND_CD_GetNumTracks(drive); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_GetPaused -* Signature: (C)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1GetPaused(JNIEnv * env, jclass clazz, jchar drive) { - return fmod_instance->FSOUND_CD_GetPaused(drive); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_GetTrack -* Signature: (C)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1GetTrack(JNIEnv * env, jclass clazz, jchar drive) { - return fmod_instance->FSOUND_CD_GetTrack(drive); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_GetTrackLength -* Signature: (CI)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1GetTrackLength(JNIEnv * env, jclass clazz, jchar drive, jint track) { - return fmod_instance->FSOUND_CD_GetTrackLength(drive, track); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_GetTrackTime -* Signature: (C)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1GetTrackTime(JNIEnv * env, jclass clazz, jchar drive) { - return fmod_instance->FSOUND_CD_GetTrackTime(drive); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_Play -* Signature: (CI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1Play(JNIEnv * env, jclass clazz, jchar drive, jint track) { - return fmod_instance->FSOUND_CD_Play(drive, track); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_SetPaused -* Signature: (CZ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1SetPaused(JNIEnv * env, jclass clazz, jchar drive, jboolean paused) { - return fmod_instance->FSOUND_CD_SetPaused(drive, paused); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_SetPlayMode -* Signature: (CI)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1SetPlayMode(JNIEnv * env, jclass clazz, jchar drive, jint mode) { - fmod_instance->FSOUND_CD_SetPlayMode(drive, mode); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_SetTrackTime -* Signature: (CI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1SetTrackTime(JNIEnv * env, jclass clazz, jchar drive, jint ms) { - return fmod_instance->FSOUND_CD_SetTrackTime(drive, ms); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_SetVolume -* Signature: (CI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1SetVolume(JNIEnv * env, jclass clazz, jchar drive, jint volume) { - return fmod_instance->FSOUND_CD_SetVolume(drive, volume); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_CD_Stop -* Signature: (C)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1CD_1Stop(JNIEnv * env, jclass clazz, jchar drive) { - return fmod_instance->FSOUND_CD_Stop(drive); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_DSP_ClearMixBuffer -* Signature: ()V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1DSP_1ClearMixBuffer(JNIEnv * env, jclass clazz) { - fmod_instance->FSOUND_DSP_ClearMixBuffer(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_Create -* Signature: (I)J -*/ -/* Commented out, conflicting declaration with the header */ -/* -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1Create(JNIEnv * env, jclass clazz, jint priority, jobject dspID) { - long * nDspID = (long *) (*env)->GetDirectBufferAddress(env, dspID); - FSOUND_DSPUNIT* dsp = fmod_instance->FSOUND_DSP_Create(fsound_dspcallback, priority, nDspID); - return safeNewBuffer(env, dsp, 0); -} -*/ -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_Free -* Signature: (J)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1Free(JNIEnv * env, jclass clazz, jobject dsp) { - FSOUND_DSPUNIT* nDsp = (FSOUND_DSPUNIT*) (*env)->GetDirectBufferAddress(env, dsp); - fmod_instance->FSOUND_DSP_Free(nDsp); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_SetActive -* Signature: (JZ)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1SetActive(JNIEnv * env, jclass clazz, jobject dsp, jboolean active) { - FSOUND_DSPUNIT* nDsp = (FSOUND_DSPUNIT*) (*env)->GetDirectBufferAddress(env, dsp); - fmod_instance->FSOUND_DSP_SetActive(nDsp, active); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetActive -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetActive(JNIEnv * env, jclass clazz, jobject dsp) { - FSOUND_DSPUNIT* nDsp = (FSOUND_DSPUNIT*) (*env)->GetDirectBufferAddress(env, dsp); - return fmod_instance->FSOUND_DSP_GetActive(nDsp); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_DSP_GetBufferLength -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1DSP_1GetBufferLength(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_DSP_GetBufferLength(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_DSP_GetBufferLengthTotal -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1DSP_1GetBufferLengthTotal(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_DSP_GetBufferLengthTotal(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_SetPriority -* Signature: (JI)V -*/ -JNIEXPORT void JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1SetPriority(JNIEnv * env, jclass clazz, jobject dsp, jint priority) { - FSOUND_DSPUNIT* nDsp = (FSOUND_DSPUNIT*) (*env)->GetDirectBufferAddress(env, dsp); - fmod_instance->FSOUND_DSP_SetPriority(nDsp, priority); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetPriority -* Signature: (J)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetPriority(JNIEnv * env, jclass clazz, jobject dsp) { - FSOUND_DSPUNIT* nDsp = (FSOUND_DSPUNIT*) (*env)->GetDirectBufferAddress(env, dsp); - return fmod_instance->FSOUND_DSP_GetPriority(nDsp); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetClearUnit -* Signature: ()J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetClearUnit(JNIEnv * env, jclass clazz) { - FSOUND_DSPUNIT* dsp = fmod_instance->FSOUND_DSP_GetClearUnit(); - return safeNewBuffer(env, dsp, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetClipAndCopyUnit -* Signature: ()J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetClipAndCopyUnit(JNIEnv * env, jclass clazz) { - FSOUND_DSPUNIT* dsp = fmod_instance->FSOUND_DSP_GetClipAndCopyUnit(); - return safeNewBuffer(env, dsp, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetMusicUnit -* Signature: ()J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetMusicUnit(JNIEnv * env, jclass clazz) { - FSOUND_DSPUNIT* dsp = fmod_instance->FSOUND_DSP_GetMusicUnit(); - return safeNewBuffer(env, dsp, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetSFXUnit -* Signature: ()J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetSFXUnit(JNIEnv * env, jclass clazz) { - FSOUND_DSPUNIT* dsp = fmod_instance->FSOUND_DSP_GetSFXUnit(); - return safeNewBuffer(env, dsp, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetFFTUnit -* Signature: ()J -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetFFTUnit(JNIEnv * env, jclass clazz) { - FSOUND_DSPUNIT* dsp = fmod_instance->FSOUND_DSP_GetFFTUnit(); - return safeNewBuffer(env, dsp, 0); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_GetSpectrum -* Signature: ()Ljava/nio/FloatBuffer; -*/ -JNIEXPORT jobject JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1GetSpectrum(JNIEnv * env, jclass clazz) { - return (*env)->NewDirectByteBuffer(env, fmod_instance->FSOUND_DSP_GetSpectrum(), (512 * sizeof(float))); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_DSP_MixBuffers -* Signature: (Ljava/nio/ByteBuffer;ILjava/nio/ByteBuffer;IIIIII)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1DSP_1MixBuffers(JNIEnv * env, jclass clazz, jobject destBuffer, jint destBufferOffset, jobject srcBuffer, jint srcBufferOffset, jint len, jint freq, jint vol, jint pan, jint mode) { - void * nDestBuffer = destBufferOffset + (char *) (*env)->GetDirectBufferAddress(env, destBuffer); - void * nSrcBuffer = srcBufferOffset + (char *) (*env)->GetDirectBufferAddress(env, srcBuffer); - return fmod_instance->FSOUND_DSP_MixBuffers(nDestBuffer, nSrcBuffer, len, freq, vol, pan, mode); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_Disable -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1Disable(JNIEnv * env, jclass clazz, jint channel) { - return fmod_instance->FSOUND_FX_Disable(channel); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_Enable -* Signature: (II)I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1Enable(JNIEnv * env, jclass clazz, jint channel, jint fx) { - return fmod_instance->FSOUND_FX_Enable(channel, fx); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetChorus -* Signature: (IFFFFIFI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetChorus(JNIEnv * env, jclass clazz, jint fxid, jfloat WetDryMix, jfloat Depth, jfloat Feedback, jfloat Frequency, jint Waveform, jfloat Delay, jint Phase) { - return fmod_instance->FSOUND_FX_SetChorus(fxid, WetDryMix, Depth, Feedback, Frequency, Waveform, Delay, Phase); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetCompressor -* Signature: (IFFFFFF)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetCompressor(JNIEnv * env, jclass clazz, jint fxid, jfloat Gain, jfloat Attack, jfloat Release, jfloat Threshold, jfloat Ratio, jfloat Predelay) { - return fmod_instance->FSOUND_FX_SetCompressor(fxid, Gain, Attack, Release, Threshold, Ratio, Predelay); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetDistortion -* Signature: (IFFFFF)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetDistortion(JNIEnv * env, jclass clazz, jint fxid, jfloat Gain, jfloat Edge, jfloat PostEQCenterFrequency, jfloat PostEQBandwidth, jfloat PreLowpassCutoff) { - return fmod_instance->FSOUND_FX_SetDistortion(fxid, Gain, Edge, PostEQCenterFrequency, PostEQBandwidth, PreLowpassCutoff); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetEcho -* Signature: (IFFFFI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetEcho(JNIEnv * env, jclass clazz, jint fxid, jfloat WetDryMix, jfloat Feedback, jfloat LeftDelay, jfloat RightDelay, jint PanDelay) { - return fmod_instance->FSOUND_FX_SetEcho(fxid, WetDryMix, Feedback, LeftDelay, RightDelay, PanDelay); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetFlanger -* Signature: (IFFFFIFI)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetFlanger(JNIEnv * env, jclass clazz, jint fxid, jfloat WetDryMix, jfloat Depth, jfloat Feedback, jfloat Frequency, jint Waveform, jfloat Delay, jint Phase) { - return fmod_instance->FSOUND_FX_SetFlanger(fxid, WetDryMix, Depth, Feedback, Frequency, Waveform, Delay, Phase); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetGargle -* Signature: (III)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetGargle(JNIEnv * env, jclass clazz, jint fxid, jint RateHz, jint WaveShape) { - return fmod_instance->FSOUND_FX_SetGargle(fxid, RateHz, WaveShape); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetI3DL2Reverb -* Signature: (IIIFFFIFIFFFF)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetI3DL2Reverb(JNIEnv * env, jclass clazz, - jint fxid, jint Room, jint RoomHF, jfloat RoomRolloffFactor, jfloat DecayTime, - jfloat DecayHFRation, jint Reflections, jfloat ReflectionsDelay, jint Reverb, - jfloat ReverbDelay, jfloat Diffusion, jfloat Density, jfloat HFReference) { - return fmod_instance->FSOUND_FX_SetI3DL2Reverb( - fxid, Room, RoomHF, RoomRolloffFactor, DecayTime, - DecayHFRation, Reflections, ReflectionsDelay, Reverb, - ReverbDelay, Diffusion, Density, HFReference); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetParamEQ -* Signature: (IFFF)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetParamEQ(JNIEnv * env, jclass clazz, jint fxid, jfloat Center, jfloat Bandwidth, jfloat Gain) { - return fmod_instance->FSOUND_FX_SetParamEQ(fxid, Center, Bandwidth, Gain); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_FX_SetWavesReverb -* Signature: (IFFFF)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1FX_1SetWavesReverb(JNIEnv * env, jclass clazz, jint fxid, jfloat InGain, jfloat ReverbMix, jfloat ReverbTime, jfloat HighFreqRTRatio) { - return fmod_instance->FSOUND_FX_SetWavesReverb(fxid, InGain, ReverbMix, ReverbTime, HighFreqRTRatio); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Record_GetDriver -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Record_1GetDriver(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_Record_GetDriver(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Record_GetDriverName -* Signature: (I)Ljava/lang/String; -*/ -JNIEXPORT jstring JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Record_1GetDriverName(JNIEnv * env, jclass clazz, jint driver) { - char * drivername = fmod_instance->FSOUND_Record_GetDriverName(driver); - return NewStringNativeWithLength(env, drivername, strlen(drivername)); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Record_GetNumDrivers -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Record_1GetNumDrivers(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_Record_GetNumDrivers(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Record_GetPosition -* Signature: ()I -*/ -JNIEXPORT jint JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Record_1GetPosition(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_Record_GetPosition(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Record_SetDriver -* Signature: (I)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Record_1SetDriver(JNIEnv * env, jclass clazz, jint outputtype) { - return fmod_instance->FSOUND_Record_SetDriver(outputtype); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Record_StartSample -* Signature: (JZ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Record_1StartSample(JNIEnv * env, jclass clazz, jlong sample, jboolean loop) { - return fmod_instance->FSOUND_Record_StartSample((FSOUND_SAMPLE *) sample, loop); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: FSOUND_Record_Stop -* Signature: ()Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_FSOUND_1Record_1Stop(JNIEnv * env, jclass clazz) { - return fmod_instance->FSOUND_Record_Stop(); -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Reverb_SetProperties -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Reverb_1SetProperties(JNIEnv * env, jclass clazz, jlong prop) { - throwFMODException(env, "missing implementation"); - //return fmod_instance->FSOUND_Reverb_SetProperties((FSOUND_REVERB_PROPERTIES*) prop); - return false; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Reverb_GetProperties -* Signature: (J)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Reverb_1GetProperties(JNIEnv * env, jclass clazz, jlong prop) { - throwFMODException(env, "missing implementation"); - //return fmod_instance->FSOUND_Reverb_GetProperties((FSOUND_REVERB_PROPERTIES*) prop); - return false; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Reverb_SetChannelProperties -* Signature: (IJ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Reverb_1SetChannelProperties(JNIEnv * env, jclass clazz, jint channel, jlong prop) { - throwFMODException(env, "missing implementation"); - //return fmod_instance->FSOUND_Reverb_SetChannelProperties(channel, (FSOUND_REVERB_CHANNELPROPERTIES*) prop); - return false; -} - -/* -* Class: org_lwjgl_fmod3_FSound -* Method: nFSOUND_Reverb_GetChannelProperties -* Signature: (IJ)Z -*/ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_fmod3_FSound_nFSOUND_1Reverb_1GetChannelProperties(JNIEnv * env, jclass clazz, jint channel, jlong prop) { - throwFMODException(env, "missing implementation"); - //return fmod_instance->FSOUND_Reverb_GetChannelProperties(channel, (FSOUND_REVERB_CHANNELPROPERTIES*) prop); - return false; -} - -/** - * This attaches the mixer thread as a daemon thread, and sets its - * priority to max value - */ -void attachStreamThread() { - jclass threadClass; - jmethodID currentThread; - jobject myThread; - jfieldID highPriority; - jint highPriorityValue; - jmethodID priority; - JavaVM* jvm = getJVM(); - (*jvm)->AttachCurrentThreadAsDaemon(jvm, (void*)&stream_jnienv, NULL); - - // set to high priority - // ============================== - // get current thread - threadClass = (*stream_jnienv)->FindClass(stream_jnienv, "java/lang/Thread"); - currentThread = (*stream_jnienv)->GetStaticMethodID(stream_jnienv, threadClass, "currentThread", "()Ljava/lang/Thread;"); - myThread = (*stream_jnienv)->CallStaticObjectMethod(stream_jnienv, threadClass, currentThread); - - // get value of high priority - highPriority = (*stream_jnienv)->GetStaticFieldID(stream_jnienv, threadClass, "MAX_PRIORITY", "I"); - highPriorityValue = (*stream_jnienv)->GetStaticIntField(stream_jnienv, threadClass, highPriority); - - // call set priority - priority = (*stream_jnienv)->GetMethodID(stream_jnienv, threadClass, "setPriority", "(I)V"); - (*stream_jnienv)->CallVoidMethod(stream_jnienv, myThread, priority, highPriorityValue); - // ------------------------------ -} - -// FSound callbacks -// ======================================= -void * F_CALLBACKAPI fsound_dspcallback(void *originalbuffer, void *newbuffer, int length, void *userdata) { - int size; - jobject origBuffer; - jobject newBuffer; - jobject resultBuffer; - - if (mixer_jnienv == NULL) { attachMixerThread(); } - size = length * fsound_dsp_buffer_size; - origBuffer = (*mixer_jnienv)->NewDirectByteBuffer(mixer_jnienv, originalbuffer, size); - newBuffer = (*mixer_jnienv)->NewDirectByteBuffer(mixer_jnienv, newbuffer, size); - resultBuffer = (*mixer_jnienv)->CallStaticObjectMethod(mixer_jnienv, fsound, sound_dspcallback, (jlong) *((long *)userdata), origBuffer, newBuffer, (jint) length); - return (*mixer_jnienv)->GetDirectBufferAddress(mixer_jnienv, resultBuffer); -} - -signed char F_CALLBACKAPI fsound_stream_endcallback(FSOUND_STREAM *stream, void *buff, int len, void *param) { - if (stream_jnienv == NULL) { attachStreamThread(); } - (*stream_jnienv)->CallStaticVoidMethod(stream_jnienv, fsound, sound_stream_endcallback, (jlong) stream); - return true; -} - -signed char F_CALLBACKAPI fsound_stream_synccallback(FSOUND_STREAM *stream, void *buff, int len, void *param) { - int length; - if (stream_jnienv == NULL) { attachStreamThread(); } - length = strlen((const char *) buff); - (*stream_jnienv)->CallStaticVoidMethod(stream_jnienv, fsound, sound_stream_synccallback, (jlong) stream, safeNewBuffer(stream_jnienv, buff, length), (jint) len); - return true; -} - -signed char F_CALLBACKAPI fsound_stream_callback(FSOUND_STREAM *stream, void *buff, int len, void *param) { - if (stream_jnienv == NULL) { attachStreamThread(); } - (*stream_jnienv)->CallStaticVoidMethod(stream_jnienv, fsound, sound_stream_callback, (jlong) stream, safeNewBuffer(stream_jnienv, buff, len), (jint) len); - return true; -} - -signed char F_CALLBACKAPI fsound_metadata_callback(char *name, char *value, void *userdata) { - if (stream_jnienv == NULL) { attachStreamThread(); } - (*stream_jnienv)->CallStaticVoidMethod(stream_jnienv, fsound, sound_metadata_callback, (jlong) userdata, safeNewBuffer(stream_jnienv, name, strlen(name)), safeNewBuffer(stream_jnienv, value, strlen(value))); - return true; -}