aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.classpath5
-rw-r--r--lib/joal/gluegen-rt.jarbin0 -> 16802 bytes
-rw-r--r--lib/joal/joal.jarbin0 -> 67324 bytes
-rw-r--r--lib/joal/linux/joal.jarbin32857 -> 0 bytes
-rw-r--r--lib/joal/linux/libgluegen-rt.sobin0 -> 7782 bytes
-rw-r--r--lib/joal/linux/libjoal.sobin27912 -> 0 bytes
-rw-r--r--lib/joal/linux/libjoal_native.sobin0 -> 101064 bytes
-rw-r--r--lib/joal/linux/libopenal.sobin215492 -> 758109 bytes
-rw-r--r--lib/joal/osx/joal.jarbin32857 -> 0 bytes
-rw-r--r--lib/joal/osx/libgluegen-rt.jnilibbin0 -> 29812 bytes
-rw-r--r--lib/joal/osx/libjoal.jnilibbin38780 -> 0 bytes
-rw-r--r--lib/joal/osx/libjoal_native.jnilibbin0 -> 170276 bytes
-rw-r--r--lib/joal/windows/OpenAL32.dllbin159744 -> 73728 bytes
-rw-r--r--lib/joal/windows/gluegen-rt.dllbin0 -> 20480 bytes
-rw-r--r--lib/joal/windows/joal.dllbin57989 -> 0 bytes
-rw-r--r--lib/joal/windows/joal.jarbin32866 -> 0 bytes
-rw-r--r--lib/joal/windows/joal_native.dllbin0 -> 45056 bytes
-rw-r--r--lib/joal/windows/wrap_oal.dllbin0 -> 409600 bytes
-rw-r--r--patch/net/java/games/joal/ALFactory.java123
-rw-r--r--scripts/Jake2_mac.sh1
-rw-r--r--src/jake2/sound/joal/Channel.java40
-rw-r--r--src/jake2/sound/joal/JOALSoundImpl.java60
22 files changed, 41 insertions, 188 deletions
diff --git a/.classpath b/.classpath
index ca67bd1..5d222e0 100644
--- a/.classpath
+++ b/.classpath
@@ -2,10 +2,9 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
- <classpathentry kind="src" path="patch"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="lib" path="lib/joal/linux/joal.jar"/>
- <classpathentry kind="lib" path="lib/joal/windows/joal.jar"/>
+ <classpathentry kind="lib" path="lib/joal/joal.jar"/>
+ <classpathentry kind="lib" path="lib/joal/gluegen-rt.jar"/>
<classpathentry kind="lib" path="lib/jogl/jogl.jar"/>
<classpathentry kind="lib" path="resources"/>
<classpathentry kind="lib" path="lib/lwjgl/lwjgl_util.jar"/>
diff --git a/lib/joal/gluegen-rt.jar b/lib/joal/gluegen-rt.jar
new file mode 100644
index 0000000..e912c03
--- /dev/null
+++ b/lib/joal/gluegen-rt.jar
Binary files differ
diff --git a/lib/joal/joal.jar b/lib/joal/joal.jar
new file mode 100644
index 0000000..7f062b4
--- /dev/null
+++ b/lib/joal/joal.jar
Binary files differ
diff --git a/lib/joal/linux/joal.jar b/lib/joal/linux/joal.jar
deleted file mode 100644
index 4078231..0000000
--- a/lib/joal/linux/joal.jar
+++ /dev/null
Binary files differ
diff --git a/lib/joal/linux/libgluegen-rt.so b/lib/joal/linux/libgluegen-rt.so
new file mode 100644
index 0000000..6acb6d4
--- /dev/null
+++ b/lib/joal/linux/libgluegen-rt.so
Binary files differ
diff --git a/lib/joal/linux/libjoal.so b/lib/joal/linux/libjoal.so
deleted file mode 100644
index 0572dc9..0000000
--- a/lib/joal/linux/libjoal.so
+++ /dev/null
Binary files differ
diff --git a/lib/joal/linux/libjoal_native.so b/lib/joal/linux/libjoal_native.so
new file mode 100644
index 0000000..79f9780
--- /dev/null
+++ b/lib/joal/linux/libjoal_native.so
Binary files differ
diff --git a/lib/joal/linux/libopenal.so b/lib/joal/linux/libopenal.so
index 84023e4..ebcaee5 100644
--- a/lib/joal/linux/libopenal.so
+++ b/lib/joal/linux/libopenal.so
Binary files differ
diff --git a/lib/joal/osx/joal.jar b/lib/joal/osx/joal.jar
deleted file mode 100644
index 5cf67a5..0000000
--- a/lib/joal/osx/joal.jar
+++ /dev/null
Binary files differ
diff --git a/lib/joal/osx/libgluegen-rt.jnilib b/lib/joal/osx/libgluegen-rt.jnilib
new file mode 100644
index 0000000..c61c79f
--- /dev/null
+++ b/lib/joal/osx/libgluegen-rt.jnilib
Binary files differ
diff --git a/lib/joal/osx/libjoal.jnilib b/lib/joal/osx/libjoal.jnilib
deleted file mode 100644
index 2c193cb..0000000
--- a/lib/joal/osx/libjoal.jnilib
+++ /dev/null
Binary files differ
diff --git a/lib/joal/osx/libjoal_native.jnilib b/lib/joal/osx/libjoal_native.jnilib
new file mode 100644
index 0000000..bbd0ea5
--- /dev/null
+++ b/lib/joal/osx/libjoal_native.jnilib
Binary files differ
diff --git a/lib/joal/windows/OpenAL32.dll b/lib/joal/windows/OpenAL32.dll
index 5ce6258..a2e77f2 100644
--- a/lib/joal/windows/OpenAL32.dll
+++ b/lib/joal/windows/OpenAL32.dll
Binary files differ
diff --git a/lib/joal/windows/gluegen-rt.dll b/lib/joal/windows/gluegen-rt.dll
new file mode 100644
index 0000000..f22efb3
--- /dev/null
+++ b/lib/joal/windows/gluegen-rt.dll
Binary files differ
diff --git a/lib/joal/windows/joal.dll b/lib/joal/windows/joal.dll
deleted file mode 100644
index 6fc1f93..0000000
--- a/lib/joal/windows/joal.dll
+++ /dev/null
Binary files differ
diff --git a/lib/joal/windows/joal.jar b/lib/joal/windows/joal.jar
deleted file mode 100644
index 111d7d8..0000000
--- a/lib/joal/windows/joal.jar
+++ /dev/null
Binary files differ
diff --git a/lib/joal/windows/joal_native.dll b/lib/joal/windows/joal_native.dll
new file mode 100644
index 0000000..59ca3f9
--- /dev/null
+++ b/lib/joal/windows/joal_native.dll
Binary files differ
diff --git a/lib/joal/windows/wrap_oal.dll b/lib/joal/windows/wrap_oal.dll
new file mode 100644
index 0000000..22697eb
--- /dev/null
+++ b/lib/joal/windows/wrap_oal.dll
Binary files differ
diff --git a/patch/net/java/games/joal/ALFactory.java b/patch/net/java/games/joal/ALFactory.java
deleted file mode 100644
index ee4bc38..0000000
--- a/patch/net/java/games/joal/ALFactory.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * -Redistribution of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * -Redistribution 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 Sun Microsystems, Inc. or the names of contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind.
- * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
- * ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
- * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
- * LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
- * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
- * IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
- * OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
- * PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
- * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
- *
- * You acknowledge that this software is not designed or intended for use in the
- * design, construction, operation or maintenance of any nuclear facility.
- */
-
-package net.java.games.joal;
-
-/**
- * This class provides factory methods for generating AL and ALC objects. The
- * class must be initialized before use, and should be deinitialized when OpenAL
- * functionality is no longer needed to free up native resources.
- *
- * @author Athomas Goldberg
- */
-public class ALFactory {
- static {
- System.loadLibrary("joal");
- }
-
- private static boolean isInitialized = false;
-
- private static ALImpl al;
-
- private static ALC alc;
-
- /**
- * Initialize the OpenAL environment
- *
- * @return true is OpenAL was able to initialize, false if OpenAL was not
- * able to intialize
- */
- public static boolean initialize() throws OpenALException {
- String osProperty = System.getProperty("os.name");
- if (osProperty.startsWith("Win")) {
- isInitialized = init(new String[] { "OpenAL32.dll" });
- } else if (osProperty.startsWith("Linux")) {
- try {
- // use the system wide lib
- isInitialized = init(new String[] { "libopenal.so" });
- } catch (OpenALException e) {
- // fallback to bytonic's libopenal.so
- String sep = System.getProperty("file.separator");
- String openalPath = System.getProperty("user.home") + sep + ".jake2";
- isInitialized = init(new String[] { openalPath + sep
- + "libopenal.so" });
- }
- } else {
- isInitialized = init(new String[] { "/Library/Frameworks/OpenAL.framework/Versions/Current/OpenAL" });
- }
- return isInitialized;
- }
-
- private static native boolean init(String[] oalPaths)
- throws OpenALException;
-
- /**
- * Deinitialize the OpenAL environment
- *
- * @return true if OpenAL was able to be deinitialized, false if OpenAL uas
- * unable to be deinitialized
- */
- public static native boolean deinitialize();
-
- /**
- * Get the default AL object. This object is used to access most of the
- * OpenAL functionality.
- *
- * @return the AL object
- */
- public static AL getAL() throws OpenALException {
- if (!isInitialized) {
- initialize();
- }
- if (isInitialized && al == null) {
- al = new ALImpl();
- }
- return al;
- }
-
- /**
- * Get the default ALC object. This object is used to access most of the
- * OpenAL context functionality.
- *
- * @return the ALC object
- */
- public static ALC getALC() throws OpenALException {
- if (!isInitialized) {
- initialize();
- }
- if (isInitialized && alc == null) {
- alc = new ALCImpl();
- }
- return alc;
- }
-} \ No newline at end of file
diff --git a/scripts/Jake2_mac.sh b/scripts/Jake2_mac.sh
index d106a05..898f9a6 100644
--- a/scripts/Jake2_mac.sh
+++ b/scripts/Jake2_mac.sh
@@ -1,6 +1,7 @@
#!/bin/sh
export LD_LIBRARY_PATH=lib/osx
+export DYLD_LIBRARY_PATH=lib/osx
CP=lib/jake2.jar:lib/jogl.jar:lib/linux/joal.jar
exec java -Xmx100M -Djava.library.path=lib/osx -cp $CP jake2.Jake2
diff --git a/src/jake2/sound/joal/Channel.java b/src/jake2/sound/joal/Channel.java
index 20d9d83..d69afb9 100644
--- a/src/jake2/sound/joal/Channel.java
+++ b/src/jake2/sound/joal/Channel.java
@@ -3,7 +3,7 @@
*
* Copyright (C) 2003
*
- * $Id: Channel.java,v 1.6 2005-12-04 20:56:26 cawe Exp $
+ * $Id: Channel.java,v 1.7 2006-10-24 22:51:20 cawe Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.
@@ -108,7 +108,7 @@ public class Channel {
int sourceId;
for (int i = 0; i < MAX_CHANNELS; i++) {
- al.alGenSources(1, tmp);
+ al.alGenSources(1, tmp, 0);
sourceId = tmp[0];
if (sourceId <= 0) break;
@@ -121,8 +121,8 @@ public class Channel {
// set default values for AL sources
al.alSourcef (sourceId, AL.AL_GAIN, 1.0f);
al.alSourcef (sourceId, AL.AL_PITCH, 1.0f);
- al.alSourcei (sourceId, AL.AL_SOURCE_ABSOLUTE, AL.AL_TRUE);
- al.alSourcefv(sourceId, AL.AL_VELOCITY, NULLVECTOR);
+ al.alSourcei (sourceId, AL.AL_SOURCE_RELATIVE, AL.AL_FALSE);
+ al.alSourcefv(sourceId, AL.AL_VELOCITY, NULLVECTOR, 0);
al.alSourcei (sourceId, AL.AL_LOOPING, AL.AL_FALSE);
al.alSourcef (sourceId, AL.AL_REFERENCE_DISTANCE, 200.0f);
al.alSourcef (sourceId, AL.AL_MIN_GAIN, 0.0005f);
@@ -141,7 +141,7 @@ public class Channel {
}
static void shutdown() {
- al.alDeleteSources(numChannels, sources);
+ al.alDeleteSources(numChannels, sources, 0);
numChannels = 0;
isInitialized = false;
}
@@ -166,7 +166,7 @@ public class Channel {
if (!streamingEnabled) return;
unqueueStreams();
int source = channels[numChannels].sourceId;
- al.alSourcei (source, AL.AL_SOURCE_ABSOLUTE, AL.AL_TRUE);
+ al.alSourcei (source, AL.AL_SOURCE_RELATIVE, AL.AL_FALSE);
// free the last source
numChannels++;
@@ -180,10 +180,12 @@ public class Channel {
// stop streaming
al.alSourceStop(source);
- int count = al.alGetSourcei(source, AL.AL_BUFFERS_QUEUED);
+ int[] tmpCount = new int[]{0};
+ al.alGetSourcei(source, AL.AL_BUFFERS_QUEUED, tmpCount, 0);
+ int count = tmpCount[0];
Com.DPrintf("unqueue " + count + " buffers\n");
while (count-- > 0) {
- al.alSourceUnqueueBuffers(source, 1, tmp);
+ al.alSourceUnqueueBuffers(source, 1, tmp, 0);
}
streamQueue = 0;
}
@@ -192,9 +194,13 @@ public class Channel {
enableStreaming();
int[] buffer = tmp;
int source = channels[numChannels].sourceId;
- int processed = al.alGetSourcei(source, AL.AL_BUFFERS_PROCESSED);
- boolean playing = (al.alGetSourcei(source, AL.AL_SOURCE_STATE) == AL.AL_PLAYING);
+ int[] tmp = new int[]{0};
+ al.alGetSourcei(source, AL.AL_BUFFERS_PROCESSED, tmp, 0);
+ int processed = tmp[0];
+ al.alGetSourcei(source, AL.AL_SOURCE_STATE, tmp, 0);
+ int state = tmp[0];
+ boolean playing = ( state == AL.AL_PLAYING);
boolean interupted = !playing && streamQueue > 2;
if (interupted) {
@@ -208,13 +214,13 @@ public class Channel {
Com.DPrintf("queue " + (streamQueue - 1) + '\n');
} else {
// reuse the buffer
- al.alSourceUnqueueBuffers(source, 1, buffer);
+ al.alSourceUnqueueBuffers(source, 1, buffer, 0);
}
samples.position(0);
samples.limit(count);
al.alBufferData(buffer[0], format, samples, count, rate);
- al.alSourceQueueBuffers(source, 1, buffer);
+ al.alSourceQueueBuffers(source, 1, buffer, 0);
if (streamQueue > 1 && !playing) {
Com.DPrintf("start sound\n");
@@ -298,6 +304,7 @@ public class Channel {
Channel ch;
int sourceId;
int state;
+ int[] tmp = new int[]{0};
for (int i = 0; i < numChannels; i++) {
ch = channels[i];
@@ -324,13 +331,14 @@ public class Channel {
al.alSourcef (sourceId, AL.AL_GAIN, ch.volume);
}
al.alSourcef (sourceId, AL.AL_ROLLOFF_FACTOR, ch.rolloff);
- al.alSourcefv(sourceId, AL.AL_POSITION, sourceOrigin);
+ al.alSourcefv(sourceId, AL.AL_POSITION, sourceOrigin, 0);
al.alSourcePlay(sourceId);
ch.modified = false;
} else {
- state = al.alGetSourcei(sourceId, AL.AL_SOURCE_STATE);
- if (state == AL.AL_PLAYING) {
- al.alSourcefv(sourceId, AL.AL_POSITION, sourceOrigin);
+ al.alGetSourcei(sourceId, AL.AL_SOURCE_STATE, tmp , 0);
+ state = tmp[0];
+ if (state == AL.AL_PLAYING) {
+ al.alSourcefv(sourceId, AL.AL_POSITION, sourceOrigin, 0);
} else {
ch.clear();
}
diff --git a/src/jake2/sound/joal/JOALSoundImpl.java b/src/jake2/sound/joal/JOALSoundImpl.java
index 6011285..0b82a1d 100644
--- a/src/jake2/sound/joal/JOALSoundImpl.java
+++ b/src/jake2/sound/joal/JOALSoundImpl.java
@@ -2,7 +2,7 @@
* JOALSoundImpl.java
* Copyright (C) 2004
*
- * $Id: JOALSoundImpl.java,v 1.15 2005-12-04 19:21:04 cawe Exp $
+ * $Id: JOALSoundImpl.java,v 1.16 2006-10-24 22:51:20 cawe Exp $
*/
package jake2.sound.joal;
@@ -20,6 +20,7 @@ import java.nio.*;
import net.java.games.joal.*;
import net.java.games.joal.eax.EAX;
import net.java.games.joal.eax.EAXFactory;
+import net.java.games.joal.util.ALut;
/**
* JOALSoundImpl
@@ -68,33 +69,24 @@ public final class JOALSoundImpl implements Sound {
* @see jake2.sound.SoundImpl#Init()
*/
public boolean Init() {
-
- // preload OpenAL native library
- String os = System.getProperty("os.name");
- if (os.startsWith("Linux")) {
- unpack();
- } else if (os.startsWith("Windows")) {
- try {
- System.loadLibrary("OpenAL32");
- } catch (Throwable e) {}
- }
-
+
try {
- initOpenAL();
+ ALut.alutInit();
al = ALFactory.getAL();
+ alc = ALFactory.getALC();
checkError();
initOpenALExtensions();
- } catch (OpenALException e) {
+ } catch (ALException e) {
Com.Printf(e.getMessage() + '\n');
return false;
} catch (Throwable e) {
- Com.DPrintf(e.getMessage() + '\n');
+ Com.Printf(e.toString() + '\n');
return false;
}
// set the master volume
s_volume = Cvar.Get("s_volume", "0.7", Defines.CVAR_ARCHIVE);
- al.alGenBuffers(buffers.length, buffers);
+ al.alGenBuffers(buffers.length, buffers, 0);
int count = Channel.init(al, buffers);
Com.Printf("... using " + count + " channels\n");
al.alDistanceModel(AL.AL_INVERSE_DISTANCE_CLAMPED);
@@ -127,31 +119,7 @@ public final class JOALSoundImpl implements Sound {
Com.Printf("------------------------------------\n");
return true;
}
-
-
- private void initOpenAL() throws OpenALException {
- ALFactory.initialize();
- alc = ALFactory.getALC();
- String deviceName = null;
-
- String os = System.getProperty("os.name");
- if (os.startsWith("Windows")) {
- deviceName = "DirectSound3D";
- }
- ALC.Device device = alc.alcOpenDevice(deviceName);
- String deviceSpecifier = alc.alcGetString(device, ALC.ALC_DEVICE_SPECIFIER);
- String defaultSpecifier = alc.alcGetString(device, ALC.ALC_DEFAULT_DEVICE_SPECIFIER);
-
- Com.Printf(os + " using " + ((deviceName == null) ? defaultSpecifier : deviceName) + '\n');
-
- ALC.Context context = alc.alcCreateContext(device, new int[] {0});
- alc.alcMakeContextCurrent(context);
- // Check for an error.
- if (alc.alcGetError(device) != ALC.ALC_NO_ERROR) {
- Com.DPrintf("Error with SoundDevice");
- }
- }
-
+
private void initOpenALExtensions() {
if (al.alIsExtensionPresent("EAX2.0")) {
Com.Printf("... using EAX2.0\n");
@@ -164,9 +132,9 @@ public final class JOALSoundImpl implements Sound {
void exitOpenAL() {
// Get the current context.
- ALC.Context curContext = alc.alcGetCurrentContext();
+ ALCcontext curContext = alc.alcGetCurrentContext();
// Get the device used by that context.
- ALC.Device curDevice = alc.alcGetContextsDevice(curContext);
+ ALCdevice curDevice = alc.alcGetContextsDevice(curContext);
// Reset the current context to NULL.
alc.alcMakeContextCurrent(null);
// Release the context and the device.
@@ -213,7 +181,7 @@ public final class JOALSoundImpl implements Sound {
public void Shutdown() {
StopAllSounds();
Channel.shutdown();
- al.alDeleteBuffers(buffers.length, buffers);
+ al.alDeleteBuffers(buffers.length, buffers, 0);
exitOpenAL();
Cmd.RemoveCommand("play");
@@ -267,10 +235,10 @@ public final class JOALSoundImpl implements Sound {
*/
public void Update(float[] origin, float[] forward, float[] right, float[] up) {
Channel.convertVector(origin, listenerOrigin);
- al.alListenerfv(AL.AL_POSITION, listenerOrigin);
+ al.alListenerfv(AL.AL_POSITION, listenerOrigin, 0);
Channel.convertOrientation(forward, up, listenerOrientation);
- al.alListenerfv(AL.AL_ORIENTATION, listenerOrientation);
+ al.alListenerfv(AL.AL_ORIENTATION, listenerOrientation, 0);
// set the listener (master) volume
al.alListenerf(AL.AL_GAIN, s_volume.value);