diff options
Diffstat (limited to 'src/main/java/com/jsyn/devices/AudioDeviceFactory.java')
-rw-r--r-- | src/main/java/com/jsyn/devices/AudioDeviceFactory.java | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/jsyn/devices/AudioDeviceFactory.java b/src/main/java/com/jsyn/devices/AudioDeviceFactory.java index 612c81d..f4e03d4 100644 --- a/src/main/java/com/jsyn/devices/AudioDeviceFactory.java +++ b/src/main/java/com/jsyn/devices/AudioDeviceFactory.java @@ -53,14 +53,32 @@ public class AudioDeviceFactory { public static AudioDeviceManager createAudioDeviceManager(boolean preferJavaSound) { if (preferJavaSound) { tryJavaSound(); + tryOpenAL(); tryJPortAudio(); } else { + tryOpenAL(); tryJPortAudio(); tryJavaSound(); } return instance; } + private static void tryOpenAL() { + if (instance == null) { + try { + @SuppressWarnings("unchecked") + final + Class<AudioDeviceManager> clazz = JavaTools.loadClass( + "com.jsyn.devices.openal.ALDevice", true); + if (clazz != null) { + instance = clazz.newInstance(); + } + } catch (final Throwable e) { + System.err.println("Could not load JOAL/OpenAL device. " + e); + } + } + } + private static void tryJavaSound() { if (instance == null) { try { |