diff --git a/src/java/org/lwjgl/openal/AL.java b/src/java/org/lwjgl/openal/AL.java index 350e490b..1dfdd7e4 100644 --- a/src/java/org/lwjgl/openal/AL.java +++ b/src/java/org/lwjgl/openal/AL.java @@ -66,6 +66,14 @@ public final class AL { * @param oalPaths Array of strings containing paths to search for OpenAL library */ private static native void nCreate(String oalPath) throws LWJGLException; + + /** + * Native method to create AL instance from the Mac OS X 10.4 OpenAL framework. + * It is only defined in the Mac OS X native library. + * + * @param oalPaths Array of strings containing paths to search for OpenAL library + */ + private static native void nCreateDefault() throws LWJGLException; /** * Native method the destroy the AL @@ -108,6 +116,11 @@ public final class AL { LWJGLUtil.log("Failed to load " + oalPaths[i] + ": " + e.getMessage()); } } + if (!created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX) { + // Try to load OpenAL from the framework instead + nCreateDefault(); + created = true; + } if (!created) throw new LWJGLException("Could not locate OpenAL library."); diff --git a/src/native/macosx/Makefile.legacy b/src/native/macosx/Makefile.legacy index 617b1294..725111c7 100644 --- a/src/native/macosx/Makefile.legacy +++ b/src/native/macosx/Makefile.legacy @@ -1,7 +1,7 @@ # Use this makefile to build for Mac OS X 10.3 and earlier -CC=gcc-3.0 -LINKER=gcc-3.0 +CC=gcc-3.3 +LINKER=gcc-3.3 STRIP=strip ARCHS= SYMBOL_FILE=lwjgl.symbols diff --git a/src/native/macosx/macosx_al.c b/src/native/macosx/macosx_al.c index 630f5f14..7cf37c58 100644 --- a/src/native/macosx/macosx_al.c +++ b/src/native/macosx/macosx_al.c @@ -97,10 +97,7 @@ bool tryLoadLibrary(JNIEnv *env, jstring path) { printfDebugJava(env, "Found OpenAL at '%s'", path_str); } (*env)->ReleaseStringUTFChars(env, path, path_str); - openal_bundle = tryLoadFramework(env); - if (openal_bundle != NULL) - printfDebugJava(env, "Found OpenAL Bundle"); - return handleOAL != NULL || openal_bundle != NULL; + return handleOAL != NULL; } /** @@ -113,3 +110,10 @@ void UnLoadOpenAL() { } } +JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreateDefault(JNIEnv *env, jclass clazz) { + openal_bundle = tryLoadFramework(env); + if (openal_bundle != NULL) + printfDebugJava(env, "Found OpenAL Bundle"); + else + throwException(env, "Could not load OpenAL framework"); +}