diff --git a/src/java/org/lwjgl/openal/AL.java b/src/java/org/lwjgl/openal/AL.java index 394d6e38..cefc29f9 100644 --- a/src/java/org/lwjgl/openal/AL.java +++ b/src/java/org/lwjgl/openal/AL.java @@ -13,7 +13,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'Light Weight Java Game Library' nor the names of + * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -29,7 +29,9 @@ * 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; +package org.lwjgl.openal; + +import org.lwjgl.Sys; /** * $Id$ @@ -40,10 +42,69 @@ * @version $Revision$ */ public class AL extends CoreAL { + + /** ALC instance. */ + protected ALC alc; + + /** ALCdevice instance. */ + protected ALCdevice device; + + /** Current ALCcontext. */ + protected ALCcontext context; + + /** + * String that requests a certain device or device configuration. + * If null is specified, the implementation will provide an + * implementation specific default. */ + protected String deviceArguments; + + /** Frequency for mixing output buffer, in units of Hz. */ + protected int contextFrequency; + + /** Refresh intervalls, in units of Hz. */ + protected int contextRefresh; + + /** Flag, indicating a synchronous context. */ + protected int contextSynchronized; + + /** + * Creates an OpenAL instance + * + * @param deviceArguments Arguments supplied to native device + * @param contextFrequency Frequency for mixing output buffer, in units of Hz (Common values include 11025, 22050, and 44100). + * @param contextRefresh Refresh intervalls, in units of Hz. + * @param contextSynchronized Flag, indicating a synchronous context.* + */ + public AL(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized) { + this.deviceArguments = deviceArguments; + this.contextFrequency = contextFrequency; + this.contextRefresh = contextRefresh; + this.contextSynchronized = contextSynchronized ? ALC.TRUE : ALC.FALSE; + } + + + /** + * @see org.lwjgl.openal.BaseAL#create() + */ + public void create() throws OpenALException { + super.create(); - /** - * Nothing to se here - please move along - */ - public AL() { - } + alc = new ALC(this); + alc.create(); + + device = alc.openDevice(deviceArguments); + + context = alc.createContext(device.device, + Sys.getDirectBufferAddress( + ALCcontext.createAttributeList(contextFrequency, contextRefresh, contextSynchronized))); + + alc.makeContextCurrent(context.context); + } + + /** + * Retrieves the AL Context class + */ + public ALC getALC() { + return alc; + } } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/ALC.java b/src/java/org/lwjgl/openal/ALC.java index 37ffa7fc..2e9e7cb8 100644 --- a/src/java/org/lwjgl/openal/ALC.java +++ b/src/java/org/lwjgl/openal/ALC.java @@ -13,7 +13,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'Light Weight Java Game Library' nor the names of + * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -42,230 +42,251 @@ package org.lwjgl.openal; */ public class ALC { /** Has the ALC object been created? */ - protected static boolean created; - - /** Bad value */ - public static final int INVALID = -1; - - /** Boolean False */ - public static final int FALSE = 0; - - /** Boolean True */ - public static final int TRUE = 1; - - /** Errors: No Error */ - public static final int NO_ERROR = FALSE; - - public static final int MAJOR_VERSION = 0x1000; - public static final int MINOR_VERSION = 0x1001; - public static final int ATTRIBUTES_SIZE = 0x1002; - public static final int ALL_ATTRIBUTES = 0x1003; - - public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004; - public static final int DEVICE_SPECIFIER = 0x1005; - public static final int EXTENSIONS = 0x1006; - - public static final int FREQUENCY = 0x1007; - public static final int REFRESH = 0x1008; - public static final int SYNC = 0x1009; - - /** The device argument does not name a valid device */ - public static final int INVALID_DEVICE = 0xA001; - - /** The context argument does not name a valid context */ - public static final int 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 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 INVALID_VALUE = 0xA004; - - /** - * A function could not be completed, because there is not enough - * memory available. - */ - public static final int OUT_OF_MEMORY = 0xA005; - + protected static boolean created; + + /** Parent AL instance */ + protected AL al = null; + + /** Bad value */ + public static final int INVALID = -1; + + /** Boolean False */ + public static final int FALSE = 0; + + /** Boolean True */ + public static final int TRUE = 1; + + /** Errors: No Error */ + public static final int NO_ERROR = FALSE; + + public static final int MAJOR_VERSION = 0x1000; + public static final int MINOR_VERSION = 0x1001; + public static final int ATTRIBUTES_SIZE = 0x1002; + public static final int ALL_ATTRIBUTES = 0x1003; + + public static final int DEFAULT_DEVICE_SPECIFIER = 0x1004; + public static final int DEVICE_SPECIFIER = 0x1005; + public static final int EXTENSIONS = 0x1006; + + public static final int FREQUENCY = 0x1007; + public static final int REFRESH = 0x1008; + public static final int SYNC = 0x1009; + + /** The device argument does not name a valid device */ + public static final int INVALID_DEVICE = 0xA001; + + /** The context argument does not name a valid context */ + public static final int 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 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 INVALID_VALUE = 0xA004; + + /** + * A function could not be completed, because there is not enough + * memory available. + */ + public static final int OUT_OF_MEMORY = 0xA005; + static { initialize(); } - - /** Creates a new instance of ALC */ - public ALC() { - } - - /** - * Override to provide any initialization code after creation. - */ + + /** Creates a new instance of ALC */ + protected ALC(AL al) { + this.al = al; + } + + /** + * Override to provide any initialization code after creation. + */ protected void init() { } - + /** * Static initialization */ private static void initialize() { System.loadLibrary(org.lwjgl.Sys.getLibraryName()); } - - /** - * Creates the ALC instance - * - * @throws Exception if a failiure occured in the ALC creation process - */ - public void create() throws Exception { + + /** + * Creates the ALC instance + * + * @throws Exception if a failiure occured in the ALC creation process + */ + protected void create() throws OpenALException { if (created) { return; - } - + } + if (!nCreate()) { - throw new Exception("ALC instance could not be created."); - } - created = true; - init(); + throw new OpenALException("ALC instance could not be created."); + } + init(); + created = true; } - + /** * Native method to create ALC instance * * @return true if the ALC creation process succeeded */ protected native boolean nCreate(); - + /** * Calls whatever destruction rutines that are needed */ - public void destroy() { + protected void destroy() { if (!created) { return; - } - created = false; - nDestroy(); + } + created = false; + nDestroy(); } - + /** * Native method the destroy the ALC */ - protected native void nDestroy(); + protected native void nDestroy(); + + /** + * Returns strings related to the context. + * + * @param pname Property to get + * @return String property from device + */ + public String getString(int pname) { + return nGetString(al.device.device, pname); + } + + native String nGetString(int device, int pname); + + /** + * Returns integers related to the context. + * + * @param pname Property to get + * @param size Size of destination buffer provided + * @param integerdata address of ByteBuffer to write integers to + */ + public void getIntegerv(int pname, int size, int integerdata) { + nGetIntegerv(al.device.device, pname, size, integerdata); + } - /** - * Returns strings related to the context. - * - * @param device ALCdevice to query - * @param pname Property to get - * @return String property from device - */ - public native String getString(ALCdevice device, int pname); - - /** - * Returns integers related to the context. - * - * @param device ALCdevice to query - * @param pname Property to get - * @param size Size of destination buffer provided - * @param integerdata address of ByteBuffer to write integers to - */ - public native void getIntegerv(ALCdevice device, int pname, int size, int integerdata); - - /** - * Opens the named device. If null is specied, the implementation will - * provide an implementation specic default. - * - * @param devicename name of device to open - * @return opened device, or null - */ - public native ALCdevice openDevice(String devicename); - - /** - * Closes the supplied device. - * - * @param device ALCdevice to close - */ - public native void closeDevice(ALCdevice device); - - /** - * Creates a context using a specified device. - * - * @param device ALCdevice to associate context to - * @param attrList address of ByteBuffer to read attributes from - * @return New context, or null if creation failed - */ - public native ALCcontext createContext(ALCdevice device, int attrList); - - /** - * Makes the supplied context the current one - * - * @param context ALCcontext to make current - * @return true if successfull, false if not - */ - public native boolean makeContextCurrent(ALCcontext context); - - /** - * Tells a context to begin processing. - * - * @param context context that should begin processing - */ - public native void processContext(ALCcontext context); - - /** - * Gets the current context - * - * @return Current ALCcontext - */ - public native ALCcontext getCurrentContext(); - - /** - * Retrives the device associated with the supplied context - * - * @param context ALCcontext to get device for - * @param ALCdevice associated with context - */ - public native ALCdevice getContextsDevice(ALCcontext context); - - /** - * Suspends processing on supplied context - * - * @param context ALCcontext to suspend - */ - public native void suspendContext(ALCcontext context); - - /** - * Destroys supplied context - * - * @param context ALCcontext to Destroy - */ - public native void destroyContext(ALCcontext context); - - /** - * Retrieves the current context error state. - * - * @param device ALDdevice associated with context - * @return Errorcode from ALC statemachine - */ - public native int getError(ALCdevice device); - - /** - * Query if a specified context extension is available. - * - * @param device device to query for extension - * @param extName name of extension to find - * @return true if extension is available, false if not - */ - public native boolean isExtensionPresent(ALCdevice device, String extName); - - /** - * retrieves the enum value for a specified enumeration name. - * - * @param device Device to query - * @param enumName name of enum to find - * @return value of enumeration - */ - public native int getEnumValue(ALCdevice device, String enumName); + native void nGetIntegerv(int device, int pname, int size, int integerdata); + + /** + * Opens the named device. If null is specied, the implementation will + * provide an implementation specic default. + * + * @param devicename name of device to open + * @return opened device, or null + */ + native ALCdevice openDevice(String devicename); + + /** + * Closes the supplied device. + * + * @param device address of native device to close + */ + native void closeDevice(int device); + + /** + * Creates a context using a specified device. + * + * @param device address of device to associate context to + * @param attrList address of ByteBuffer to read attributes from + * @return New context, or null if creation failed + */ + native ALCcontext createContext(int device, int attrList); + + /** + * Makes the supplied context the current one + * + * @param context address of context to make current + * @return true if successfull, false if not + */ + native boolean makeContextCurrent(int context); + + /** + * Tells a context to begin processing. + */ + public void processContext() { + nProcessContext(al.context.context); + } + + native void nProcessContext(int context); + + /** + * Gets the current context + * + * @return Current ALCcontext + */ + native ALCcontext getCurrentContext(); + + /** + * Retrives the device associated with the supplied context + * + * @param context address of context to get device for + * @param ALCdevice associated with context + */ + native ALCdevice getContextsDevice(int context); + + /** + * Suspends processing on supplied context + * + * @param context address of context to suspend + */ + native void suspendContext(int context); + + /** + * Destroys supplied context + * + * @param context address of context to Destroy + */ + native void destroyContext(int context); + + /** + * Retrieves the current context error state. + * + * @return Errorcode from ALC statemachine + */ + public int getError() { + return nGetError(al.device.device); + } + + native int nGetError(int device); + + /** + * Query if a specified context extension is available. + * + * @param extName name of extension to find + * @return true if extension is available, false if not + */ + public boolean isExtensionPresent(String extName) { + return nIsExtensionPresent(al.device.device, extName); + } + + native boolean nIsExtensionPresent(int device, String extName); + + /** + * retrieves the enum value for a specified enumeration name. + * + * @param enumName name of enum to find + * @return value of enumeration + */ + public int getEnumValue(String enumName) { + return nGetEnumValue(al.device.device, enumName); + } + + native int nGetEnumValue(int device, String enumName); } \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/ALCcontext.java b/src/java/org/lwjgl/openal/ALCcontext.java index 785617d6..56f5212d 100644 --- a/src/java/org/lwjgl/openal/ALCcontext.java +++ b/src/java/org/lwjgl/openal/ALCcontext.java @@ -13,7 +13,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'Light Weight Java Game Library' nor the names of + * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -29,7 +29,10 @@ * 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; +package org.lwjgl.openal; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; /** * $Id$ @@ -39,7 +42,7 @@ * @author Brian Matzon * @version $Revision$ */ -public class ALCcontext { +class ALCcontext { /** address of actual context */ public final int context; @@ -51,5 +54,19 @@ public class ALCcontext { */ public ALCcontext(int context) { this.context = context; - } -} + } + + public static ByteBuffer createAttributeList(int contextFrequency, int contextRefresh, int contextSynchronized) { + ByteBuffer attribList = ByteBuffer.allocateDirect(7*4).order(ByteOrder.nativeOrder()); + + attribList.putInt(ALC.FREQUENCY); + attribList.putInt(contextFrequency); + attribList.putInt(ALC.REFRESH); + attribList.putInt(contextRefresh); + attribList.putInt(ALC.SYNC); + attribList.putInt(contextSynchronized); + attribList.putInt(0); //terminating int + + return attribList; + } +} \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/ALCdevice.java b/src/java/org/lwjgl/openal/ALCdevice.java index c20fba3e..fbcbdd16 100644 --- a/src/java/org/lwjgl/openal/ALCdevice.java +++ b/src/java/org/lwjgl/openal/ALCdevice.java @@ -13,7 +13,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * * Neither the name of 'Light Weight Java Game Library' nor the names of + * * Neither the name of 'Lightweight Java Game Library' nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * @@ -29,7 +29,7 @@ * 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; +package org.lwjgl.openal; /** * $Id$ @@ -39,7 +39,7 @@ * @author Brian Matzon * @version $Revision$ */ -public class ALCdevice { +class ALCdevice { /** address of actual device */ public final int device; @@ -52,4 +52,4 @@ public class ALCdevice { public ALCdevice(int device) { this.device = device; } -} +} \ No newline at end of file diff --git a/src/java/org/lwjgl/openal/BaseAL.java b/src/java/org/lwjgl/openal/BaseAL.java index 4f835124..50de4623 100644 --- a/src/java/org/lwjgl/openal/BaseAL.java +++ b/src/java/org/lwjgl/openal/BaseAL.java @@ -47,83 +47,87 @@ import java.util.StringTokenizer; * @version $Revision$ */ public abstract class BaseAL { - /** Has the ALC object been created? */ - protected static boolean created; + /** Have we been created? */ + protected static boolean created; + + static { + initialize(); + } + + /** + * Override to provide any initialization code after creation. + */ + protected void init() throws OpenALException { + } + + /** + * Static initialization + */ + private static void initialize() { + System.loadLibrary(org.lwjgl.Sys.getLibraryName()); + } + + /** + * Creates the AL instance + * + * @throws Exception if a failiure occured in the AL creation process + */ + public void create() throws OpenALException { + if (created) { + return; + } - static { - initialize(); - } + // need to pass path of possible locations of OAL to native side + String libpath = System.getProperty("java.library.path"); + String seperator = System.getProperty("path.separator"); + String libname; - /** - * Override to provide any initialization code after creation. - */ - protected void init() throws Exception { - } + // libname is hardcoded atm - this will change in a near future... + libname = (System.getProperty("os.name").toLowerCase().indexOf("windows") == -1) + ? "libopenal.so" + : "OpenAL32.dll"; - /** - * Static initialization - */ - private static void initialize() { - System.loadLibrary(org.lwjgl.Sys.getLibraryName()); - } + StringTokenizer st = new StringTokenizer(libpath, seperator); + + //create needed string array + String[] oalPaths = new String[st.countTokens()+1]; - /** - * Creates the AL instance - * - * @throws Exception if a failiure occured in the AL creation process - */ - public void create() throws Exception { - if (created) { - return; - } + //build paths + for(int i=0;iGetObjectClass(device); - jfieldID field_device = env->GetFieldID(class_device, "device", "I"); - jint deviceaddress = env->GetIntField(device, field_device); - +JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_nGetString (JNIEnv *env, jobject obj, jint deviceaddress, jint token) { const char* alcString = (const char*) alcGetString((ALCdevice*) deviceaddress, (ALenum) token); if(alcString == NULL) { return NULL; @@ -96,11 +92,7 @@ JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_getString (JNIEnv *env, jobj * C Specification: * ALvoid alcGetIntegerv(ALCdevice *device, ALenum token, ALsizei size, ALint *dest); */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_getIntegerv (JNIEnv *env, jobject obj, jobject device, jint token, jint size, jint dest) { - jclass device_class = env->GetObjectClass(device); - jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(device, device_field); - +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nGetIntegerv (JNIEnv *env, jobject obj, jint deviceaddress, jint token, jint size, jint dest) { alcGetIntegerv((ALCdevice*) deviceaddress, (ALenum) token, (ALsizei) size, (ALint*) dest); CHECK_ALC_ERROR } @@ -157,11 +149,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_openDevice (JNIEnv *env, job * C Specification: * void alcCloseDevice( ALCdevice *dev ); */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice (JNIEnv *env, jobject obj, jobject device) { - jclass device_class = env->GetObjectClass(device); - jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(device, device_field); - +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice (JNIEnv *env, jobject obj, jint deviceaddress) { alcCloseDevice((ALCdevice*) deviceaddress); CHECK_ALC_ERROR } @@ -172,12 +160,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice (JNIEnv *env, jobje * C Specification: * ALCcontext* alcCreateContext( ALCdevice *dev, ALint* attrlist ); */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext (JNIEnv *env, jobject obj, jobject device, jint attrlist) { - /* get device address */ - jclass device_class = env->GetObjectClass(device); - jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(device, device_field); - +JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext (JNIEnv *env, jobject obj, jint deviceaddress, jint attrlist) { ALCcontext* context = alcCreateContext((ALCdevice*) deviceaddress, (ALint*) attrlist); /* if error - get out */ @@ -207,16 +190,10 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext (JNIEnv *env, * C Specification: * ALCboolean alcMakeContextCurrent(ALCcontext *context); */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent (JNIEnv *env, jobject obj, jobject context) { - if(context == NULL) { +JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent (JNIEnv *env, jobject obj, jint contextaddress) { + if(contextaddress == NULL) { return alcMakeContextCurrent(NULL); } - - /* get context address */ - jclass context_class = env->GetObjectClass(context); - jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(context, context_field); - return alcMakeContextCurrent((ALCcontext*) contextaddress); } @@ -226,12 +203,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent (JNIEnv * C Specification: * void alcProcessContext(ALCcontext *context); */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_processContext (JNIEnv *env, jobject obj, jobject context) { - /* get context address */ - jclass context_class = env->GetObjectClass(context); - jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(context, context_field); - +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nProcessContext (JNIEnv *env, jobject obj, jint contextaddress) { alcProcessContext((ALCcontext*) contextaddress); } @@ -269,12 +241,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getCurrentContext (JNIEnv *e * C Specification: * ALCdevice* alcGetContextsDevice(ALCcontext *context); */ -JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice (JNIEnv *env, jobject obj, jobject context) { - - /* get context address */ - jclass context_class = env->GetObjectClass(context); - jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(context, context_field); +JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice (JNIEnv *env, jobject obj, jint contextaddress) { ALCdevice* device = alcGetContextsDevice((ALCcontext*) contextaddress); if(device == NULL) { @@ -302,12 +269,7 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice (JNIEnv *e * C Specification: * void alcSuspendContext(ALCcontext *context); */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext (JNIEnv *env, jobject obj, jobject context) { - /* get context address */ - jclass context_class = env->GetObjectClass(context); - jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(context, context_field); - +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext (JNIEnv *env, jobject obj, jint contextaddress) { alcSuspendContext((ALCcontext*) contextaddress); } @@ -317,12 +279,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext (JNIEnv *env, jo * C Specification: * void alcDestroyContext(ALCcontext *context); */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext (JNIEnv *env, jobject obj, jobject context) { - /* get context address */ - jclass context_class = env->GetObjectClass(context); - jfieldID context_field = env->GetFieldID(context_class, "context", "I"); - jint contextaddress = env->GetIntField(context, context_field); - +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext (JNIEnv *env, jobject obj, jint contextaddress) { alcDestroyContext((ALCcontext*) contextaddress); } @@ -332,12 +289,7 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext (JNIEnv *env, jo * C Specification: * ALCenum alcGetError(ALCdevice *device); */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getError (JNIEnv *env, jobject obj, jobject device) { - /* get device address */ - jclass device_class = env->GetObjectClass(device); - jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(device, device_field); - +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetError (JNIEnv *env, jobject obj, jint deviceaddress) { jint result = alcGetError((ALCdevice*) deviceaddress); CHECK_ALC_ERROR return result; @@ -349,12 +301,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getError (JNIEnv *env, jobject * C Specification: * ALboolean alcIsExtensionPresent(ALCdevice *device, ALubyte *extName); */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_isExtensionPresent (JNIEnv *env, jobject obj, jobject device, jstring extName) { - /* get device address */ - jclass device_class = env->GetObjectClass(device); - jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(device, device_field); - +JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_nIsExtensionPresent (JNIEnv *env, jobject obj, jint deviceaddress, jstring extName) { /* get extension */ ALubyte* functionname = (ALubyte*) (env->GetStringUTFChars(extName, 0)); @@ -372,12 +319,7 @@ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_isExtensionPresent (JNIEnv * C Specification: * ALenum alcGetEnumValue(ALCdevice *device, ALubyte *enumName); */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getEnumValue (JNIEnv *env, jobject obj, jobject device, jstring enumName) { - /* get device address */ - jclass device_class = env->GetObjectClass(device); - jfieldID device_field = env->GetFieldID(device_class, "device", "I"); - jint deviceaddress = env->GetIntField(device, device_field); - +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetEnumValue (JNIEnv *env, jobject obj, jint deviceaddress, jstring enumName) { /* get extension */ ALubyte* enumerationname = (ALubyte*) (env->GetStringUTFChars(enumName, 0)); diff --git a/src/native/common/org_lwjgl_openal_ALC.h b/src/native/common/org_lwjgl_openal_ALC.h index 07caa40d..b3e1475b 100644 --- a/src/native/common/org_lwjgl_openal_ALC.h +++ b/src/native/common/org_lwjgl_openal_ALC.h @@ -1,3 +1,35 @@ +/* + * Copyright (c) 2002 Lightweight Java Game Library 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 'Lightweight Java Game Library' 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. + */ + /* DO NOT EDIT THIS FILE - it is machine generated */ #include /* Header for class org_lwjgl_openal_ALC */ @@ -7,6 +39,45 @@ #ifdef __cplusplus extern "C" { #endif +/* Inaccessible static: created */ +#undef org_lwjgl_openal_ALC_INVALID +#define org_lwjgl_openal_ALC_INVALID -1L +#undef org_lwjgl_openal_ALC_FALSE +#define org_lwjgl_openal_ALC_FALSE 0L +#undef org_lwjgl_openal_ALC_TRUE +#define org_lwjgl_openal_ALC_TRUE 1L +#undef org_lwjgl_openal_ALC_NO_ERROR +#define org_lwjgl_openal_ALC_NO_ERROR 0L +#undef org_lwjgl_openal_ALC_MAJOR_VERSION +#define org_lwjgl_openal_ALC_MAJOR_VERSION 4096L +#undef org_lwjgl_openal_ALC_MINOR_VERSION +#define org_lwjgl_openal_ALC_MINOR_VERSION 4097L +#undef org_lwjgl_openal_ALC_ATTRIBUTES_SIZE +#define org_lwjgl_openal_ALC_ATTRIBUTES_SIZE 4098L +#undef org_lwjgl_openal_ALC_ALL_ATTRIBUTES +#define org_lwjgl_openal_ALC_ALL_ATTRIBUTES 4099L +#undef org_lwjgl_openal_ALC_DEFAULT_DEVICE_SPECIFIER +#define org_lwjgl_openal_ALC_DEFAULT_DEVICE_SPECIFIER 4100L +#undef org_lwjgl_openal_ALC_DEVICE_SPECIFIER +#define org_lwjgl_openal_ALC_DEVICE_SPECIFIER 4101L +#undef org_lwjgl_openal_ALC_EXTENSIONS +#define org_lwjgl_openal_ALC_EXTENSIONS 4102L +#undef org_lwjgl_openal_ALC_FREQUENCY +#define org_lwjgl_openal_ALC_FREQUENCY 4103L +#undef org_lwjgl_openal_ALC_REFRESH +#define org_lwjgl_openal_ALC_REFRESH 4104L +#undef org_lwjgl_openal_ALC_SYNC +#define org_lwjgl_openal_ALC_SYNC 4105L +#undef org_lwjgl_openal_ALC_INVALID_DEVICE +#define org_lwjgl_openal_ALC_INVALID_DEVICE 40961L +#undef org_lwjgl_openal_ALC_INVALID_CONTEXT +#define org_lwjgl_openal_ALC_INVALID_CONTEXT 40962L +#undef org_lwjgl_openal_ALC_INVALID_ENUM +#define org_lwjgl_openal_ALC_INVALID_ENUM 40963L +#undef org_lwjgl_openal_ALC_INVALID_VALUE +#define org_lwjgl_openal_ALC_INVALID_VALUE 40964L +#undef org_lwjgl_openal_ALC_OUT_OF_MEMORY +#define org_lwjgl_openal_ALC_OUT_OF_MEMORY 40965L /* * Class: org_lwjgl_openal_ALC * Method: nCreate @@ -25,19 +96,19 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nDestroy /* * Class: org_lwjgl_openal_ALC - * Method: getString - * Signature: (Lorg/lwjgl/openal/ALCdevice;I)Ljava/lang/String; + * Method: nGetString + * Signature: (II)Ljava/lang/String; */ -JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_getString - (JNIEnv *, jobject, jobject, jint); +JNIEXPORT jstring JNICALL Java_org_lwjgl_openal_ALC_nGetString + (JNIEnv *, jobject, jint, jint); /* * Class: org_lwjgl_openal_ALC - * Method: getIntegerv - * Signature: (Lorg/lwjgl/openal/ALCdevice;III)V + * Method: nGetIntegerv + * Signature: (IIII)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_getIntegerv - (JNIEnv *, jobject, jobject, jint, jint, jint); +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nGetIntegerv + (JNIEnv *, jobject, jint, jint, jint, jint); /* * Class: org_lwjgl_openal_ALC @@ -50,34 +121,34 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_openDevice /* * Class: org_lwjgl_openal_ALC * Method: closeDevice - * Signature: (Lorg/lwjgl/openal/ALCdevice;)V + * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_closeDevice - (JNIEnv *, jobject, jobject); + (JNIEnv *, jobject, jint); /* * Class: org_lwjgl_openal_ALC * Method: createContext - * Signature: (Lorg/lwjgl/openal/ALCdevice;I)Lorg/lwjgl/openal/ALCcontext; + * Signature: (II)Lorg/lwjgl/openal/ALCcontext; */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_createContext - (JNIEnv *, jobject, jobject, jint); + (JNIEnv *, jobject, jint, jint); /* * Class: org_lwjgl_openal_ALC * Method: makeContextCurrent - * Signature: (Lorg/lwjgl/openal/ALCcontext;)Z + * Signature: (I)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_makeContextCurrent - (JNIEnv *, jobject, jobject); + (JNIEnv *, jobject, jint); /* * Class: org_lwjgl_openal_ALC - * Method: processContext - * Signature: (Lorg/lwjgl/openal/ALCcontext;)V + * Method: nProcessContext + * Signature: (I)V */ -JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_processContext - (JNIEnv *, jobject, jobject); +JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_nProcessContext + (JNIEnv *, jobject, jint); /* * Class: org_lwjgl_openal_ALC @@ -90,50 +161,50 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getCurrentContext /* * Class: org_lwjgl_openal_ALC * Method: getContextsDevice - * Signature: (Lorg/lwjgl/openal/ALCcontext;)Lorg/lwjgl/openal/ALCdevice; + * Signature: (I)Lorg/lwjgl/openal/ALCdevice; */ JNIEXPORT jobject JNICALL Java_org_lwjgl_openal_ALC_getContextsDevice - (JNIEnv *, jobject, jobject); + (JNIEnv *, jobject, jint); /* * Class: org_lwjgl_openal_ALC * Method: suspendContext - * Signature: (Lorg/lwjgl/openal/ALCcontext;)V + * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_suspendContext - (JNIEnv *, jobject, jobject); + (JNIEnv *, jobject, jint); /* * Class: org_lwjgl_openal_ALC * Method: destroyContext - * Signature: (Lorg/lwjgl/openal/ALCcontext;)V + * Signature: (I)V */ JNIEXPORT void JNICALL Java_org_lwjgl_openal_ALC_destroyContext - (JNIEnv *, jobject, jobject); + (JNIEnv *, jobject, jint); /* * Class: org_lwjgl_openal_ALC - * Method: getError - * Signature: (Lorg/lwjgl/openal/ALCdevice;)I + * Method: nGetError + * Signature: (I)I */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getError - (JNIEnv *, jobject, jobject); +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetError + (JNIEnv *, jobject, jint); /* * Class: org_lwjgl_openal_ALC - * Method: isExtensionPresent - * Signature: (Lorg/lwjgl/openal/ALCdevice;Ljava/lang/String;)Z + * Method: nIsExtensionPresent + * Signature: (ILjava/lang/String;)Z */ -JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_isExtensionPresent - (JNIEnv *, jobject, jobject, jstring); +JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_ALC_nIsExtensionPresent + (JNIEnv *, jobject, jint, jstring); /* * Class: org_lwjgl_openal_ALC - * Method: getEnumValue - * Signature: (Lorg/lwjgl/openal/ALCdevice;Ljava/lang/String;)I + * Method: nGetEnumValue + * Signature: (ILjava/lang/String;)I */ -JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_getEnumValue - (JNIEnv *, jobject, jobject, jstring); +JNIEXPORT jint JNICALL Java_org_lwjgl_openal_ALC_nGetEnumValue + (JNIEnv *, jobject, jint, jstring); #ifdef __cplusplus } diff --git a/src/native/common/org_lwjgl_openal_BaseAL.h b/src/native/common/org_lwjgl_openal_BaseAL.h index 3b8cd15d..9fd9c732 100644 --- a/src/native/common/org_lwjgl_openal_BaseAL.h +++ b/src/native/common/org_lwjgl_openal_BaseAL.h @@ -1,31 +1,31 @@ -/* - * Copyright (c) 2002 Light Weight Java Game Library Project +/* + * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * 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 'Light Weight Java Game Library' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'Lightweight Java Game Library' 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 + * 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 + * 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. */ @@ -43,7 +43,7 @@ extern "C" { /* * Class: org_lwjgl_openal_BaseAL * Method: nCreate - * Signature: ()Z + * Signature: ([Ljava/lang/String;)Z */ JNIEXPORT jboolean JNICALL Java_org_lwjgl_openal_BaseAL_nCreate (JNIEnv *, jobject, jobjectArray); diff --git a/src/native/common/org_lwjgl_openal_CoreAL.h b/src/native/common/org_lwjgl_openal_CoreAL.h index fc8d6b11..06f4d946 100644 --- a/src/native/common/org_lwjgl_openal_CoreAL.h +++ b/src/native/common/org_lwjgl_openal_CoreAL.h @@ -1,31 +1,31 @@ -/* - * Copyright (c) 2002 Light Weight Java Game Library Project +/* + * Copyright (c) 2002 Lightweight Java Game Library Project * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are + * modification, are permitted provided that the following conditions are * met: - * - * * Redistributions of source code must retain the above copyright + * + * * 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 'Light Weight Java Game Library' nor the names of - * its contributors may be used to endorse or promote products derived + * * Neither the name of 'Lightweight Java Game Library' 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 + * 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 + * 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. */ @@ -39,6 +39,7 @@ #ifdef __cplusplus extern "C" { #endif +/* Inaccessible static: created */ /* * Class: org_lwjgl_openal_CoreAL * Method: enable