From 9564ff99ebbe4c491fb368beb0d13f166431de2e Mon Sep 17 00:00:00 2001 From: Brian Matzon Date: Thu, 12 Sep 2002 01:42:49 +0000 Subject: [PATCH] fix: don't do the whole initializing thingy - just assume that OpenAL is initialized fix:: wrong comment fix: changed ifndef to ifdef DOH! --- .../win32/org_lwjgl_opengl_eax_CoreEAX.cpp | 37 +++---------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/src/native/win32/org_lwjgl_opengl_eax_CoreEAX.cpp b/src/native/win32/org_lwjgl_opengl_eax_CoreEAX.cpp index 5d65f7dd..af6acbda 100644 --- a/src/native/win32/org_lwjgl_opengl_eax_CoreEAX.cpp +++ b/src/native/win32/org_lwjgl_opengl_eax_CoreEAX.cpp @@ -57,30 +57,10 @@ void ThrowException(JNIEnv *env, const char* message) { JNIEXPORT void JNICALL Java_org_lwjgl_openal_eax_CoreEAX_determineAvailableExtensions (JNIEnv *env, jobject obj) { #ifdef _WIN32 bool EAXSupported = false; - ALCcontext *Context; - ALCdevice *Device; - //open device - Device = alcOpenDevice(NULL); - if(Device == NULL) { - ThrowException(env, "Unable to determine EAX Extensions"); - return; - } - - //create a context - Context = alcCreateContext(Device, NULL); - if(Context == NULL) { - alcCloseDevice(Device); - ThrowException(env, "Unable to determine EAX Extensions"); - return; - } - - //make current - alcMakeContextCurrent(Context); - if(alGetError() != AL_NO_ERROR) { - alcCloseDevice(Device); - ThrowException(env, "Unable to determine EAX Extensions"); - return; + //check that we have a current context + if(alcGetCurrentContext() == NULL) { + ThrowException(env, "Unable to determine EAX Extensions: No current context"); } //check for extension, and assign if available @@ -90,11 +70,6 @@ JNIEXPORT void JNICALL Java_org_lwjgl_openal_eax_CoreEAX_determineAvailableExten EAXSupported = (eaxSet != NULL && eaxGet != NULL); } - //clean up - alcMakeContextCurrent(NULL); - alcDestroyContext(Context); - alcCloseDevice(Device); - //throw exception if no EAX support if(EAXSupported != true) { ThrowException(env, "Unable to determine EAX Extensions"); @@ -130,7 +105,7 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxGet (JNIEnv *env, jo #ifdef _WIN32 jint result = (jint) eaxGet((const struct _GUID*)propertySetID, (ALuint) property, (ALuint) source, (ALvoid*) value, (ALuint) size); CHECK_AL_ERROR - + return result; #else return AL_INVALID_OPERATION; @@ -141,11 +116,11 @@ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxGet (JNIEnv *env, jo * This function sets an EAX value. * * C Specification: - * ALenum EAXGet(const struct _GUID *propertySetID,ALuint property,ALuint source,ALvoid + * ALenum EAXSet(const struct _GUID *propertySetID,ALuint property,ALuint source,ALvoid * *value,ALuint size); */ JNIEXPORT jint JNICALL Java_org_lwjgl_openal_eax_CoreEAX_eaxSet (JNIEnv *env, jobject obj, jint propertySetID, jint property, jint source, jint value, jint size) { -#ifndef _WIN32 +#ifdef _WIN32 jint result = (jint) eaxSet((const struct _GUID*)propertySetID, (ALuint) property, (ALuint) source, (ALvoid*) value, (ALuint) size); CHECK_AL_ERROR