From 92e931caf64cf24e2b885d2552e64aebcf70a45a Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 1 Feb 2013 11:55:07 +0100
Subject: OpenAL Library Selection (Bug 662): Use String value of new property
 'joal.openal.lib'. OSX: Prefer system OpenAL (nou OpenAL-Soft output device
 support)

+ * Select preferred OpenAL native library type via system properties,
+ * i.e. System-OpenAL or bundled Soft-OpenAL.<br/>
+ * If the preferred choice fails, implementation falls back to the other.
+ * <PRE>
+    -Djoal.openal.lib=auto     Prefer System-OpenAL over bundled Soft-OpenAL for OSX. Prefer bundled Soft-OpenAL over System-OpenAL for all others. This is the default.
+    -Djoal.openal.lib=system   Prefer System-OpenAL over bundled Soft-OpenAL for all.
+    -Djoal.openal.lib=soft     Prefer bundled Soft-OpenAL over System-OpenAL for all.
+   </PRE>
+ * Note: You may use the 'jnlp.' prefix, allowing using above property names w/ Applets and WebStart,
+ * e.g. 'jnlp.joal.openal.lib=system'.
+ * </p>
---
 .../jogamp/openal/ALDynamicLibraryBundleInfo.java  | 56 +++++++++++-----------
 1 file changed, 28 insertions(+), 28 deletions(-)

(limited to 'src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java')

diff --git a/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java b/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java
index 55f6ed7..6ba81f0 100644
--- a/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java
+++ b/src/java/jogamp/openal/ALDynamicLibraryBundleInfo.java
@@ -34,6 +34,7 @@ import com.jogamp.common.os.DynamicLibraryBundleInfo;
 import com.jogamp.common.os.Platform;
 import com.jogamp.common.util.RunnableExecutor;
 import com.jogamp.common.util.cache.TempJarCache;
+import com.jogamp.openal.ALFactory;
 
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -78,40 +79,39 @@ public class ALDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo  {
     public List<List<String>> getToolLibNames() {
         List<List<String>> libNamesList = new ArrayList<List<String>>();
 
-        List<String> alLibNames = new ArrayList<String>();
-
-        if(Debug.isPropertyDefined("joal.SystemOpenAL", true)) {
-            // First test the System OpenAL 
+        final List<String> alSystemLibNames = new ArrayList<String>();
+        {
             // this is the default AL lib name, according to the spec
-            alLibNames.add("libopenal.so.1"); // unix
-            alLibNames.add("OpenAL32"); // windows
-            alLibNames.add("OpenAL"); // OSX
-
+            alSystemLibNames.add("libopenal.so.1"); // unix
+            alSystemLibNames.add("OpenAL32"); // windows
+            alSystemLibNames.add("OpenAL"); // OSX
+    
             // try this one as well, if spec fails
-            alLibNames.add("libOpenAL.so.1");
-            alLibNames.add("libopenal.so");
-            alLibNames.add("libOpenAL.so");
-
-            // last but not least .. the generic one
+            alSystemLibNames.add("libOpenAL.so.1");
+            alSystemLibNames.add("libopenal.so");
+            alSystemLibNames.add("libOpenAL.so");
+        }
+        final List<String> alSoftLibNames = new ArrayList<String>();
+        {
             // These names are in use by the bundled OpenAL-soft
-            alLibNames.add("openal");
-            alLibNames.add("OpenAL");
+            alSoftLibNames.add("openal");
+            alSoftLibNames.add("OpenAL");            
+        }
+
+        final List<String> alLibNames = new ArrayList<String>();
+        
+        if( ALFactory.PREFER_SYSTEM_OPENAL ) {
+            // First test the System OpenAL
+            alLibNames.addAll(alSystemLibNames);
+
+            // last but not least .. bundled OpenAL-soft
+            alLibNames.addAll(alSoftLibNames);
         } else {
             // First test use of the bundled OpenAL-soft
-            // the generic one
-            alLibNames.add("openal");
-            alLibNames.add("OpenAL");
-
+            alLibNames.addAll(alSoftLibNames);
+            
             // Then try the System OpenAL
-            // this is the default AL lib name, according to the spec
-            alLibNames.add("libopenal.so.1"); // unix
-            alLibNames.add("OpenAL32"); // windows
-            alLibNames.add("OpenAL"); // OSX
-
-            // try this one as well, if spec fails
-            alLibNames.add("libOpenAL.so.1");
-            alLibNames.add("libopenal.so");
-            alLibNames.add("libOpenAL.so");
+            alLibNames.addAll(alSystemLibNames);
         }
 
         // last but not least .. the generic one
-- 
cgit v1.2.3