You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ma...@us...> - 2007-04-19 22:34:02
|
Revision: 2772
http://svn.sourceforge.net/java-game-lib/?rev=2772&view=rev
Author: matzon
Date: 2007-04-19 15:18:16 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
using NewStringNativeWithLength
Modified Paths:
--------------
trunk/LWJGL/src/native/common/common_tools.c
trunk/LWJGL/src/native/common/common_tools.h
Modified: trunk/LWJGL/src/native/common/common_tools.c
===================================================================
--- trunk/LWJGL/src/native/common/common_tools.c 2007-04-19 12:00:40 UTC (rev 2771)
+++ trunk/LWJGL/src/native/common/common_tools.c 2007-04-19 22:18:16 UTC (rev 2772)
@@ -195,11 +195,11 @@
* match GLuchar and ALuchar types
*/
jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str) {
- return NewStringNative(env, (const char *)str);
+ return NewStringNativeWithLength(env, (const char *)str, strlen((const char *)str));
}
// creates locale specific string
-jstring NewStringNative(JNIEnv *env, const char *str) {
+jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length) {
jclass jcls_str;
jmethodID jmethod_str;
jstring result;
@@ -221,10 +221,10 @@
if ((*env)->EnsureLocalCapacity(env,2) < 0) {
return NULL; /* out of memory error */
}
- len = strlen(str);
- bytes = (*env)->NewByteArray(env,len);
+
+ bytes = (*env)->NewByteArray(env,length);
if (bytes != NULL) {
- (*env)->SetByteArrayRegion(env,bytes, 0, len, (jbyte *)str);
+ (*env)->SetByteArrayRegion(env,bytes, 0, length, (jbyte *)str);
result = (jstring)(*env)->NewObject(env,jcls_str, jmethod_str, bytes);
(*env)->DeleteLocalRef(env,bytes);
return result;
@@ -289,7 +289,7 @@
}
bool getBooleanProperty(JNIEnv *env, const char* propertyName) {
- jstring property = NewStringNative(env, propertyName);
+ jstring property = NewStringNativeWithLength(env, propertyName, strlen(propertyName));
jclass org_lwjgl_LWJGLUtil_class;
jmethodID getBoolean;
if (property == NULL)
Modified: trunk/LWJGL/src/native/common/common_tools.h
===================================================================
--- trunk/LWJGL/src/native/common/common_tools.h 2007-04-19 12:00:40 UTC (rev 2771)
+++ trunk/LWJGL/src/native/common/common_tools.h 2007-04-19 22:18:16 UTC (rev 2772)
@@ -138,7 +138,7 @@
extern void printfDebug(const char *format, ...);
extern bool getBooleanProperty(JNIEnv *env, const char* propertyName);
extern char * GetStringNativeChars(JNIEnv *env, jstring jstr);
-extern jstring NewStringNative(JNIEnv *env, const char *str);
+extern jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length);
extern jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str);
extern jobject newJavaManagedByteBuffer(JNIEnv *env, const int size);
extern bool positionBuffer(JNIEnv *env, jobject buffer, jint position);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:26:25
|
Revision: 2785
http://svn.sourceforge.net/java-game-lib/?rev=2785&view=rev
Author: matzon
Date: 2007-04-19 15:26:19 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
updated to ALC10 instead of ALC
Removed Paths:
-------------
trunk/LWJGL/src/java/org/lwjgl/openal/ALC.java
Deleted: trunk/LWJGL/src/java/org/lwjgl/openal/ALC.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC.java 2007-04-19 22:25:47 UTC (rev 2784)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC.java 2007-04-19 22:26:19 UTC (rev 2785)
@@ -1,382 +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.openal;
-
-import java.nio.Buffer;
-import java.nio.IntBuffer;
-
-import org.lwjgl.BufferChecks;
-import org.lwjgl.LWJGLException;
-import org.lwjgl.Sys;
-
-/**
- *
- * <p>
- * This is the context class for OpenAL. This class implements functions
- * in alc.h
- * </p>
- *
- * <p>
- * ALC introduces the notion of a Device. A Device can be, depending on the
- * implementation, a hardware device, or a daemon/OS service/actual server. This
- * mechanism also permits different drivers (and hardware) to coexist within the same
- * system, as well as allowing several applications to share system resources for audio,
- * including a single hardware output device. The details are left to the
- * implementation, which has to map the available backends to unique device
- * specifiers (represented as strings).
- * </p>
- *
- * <p>
- * <b>NOTE:</b><br>
- * The LWJGL implementation of OpenAL does not expose the device, nor the context.
- * Whenever <code>AL</code> is created using the <code>create</code> method, an underlying
- * device and context is created. Thus more advanced usage of multiple contexts and/or devices
- * are not possible. The above mentioned features are very rarely used in games.
- * </p>
- *
- * @author Brian Matzon <br...@ma...>
- * @version $Revision$
- * $Id$
- */
-public final class ALC {
- /** Bad value */
- public static final int ALC_INVALID = -1;
-
- /** Boolean False */
- public static final int ALC_FALSE = 0;
-
- /** Boolean True */
- public static final int ALC_TRUE = 1;
-
- /** Errors: No Error */
- public static final int ALC_NO_ERROR = ALC_FALSE;
-
- /** Major version query. */
- public static final int ALC_MAJOR_VERSION = 0x1000;
-
- /** Minor version query. */
- public static final int ALC_MINOR_VERSION = 0x1001;
-
- /**
- * The size required for the zero-terminated attributes list, for the current context.
- **/
- public static final int ALC_ATTRIBUTES_SIZE = 0x1002;
-
- /**
- * Expects a destination of ALC_CURRENT_ATTRIBUTES_SIZE,
- * and provides the attribute list for the current context of the specified device.
- */
- public static final int ALC_ALL_ATTRIBUTES = 0x1003;
-
- /** The specifier string for the default device */
- public static final int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004;
-
- /** The specifier string for the device */
- public static final int ALC_DEVICE_SPECIFIER = 0x1005;
-
- /** The extensions string for diagnostics and printing */
- public static final int ALC_EXTENSIONS = 0x1006;
-
- /** Frequency for mixing output buffer, in units of Hz. */
- public static final int ALC_FREQUENCY = 0x1007;
-
- /** Refresh intervalls, in units of Hz. */
- public static final int ALC_REFRESH = 0x1008;
-
- /** Flag, indicating a synchronous context. */
- public static final int ALC_SYNC = 0x1009;
-
- /** The device argument does not name a valid device */
- public static final int ALC_INVALID_DEVICE = 0xA001;
-
- /** The context argument does not name a valid context */
- public static final int ALC_INVALID_CONTEXT = 0xA002;
-
- /**
- * A function was called at inappropriate time, or in an inappropriate way,
- * causing an illegal state. This can be an incompatible ALenum, object ID,
- * and/or function.
- */
- public static final int ALC_INVALID_ENUM = 0xA003;
-
- /**
- * Illegal value passed as an argument to an AL call.
- * Applies to parameter values, but not to enumerations.
- */
- public static final int ALC_INVALID_VALUE = 0xA004;
-
- /**
- * A function could not be completed, because there is not enough
- * memory available.
- */
- public static final int ALC_OUT_OF_MEMORY = 0xA005;
-
- static {
- Sys.initialize();
- }
-
- private ALC() {
- }
-
- static native void initNativeStubs() throws LWJGLException;
-
- static long getDevice() {
- if(AL.device != null) {
- return AL.device.device;
- }
- return 0L;
- }
-
- /**
- * The application can obtain certain strings from ALC.
- *
- * <code>ALC_DEFAULT_DEVICE_SPECIFIER</code> - The specifer string for the default device
- * <code>ALC_DEVICE_SPECIFIER</code> - The specifer string for the device
- * <code>ALC_EXTENSIONS</code> - The extensions string for diagnostics and printing.
- *
- * In addition, printable error message strings are provided for all valid error tokens,
- * including <code>ALC_NO_ERROR</code>,<code>ALC_INVALID_DEVICE</code>, <code>ALC_INVALID_CONTEXT</code>,
- * <code>ALC_INVALID_ENUM</code>, <code>ALC_INVALID_VALUE</code>.
- *
- * @param pname Property to get
- * @return String property from device
- */
- public static String alcGetString(int pname) {
- String result;
- result = nalcGetString(getDevice(), pname);
- Util.checkALCError();
- return result;
- }
- private native static String nalcGetString(long device, int pname);
-
- /**
- * The application can query ALC for information using an integer query function.
- * For some tokens, <code>null</code> is a legal deviceHandle. In other cases, specifying a <code>null</code>
- * device will generate an <code>ALC_INVALID_DEVICE</code> error. The application has to
- * specify the size of the destination buffer provided. A <code>null</code> destination or a zero
- * size parameter will cause ALC to ignore the query.
- *
- * <code>ALC_MAJOR_VERSION</code> - Major version query.
- * <code>ALC_MINOR_VERSION</code> - Minor version query.
- * <code>ALC_ATTRIBUTES_SIZE</code> - The size required for the zero-terminated attributes list,
- * for the current context. <code>null</code> is an invalid device. <code>null</code> (no current context
- * for the specified device) is legal.
- * <code>ALC_ALL_ATTRIBUTES</code> - Expects a destination of <code>ALC_CURRENT_ATTRIBUTES_SIZE</code>,
- * and provides the attribute list for the current context of the specified device.
- * <code>null</code> is an invalid device. <code>null</code> (no current context for the specified device)
- * will return the default attributes defined by the specified device.
- *
- * @param pname Property to get
- * @param integerdata ByteBuffer to write integers to
- */
- public static void alcGetInteger(int pname, IntBuffer integerdata) {
- BufferChecks.checkDirect(integerdata);
- nalcGetIntegerv(getDevice(), pname, integerdata.remaining(), integerdata, integerdata.position());
- Util.checkALCError();
- }
- private native static void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset);
-
- /**
- * The <code>alcOpenDevice</code> function allows the application (i.e. the client program) to
- * connect to a device (i.e. the server).
- *
- * If the function returns <code>null</code>, then no sound driver/device has been found. The
- * argument is a null terminated string that requests a certain device or device
- * configuration. If <code>null</code> is specified, the implementation will provide an
- * implementation specific default.
- *
- * @param devicename name of device to open
- * @return opened device, or null
- */
- native static ALCdevice alcOpenDevice(String devicename);
-
- /**
- * The <code>alcCloseDevice</code> function allows the application (i.e. the client program) to
- * disconnect from a device (i.e. the server).
- *
- * If deviceHandle is <code>null</code> or invalid, an <code>ALC_INVALID_DEVICE</code> error will be
- * generated. Once closed, a deviceHandle is invalid.
- *
- * @param device address of native device to close
- */
- native static void alcCloseDevice(long device);
-
- /**
- * A context is created using <code>alcCreateContext</code>. The device parameter has to be a valid
- * device. The attribute list can be <code>null</code>, or a zero terminated list of integer pairs
- * composed of valid ALC attribute tokens and requested values.
- *
- * Context creation will fail if the application requests attributes that, by themselves,
- * can not be provided. Context creation will fail if the combination of specified
- * attributes can not be provided. Context creation will fail if a specified attribute, or
- * the combination of attributes, does not match the default values for unspecified
- * attributes.
- *
- * @param device address of device to associate context to
- * @param attrList Buffer to read attributes from
- * @return New context, or null if creation failed
- */
- static ALCcontext alcCreateContext(long device, IntBuffer attrList) {
- ALCcontext result = nalcCreateContext(device, attrList);
- Util.checkALCError();
- return result;
- }
- private native static ALCcontext nalcCreateContext(long device, IntBuffer attrList);
-
- /**
- * To make a Context current with respect to AL Operation (state changes by issueing
- * commands), <code>alcMakeContextCurrent</code> is used. The context parameter can be <code>null</code>
- * or a valid context pointer. The operation will apply to the device that the context
- * was created for.
- *
- * For each OS process (usually this means for each application), only one context can
- * be current at any given time. All AL commands apply to the current context.
- * Commands that affect objects shared among contexts (e.g. buffers) have side effects
- * on other contexts.
- *
- * @param context address of context to make current
- * @return true if successfull, false if not
- */
- native static int alcMakeContextCurrent(long context);
-
- /**
- * The current context is the only context accessible to state changes by AL commands
- * (aside from state changes affecting shared objects). However, multiple contexts can
- * be processed at the same time. To indicate that a context should be processed (i.e.
- * that internal execution state like offset increments are supposed to be performed),
- * the application has to use <code>alcProcessContext</code>.
- *
- * Repeated calls to <code>alcProcessContext</code> are legal, and do not affect a context that is
- * already marked as processing. The default state of a context created by
- * alcCreateContext is that it is not marked as processing.
- */
- public static void alcProcessContext() {
- nalcProcessContext(AL.context.context);
- }
- private native static void nalcProcessContext(long context);
-
- /**
- * The application can query for, and obtain an handle to, the current context for the
- * application. If there is no current context, <code>null</code> is returned.
- *
- * @return Current ALCcontext
- */
- native static ALCcontext alcGetCurrentContext();
-
- /**
- * The application can query for, and obtain an handle to, the device of a given context.
- *
- * @param context address of context to get device for
- * @param ALCdevice associated with context
- */
- native static ALCdevice alcGetContextsDevice(long context);
-
- /**
- * The application can suspend any context from processing (including the current
- * one). To indicate that a context should be suspended from processing (i.e. that
- * internal execution state like offset increments is not supposed to be changed), the
- * application has to use <code>alcSuspendContext</code>.
- *
- * Repeated calls to <code>alcSuspendContext</code> are legal, and do not affect a context that is
- * already marked as suspended. The default state of a context created by
- * <code>alcCreateContext</code> is that it is marked as suspended.
- *
- * @param context address of context to suspend
- */
- public static void alcSuspendContext() {
- nalcSuspendContext(AL.context.context);
- }
- private native static void nalcSuspendContext(long context);
-
- /**
- * The correct way to destroy a context is to first release it using <code>alcMakeCurrent</code> and
- * <code>null</code>. Applications should not attempt to destroy a current context.
- *
- * @param context address of context to Destroy
- */
- native static void alcDestroyContext(long context);
-
- /**
- * ALC uses the same conventions and mechanisms as AL for error handling. In
- * particular, ALC does not use conventions derived from X11 (GLX) or Windows
- * (WGL). The <code>alcGetError</code> function can be used to query ALC errors.
- *
- * Error conditions are specific to the device.
- *
- * ALC_NO_ERROR - The device handle or specifier does name an accessible driver/server.
- * <code>ALC_INVALID_DEVICE</code> - The Context argument does not name a valid context.
- * <code>ALC_INVALID_CONTEXT</code> - The Context argument does not name a valid context.
- * <code>ALC_INVALID_ENUM</code> - A token used is not valid, or not applicable.
- * <code>ALC_INVALID_VALUE</code> - An value (e.g. attribute) is not valid, or not applicable.
- *
- * @return Errorcode from ALC statemachine
- */
- public static int alcGetError() {
- return nalcGetError(getDevice());
- }
- private native static int nalcGetError(long device);
-
- /**
- * Verify that a given extension is available for the current context and the device it
- * is associated with.
- * A <code>null</code> name argument returns <code>ALC_FALSE</code>, as do invalid and unsupported string
- * tokens.
- *
- * @param extName name of extension to find
- * @return true if extension is available, false if not
- */
- public static boolean alcIsExtensionPresent(String extName) {
- boolean result = nalcIsExtensionPresent(getDevice(), extName);
- Util.checkALCError();
- return result;
- }
- private native static boolean nalcIsExtensionPresent(long device, String extName);
-
- /**
- * Enumeration/token values are device independend, but tokens defined for
- * extensions might not be present for a given device. But only the tokens defined
- * by the AL core are guaranteed. Availability of extension tokens dependends on the ALC extension.
- *
- * Specifying a <code>null</code> name parameter will cause an <code>ALC_INVALID_VALUE</code> error.
- *
- * @param enumName name of enum to find
- * @return value of enumeration
- */
- public static int alcGetEnumValue(String enumName) {
- int result = nalcGetEnumValue(getDevice(), enumName);
- Util.checkALCError();
- return result;
- }
- private native static int nalcGetEnumValue(long device, String enumName);
-
- static native String[] ngetImplementations();
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:25:49
|
Revision: 2784
http://svn.sourceforge.net/java-game-lib/?rev=2784&view=rev
Author: matzon
Date: 2007-04-19 15:25:47 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
updated to ALC10 instead of ALC
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
Added: trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2007-04-19 22:25:47 UTC (rev 2784)
@@ -0,0 +1,415 @@
+/*
+ * 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.openal;
+
+import java.nio.Buffer;
+import java.nio.IntBuffer;
+
+import org.lwjgl.BufferChecks;
+import org.lwjgl.LWJGLException;
+
+/**
+ *
+ * <p>
+ * This is the context class for OpenAL. This class implements functions
+ * in alc.h
+ * </p>
+ *
+ * <p>
+ * ALC introduces the notion of a Device. A Device can be, depending on the
+ * implementation, a hardware device, or a daemon/OS service/actual server. This
+ * mechanism also permits different drivers (and hardware) to coexist within the same
+ * system, as well as allowing several applications to share system resources for audio,
+ * including a single hardware output device. The details are left to the
+ * implementation, which has to map the available backends to unique device
+ * specifiers (represented as strings).
+ * </p>
+ *
+ * <p>
+ * <b>NOTE:</b><br>
+ * The LWJGL implementation of OpenAL does not expose the device, nor the context.
+ * Whenever <code>AL</code> is created using the <code>create</code> method, an underlying
+ * device and context is created. Thus more advanced usage of multiple contexts and/or devices
+ * are not possible. The above mentioned features are very rarely used in games.
+ * </p>
+ *
+ * @author Brian Matzon <br...@ma...>
+ * @version $Revision: 2286 $
+ * $Id: ALC.java 2286 2006-03-23 19:32:21 +0000 (to, 23 mar 2006) matzon $
+ */
+public final class ALC10 {
+ /** Bad value */
+ public static final int ALC_INVALID = 0;
+
+ /** Boolean False */
+ public static final int ALC_FALSE = 0;
+
+ /** Boolean True */
+ public static final int ALC_TRUE = 1;
+
+ /** Errors: No Error */
+ public static final int ALC_NO_ERROR = ALC_FALSE;
+
+ /** Major version query. */
+ public static final int ALC_MAJOR_VERSION = 0x1000;
+
+ /** Minor version query. */
+ public static final int ALC_MINOR_VERSION = 0x1001;
+
+ /**
+ * The size required for the zero-terminated attributes list, for the current context.
+ **/
+ public static final int ALC_ATTRIBUTES_SIZE = 0x1002;
+
+ /**
+ * Expects a destination of ALC_CURRENT_ATTRIBUTES_SIZE,
+ * and provides the attribute list for the current context of the specified device.
+ */
+ public static final int ALC_ALL_ATTRIBUTES = 0x1003;
+
+ /** The specifier string for the default device */
+ public static final int ALC_DEFAULT_DEVICE_SPECIFIER = 0x1004;
+
+ /** The specifier string for the device */
+ public static final int ALC_DEVICE_SPECIFIER = 0x1005;
+
+ /** The extensions string for diagnostics and printing */
+ public static final int ALC_EXTENSIONS = 0x1006;
+
+ /** Frequency for mixing output buffer, in units of Hz. */
+ public static final int ALC_FREQUENCY = 0x1007;
+
+ /** Refresh intervalls, in units of Hz. */
+ public static final int ALC_REFRESH = 0x1008;
+
+ /** Flag, indicating a synchronous context. */
+ public static final int ALC_SYNC = 0x1009;
+
+ /** The device argument does not name a valid device */
+ public static final int ALC_INVALID_DEVICE = 0xA001;
+
+ /** The context argument does not name a valid context */
+ public static final int ALC_INVALID_CONTEXT = 0xA002;
+
+ /**
+ * A function was called at inappropriate time, or in an inappropriate way,
+ * causing an illegal state. This can be an incompatible ALenum, object ID,
+ * and/or function.
+ */
+ public static final int ALC_INVALID_ENUM = 0xA003;
+
+ /**
+ * Illegal value passed as an argument to an AL call.
+ * Applies to parameter values, but not to enumerations.
+ */
+ public static final int ALC_INVALID_VALUE = 0xA004;
+
+ /**
+ * A function could not be completed, because there is not enough
+ * memory available.
+ */
+ public static final int ALC_OUT_OF_MEMORY = 0xA005;
+
+ static native void initNativeStubs() throws LWJGLException;
+
+ /**
+ * The application can obtain certain strings from ALC.
+ *
+ * <code>ALC_DEFAULT_DEVICE_SPECIFIER</code> - The specifer string for the default device
+ * <code>ALC_DEVICE_SPECIFIER</code> - The specifer string for the device
+ * <code>ALC_EXTENSIONS</code> - The extensions string for diagnostics and printing.
+ *
+ * In addition, printable error message strings are provided for all valid error tokens,
+ * including <code>ALC_NO_ERROR</code>,<code>ALC_INVALID_DEVICE</code>, <code>ALC_INVALID_CONTEXT</code>,
+ * <code>ALC_INVALID_ENUM</code>, <code>ALC_INVALID_VALUE</code>.
+ *
+ * @param pname Property to get
+ * @return String property from device
+ */
+ public static String alcGetString(ALCdevice device, int pname) {
+ String result;
+ result = nalcGetString(getDevice(device), pname);
+ //Util.checkALCError();
+ return result;
+ }
+ private native static String nalcGetString(long device, int pname);
+
+ /**
+ * The application can query ALC for information using an integer query function.
+ * For some tokens, <code>null</code> is a legal deviceHandle. In other cases, specifying a <code>null</code>
+ * device will generate an <code>ALC_INVALID_DEVICE</code> error. The application has to
+ * specify the size of the destination buffer provided. A <code>null</code> destination or a zero
+ * size parameter will cause ALC to ignore the query.
+ *
+ * <code>ALC_MAJOR_VERSION</code> - Major version query.
+ * <code>ALC_MINOR_VERSION</code> - Minor version query.
+ * <code>ALC_ATTRIBUTES_SIZE</code> - The size required for the zero-terminated attributes list,
+ * for the current context. <code>null</code> is an invalid device. <code>null</code> (no current context
+ * for the specified device) is legal.
+ * <code>ALC_ALL_ATTRIBUTES</code> - Expects a destination of <code>ALC_CURRENT_ATTRIBUTES_SIZE</code>,
+ * and provides the attribute list for the current context of the specified device.
+ * <code>null</code> is an invalid device. <code>null</code> (no current context for the specified device)
+ * will return the default attributes defined by the specified device.
+ *
+ * @param pname Property to get
+ * @param integerdata ByteBuffer to write integers to
+ */
+ public static void alcGetInteger(ALCdevice device, int pname, IntBuffer integerdata) {
+ BufferChecks.checkDirect(integerdata);
+ nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), integerdata, integerdata.position());
+ Util.checkALCError();
+ }
+ private native static void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset);
+
+ /**
+ * The <code>alcOpenDevice</code> function allows the application (i.e. the client program) to
+ * connect to a device (i.e. the server).
+ *
+ * If the function returns <code>null</code>, then no sound driver/device has been found. The
+ * argument is a null terminated string that requests a certain device or device
+ * configuration. If <code>null</code> is specified, the implementation will provide an
+ * implementation specific default.
+ *
+ * @param devicename name of device to open
+ * @return opened device, or null
+ */
+ public static ALCdevice alcOpenDevice(String devicename) {
+ long device = nalcOpenDevice(devicename);
+ if(device > 0) {
+ return new ALCdevice(device);
+ }
+ return null;
+ }
+ native static long nalcOpenDevice(String devicename);
+
+ /**
+ * The <code>alcCloseDevice</code> function allows the application (i.e. the client program) to
+ * disconnect from a device (i.e. the server).
+ *
+ * If deviceHandle is <code>null</code> or invalid, an <code>ALC_INVALID_DEVICE</code> error will be
+ * generated. Once closed, a deviceHandle is invalid.
+ *
+ * @param device address of native device to close
+ */
+ public static boolean alcCloseDevice(ALCdevice device) {
+ return nalcCloseDevice(getDevice(device));
+ }
+ native static boolean nalcCloseDevice(long device);
+
+ /**
+ * A context is created using <code>alcCreateContext</code>. The device parameter has to be a valid
+ * device. The attribute list can be <code>null</code>, or a zero terminated list of integer pairs
+ * composed of valid ALC attribute tokens and requested values.
+ *
+ * Context creation will fail if the application requests attributes that, by themselves,
+ * can not be provided. Context creation will fail if the combination of specified
+ * attributes can not be provided. Context creation will fail if a specified attribute, or
+ * the combination of attributes, does not match the default values for unspecified
+ * attributes.
+ *
+ * @param device address of device to associate context to
+ * @param attrList Buffer to read attributes from
+ * @return New context, or null if creation failed
+ */
+ public static ALCcontext alcCreateContext(ALCdevice device, IntBuffer attrList) {
+ long context = nalcCreateContext(getDevice(device), attrList);
+ Util.checkALCError();
+
+ if(context > 0) {
+ return new ALCcontext(context);
+ }
+
+ return null;
+ }
+ private native static long nalcCreateContext(long device, IntBuffer attrList);
+
+ /**
+ * To make a Context current with respect to AL Operation (state changes by issueing
+ * commands), <code>alcMakeContextCurrent</code> is used. The context parameter can be <code>null</code>
+ * or a valid context pointer. The operation will apply to the device that the context
+ * was created for.
+ *
+ * For each OS process (usually this means for each application), only one context can
+ * be current at any given time. All AL commands apply to the current context.
+ * Commands that affect objects shared among contexts (e.g. buffers) have side effects
+ * on other contexts.
+ *
+ * @param context address of context to make current
+ * @return true if successfull, false if not
+ */
+ public static int alcMakeContextCurrent(ALCcontext context) {
+ return nalcMakeContextCurrent(getContext(context));
+ }
+ public native static int nalcMakeContextCurrent(long context);
+
+ /**
+ * The current context is the only context accessible to state changes by AL commands
+ * (aside from state changes affecting shared objects). However, multiple contexts can
+ * be processed at the same time. To indicate that a context should be processed (i.e.
+ * that internal execution state like offset increments are supposed to be performed),
+ * the application has to use <code>alcProcessContext</code>.
+ *
+ * Repeated calls to <code>alcProcessContext</code> are legal, and do not affect a context that is
+ * already marked as processing. The default state of a context created by
+ * alcCreateContext is that it is not marked as processing.
+ */
+ public static void alcProcessContext(ALCcontext context) {
+ nalcProcessContext(getContext(context));
+ }
+ private native static void nalcProcessContext(long context);
+
+ /**
+ * The application can query for, and obtain an handle to, the current context for the
+ * application. If there is no current context, <code>null</code> is returned.
+ *
+ * @return Current ALCcontext
+ */
+ public static ALCcontext alcGetCurrentContext() {
+ long context = nalcGetCurrentContext();
+ if(context > 0) {
+ return new ALCcontext(context);
+ }
+ return null;
+ }
+ public native static long nalcGetCurrentContext();
+
+ /**
+ * The application can query for, and obtain an handle to, the device of a given context.
+ *
+ * @param context address of context to get device for
+ * @param ALCdevice associated with context
+ */
+ public static ALCdevice alcGetContextsDevice(ALCcontext context) {
+ long device = nalcGetContextsDevice(getContext(context));
+ if (device > 0) {
+ return new ALCdevice(device);
+ }
+ return null;
+ }
+ private native static long nalcGetContextsDevice(long context);
+
+ /**
+ * The application can suspend any context from processing (including the current
+ * one). To indicate that a context should be suspended from processing (i.e. that
+ * internal execution state like offset increments is not supposed to be changed), the
+ * application has to use <code>alcSuspendContext</code>.
+ *
+ * Repeated calls to <code>alcSuspendContext</code> are legal, and do not affect a context that is
+ * already marked as suspended. The default state of a context created by
+ * <code>alcCreateContext</code> is that it is marked as suspended.
+ *
+ * @param context address of context to suspend
+ */
+ public static void alcSuspendContext(ALCcontext context) {
+ nalcSuspendContext(getContext(context));
+ }
+ private native static void nalcSuspendContext(long context);
+
+ /**
+ * The correct way to destroy a context is to first release it using <code>alcMakeCurrent</code> and
+ * <code>null</code>. Applications should not attempt to destroy a current context.
+ *
+ * @param context address of context to Destroy
+ */
+ public static void alcDestroyContext(ALCcontext context) {
+ nalcDestroyContext(getContext(context));
+ }
+ native static void nalcDestroyContext(long context);
+
+ /**
+ * ALC uses the same conventions and mechanisms as AL for error handling. In
+ * particular, ALC does not use conventions derived from X11 (GLX) or Windows
+ * (WGL). The <code>alcGetError</code> function can be used to query ALC errors.
+ *
+ * Error conditions are specific to the device.
+ *
+ * ALC_NO_ERROR - The device handle or specifier does name an accessible driver/server.
+ * <code>ALC_INVALID_DEVICE</code> - The Context argument does not name a valid context.
+ * <code>ALC_INVALID_CONTEXT</code> - The Context argument does not name a valid context.
+ * <code>ALC_INVALID_ENUM</code> - A token used is not valid, or not applicable.
+ * <code>ALC_INVALID_VALUE</code> - An value (e.g. attribute) is not valid, or not applicable.
+ *
+ * @return Errorcode from ALC statemachine
+ */
+ public static int alcGetError(ALCdevice device) {
+ return nalcGetError(getDevice(device));
+ }
+ private native static int nalcGetError(long device);
+
+ /**
+ * Verify that a given extension is available for the current context and the device it
+ * is associated with.
+ * A <code>null</code> name argument returns <code>ALC_FALSE</code>, as do invalid and unsupported string
+ * tokens.
+ *
+ * @param extName name of extension to find
+ * @return true if extension is available, false if not
+ */
+ public static boolean alcIsExtensionPresent(ALCdevice device, String extName) {
+ boolean result = nalcIsExtensionPresent(getDevice(device), extName);
+ Util.checkALCError();
+ return result;
+ }
+ private native static boolean nalcIsExtensionPresent(long device, String extName);
+
+ /**
+ * Enumeration/token values are device independend, but tokens defined for
+ * extensions might not be present for a given device. But only the tokens defined
+ * by the AL core are guaranteed. Availability of extension tokens dependends on the ALC extension.
+ *
+ * Specifying a <code>null</code> name parameter will cause an <code>ALC_INVALID_VALUE</code> error.
+ *
+ * @param enumName name of enum to find
+ * @return value of enumeration
+ */
+ public static int alcGetEnumValue(ALCdevice device, String enumName) {
+ int result = nalcGetEnumValue(getDevice(device), enumName);
+ Util.checkALCError();
+ return result;
+ }
+ private native static int nalcGetEnumValue(long device, String enumName);
+
+ static long getDevice(ALCdevice device) {
+ if(device != null) {
+ return device.device;
+ }
+ return 0L;
+ }
+
+ static long getContext(ALCcontext context) {
+ if(context != null) {
+ return context.context;
+ }
+ return 0L;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:25:14
|
Revision: 2783
http://svn.sourceforge.net/java-game-lib/?rev=2783&view=rev
Author: matzon
Date: 2007-04-19 15:25:13 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
openal 1.1
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
Added: trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2007-04-19 22:25:13 UTC (rev 2783)
@@ -0,0 +1,180 @@
+/*
+ * 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.openal;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.LWJGLException;
+import org.lwjgl.LWJGLUtil;
+
+
+/**
+ *
+ * @author Brian Matzon <br...@ma...>
+ * @version $Revision: 2286 $
+ * $Id: ALC.java 2286 2006-03-23 19:32:21 +0000 (to, 23 mar 2006) matzon $
+ */
+public final class ALC11 {
+
+ public static int ALC_CAPTURE_DEVICE_SPECIFIER = 0x310;
+ public static int ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER = 0x311;
+ public static int ALC_CAPTURE_SAMPLES = 0x312;
+
+ /**
+ * The alcCaptureOpenDevice function allows the application to connect to a capture
+ * device. To obtain a list of all available capture devices, use getCaptureDevices a list of all
+ * capture devices will be returned. Retrieving ALC_CAPTURE_DEVICE_SPECIFIER with a valid capture device specified will result
+ * in the name of that device being returned as a single string.
+ *
+ * If the function returns null, then no sound driver/device has been found, or the
+ * requested format could not be fulfilled.
+ * The "deviceName" argument is a string that requests a certain device or
+ * device configuration. If null is specified, the implementation will provide an
+ * implementation specific default. The "frequency" and "format" arguments specify the format that
+ * audio data will be presented to the application, and match the values that can be passed to
+ * alBufferData. The implementation is expected to convert and resample to this format on
+ * behalf of the application. The "buffersize" argument specifies the number of sample frames
+ * to buffer in the AL, for example, requesting a format of AL_FORMAT_STEREO16 and
+ * a buffer size of 1024 would require the AL to store up to 1024 * 4 bytes of audio data.
+ * Note that the implementation may use a larger buffer than requested if it needs to, but the
+ * implementation will set up a buffer of at least the requested size.
+ * Specifying a compressed or extension-supplied format may result in failure, even if the
+ * extension is supplied for rendering.
+ *
+ * <i>LWJGL SPECIFIC: the actual created device is managed internally in lwjgl</i>
+ *
+ * @param devicename Name of device to open for capture
+ * @param frequency Frequency of samples to capture
+ * @param format Format of samples to capture
+ * @param buffersize Size of buffer to capture to
+ * @return ALCdevice if it was possible to open a device
+ */
+ public static ALCdevice alcCaptureOpenDevice(String devicename, int frequency, int format, int buffersize) {
+ long device = nalcCaptureOpenDevice(devicename, frequency, format, buffersize);
+ if(device > 0) {
+ System.out.println("new device: " + device + "/" + devicename);
+ return new ALCdevice(device);
+ }
+ return null;
+ }
+ static native long nalcCaptureOpenDevice( String devicename, int frequency, int format, int buffersize);
+
+ /**
+ * The alcCaptureCloseDevice function allows the application to disconnect from a capture
+ * device.
+ *
+ * The return code will be true or false, indicating success or failure. If
+ * the device is null or invalid, an ALC_INVALID_DEVICE error will be generated.
+ * Once closed, a capture device is invalid.
+ * @return true if device was successfully closed
+ */
+ public static boolean alcCaptureCloseDevice(ALCdevice device) {
+ return nalcCaptureCloseDevice(ALC10.getDevice(device));
+ }
+ static native boolean nalcCaptureCloseDevice(long device);
+
+ /**
+ * Once a capture device has been opened via alcCaptureOpenDevice, it is made to start
+ * recording audio via the alcCaptureStart entry point:
+ *
+ * Once started, the device will record audio to an internal ring buffer, the size of which was
+ * specified when opening the device.
+ * The application may query the capture device to discover how much data is currently
+ * available via the alcGetInteger with the ALC_CAPTURE_SAMPLES token. This will
+ * report the number of sample frames currently available.
+ */
+ public static void alcCaptureStart(ALCdevice device) {
+ nalcCaptureStart(ALC10.getDevice(device));
+ }
+ static native void nalcCaptureStart(long device);
+
+ /**
+ * If the application doesn't need to capture more audio for an amount of time, they can halt
+ * the device without closing it via the alcCaptureStop entry point.
+ * The implementation is encouraged to optimize for this case. The amount of audio
+ * samples available after restarting a stopped capture device is reset to zero. The
+ * application does not need to stop the capture device to read from it.
+ */
+ public static void alcCaptureStop(ALCdevice device) {
+ nalcCaptureStop(ALC10.getDevice(device));
+ }
+ static native void nalcCaptureStop(long device);
+
+ /**
+ * When the application feels there are enough samples available to process, it can obtain
+ * them from the AL via the alcCaptureSamples entry point.
+ *
+ * The "buffer" argument specifies an application-allocated buffer that can contain at least
+ * "samples" sample frames. The implementation may defer conversion and resampling until
+ * this point. Requesting more sample frames than are currently available is an error.
+ *
+ * @param buffer Buffer to store samples in
+ * @param samples Number of samples to request
+ */
+ public static void alcCaptureSamples(ALCdevice device, ByteBuffer buffer, int samples ) {
+ nalcCaptureSamples(ALC10.getDevice(device), buffer, buffer.position(), samples);
+ }
+ static native void nalcCaptureSamples(long device, ByteBuffer buffer, int position, int samples );
+
+ static native void initNativeStubs() throws LWJGLException;
+
+ /**
+ * Initializes ALC11, including any extensions
+ * @return true if initialization was successfull
+ */
+ static boolean initialize() {
+ try {
+ IntBuffer ib = BufferUtils.createIntBuffer(2);
+ ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, ib);
+ ib.position(1);
+ ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, ib);
+
+ int major = ib.get(0);
+ int minor = ib.get(1);
+
+ // checking for version 1.x+
+ if(major >= 1) {
+
+ // checking for version 1.1+
+ if(minor >= 1) {
+ initNativeStubs();
+ }
+ }
+ } catch (LWJGLException le) {
+ LWJGLUtil.log("failed to initialize ALC11: " + le);
+ return false;
+ }
+ return true;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:24:38
|
Revision: 2782
http://svn.sourceforge.net/java-game-lib/?rev=2782&view=rev
Author: matzon
Date: 2007-04-19 15:24:36 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
exposing context and device
updated to ALC10 instead of ALC
removed getImplementations - alcGetString now works as "expected"
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/AL.java
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/AL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2007-04-19 22:23:40 UTC (rev 2781)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2007-04-19 22:24:36 UTC (rev 2782)
@@ -156,26 +156,28 @@
private static void init(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice) throws LWJGLException {
try {
AL10.initNativeStubs();
- ALC.initNativeStubs();
-
+ ALC10.initNativeStubs();
+
if(openDevice) {
- device = ALC.alcOpenDevice(deviceArguments);
+ device = ALC10.alcOpenDevice(deviceArguments);
if (device == null)
throw new LWJGLException("Could not open ALC device");
if (contextFrequency == -1) {
- context = ALC.alcCreateContext(device.device, null);
+ context = ALC10.alcCreateContext(device, null);
} else {
- context = ALC.alcCreateContext(device.device,
+ context = ALC10.alcCreateContext(device,
ALCcontext.createAttributeList(contextFrequency, contextRefresh,
- contextSynchronized ? ALC.ALC_TRUE : ALC.ALC_FALSE));
+ contextSynchronized ? ALC10.ALC_TRUE : ALC10.ALC_FALSE));
}
- ALC.alcMakeContextCurrent(context.context);
+ ALC10.alcMakeContextCurrent(context);
}
} catch (LWJGLException e) {
destroy();
throw e;
}
+
+ ALC11.initialize();
}
/**
@@ -194,15 +196,16 @@
*/
public static void destroy() {
if (context != null) {
- ALC.alcDestroyContext(context.context);
+ ALC10.alcDestroyContext(context);
context = null;
}
if (device != null) {
- ALC.alcCloseDevice(device.device);
+ boolean result = ALC10.alcCloseDevice(device);
device = null;
}
resetNativeStubs(AL10.class);
- resetNativeStubs(ALC.class);
+ resetNativeStubs(ALC10.class);
+ resetNativeStubs(ALC11.class);
if (created)
nDestroy();
@@ -212,50 +215,16 @@
private static native void resetNativeStubs(Class clazz);
/**
- * Gets a handle to the current openAL context. The handle is "opaque" right now
- * because, realistically, there is nothing you can actually do with it. If it turns
- * out that there are useful things you can do with it then it'll return an instance
- * of ALCcontext (which will have to become a public class)
- * @return an opaque handle to the AL context.
+ * @return handle to the default AL context.
*/
- public static Object getContext() {
+ public static ALCcontext getContext() {
return context;
}
-
+
/**
- *
- * @return
+ * @return handle to the default AL device.
*/
- public static String[] getImplementations() throws LWJGLException, OpenALException {
- if(AL.isCreated()) {
- throw new OpenALException("Cannot enumerate devices if AL has already been created");
- }
-
- Vector availableDevices = new Vector();
-
- try {
- // init
- create(null, 44100, 60, false, false);
-
- // check for extension
- if(!ALC.alcIsExtensionPresent("ALC_ENUMERATION_EXT")) {
- throw new OpenALException("ALC_ENUMERATION_EXT extension not available");
- }
-
- // get list of published devices
- String[] publishedDevices = ALC.ngetImplementations();
-
- // run through them and verify
- for (int i = 0; i < publishedDevices.length; i++) {
- availableDevices.add(publishedDevices[i]);
- }
- } finally {
- destroy();
- }
-
- String[] available = new String[availableDevices.size()];
- availableDevices.copyInto(available);
-
- return available;
+ public static ALCdevice getDevice() {
+ return device;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:23:41
|
Revision: 2781
http://svn.sourceforge.net/java-game-lib/?rev=2781&view=rev
Author: matzon
Date: 2007-04-19 15:23:40 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
updated to ALC10 instead of ALC
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/Util.java
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/Util.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/Util.java 2007-04-19 22:23:20 UTC (rev 2780)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/Util.java 2007-04-19 22:23:40 UTC (rev 2781)
@@ -45,9 +45,9 @@
}
public static void checkALCError() {
- int err = ALC.alcGetError();
- if (err != ALC.ALC_NO_ERROR)
- throw new OpenALException(ALC.alcGetString(err));
+ int err = ALC10.alcGetError(AL.getDevice());
+ if (err != ALC10.ALC_NO_ERROR)
+ throw new OpenALException(ALC10.alcGetString(AL.getDevice(), err));
}
public static void checkALError() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:23:34
|
Revision: 2780
http://svn.sourceforge.net/java-game-lib/?rev=2780&view=rev
Author: matzon
Date: 2007-04-19 15:23:20 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
exposing context and device
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java 2007-04-19 22:23:04 UTC (rev 2779)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java 2007-04-19 22:23:20 UTC (rev 2780)
@@ -43,7 +43,7 @@
* @version $Revision$
* $Id$
*/
-final class ALCcontext {
+public final class ALCcontext {
/** address of actual context */
final long context;
@@ -57,14 +57,31 @@
this.context = context;
}
+ /*
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object context) {
+ if(context instanceof ALCcontext) {
+ return ((ALCcontext)context).context == this.context;
+ }
+ return super.equals(context);
+ }
+
+ /**
+ * Creates an attribute list in a ByteBuffer
+ * @param contextFrequency Frequency to add
+ * @param contextRefresh Refresh rate to add
+ * @param contextSynchronized Whether to synchronize the context
+ * @return
+ */
static IntBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) {
IntBuffer attribList = BufferUtils.createIntBuffer(7);
- attribList.put(ALC.ALC_FREQUENCY);
+ attribList.put(ALC10.ALC_FREQUENCY);
attribList.put(contextFrequency);
- attribList.put(ALC.ALC_REFRESH);
+ attribList.put(ALC10.ALC_REFRESH);
attribList.put(contextRefresh);
- attribList.put(ALC.ALC_SYNC);
+ attribList.put(ALC10.ALC_SYNC);
attribList.put(contextSynchronized);
attribList.put(0); //terminating int
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-04-19 22:23:04 UTC (rev 2779)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-04-19 22:23:20 UTC (rev 2780)
@@ -39,7 +39,7 @@
* @version $Revision$
* $Id$
*/
-final class ALCdevice {
+public final class ALCdevice {
/** address of actual device */
final long device;
@@ -51,5 +51,15 @@
*/
ALCdevice(long device) {
this.device = device;
- }
+ }
+
+ /*
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object device) {
+ if(device instanceof ALCdevice) {
+ return ((ALCdevice)device).device == this.device;
+ }
+ return super.equals(device);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:23:06
|
Revision: 2779
http://svn.sourceforge.net/java-game-lib/?rev=2779&view=rev
Author: matzon
Date: 2007-04-19 15:23:04 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
updated to ALC10 instead of ALC
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCTest.java
trunk/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java
Modified: trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCTest.java 2007-04-19 22:22:18 UTC (rev 2778)
+++ trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCTest.java 2007-04-19 22:23:04 UTC (rev 2779)
@@ -34,7 +34,8 @@
import java.nio.IntBuffer;
import org.lwjgl.BufferUtils;
-import org.lwjgl.openal.ALC;
+import org.lwjgl.openal.AL;
+import org.lwjgl.openal.ALC10;
/**
*
@@ -58,29 +59,29 @@
*/
protected void execute(String[] args) {
//error stuff
- int lastError = ALC.ALC_NO_ERROR;
+ int lastError = ALC10.ALC_NO_ERROR;
//create attribute list for context creation
IntBuffer buffer = BufferUtils.createIntBuffer(7);
- if ((lastError = ALC.alcGetError()) != ALC.ALC_NO_ERROR) {
- System.out.println("ALC Error: " + ALC.alcGetString(lastError));
+ if ((lastError = ALC10.alcGetError(AL.getDevice())) != ALC10.ALC_NO_ERROR) {
+ System.out.println("ALC Error: " + ALC10.alcGetString(AL.getDevice(), lastError));
System.exit(-1);
}
//query
System.out.println(
"DEFAULT_DEVICE_SPECIFIER: "
- + ALC.alcGetString(ALC.ALC_DEFAULT_DEVICE_SPECIFIER));
+ + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));
System.out.println(
- "DEVICE_SPECIFIER: " + ALC.alcGetString(ALC.ALC_DEVICE_SPECIFIER));
- System.out.println("EXTENSIONS: " + ALC.alcGetString(ALC.ALC_EXTENSIONS));
+ "DEVICE_SPECIFIER: " + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_DEVICE_SPECIFIER));
+ System.out.println("EXTENSIONS: " + ALC10.alcGetString(AL.getDevice(), ALC10.ALC_EXTENSIONS));
//mo query
buffer.rewind();
buffer.position(0);
- ALC.alcGetInteger(ALC.ALC_MAJOR_VERSION, buffer);
- ALC.alcGetInteger(ALC.ALC_MINOR_VERSION, (IntBuffer) buffer.position(1));
+ ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MAJOR_VERSION, buffer);
+ ALC10.alcGetInteger(AL.getDevice(), ALC10.ALC_MINOR_VERSION, (IntBuffer) buffer.position(1));
System.out.println("ALC_MAJOR_VERSION: " + buffer.get(0));
System.out.println("ALC_MINOR_VERSION: " + buffer.get(1));
@@ -91,7 +92,7 @@
//get an enumerstion value
System.out.println(
"Value of ALC_MAJOR_VERSION: "
- + ALC.alcGetEnumValue("ALC_MAJOR_VERSION"));
+ + ALC10.alcGetEnumValue(AL.getDevice(), "ALC_MAJOR_VERSION"));
alExit();
}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java 2007-04-19 22:22:18 UTC (rev 2778)
+++ trunk/LWJGL/src/java/org/lwjgl/test/openal/BasicTest.java 2007-04-19 22:23:04 UTC (rev 2779)
@@ -36,6 +36,7 @@
import org.lwjgl.BufferUtils;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.AL10;
+import org.lwjgl.openal.ALC10;
import org.lwjgl.opengl.DisplayMode;
/**
@@ -53,23 +54,21 @@
*/
public BasicTest() {
try {
- String[] imps = AL.getImplementations();
- if(imps.length > 0) {
- System.out.println("Available devices: ");
- for(int i=0; i<imps.length; i++) {
- System.out.println(" " + i + ": " + imps[i]);
- }
- }
+ AL.create();
+
+ System.out.println("Default device: " + ALC10.alcGetString(null, ALC10.ALC_DEFAULT_DEVICE_SPECIFIER));
+
+ if(ALC10.alcIsExtensionPresent(null, "ALC_ENUMERATION_EXT")) {
+ String[] devices = ALC10.alcGetString(null, ALC10.ALC_DEVICE_SPECIFIER).split("\0");
+ System.out.println("Available devices: ");
+ for(int i=0; i<devices.length; i++) {
+ System.out.println(i +": " + devices[i]);
+ }
+ }
} catch (Exception e) {
- System.out.println("Unable to query available devices: " + e.getMessage());
+ System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
+ return;
}
-
- try {
- AL.create();
- } catch (Exception e) {
- System.out.println("Unable to create OpenAL.\nPlease make sure that OpenAL is available on this system. Exception: " + e);
- return;
- }
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:22:25
|
Revision: 2778
http://svn.sourceforge.net/java-game-lib/?rev=2778&view=rev
Author: matzon
Date: 2007-04-19 15:22:18 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
Capture test for OpenAL 1.1
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCCaptureTest.java
Added: trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCCaptureTest.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCCaptureTest.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/test/openal/ALCCaptureTest.java 2007-04-19 22:22:18 UTC (rev 2778)
@@ -0,0 +1,154 @@
+/*
+ * 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.openal;
+
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+
+import org.lwjgl.BufferUtils;
+import org.lwjgl.openal.AL;
+import org.lwjgl.openal.AL10;
+import org.lwjgl.openal.ALC10;
+import org.lwjgl.openal.ALC11;
+import org.lwjgl.openal.ALCdevice;
+import org.lwjgl.openal.OpenALException;
+
+/**
+ *
+ * This is a test for the ALC part of OpenAL
+ *
+ * @author Brian Matzon <br...@ma...>
+ * @version $Revision: 2286 $
+ * $Id: ALCTest.java 2286 2006-03-23 19:32:21Z matzon $
+ */
+public class ALCCaptureTest extends BasicTest {
+
+ /**
+ * Creates an instance of ALCTest
+ */
+ public ALCCaptureTest() {
+ super();
+ }
+
+ /**
+ * Runs the actual test, using supplied arguments
+ */
+ protected void execute(String[] args) {
+ int lastError = ALC10.ALC_NO_ERROR;
+ IntBuffer sampleCount = BufferUtils.createIntBuffer(1);
+
+ int state = AL10.AL_PLAYING;
+ int FMT = AL10.AL_FORMAT_MONO16;
+ int FMTSIZE = 16/8;
+ int FREQ = 44100;
+ int TIME = 5;
+ int SAMPS = (FREQ * TIME);
+ ByteBuffer buf = BufferUtils.createByteBuffer(SAMPS * FMTSIZE);
+
+ // check that capture is available
+ if(!ALC10.alcIsExtensionPresent(AL.getDevice(), "ALC_EXT_CAPTURE")) {
+ throw new OpenALException("ALC_EXT_CAPTURE extension not available");
+ }
+
+ // get list of devices
+ String captureDevices = ALC10.alcGetString(null, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER);
+ System.out.println("captureDevices: " + captureDevices);
+
+
+ String defaultRecorder = ALC10.alcGetString(AL.getDevice(), ALC11.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
+ System.out.println("Default capture device: " + defaultRecorder);
+
+ ALCdevice device = ALC11.alcCaptureOpenDevice(null, FREQ, FMT, SAMPS);
+
+
+
+ if(device != null) {
+ // record some sound
+ // =====================================
+ System.out.print("Recording using " + ALC10.alcGetString(device, ALC11.ALC_CAPTURE_DEVICE_SPECIFIER) + "...");
+ ALC11.alcCaptureStart(device);
+ while (sampleCount.get(0) < SAMPS) {
+ pause(1000);
+ ALC10.alcGetInteger(device, ALC11.ALC_CAPTURE_SAMPLES, sampleCount);
+ }
+ System.out.println("done");
+ ALC11.alcCaptureStop(device);
+
+ // capure the samples
+ ALC11.alcCaptureSamples(device, buf, SAMPS);
+ ALC11.alcCaptureCloseDevice(device);
+ // -------------------------------------
+
+ // play back recording
+ // ===================
+ IntBuffer buffers = BufferUtils.createIntBuffer(1);
+ IntBuffer sources = BufferUtils.createIntBuffer(1);
+
+ buffers.position(0).limit(1);
+ AL10.alGenBuffers(buffers);
+
+ sources.position(0).limit(1);
+ AL10.alGenSources(sources);
+
+ System.out.print("Playing...");
+
+ AL10.alBufferData(buffers.get(0), FMT, buf, FREQ);
+ AL10.alSourcei(sources.get(0), AL10.AL_BUFFER, buffers.get(0));
+ AL10.alSourcei(sources.get(0), AL10.AL_LOOPING, AL10.AL_FALSE);
+ AL10.alSourcePlay(sources.get(0));
+
+ while (state == AL10.AL_PLAYING)
+ {
+ pause(100);
+ state = AL10.alGetSourcei(sources.get(0), AL10.AL_SOURCE_STATE);
+ }
+
+ System.out.println("done");
+
+ AL10.alDeleteSources(sources);
+ AL10.alDeleteBuffers(buffers);
+ }
+
+ alExit();
+ }
+
+ /**
+ * main entry point
+ *
+ * @param args String array containing arguments
+ */
+ public static void main(String[] args) {
+ ALCCaptureTest alcTest = new ALCCaptureTest();
+ alcTest.execute(args);
+ System.exit(0);
+ }
+}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:21:53
|
Revision: 2777
http://svn.sourceforge.net/java-game-lib/?rev=2777&view=rev
Author: matzon
Date: 2007-04-19 15:21:52 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
openal 1.1
Added Paths:
-----------
trunk/LWJGL/src/templates/org/lwjgl/openal/AL11.java
Added: trunk/LWJGL/src/templates/org/lwjgl/openal/AL11.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/openal/AL11.java (rev 0)
+++ trunk/LWJGL/src/templates/org/lwjgl/openal/AL11.java 2007-04-19 22:21:52 UTC (rev 2777)
@@ -0,0 +1,278 @@
+/*
+ * 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.openal;
+
+import java.nio.Buffer;
+import java.nio.IntBuffer;
+import java.nio.FloatBuffer;
+import java.nio.DoubleBuffer;
+
+import org.lwjgl.openal.AL10;
+import org.lwjgl.util.generator.*;
+
+/**
+ * <br>
+ * This is the core OpenAL class. This class implements
+ * AL.h version 1.1
+ *
+ * @author Brian Matzon <br...@ma...>
+ * @version $Revision: 2286 $
+ * $Id: AL10.java 2286 2006-03-23 19:32:21Z matzon $
+ */
+public interface AL11 {
+
+ /** Source buffer position information in seconds */
+ public static final int AL_SEC_OFFSET = 0x1024;
+
+ /** Source buffer position information in samples */
+ public static final int AL_SAMPLE_OFFSET = 0x1025;
+
+ /** Source buffer position information in bytes */
+ public static final int AL_BYTE_OFFSET = 0x1026;
+
+ /** Type of source: Buffer has been attached using AL_BUFFER */
+ public static final int AL_STATIC = 0x1028;
+
+ /** Type of source: if one or more Buffers have been attached using alSourceQueueBuffers */
+ public static final int AL_STREAMING = 0x1029;
+
+ /** Type of source: when it has the NULL buffer attached */
+ public static final int AL_UNDETERMINED = 0x1030;
+
+ /** @see AL10.AL_INVALID_OPERATION */
+ public static final int AL_ILLEGAL_COMMAND = 0xA004;
+
+ /** Speed of Sound in units per second */
+ public static final int AL_SPEED_OF_SOUND = 0xC003;
+
+ public static final int AL_LINEAR_DISTANCE = 0xD003;
+ public static final int AL_LINEAR_DISTANCE_CLAMPED = 0xD004;
+ public static final int AL_EXPONENT_DISTANCE = 0xD005;
+ public static final int AL_EXPONENT_DISTANCE_CLAMPED = 0xD006;
+
+ /**
+ * Listener attributes are changed using the Listener group of commands.
+ *
+ * @param pname name of the attribute to be set
+ * @param v1 value value 1
+ * @param v2 value value 2
+ * @param v3 value value 3
+ */
+ @ALvoid
+ void alListener3i(@ALenum int pname, int v1, int v2, int v3);
+
+ /**
+ * Listener state is maintained inside the AL implementation and can be queried in
+ * full.
+ *
+ * @param pname name of the attribute to be retrieved
+ * @param intdata Buffer to write ints to
+ */
+ // TODO: What's the real minimum number of elements?
+ @StripPostfix("intdata")
+ @ALvoid
+ void alGetListeneriv(@ALenum int pname, @Check("1") FloatBuffer intdata);
+
+ /**
+ * Specifies the position and other properties as taken into account during
+ * sound processing.
+ *
+ * @param source Source to set property on
+ * @param pname property to set
+ * @param v1 value 1 of property
+ * @param v2 value 2 of property
+ * @param v3 value 3 of property
+ */
+ @ALvoid
+ void alSource3i(@ALuint int source, @ALenum int pname, int v1, int v2, int v3);
+
+ /**
+ * Specifies the position and other properties as taken into account during
+ * sound processing.
+ *
+ * @param source Source to set property on
+ * @param pname property to set
+ * @param value IntBuffer containing value of property
+ */
+ // TODO: What's the correct minimum value?
+ @StripPostfix("value")
+ @ALvoid
+ void alSourceiv(@ALuint int source, @ALenum int pname, @Check("1") @Const IntBuffer value);
+
+ /**
+ * This function sets a floating point property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to set property on
+ * @param pname property to set
+ * @param value value of property
+ */
+ @ALvoid
+ void alBufferf(@ALuint int buffer, @ALenum int pname, float value);
+
+ /**
+ * This function sets a floating point property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to set property on
+ * @param pname property to set
+ * @param v1 value of property
+ * @param v2 value of property
+ * @param v3 value of property
+ */
+ @ALvoid
+ void alBuffer3f(@ALuint int buffer, @ALenum int pname, float v1, float v2, float v3);
+
+ /**
+ * This function sets a floating point property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to set property on
+ * @param pname property to set
+ * @param value FloatBuffer containing value of property
+ */
+ // TODO: What's the correct minimum value?
+ @StripPostfix("value")
+ @ALvoid
+ void alBufferfv(@ALuint int buffer, @ALenum int pname, @Check("1") @Const FloatBuffer value);
+
+ /**
+ * This function sets an integer property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to set property on
+ * @param pname property to set
+ * @param value value of property
+ */
+ @ALvoid
+ void alBufferi(@ALuint int buffer, @ALenum int pname, int value);
+
+ /**
+ * This function sets an integer property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to set property on
+ * @param pname property to set
+ * @param v1 value of property
+ * @param v2 value of property
+ * @param v3 value of property
+ */
+ @ALvoid
+ void alBuffer3i(@ALuint int buffer, @ALenum int pname, int v1, int v2, int v3);
+
+ /**
+ * This function sets an integer property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to set property on
+ * @param pname property to set
+ * @param value IntBuffer containing value of property
+ */
+ // TODO: What's the correct minimum value?
+ @StripPostfix("value")
+ @ALvoid
+ void alBufferiv(@ALuint int buffer, @ALenum int pname, @Check("1") @Const IntBuffer value);
+
+ /**
+ * This function retrieves an integer property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to get property from
+ * @param pname name of property
+ * @return int
+ */
+ @ALvoid
+ void alGetBufferi(@ALuint int buffer, @ALenum int pname, @Result int value);
+
+ /**
+ * This function retrieves an integer property of a buffer.
+ *
+ * @param buffer Buffer to get property from
+ * @param pname name of property
+ */
+ // TODO: What's the correct minimum value?
+ @StripPostfix("values")
+ @ALvoid
+ void alGetBufferiv(@ALuint int buffer, @ALenum int pname, @Check("1") IntBuffer values);
+
+ /**
+ * This function retrieves a floating point property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to get property from
+ * @param pname name of property
+ * @return floating point property
+ */
+ @ALvoid
+ void alGetBufferf(@ALuint int buffer, @ALenum int pname, @Result float value);
+
+ /**
+ * This function retrieves a floating point property of a buffer.
+ * <i>note: There are no relevant buffer properties defined in OpenAL 1.1 which can be affected by
+ * this call, but this function may be used by OpenAL extensions.</i>
+ *
+ * @param buffer Buffer to get property from
+ * @param pname name of property
+ */
+ // TODO: What's the correct minimum value?
+ @StripPostfix("values")
+ @ALvoid
+ void alGetBufferfv(@ALuint int buffer, @ALenum int pname, @Check("1") FloatBuffer values);
+
+ /**
+ * <p>
+ * AL_SPEED_OF_SOUND allows the application to change the reference (propagation)
+ * speed used in the Doppler calculation. The source and listener velocities should be
+ * expressed in the same units as the speed of sound.
+ * </p>
+ * <p>
+ * A negative or zero value will result in an AL_INVALID_VALUE error, and the
+ * command is ignored. The default value is 343.3 (appropriate for velocity units of meters
+ * and air as the propagation medium). The current setting can be queried using
+ * alGetFloat{v} and AL_SPEED_OF_SOUND.
+ * Distance and velocity units are completely independent of one another (so you could use
+ * different units for each if desired).
+ * </p>
+ *
+ * @param value distance model to be set
+ */
+ @ALvoid
+ void alSpeedOfSound(float value);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:21:40
|
Revision: 2776
http://svn.sourceforge.net/java-game-lib/?rev=2776&view=rev
Author: matzon
Date: 2007-04-19 15:21:37 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
AL_SOURCE_TYPE changed value ...
Modified Paths:
--------------
trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java
Modified: trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2007-04-19 22:21:04 UTC (rev 2775)
+++ trunk/LWJGL/src/templates/org/lwjgl/openal/AL10.java 2007-04-19 22:21:37 UTC (rev 2776)
@@ -64,7 +64,7 @@
* Indicate the type of SOURCE.
* Sources can be spatialized
*/
- int AL_SOURCE_TYPE = 0x200;
+ int AL_SOURCE_TYPE = 0x1027;
/** Indicate source has absolute coordinates */
int AL_SOURCE_ABSOLUTE = 0x201;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:21:08
|
Revision: 2775
http://svn.sourceforge.net/java-game-lib/?rev=2775&view=rev
Author: matzon
Date: 2007-04-19 15:21:04 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
using NewStringNativeWithLength
Modified Paths:
--------------
trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2007-04-19 22:20:36 UTC (rev 2774)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_Sys.c 2007-04-19 22:21:04 UTC (rev 2775)
@@ -105,7 +105,7 @@
CloseClipboard();
return NULL;
}
- ret = NewStringNative(env, (const char *) clipboard_data);
+ ret = NewStringNativeWithLength(env, (const char *) clipboard_data, strlen(clipboard_data));
} else {
return NULL;
}
Modified: trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c
===================================================================
--- trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c 2007-04-19 22:20:36 UTC (rev 2774)
+++ trunk/LWJGL/src/native/windows/org_lwjgl_opengl_WindowsRegistry.c 2007-04-19 22:21:04 UTC (rev 2775)
@@ -93,7 +93,7 @@
return NULL;
}
result[buf_size - 1] = '\0';
- java_result = NewStringNative(env, result);
+ java_result = NewStringNativeWithLength(env, result, strlen(result));
free(result);
return java_result;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:20:39
|
Revision: 2774
http://svn.sourceforge.net/java-game-lib/?rev=2774&view=rev
Author: matzon
Date: 2007-04-19 15:20:36 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
using NewStringNativeWithLength
Modified Paths:
--------------
trunk/LWJGL/src/native/windows/dinputhelper.c
Modified: trunk/LWJGL/src/native/windows/dinputhelper.c
===================================================================
--- trunk/LWJGL/src/native/windows/dinputhelper.c 2007-04-19 22:20:14 UTC (rev 2773)
+++ trunk/LWJGL/src/native/windows/dinputhelper.c 2007-04-19 22:20:36 UTC (rev 2774)
@@ -47,7 +47,7 @@
jmethodID nextObject_method;
jboolean should_continue;
- name = NewStringNative(env, tszName);
+ name = NewStringNativeWithLength(env, tszName, strlen(tszName));
if (name == NULL)
return false;
enum_class = (*env)->GetObjectClass(env, enumerator);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-19 22:20:16
|
Revision: 2773
http://svn.sourceforge.net/java-game-lib/?rev=2773&view=rev
Author: matzon
Date: 2007-04-19 15:20:14 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
openal 1.1
exposing device and context
Added Paths:
-----------
trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c
Added: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c (rev 0)
+++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC10.c 2007-04-19 22:20:14 UTC (rev 2773)
@@ -0,0 +1,342 @@
+/*
+ * 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.
+ */
+
+/**
+ * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $
+ *
+ * This is the actual JNI implementation of the OpenAL context/device library.
+ *
+ * @author Brian Matzon <br...@ma...>
+ * @version $Revision: 2279 $
+ */
+
+/* OpenAL includes */
+#include "extal.h"
+
+//alc
+typedef ALCubyte* (ALCAPIENTRY *alcGetStringPROC)(ALCdevice *device,ALCenum param);
+typedef ALCvoid (ALCAPIENTRY *alcGetIntegervPROC)(ALCdevice *device,ALCenum param,ALCsizei size,ALCint *data);
+typedef ALCdevice* (ALCAPIENTRY *alcOpenDevicePROC)(ALCubyte *deviceName);
+typedef ALCboolean (ALCAPIENTRY *alcCloseDevicePROC)(ALCdevice *device);
+typedef ALCcontext* (ALCAPIENTRY *alcCreateContextPROC)(ALCdevice *device,ALCint *attrList);
+typedef ALCenum (ALCAPIENTRY *alcMakeContextCurrentPROC)(ALCcontext *context);
+typedef ALCvoid (ALCAPIENTRY *alcProcessContextPROC)(ALCcontext *context);
+typedef ALCdevice* (ALCAPIENTRY *alcGetContextsDevicePROC)(ALCcontext *context);
+typedef ALCvoid (ALCAPIENTRY *alcSuspendContextPROC)(ALCcontext *context);
+typedef ALCvoid (ALCAPIENTRY *alcDestroyContextPROC)(ALCcontext *context);
+typedef ALCenum (ALCAPIENTRY *alcGetErrorPROC)(ALCdevice *device);
+typedef ALCboolean (ALCAPIENTRY *alcIsExtensionPresentPROC)(ALCdevice *device,ALCubyte *extName);
+//typedef ALCvoid* (ALCAPIENTRY *alcGetProcAddressPROC)(ALCdevice *device,ALCubyte *funcName);
+typedef ALCenum (ALCAPIENTRY *alcGetEnumValuePROC)(ALCdevice *device,ALCubyte *enumName);
+typedef ALCcontext* (ALCAPIENTRY *alcGetCurrentContextPROC)(ALCvoid);
+
+static alcGetCurrentContextPROC alcGetCurrentContext = NULL;
+static alcGetStringPROC alcGetString;
+static alcGetIntegervPROC alcGetIntegerv;
+static alcOpenDevicePROC alcOpenDevice;
+static alcCloseDevicePROC alcCloseDevice;
+static alcCreateContextPROC alcCreateContext;
+static alcMakeContextCurrentPROC alcMakeContextCurrent;
+static alcProcessContextPROC alcProcessContext;
+static alcGetContextsDevicePROC alcGetContextsDevice;
+static alcSuspendContextPROC alcSuspendContext;
+static alcDestroyContextPROC alcDestroyContext;
+static alcGetErrorPROC alcGetError;
+static alcIsExtensionPresentPROC alcIsExtensionPresent;
+//static alcGetProcAddressPROC alcGetProcAddress;
+static alcGetEnumValuePROC alcGetEnumValue;
+
+/**
+ * This function returns strings related to the context.
+ *
+ * C Specification:
+ * ALubyte * alcGetString(ALCdevice *device, ALenum token);
+ */
+static jstring JNICALL Java_org_lwjgl_openal_ALC10_nalcGetString (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token) {
+ const char* alcString = (const char*) alcGetString((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token);
+ int length;
+ int i=1;
+
+ if(alcString == NULL) {
+ return NULL;
+ }
+
+ // Special treatment of enumeration tokens
+ // These are encoded using \0 between elements and a finishing \0\0
+ switch(token) {
+ case 0x1005: // ALC_DEVICE_SPECIFIER
+ case 0x310: // ALC_CAPTURE_DEVICE_SPECIFIER
+ while (alcString[i - 1] != '\0' || alcString[i] != '\0') {
+ i++;
+ }
+ length = i + 1;
+ break;
+ default:
+ length = strlen(alcString);
+ }
+ return NewStringNativeWithLength(env, alcString, length);
+}
+
+/**
+ * This function returns integers related to the context.
+ *
+ * C Specification:
+ * ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei size, ALint *dest);
+ */
+static void JNICALL Java_org_lwjgl_openal_ALC10_nalcGetIntegerv (JNIEnv *env, jclass clazz, jlong deviceaddress, jint token, jint size, jobject dest, jint offset) {
+ ALint* address = NULL;
+ if (dest != NULL) {
+ address = offset + (ALint*) (*env)->GetDirectBufferAddress(env, dest);
+ }
+ alcGetIntegerv((ALCdevice*)((intptr_t)deviceaddress), (ALenum) token, (ALsizei) size, address);
+}
+
+/**
+ * This function opens a device by name.
+ *
+ * C Specification:
+ * ALCdevice *alcOpenDevice( const ALubyte *tokstr );
+ */
+static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcOpenDevice (JNIEnv *env, jclass clazz, jstring tokstr) {
+ char * tokenstring;
+ ALCdevice* device;
+
+ if(tokstr != NULL) {
+ tokenstring = GetStringNativeChars(env, tokstr);
+ } else {
+ tokenstring = NULL;
+ }
+
+ /* get device */
+ device = alcOpenDevice((ALubyte *) tokenstring);
+
+ /* if error - cleanup and get out */
+ if(device == NULL) {
+ if(tokenstring != NULL) {
+ free(tokenstring);
+ }
+ return (jlong) NULL;
+ }
+
+ /* clean up */
+ if (tokenstring != NULL)
+ free(tokenstring);
+
+ return (jlong)((intptr_t)device);
+}
+
+/**
+ * This function closes a device by name.
+ *
+ * C Specification:
+ * bool alcCloseDevice( ALCdevice *dev );
+ */
+static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcCloseDevice (JNIEnv *env, jclass clazz, jlong deviceaddress) {
+ return alcCloseDevice((ALCdevice*)((intptr_t)deviceaddress));
+}
+
+/**
+ * This function creates a context using a specified device.
+ *
+ * C Specification:
+ * ALCcontext* alcCreateContext( ALCdevice *dev, ALint* attrlist );
+ */
+static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcCreateContext (JNIEnv *env, jclass clazz, jlong deviceaddress, jobject attrlist) {
+ ALint* address = NULL;
+ ALCcontext* context;
+
+ if (attrlist != NULL) {
+ address = (ALint*) safeGetBufferAddress(env, attrlist);
+ }
+ context = alcCreateContext((ALCdevice*)((intptr_t)deviceaddress), address);
+
+ /* if error - get out */
+ if(context == NULL) {
+ return (jlong) NULL;
+ }
+
+ return (jlong)((intptr_t)context);
+}
+
+/**
+ * This function makes a specified context the current context.
+ *
+ * C Specification:
+ * ALCboolean alcMakeContextCurrent(ALCcontext *context);
+ */
+static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent (JNIEnv *env, jclass clazz, jlong contextaddress) {
+ ALCcontext* context = (ALCcontext*)((intptr_t)contextaddress);
+ ALCenum result;
+ if(context == NULL) {
+ result = alcMakeContextCurrent(NULL);
+ } else {
+ result = alcMakeContextCurrent(context);
+ }
+ return result;
+}
+
+/**
+ * This function tells a context to begin processing.
+ *
+ * C Specification:
+ * void alcProcessContext(ALCcontext *context);
+ */
+static void JNICALL Java_org_lwjgl_openal_ALC10_nalcProcessContext (JNIEnv *env, jclass clazz, jlong contextaddress) {
+ alcProcessContext((ALCcontext*)((intptr_t)contextaddress));
+}
+
+/**
+ * This function retrieves the current context.
+ *
+ * C Specification:
+ * ALCcontext* alcGetCurrentContext( ALvoid );
+ */
+static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext (JNIEnv *env, jclass clazz) {
+ ALCcontext* context = alcGetCurrentContext();
+
+ if(context == NULL) {
+ return (jlong) NULL;
+ }
+ return (jlong)((intptr_t)context);
+}
+
+/**
+ * This function retrieves the specified contexts device
+ *
+ * C Specification:
+ * ALCdevice* alcGetContextsDevice(ALCcontext *context);
+ */
+static jlong JNICALL Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice (JNIEnv *env, jclass clazz, jlong contextaddress) {
+ ALCdevice* device = alcGetContextsDevice((ALCcontext*)((intptr_t)contextaddress));
+
+ if(device == NULL) {
+ return (jlong) NULL;
+ }
+
+ return (jlong)((intptr_t)device);
+}
+
+/**
+ * This function suspends processing on a specified context.
+ *
+ * C Specification:
+ * void alcSuspendContext(ALCcontext *context);
+ */
+static void JNICALL Java_org_lwjgl_openal_ALC10_nalcSuspendContext (JNIEnv *env, jclass clazz, jlong contextaddress) {
+ alcSuspendContext((ALCcontext*)((intptr_t)contextaddress));
+}
+
+/**
+ * This function destroys a context.
+ *
+ * C Specification:
+ * void alcDestroyContext(ALCcontext *context);
+ */
+static void JNICALL Java_org_lwjgl_openal_ALC10_nalcDestroyContext (JNIEnv *env, jclass clazz, jlong contextaddress) {
+ alcDestroyContext((ALCcontext*)((intptr_t)contextaddress));
+}
+
+/**
+ * This function retrieves the specified devices context error state.
+ *
+ * C Specification:
+ * ALCenum alcGetError(ALCdevice *device);
+ */
+static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetError (JNIEnv *env, jclass clazz, jlong deviceaddress) {
+ return alcGetError((ALCdevice*)((intptr_t)deviceaddress));
+}
+
+/**
+ * This function queries if a specified context extension is available.
+ *
+ * C Specification:
+ * ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName);
+ */
+static jboolean JNICALL Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring extName) {
+ /* get extension */
+ ALubyte* functionname = (ALubyte*) GetStringNativeChars(env, extName);
+
+ jboolean result = (jboolean) alcIsExtensionPresent((ALCdevice*)((intptr_t)deviceaddress), functionname);
+
+ free(functionname);
+
+ return result;
+}
+
+/**
+ * This function retrieves the enum value for a specified enumeration name.
+ *
+ * C Specification:
+ * ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName);
+ */
+static jint JNICALL Java_org_lwjgl_openal_ALC10_nalcGetEnumValue (JNIEnv *env, jclass clazz, jlong deviceaddress, jstring enumName) {
+ /* get extension */
+ ALubyte* enumerationname = (ALubyte*) GetStringNativeChars(env, enumName);
+
+ jint result = (jint) alcGetEnumValue((ALCdevice*)((intptr_t)deviceaddress), enumerationname);
+
+ free(enumerationname);
+
+ return result;
+}
+
+/**
+ * Loads the context OpenAL functions
+ *
+ * @return true if all methods were loaded, false if one of the methods could not be loaded
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC10_initNativeStubs(JNIEnv *env, jclass clazz) {
+ JavaMethodAndExtFunction functions[] = {
+ {"nalcGetString", "(JI)Ljava/lang/String;", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetString, "alcGetString", (void*)&alcGetString},
+ {"nalcGetIntegerv", "(JIILjava/nio/Buffer;I)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetIntegerv, "alcGetIntegerv", (void*)&alcGetIntegerv},
+ {"nalcOpenDevice", "(Ljava/lang/String;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcOpenDevice, "alcOpenDevice", (void*)&alcOpenDevice},
+ {"nalcCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcCloseDevice, "alcCloseDevice", (void*)&alcCloseDevice},
+ {"nalcCreateContext", "(JLjava/nio/IntBuffer;)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcCreateContext, "alcCreateContext", (void*)&alcCreateContext},
+ {"nalcMakeContextCurrent", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcMakeContextCurrent, "alcMakeContextCurrent", (void*)&alcMakeContextCurrent},
+ {"nalcProcessContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcProcessContext, "alcProcessContext", (void*)&alcProcessContext},
+ {"nalcGetCurrentContext", "()J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetCurrentContext, "alcGetCurrentContext", (void*)&alcGetCurrentContext},
+ {"nalcGetContextsDevice", "(J)J", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetContextsDevice, "alcGetContextsDevice", (void*)&alcGetContextsDevice},
+ {"nalcSuspendContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcSuspendContext, "alcSuspendContext", (void*)&alcSuspendContext},
+ {"nalcDestroyContext", "(J)V", (void*)&Java_org_lwjgl_openal_ALC10_nalcDestroyContext, "alcDestroyContext", (void*)&alcDestroyContext},
+ {"nalcGetError", "(J)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetError, "alcGetError", (void*)&alcGetError},
+ {"nalcIsExtensionPresent", "(JLjava/lang/String;)Z", (void*)&Java_org_lwjgl_openal_ALC10_nalcIsExtensionPresent, "alcIsExtensionPresent", (void*)&alcIsExtensionPresent},
+ {"nalcGetEnumValue", "(JLjava/lang/String;)I", (void*)&Java_org_lwjgl_openal_ALC10_nalcGetEnumValue, "alcGetEnumValue", (void*)&alcGetEnumValue}
+ };
+ int num_functions = NUMFUNCTIONS(functions);
+ extal_InitializeClass(env, clazz, num_functions, functions);
+}
+#ifdef __cplusplus
+}
+#endif
Added: trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c
===================================================================
--- trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c (rev 0)
+++ trunk/LWJGL/src/native/common/org_lwjgl_openal_ALC11.c 2007-04-19 22:20:14 UTC (rev 2773)
@@ -0,0 +1,135 @@
+/*
+ * 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.
+ */
+
+/**
+ * $Id: org_lwjgl_openal_ALC.c 2279 2006-02-23 19:22:00Z elias_naur $
+ *
+ * This is the actual JNI implementation of the OpenAL context/device library.
+ *
+ * @author Brian Matzon <br...@ma...>
+ * @version $Revision: 2279 $
+ */
+
+/* OpenAL includes */
+#include "extal.h"
+
+//alc
+typedef ALCdevice * (ALCAPIENTRY *alcCaptureOpenDevicePROC)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
+typedef ALCboolean (ALCAPIENTRY *alcCaptureCloseDevicePROC)( ALCdevice *device );
+typedef void (ALCAPIENTRY *alcCaptureStartPROC)( ALCdevice *device );
+typedef void (ALCAPIENTRY *alcCaptureStopPROC)( ALCdevice *device );
+typedef void (ALCAPIENTRY *alcCaptureSamplesPROC)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
+
+static alcCaptureOpenDevicePROC alcCaptureOpenDevice;
+static alcCaptureCloseDevicePROC alcCaptureCloseDevice;
+static alcCaptureStartPROC alcCaptureStart;
+static alcCaptureStopPROC alcCaptureStop;
+static alcCaptureSamplesPROC alcCaptureSamples;
+
+/*
+ * Class: org_lwjgl_openal_ALC11
+ * Method: nalcCaptureOpenDevice
+ * Signature: (Ljava/lang/String;III)J
+ */
+static jlong JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice(JNIEnv *env, jclass clazz, jstring devicename, jint frequency, jint format, jint buffersize) {
+ ALubyte* dev_name = NULL;
+ ALCdevice* device = NULL;
+
+ if(devicename != NULL) {
+ dev_name = (ALubyte*) GetStringNativeChars(env, devicename);
+ }
+
+ device = alcCaptureOpenDevice(dev_name, frequency, format, buffersize);
+
+ free(dev_name);
+ return (jlong) device;
+}
+
+/*
+ * Class: org_lwjgl_openal_ALC11
+ * Method: nalcCaptureCloseDevice
+ * Signature: (J)Z
+ */
+static jboolean JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice(JNIEnv *env, jclass clazz, jlong device) {
+ return (jboolean) alcCaptureCloseDevice((ALCdevice*) device);
+}
+
+/*
+ * Class: org_lwjgl_openal_ALC11
+ * Method: nalcCaptureStart
+ * Signature: (J)V
+ */
+static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureStart(JNIEnv *env, jclass clazz, jlong device) {
+ alcCaptureStart((ALCdevice*) device);
+}
+
+/*
+ * Class: org_lwjgl_openal_ALC11
+ * Method: nalcCaptureStop
+ * Signature: (J)V
+ */
+static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureStop(JNIEnv * env, jclass clazz, jlong device) {
+ alcCaptureStop((ALCdevice*) device);
+}
+
+/*
+ * Class: org_lwjgl_openal_ALC11
+ * Method: nalcCaptureSamples
+ * Signature: (JLjava/nio/ByteBuffer;I)V
+ */
+static void JNICALL Java_org_lwjgl_openal_ALC11_nalcCaptureSamples(JNIEnv *env, jclass clazz, jlong device, jobject buffer, jint position, jint samples) {
+ ALuint *buffer_address = ((ALuint *)(*env)->GetDirectBufferAddress(env, buffer)) + position;
+ alcCaptureSamples((ALCdevice*) device, buffer_address, samples);
+}
+
+/**
+ * Loads the context OpenAL functions
+ *
+ * @return true if all methods were loaded, false if one of the methods could not be loaded
+ */
+#ifdef __cplusplus
+extern "C" {
+#endif
+JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC11_initNativeStubs(JNIEnv *env, jclass clazz) {
+ JavaMethodAndExtFunction functions[] = {
+ {"nalcCaptureOpenDevice", "(Ljava/lang/String;III)J", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureOpenDevice, "alcCaptureOpenDevice", (void*)&alcCaptureOpenDevice},
+ {"nalcCaptureCloseDevice", "(J)Z", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureCloseDevice, "alcCaptureCloseDevice", (void*)&alcCaptureCloseDevice},
+ {"nalcCaptureStart", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStart, "alcCaptureStart", (void*)&alcCaptureStart},
+ {"nalcCaptureStop", "(J)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureStop, "alcCaptureStop", (void*)&alcCaptureStop},
+ {"nalcCaptureSamples", "(JLjava/nio/ByteBuffer;II)V", (void*)&Java_org_lwjgl_openal_ALC11_nalcCaptureSamples, "alcCaptureSamples", (void*)&alcCaptureSamples}
+ };
+ int num_functions = NUMFUNCTIONS(functions);
+ extal_InitializeClass(env, clazz, num_functions, functions);
+}
+#ifdef __cplusplus
+}
+#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-19 12:00:41
|
Revision: 2771
http://svn.sourceforge.net/java-game-lib/?rev=2771&view=rev
Author: elias_naur
Date: 2007-04-19 05:00:40 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
JInput update
Modified Paths:
--------------
trunk/LWJGL/libs/jinput.jar
Modified: trunk/LWJGL/libs/jinput.jar
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-19 08:25:17
|
Revision: 2770
http://svn.sourceforge.net/java-game-lib/?rev=2770&view=rev
Author: elias_naur
Date: 2007-04-19 01:24:36 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
Removed reference to generated code in build.xml
Modified Paths:
--------------
trunk/LWJGL/build.xml
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2007-04-19 07:42:01 UTC (rev 2769)
+++ trunk/LWJGL/build.xml 2007-04-19 08:24:36 UTC (rev 2770)
@@ -206,7 +206,6 @@
<uptodate property="lwjgl.main.built" targetfile="${lwjgl.lib}/win32/lwjgl.dll" >
<srcfiles dir= "${lwjgl.src.native}/common" includes="*.c*"/>
- <srcfiles dir= "${lwjgl.src.native}/generated" includes="*.c"/>
<srcfiles dir= "${lwjgl.src.native}/windows" includes="*.c"/>
</uptodate>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-19 07:42:03
|
Revision: 2769
http://svn.sourceforge.net/java-game-lib/?rev=2769&view=rev
Author: elias_naur
Date: 2007-04-19 00:42:01 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
Cut VBO/PBO sanity checks from two to one glGetInteger call by exploiting GL enum value aliasing (once again inspired by MatthiasM). Additionally, support PBO calls added in OpenGL 2.1.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2007-04-15 19:43:35 UTC (rev 2768)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2007-04-19 07:42:01 UTC (rev 2769)
@@ -80,56 +80,49 @@
/** Helper method to ensure that array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureArrayVBOdisabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, false) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ARRAY_BUFFER_BINDING_ARB, false))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Array Buffer Object is enabled");
}
/** Helper method to ensure that array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureArrayVBOenabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, true) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ARRAY_BUFFER_BINDING_ARB, true))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ARRAY_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Array Buffer Object is disabled");
}
/** Helper method to ensure that element array buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureElementVBOdisabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, false) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, false))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Element Array Buffer Object is enabled");
}
/** Helper method to ensure that element array buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureElementVBOenabled(ContextCapabilities caps) {
- if ((caps.OpenGL15 && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, true) ||
- (caps.GL_ARB_vertex_buffer_object && !checkBufferObject(caps, ARBVertexBufferObject.GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, true))))
+ if ((caps.OpenGL15 || caps.GL_ARB_vertex_buffer_object) && !checkBufferObject(caps, GL15.GL_ELEMENT_ARRAY_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Element Array Buffer Object is disabled");
}
/** Helper method to ensure that pixel pack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensurePackPBOdisabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_ARB, false) || (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_EXT, false))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_PACK_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Pixel Pack Buffer Object is enabled");
}
/** Helper method to ensure that pixel pack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensurePackPBOenabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_ARB, true) ||
- (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_PACK_BUFFER_BINDING_EXT, true))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_PACK_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Pixel Pack Buffer Object is disabled");
}
/** Helper method to ensure that pixel unpack buffer objects are disabled. If they are enabled, we'll throw an OpenGLException */
static void ensureUnpackPBOdisabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_ARB, false) ||
- (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_EXT, false))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_UNPACK_BUFFER_BINDING, false))
throw new OpenGLException("Cannot use Buffers when Pixel Unpack Buffer Object is enabled");
}
/** Helper method to ensure that pixel unpack buffer objects are enabled. If they are disabled, we'll throw an OpenGLException */
static void ensureUnpackPBOenabled(ContextCapabilities caps) {
- if ((caps.GL_ARB_pixel_buffer_object && !checkBufferObject(caps, ARBPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_ARB, true) ||
- (caps.GL_EXT_pixel_buffer_object && !checkBufferObject(caps, EXTPixelBufferObject.GL_PIXEL_UNPACK_BUFFER_BINDING_EXT, true))))
+ if ((caps.GL_ARB_pixel_buffer_object || caps.GL_EXT_pixel_buffer_object || caps.OpenGL21) && !checkBufferObject(caps, GL21.GL_PIXEL_UNPACK_BUFFER_BINDING, true))
throw new OpenGLException("Cannot use offsets when Pixel Unpack Buffer Object is disabled");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-15 19:43:37
|
Revision: 2768
http://svn.sourceforge.net/java-game-lib/?rev=2768&view=rev
Author: elias_naur
Date: 2007-04-15 12:43:35 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
Move null parameter checks from check classes to the generated classes, since calculateImageSize assumes the buffer being non-null
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2007-04-15 19:33:03 UTC (rev 2767)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2007-04-15 19:43:35 UTC (rev 2768)
@@ -85,45 +85,6 @@
}
/**
- * Helper methods to ensure a buffer is direct or null.
- */
- public static void checkDirectOrNull(ByteBuffer buf) {
- if (buf != null) {
- checkDirect(buf);
- }
- }
-
- public static void checkDirectOrNull(ShortBuffer buf) {
- if (buf != null) {
- checkDirect(buf);
- }
- }
-
- public static void checkDirectOrNull(IntBuffer buf) {
- if (buf != null) {
- checkDirect(buf);
- }
- }
-
- public static void checkDirectOrNull(LongBuffer buf) {
- if (buf != null) {
- checkDirect(buf);
- }
- }
-
- public static void checkDirectOrNull(FloatBuffer buf) {
- if (buf != null) {
- checkDirect(buf);
- }
- }
-
- public static void checkDirectOrNull(DoubleBuffer buf) {
- if (buf != null) {
- checkDirect(buf);
- }
- }
-
- /**
* Helper methods to ensure a buffer is direct (and, implicitly, non-null).
*/
public static void checkDirect(ByteBuffer buf) {
@@ -214,43 +175,4 @@
checkBufferSize(buf, size);
checkDirect(buf);
}
-
- /**
- * Helper methods to ensure a buffer is direct, has a minimum size or null.
- */
- public static void checkBufferOrNull(ByteBuffer buf, int size) {
- if (buf != null) {
- checkBuffer(buf, size);
- }
- }
-
- public static void checkBufferOrNull(ShortBuffer buf, int size) {
- if (buf != null) {
- checkBuffer(buf, size);
- }
- }
-
- public static void checkBufferOrNull(IntBuffer buf, int size) {
- if (buf != null) {
- checkBuffer(buf, size);
- }
- }
-
- public static void checkBufferOrNull(LongBuffer buf, int size) {
- if (buf != null) {
- checkBuffer(buf, size);
- }
- }
-
- public static void checkBufferOrNull(FloatBuffer buf, int size) {
- if (buf != null) {
- checkBuffer(buf, size);
- }
- }
-
- public static void checkBufferOrNull(DoubleBuffer buf, int size) {
- if (buf != null) {
- checkBuffer(buf, size);
- }
- }
}
Modified: trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2007-04-15 19:33:03 UTC (rev 2767)
+++ trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2007-04-15 19:43:35 UTC (rev 2768)
@@ -67,42 +67,6 @@
return buffers;
}
- public static ByteBuffer wrapBufferOrNull(ByteBuffer buf, int size) {
- if (buf != null)
- return wrapBuffer(buf, size);
- return buf;
- }
-
- public static ShortBuffer wrapBufferOrNull(ShortBuffer buf, int size) {
- if (buf != null)
- return wrapBuffer(buf, size);
- return buf;
- }
-
- public static IntBuffer wrapBufferOrNull(IntBuffer buf, int size) {
- if (buf != null)
- return wrapBuffer(buf, size);
- return buf;
- }
-
- public static LongBuffer wrapBufferOrNull(LongBuffer buf, int size) {
- if (buf != null)
- return wrapBuffer(buf, size);
- return buf;
- }
-
- public static FloatBuffer wrapBufferOrNull(FloatBuffer buf, int size) {
- if (buf != null)
- return wrapBuffer(buf, size);
- return buf;
- }
-
- public static DoubleBuffer wrapBufferOrNull(DoubleBuffer buf, int size) {
- if (buf != null)
- return wrapBuffer(buf, size);
- return buf;
- }
-
public static ByteBuffer wrapBuffer(ByteBuffer buf, int size) {
BufferChecks.checkBufferSize(buf, size);
return wrapDirect(buf);
@@ -133,42 +97,6 @@
return wrapDirect(buf);
}
- public static ByteBuffer wrapDirectOrNull(ByteBuffer buffer) {
- if (buffer != null)
- return wrapDirect(buffer);
- return buffer;
- }
-
- public static ShortBuffer wrapDirectOrNull(ShortBuffer buffer) {
- if (buffer != null)
- return wrapDirect(buffer);
- return buffer;
- }
-
- public static FloatBuffer wrapDirectOrNull(FloatBuffer buffer) {
- if (buffer != null)
- return wrapDirect(buffer);
- return buffer;
- }
-
- public static IntBuffer wrapDirectOrNull(IntBuffer buffer) {
- if (buffer != null)
- return wrapDirect(buffer);
- return buffer;
- }
-
- public static LongBuffer wrapDirectOrNull(LongBuffer buffer) {
- if (buffer != null)
- return wrapDirect(buffer);
- return buffer;
- }
-
- public static DoubleBuffer wrapDirectOrNull(DoubleBuffer buffer) {
- if (buffer != null)
- return wrapDirect(buffer);
- return buffer;
- }
-
public static ByteBuffer wrapDirect(ByteBuffer buffer) {
if (!buffer.isDirect())
return doWrap(buffer);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2007-04-15 19:33:03 UTC (rev 2767)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2007-04-15 19:43:35 UTC (rev 2768)
@@ -438,20 +438,18 @@
}
private static void printParameterCheck(PrintWriter writer, String name, String check_value, boolean can_be_null, boolean null_terminated, boolean indirect_buffer_allowed) {
+ if (can_be_null) {
+ writer.println("\t\tif (" + name + " != null)");
+ writer.print("\t");
+ }
if (indirect_buffer_allowed)
writer.print("\t\t" + name + " = NondirectBufferWrapper.wrap");
else
writer.print("\t\tBufferChecks.check");
if (check_value != null && !"".equals(check_value) ) {
- writer.print("Buffer");
- if (can_be_null)
- writer.print("OrNull");
- writer.print("(" + name + ", " + check_value);
+ writer.print("Buffer(" + name + ", " + check_value);
} else {
- writer.print("Direct");
- if (can_be_null)
- writer.print("OrNull");
- writer.print("(" + name);
+ writer.print("Direct(" + name);
}
writer.println(");");
if (null_terminated)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-15 19:33:05
|
Revision: 2767
http://svn.sourceforge.net/java-game-lib/?rev=2767&view=rev
Author: elias_naur
Date: 2007-04-15 12:33:03 -0700 (Sun, 15 Apr 2007)
Log Message:
-----------
Don't add border when checking image sizes
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java
trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL12.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java 2007-04-11 20:33:07 UTC (rev 2766)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferUtils.java 2007-04-15 19:33:03 UTC (rev 2767)
@@ -133,7 +133,7 @@
else if (buf instanceof LongBuffer || buf instanceof DoubleBuffer)
return 3;
else
- throw new IllegalStateException("Unsupported buffer type");
+ throw new IllegalStateException("Unsupported buffer type: " + buf);
}
/**
Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2007-04-11 20:33:07 UTC (rev 2766)
+++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLChecks.java 2007-04-15 19:33:03 UTC (rev 2767)
@@ -148,16 +148,16 @@
return calculateImageStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer);
}
- static int calculateTexImage1DStorage(Buffer buffer, int format, int type, int width, int border) {
- return calculateTexImage1DStorage(format, type, width, border) >> BufferUtils.getElementSizeExponent(buffer);
+ static int calculateTexImage1DStorage(Buffer buffer, int format, int type, int width) {
+ return calculateTexImage1DStorage(format, type, width) >> BufferUtils.getElementSizeExponent(buffer);
}
- static int calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height, int border) {
- return calculateTexImage2DStorage(format, type, width, height, border) >> BufferUtils.getElementSizeExponent(buffer);
+ static int calculateTexImage2DStorage(Buffer buffer, int format, int type, int width, int height) {
+ return calculateTexImage2DStorage(format, type, width, height) >> BufferUtils.getElementSizeExponent(buffer);
}
- static int calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth, int border) {
- return calculateTexImage3DStorage(format, type, width, height, depth, border) >> BufferUtils.getElementSizeExponent(buffer);
+ static int calculateTexImage3DStorage(Buffer buffer, int format, int type, int width, int height, int depth) {
+ return calculateTexImage3DStorage(format, type, width, height, depth) >> BufferUtils.getElementSizeExponent(buffer);
}
/**
@@ -175,16 +175,16 @@
return calculateBytesPerPixel(format, type) * width * height * depth;
}
- private static int calculateTexImage1DStorage(int format, int type, int width, int border) {
- return calculateBytesPerPixel(format, type) * (width + (border << 1));
+ private static int calculateTexImage1DStorage(int format, int type, int width) {
+ return calculateBytesPerPixel(format, type) * width;
}
- private static int calculateTexImage2DStorage(int format, int type, int width, int height, int border) {
- return calculateTexImage1DStorage(format, type, width, border) * (height + (border << 1));
+ private static int calculateTexImage2DStorage(int format, int type, int width, int height) {
+ return calculateTexImage1DStorage(format, type, width) * height;
}
- private static int calculateTexImage3DStorage(int format, int type, int width, int height, int depth, int border) {
- return calculateTexImage2DStorage(format, type, width, height, border) * (depth + (border << 1));
+ private static int calculateTexImage3DStorage(int format, int type, int width, int height, int depth) {
+ return calculateTexImage2DStorage(format, type, width, height) * depth;
}
private static int calculateBytesPerPixel(int format, int type) {
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2007-04-11 20:33:07 UTC (rev 2766)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2007-04-15 19:33:03 UTC (rev 2767)
@@ -1261,7 +1261,7 @@
void glTexImage1D(@GLenum int target, int level, int internalformat, @GLsizei int width, int border, @GLenum int format, @GLenum int type,
@BufferObject(BufferKind.UnpackPBO)
- @Check(value = "GLChecks.calculateTexImage1DStorage(pixels, format, type, width, border)", canBeNull = true)
+ @Check(value = "GLChecks.calculateTexImage1DStorage(pixels, format, type, width)", canBeNull = true)
@Const
@GLbyte
@GLshort
@@ -1271,7 +1271,7 @@
void glTexImage2D(@GLenum int target, int level, int internalformat, int width, int height, int border, @GLenum int format, @GLenum int type,
@BufferObject(BufferKind.UnpackPBO)
- @Check(value = "GLChecks.calculateTexImage2DStorage(pixels, format, type, width, height, border)", canBeNull = true)
+ @Check(value = "GLChecks.calculateTexImage2DStorage(pixels, format, type, width, height)", canBeNull = true)
@Const
@GLbyte
@GLshort
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL12.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL12.java 2007-04-11 20:33:07 UTC (rev 2766)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL12.java 2007-04-15 19:33:03 UTC (rev 2767)
@@ -97,7 +97,7 @@
void glTexImage3D(@GLenum int target, int level, int internalFormat, @GLsizei int width, @GLsizei int height, @GLsizei int depth, int border, @GLenum int format, @GLenum int type,
@BufferObject(BufferKind.UnpackPBO)
- @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth, border)", canBeNull = true)
+ @Check(value = "GLChecks.calculateTexImage3DStorage(pixels, format, type, width, height, depth)", canBeNull = true)
@Const
@GLbyte
@GLshort
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: ackroydi2ag <ack...@ho...> - 2007-04-14 09:59:45
|
Hillo2 98a |
|
From: <ma...@us...> - 2007-04-11 20:33:09
|
Revision: 2766
http://svn.sourceforge.net/java-game-lib/?rev=2766&view=rev
Author: matzon
Date: 2007-04-11 13:33:07 -0700 (Wed, 11 Apr 2007)
Log Message:
-----------
tagging 1.1
Added Paths:
-----------
tags/lwjgl1.1/
Copied: tags/lwjgl1.1 (from rev 2765, trunk)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-11 20:32:47
|
Revision: 2764
http://svn.sourceforge.net/java-game-lib/?rev=2764&view=rev
Author: matzon
Date: 2007-04-11 13:32:12 -0700 (Wed, 11 Apr 2007)
Log Message:
-----------
1.1 version string
Modified Paths:
--------------
trunk/LWJGL/build.xml
trunk/LWJGL/src/java/org/lwjgl/Sys.java
trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
Modified: trunk/LWJGL/build.xml
===================================================================
--- trunk/LWJGL/build.xml 2007-04-11 17:30:13 UTC (rev 2763)
+++ trunk/LWJGL/build.xml 2007-04-11 20:32:12 UTC (rev 2764)
@@ -13,7 +13,7 @@
<property name="lwjgl.docs" location="doc" />
<property name="lwjgl.temp" location="temp" />
<property name="lwjgl.res" location="res" />
- <property name="lwjgl.version" value="1.0.1" />
+ <property name="lwjgl.version" value="1.1" />
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java"/>
<!-- ================================================================== -->
Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2007-04-11 17:30:13 UTC (rev 2763)
+++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2007-04-11 20:32:12 UTC (rev 2764)
@@ -54,7 +54,7 @@
private static final String JNI_LIBRARY_NAME = "lwjgl";
/** Current version of library */
- private static final String VERSION = "1.0.1";
+ private static final String VERSION = "1.1";
/** Current version of the JNI library */
static final int JNI_VERSION = 8;
Modified: trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2007-04-11 17:30:13 UTC (rev 2763)
+++ trunk/LWJGL/src/java/org/lwjgl/devil/ILNative.java 2007-04-11 20:32:12 UTC (rev 2764)
@@ -53,7 +53,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-devil";
/** Version of IL */
- static final String VERSION = "1.0.1";
+ static final String VERSION = "1.1";
/** Current version of the JNI library */
static final int JNI_VERSION = 2;
Modified: trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2007-04-11 17:30:13 UTC (rev 2763)
+++ trunk/LWJGL/src/java/org/lwjgl/fmod3/FMOD.java 2007-04-11 20:32:12 UTC (rev 2764)
@@ -193,7 +193,7 @@
private static String JNI_LIBRARY_NAME = "lwjgl-fmod3";
/** Version of FMOD */
- private static final String VERSION = "1.0.1";
+ private static final String VERSION = "1.1";
/** Current version of the JNI library */
static final int JNI_VERSION = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-04-11 20:32:46
|
Revision: 2765
http://svn.sourceforge.net/java-game-lib/?rev=2765&view=rev
Author: matzon
Date: 2007-04-11 13:32:27 -0700 (Wed, 11 Apr 2007)
Log Message:
-----------
nuking unreleases 1.0.1
Removed Paths:
-------------
tags/lwjgl1.0.1/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-11 17:30:15
|
Revision: 2763
http://svn.sourceforge.net/java-game-lib/?rev=2763&view=rev
Author: elias_naur
Date: 2007-04-11 10:30:13 -0700 (Wed, 11 Apr 2007)
Log Message:
-----------
Added support for non-direct buffers for all functions that doesn't cache the buffer address at the native side (e.g. glVertexPointer). Reasons:
1. We can now support calls like "glLight(..., ..., FloatBuffer.wrap(new float[] {...}));" without worrying about running out of direct memory heap,
since both the FloatBuffer and the array are allocated on the java heap. Future JVMs with stack allocation support could improve this even further.
2. We avoid getting in the way of users that doesn't (yet) know why direct buffers are important.
Obviously, we'd like direct support for arrays, but non-direct buffers are a nice compromise that avoids the API bloat that results when almost all
functions gain an overloaded versions that take arrays instead of buffers.
Notes:
1. Non-direct buffer support should not affect the performance in the direct buffer case, since the non-direct buffer code path is only activated
when the isDirect() check fails, and we were already checking isDirect() for sanity checking.
2. When using non-direct buffers, the buffer contents (remaining() bytes) are copied to a resizable ThreadLocal cached direct buffer (which is
resized as needed) and used instead of the non-direct buffer. Thus, performance of non-direct buffers is lower than direct buffers.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2007-04-11 16:13:05 UTC (rev 2762)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2007-04-11 17:30:13 UTC (rev 2763)
@@ -43,6 +43,8 @@
* <p>A class to check buffer boundaries in general. If there is unsufficient space
* in the buffer when the call is made then a buffer overflow would otherwise
* occur and cause unexpected behaviour, a crash, or worse, a security risk.
+ *
+ * Internal class, don't use.
* </p>
* @author cix_foo <ci...@us...>
* @author elias_naur <eli...@us...>
@@ -177,7 +179,7 @@
* The minimum buffer size
* @throws IllegalArgumentException
*/
- private static void checkBufferSize(Buffer buf, int size) {
+ public static void checkBufferSize(Buffer buf, int size) {
if (buf.remaining() < size) {
throwBufferSizeException(buf, size);
}
Added: trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/NondirectBufferWrapper.java 2007-04-11 17:30:13 UTC (rev 2763)
@@ -0,0 +1,301 @@
+/*
+ * 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;
+
+import java.nio.ByteBuffer;
+import java.nio.ShortBuffer;
+import java.nio.IntBuffer;
+import java.nio.FloatBuffer;
+import java.nio.LongBuffer;
+import java.nio.DoubleBuffer;
+import java.nio.ByteOrder;
+
+/**
+ * Utility class to cache thread local direct buffers so when we are passed a non-direct buffer,
+ * we can put its contents into a cached direct buffer and use that at the native side instead.
+ *
+ * Internal class, don't use.
+ * @author elias_naur <eli...@us...>
+ * @version $Revision: 2762 $
+ * $Id: BufferChecks.java 2762 2007-04-11 16:13:05Z elias_naur $
+ */
+public final class NondirectBufferWrapper {
+ private final static int INITIAL_BUFFER_SIZE = 1;
+
+ private final static ThreadLocal thread_buffer = new ThreadLocal() {
+ protected final Object initialValue() {
+ return new CachedBuffers(INITIAL_BUFFER_SIZE);
+ }
+ };
+
+ private static CachedBuffers getCachedBuffers(int minimum_byte_size) {
+ CachedBuffers buffers = (CachedBuffers)thread_buffer.get();
+ int current_byte_size = buffers.byte_buffer.capacity();
+ if (minimum_byte_size > current_byte_size) {
+ buffers = new CachedBuffers(minimum_byte_size);
+ thread_buffer.set(buffers);
+ }
+ return buffers;
+ }
+
+ public static ByteBuffer wrapBufferOrNull(ByteBuffer buf, int size) {
+ if (buf != null)
+ return wrapBuffer(buf, size);
+ return buf;
+ }
+
+ public static ShortBuffer wrapBufferOrNull(ShortBuffer buf, int size) {
+ if (buf != null)
+ return wrapBuffer(buf, size);
+ return buf;
+ }
+
+ public static IntBuffer wrapBufferOrNull(IntBuffer buf, int size) {
+ if (buf != null)
+ return wrapBuffer(buf, size);
+ return buf;
+ }
+
+ public static LongBuffer wrapBufferOrNull(LongBuffer buf, int size) {
+ if (buf != null)
+ return wrapBuffer(buf, size);
+ return buf;
+ }
+
+ public static FloatBuffer wrapBufferOrNull(FloatBuffer buf, int size) {
+ if (buf != null)
+ return wrapBuffer(buf, size);
+ return buf;
+ }
+
+ public static DoubleBuffer wrapBufferOrNull(DoubleBuffer buf, int size) {
+ if (buf != null)
+ return wrapBuffer(buf, size);
+ return buf;
+ }
+
+ public static ByteBuffer wrapBuffer(ByteBuffer buf, int size) {
+ BufferChecks.checkBufferSize(buf, size);
+ return wrapDirect(buf);
+ }
+
+ public static ShortBuffer wrapBuffer(ShortBuffer buf, int size) {
+ BufferChecks.checkBufferSize(buf, size);
+ return wrapDirect(buf);
+ }
+
+ public static IntBuffer wrapBuffer(IntBuffer buf, int size) {
+ BufferChecks.checkBufferSize(buf, size);
+ return wrapDirect(buf);
+ }
+
+ public static LongBuffer wrapBuffer(LongBuffer buf, int size) {
+ BufferChecks.checkBufferSize(buf, size);
+ return wrapDirect(buf);
+ }
+
+ public static FloatBuffer wrapBuffer(FloatBuffer buf, int size) {
+ BufferChecks.checkBufferSize(buf, size);
+ return wrapDirect(buf);
+ }
+
+ public static DoubleBuffer wrapBuffer(DoubleBuffer buf, int size) {
+ BufferChecks.checkBufferSize(buf, size);
+ return wrapDirect(buf);
+ }
+
+ public static ByteBuffer wrapDirectOrNull(ByteBuffer buffer) {
+ if (buffer != null)
+ return wrapDirect(buffer);
+ return buffer;
+ }
+
+ public static ShortBuffer wrapDirectOrNull(ShortBuffer buffer) {
+ if (buffer != null)
+ return wrapDirect(buffer);
+ return buffer;
+ }
+
+ public static FloatBuffer wrapDirectOrNull(FloatBuffer buffer) {
+ if (buffer != null)
+ return wrapDirect(buffer);
+ return buffer;
+ }
+
+ public static IntBuffer wrapDirectOrNull(IntBuffer buffer) {
+ if (buffer != null)
+ return wrapDirect(buffer);
+ return buffer;
+ }
+
+ public static LongBuffer wrapDirectOrNull(LongBuffer buffer) {
+ if (buffer != null)
+ return wrapDirect(buffer);
+ return buffer;
+ }
+
+ public static DoubleBuffer wrapDirectOrNull(DoubleBuffer buffer) {
+ if (buffer != null)
+ return wrapDirect(buffer);
+ return buffer;
+ }
+
+ public static ByteBuffer wrapDirect(ByteBuffer buffer) {
+ if (!buffer.isDirect())
+ return doWrap(buffer);
+ return buffer;
+ }
+
+ public static ShortBuffer wrapDirect(ShortBuffer buffer) {
+ if (!buffer.isDirect())
+ return doWrap(buffer);
+ return buffer;
+ }
+
+ public static FloatBuffer wrapDirect(FloatBuffer buffer) {
+ if (!buffer.isDirect())
+ return doWrap(buffer);
+ return buffer;
+ }
+
+ public static IntBuffer wrapDirect(IntBuffer buffer) {
+ if (!buffer.isDirect())
+ return doWrap(buffer);
+ return buffer;
+ }
+
+ public static LongBuffer wrapDirect(LongBuffer buffer) {
+ if (!buffer.isDirect())
+ return doWrap(buffer);
+ return buffer;
+ }
+
+ public static DoubleBuffer wrapDirect(DoubleBuffer buffer) {
+ if (!buffer.isDirect())
+ return doWrap(buffer);
+ return buffer;
+ }
+
+ private static ByteBuffer doWrap(ByteBuffer buffer) {
+ ByteBuffer direct_buffer = getCachedBuffers(buffer.remaining()).byte_buffer;
+ direct_buffer.clear();
+ int saved_position = buffer.position();
+ direct_buffer.put(buffer);
+ buffer.position(saved_position);
+ direct_buffer.flip();
+ return direct_buffer;
+ }
+
+ private static ShortBuffer doWrap(ShortBuffer buffer) {
+ CachedBuffers buffers = getCachedBuffers(buffer.remaining()*2);
+ ShortBuffer direct_buffer = buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.short_buffer_little : buffers.short_buffer_big;
+ direct_buffer.clear();
+ int saved_position = buffer.position();
+ direct_buffer.put(buffer);
+ buffer.position(saved_position);
+ direct_buffer.flip();
+ return direct_buffer;
+ }
+
+ private static FloatBuffer doWrap(FloatBuffer buffer) {
+ CachedBuffers buffers = getCachedBuffers(buffer.remaining()*4);
+ FloatBuffer direct_buffer = buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.float_buffer_little : buffers.float_buffer_big;
+ direct_buffer.clear();
+ int saved_position = buffer.position();
+ direct_buffer.put(buffer);
+ buffer.position(saved_position);
+ direct_buffer.flip();
+ return direct_buffer;
+ }
+
+ private static IntBuffer doWrap(IntBuffer buffer) {
+ CachedBuffers buffers = getCachedBuffers(buffer.remaining()*4);
+ IntBuffer direct_buffer = buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.int_buffer_little : buffers.int_buffer_big;
+ direct_buffer.clear();
+ int saved_position = buffer.position();
+ direct_buffer.put(buffer);
+ buffer.position(saved_position);
+ direct_buffer.flip();
+ return direct_buffer;
+ }
+
+ private static LongBuffer doWrap(LongBuffer buffer) {
+ CachedBuffers buffers = getCachedBuffers(buffer.remaining()*8);
+ LongBuffer direct_buffer = buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.long_buffer_little : buffers.long_buffer_big;
+ direct_buffer.clear();
+ int saved_position = buffer.position();
+ direct_buffer.put(buffer);
+ buffer.position(saved_position);
+ direct_buffer.flip();
+ return direct_buffer;
+ }
+
+ private static DoubleBuffer doWrap(DoubleBuffer buffer) {
+ CachedBuffers buffers = getCachedBuffers(buffer.remaining()*8);
+ DoubleBuffer direct_buffer = buffer.order() == ByteOrder.LITTLE_ENDIAN ? buffers.double_buffer_little : buffers.double_buffer_big;
+ direct_buffer.clear();
+ int saved_position = buffer.position();
+ direct_buffer.put(buffer);
+ buffer.position(saved_position);
+ direct_buffer.flip();
+ return direct_buffer;
+ }
+
+ private final static class CachedBuffers {
+ private final ByteBuffer byte_buffer;
+ private final ShortBuffer short_buffer_big;
+ private final IntBuffer int_buffer_big;
+ private final FloatBuffer float_buffer_big;
+ private final LongBuffer long_buffer_big;
+ private final DoubleBuffer double_buffer_big;
+ private final ShortBuffer short_buffer_little;
+ private final IntBuffer int_buffer_little;
+ private final FloatBuffer float_buffer_little;
+ private final LongBuffer long_buffer_little;
+ private final DoubleBuffer double_buffer_little;
+
+ private CachedBuffers(int size) {
+ this.byte_buffer = ByteBuffer.allocateDirect(size);
+ this.short_buffer_big = byte_buffer.asShortBuffer();
+ this.int_buffer_big = byte_buffer.asIntBuffer();
+ this.float_buffer_big = byte_buffer.asFloatBuffer();
+ this.long_buffer_big = byte_buffer.asLongBuffer();
+ this.double_buffer_big = byte_buffer.asDoubleBuffer();
+ this.byte_buffer.order(ByteOrder.LITTLE_ENDIAN);
+ this.short_buffer_little = byte_buffer.asShortBuffer();
+ this.int_buffer_little = byte_buffer.asIntBuffer();
+ this.float_buffer_little = byte_buffer.asFloatBuffer();
+ this.long_buffer_little = byte_buffer.asLongBuffer();
+ this.double_buffer_little = byte_buffer.asDoubleBuffer();
+ }
+ }
+}
Modified: trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java 2007-04-11 16:13:05 UTC (rev 2762)
+++ trunk/LWJGL/src/java/org/lwjgl/test/opengl/Gears.java 2007-04-11 17:30:13 UTC (rev 2763)
@@ -156,18 +156,14 @@
Display.setLocation((Display.getDisplayMode().getWidth() - 300) / 2,
(Display.getDisplayMode().getHeight() - 300) / 2);
Display.setDisplayMode(new DisplayMode(300, 300));
- Display.setTitle("Gears");
+ Display.setTitle("Gears");
Display.create();
// setup ogl
- FloatBuffer pos = BufferUtils.createFloatBuffer(4).put(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
- FloatBuffer red = BufferUtils.createFloatBuffer(4).put(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
- FloatBuffer green = BufferUtils.createFloatBuffer(4).put(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
- FloatBuffer blue = BufferUtils.createFloatBuffer(4).put(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
- pos.flip();
- red.flip();
- green.flip();
- blue.flip();
+ FloatBuffer pos = FloatBuffer.wrap(new float[] { 5.0f, 5.0f, 10.0f, 0.0f});
+ FloatBuffer red = FloatBuffer.wrap(new float[] { 0.8f, 0.1f, 0.0f, 1.0f});
+ FloatBuffer green = FloatBuffer.wrap(new float[] { 0.0f, 0.8f, 0.2f, 1.0f});
+ FloatBuffer blue = FloatBuffer.wrap(new float[] { 0.2f, 0.2f, 1.0f, 1.0f});
GL11.glLight(GL11.GL_LIGHT0, GL11.GL_POSITION, pos);
GL11.glEnable(GL11.GL_CULL_FACE);
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2007-04-11 16:13:05 UTC (rev 2762)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2007-04-11 17:30:13 UTC (rev 2763)
@@ -171,6 +171,7 @@
java_writer.println();
java_writer.println("import org.lwjgl.LWJGLException;");
java_writer.println("import org.lwjgl.BufferChecks;");
+ java_writer.println("import org.lwjgl.NondirectBufferWrapper;");
java_writer.println("import java.nio.*;");
java_writer.println();
java_writer.print("public ");
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2007-04-11 16:13:05 UTC (rev 2762)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2007-04-11 17:30:13 UTC (rev 2763)
@@ -425,7 +425,8 @@
}
boolean null_terminated = param.getAnnotation(NullTerminated.class) != null;
if (Buffer.class.isAssignableFrom(java_type)) {
- printParameterCheck(writer, param.getSimpleName(), check_value, can_be_null, null_terminated);
+ boolean indirect_buffer_allowed = param.getAnnotation(CachedReference.class) == null;
+ printParameterCheck(writer, param.getSimpleName(), check_value, can_be_null, null_terminated, indirect_buffer_allowed);
} else if (String.class.equals(java_type)) {
if (!can_be_null)
writer.println("\t\tBufferChecks.checkNotNull(" + param.getSimpleName() + ");");
@@ -433,11 +434,14 @@
}
}
if (method.getAnnotation(CachedResult.class) != null)
- printParameterCheck(writer, Utils.CACHED_BUFFER_NAME, null, true, false);
+ printParameterCheck(writer, Utils.CACHED_BUFFER_NAME, null, true, false, false);
}
- private static void printParameterCheck(PrintWriter writer, String name, String check_value, boolean can_be_null, boolean null_terminated) {
- writer.print("\t\tBufferChecks.check");
+ private static void printParameterCheck(PrintWriter writer, String name, String check_value, boolean can_be_null, boolean null_terminated, boolean indirect_buffer_allowed) {
+ if (indirect_buffer_allowed)
+ writer.print("\t\t" + name + " = NondirectBufferWrapper.wrap");
+ else
+ writer.print("\t\tBufferChecks.check");
if (check_value != null && !"".equals(check_value) ) {
writer.print("Buffer");
if (can_be_null)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <eli...@us...> - 2007-04-11 16:13:08
|
Revision: 2762
http://svn.sourceforge.net/java-game-lib/?rev=2762&view=rev
Author: elias_naur
Date: 2007-04-11 09:13:05 -0700 (Wed, 11 Apr 2007)
Log Message:
-----------
Moved null check from generated code to BufferChecks and removed unused buffer checks
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
Modified: trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2007-04-08 21:33:35 UTC (rev 2761)
+++ trunk/LWJGL/src/java/org/lwjgl/BufferChecks.java 2007-04-11 16:13:05 UTC (rev 2762)
@@ -124,23 +124,6 @@
/**
* Helper methods to ensure a buffer is direct (and, implicitly, non-null).
*/
- public static void checkDirectBuffer(Buffer buf) {
- if (buf instanceof FloatBuffer)
- checkDirect((FloatBuffer)buf);
- else if (buf instanceof ByteBuffer)
- checkDirect((ByteBuffer)buf);
- else if (buf instanceof ShortBuffer)
- checkDirect((ShortBuffer)buf);
- else if (buf instanceof IntBuffer)
- checkDirect((IntBuffer)buf);
- else if (buf instanceof LongBuffer)
- checkDirect((LongBuffer)buf);
- else if (buf instanceof DoubleBuffer)
- checkDirect((DoubleBuffer)buf);
- else
- throw new IllegalStateException("Unsupported buffer type");
- }
-
public static void checkDirect(ByteBuffer buf) {
if (!buf.isDirect()) {
throw new IllegalArgumentException("ByteBuffer is not direct");
@@ -231,36 +214,41 @@
}
/**
- * Helper methods to ensure a buffer is big enough to receive data from a
- * glGet* operation. To avoid unnecessarily complex buffer size checking
- * we've just set the bar artificially high and insist that any receiving
- * buffer has at least 4 remaining().
- *
- * @param buf
- * The buffer to check
- * @throws IllegalArgumentException
+ * Helper methods to ensure a buffer is direct, has a minimum size or null.
*/
- public static void checkBuffer(ByteBuffer buf) {
- checkBuffer(buf, DEFAULT_BUFFER_SIZE);
+ public static void checkBufferOrNull(ByteBuffer buf, int size) {
+ if (buf != null) {
+ checkBuffer(buf, size);
+ }
}
- public static void checkBuffer(ShortBuffer buf) {
- checkBuffer(buf, DEFAULT_BUFFER_SIZE);
+ public static void checkBufferOrNull(ShortBuffer buf, int size) {
+ if (buf != null) {
+ checkBuffer(buf, size);
+ }
}
- public static void checkBuffer(IntBuffer buf) {
- checkBuffer(buf, DEFAULT_BUFFER_SIZE);
+ public static void checkBufferOrNull(IntBuffer buf, int size) {
+ if (buf != null) {
+ checkBuffer(buf, size);
+ }
}
- public static void checkBuffer(LongBuffer buf) {
- checkBuffer(buf, DEFAULT_BUFFER_SIZE);
+ public static void checkBufferOrNull(LongBuffer buf, int size) {
+ if (buf != null) {
+ checkBuffer(buf, size);
+ }
}
- public static void checkBuffer(FloatBuffer buf) {
- checkBuffer(buf, DEFAULT_BUFFER_SIZE);
+ public static void checkBufferOrNull(FloatBuffer buf, int size) {
+ if (buf != null) {
+ checkBuffer(buf, size);
+ }
}
- public static void checkBuffer(DoubleBuffer buf) {
- checkBuffer(buf, DEFAULT_BUFFER_SIZE);
+ public static void checkBufferOrNull(DoubleBuffer buf, int size) {
+ if (buf != null) {
+ checkBuffer(buf, size);
+ }
}
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2007-04-08 21:33:35 UTC (rev 2761)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2007-04-11 16:13:05 UTC (rev 2762)
@@ -437,15 +437,16 @@
}
private static void printParameterCheck(PrintWriter writer, String name, String check_value, boolean can_be_null, boolean null_terminated) {
- if (can_be_null) {
- writer.println("\t\tif (" + name + " != null)");
- writer.print("\t");
- }
writer.print("\t\tBufferChecks.check");
if (check_value != null && !"".equals(check_value) ) {
- writer.print("Buffer(" + name + ", " + check_value);
+ writer.print("Buffer");
+ if (can_be_null)
+ writer.print("OrNull");
+ writer.print("(" + name + ", " + check_value);
} else {
writer.print("Direct");
+ if (can_be_null)
+ writer.print("OrNull");
writer.print("(" + name);
}
writer.println(");");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|