diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/java/net/java/games/joal/ALCImpl.java | 29 | ||||
-rw-r--r-- | src/java/net/java/games/sound3d/Source.java | 6 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/java/net/java/games/joal/ALCImpl.java b/src/java/net/java/games/joal/ALCImpl.java index ed5906e..d621a0a 100644 --- a/src/java/net/java/games/joal/ALCImpl.java +++ b/src/java/net/java/games/joal/ALCImpl.java @@ -37,16 +37,16 @@ import java.util.HashMap; final class ALCImpl implements ALC { private final HashMap contextMap = new HashMap(); + private static Object lock = new Object(); ALCImpl() { System.loadLibrary("joal"); - /* + Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { public void run() { exit(); } })); - */ } public Device alcOpenDevice(String deviceName) { @@ -84,17 +84,28 @@ final class ALCImpl implements ALC { public int alcMakeContextCurrent(Context context) { int result = 0; - int pointer = 0; - - if (context != null) { - pointer = context.pointer; + synchronized(lock) { + int pointer = 0; + if (context != null) { + pointer = context.pointer; + } + result = makeContextCurrentNative(pointer); + try { + lock.wait(); + } catch (InterruptedException e) { + result = 0; + } } - - result = makeContextCurrentNative(pointer); - return result; } + public void alcFreeCurrentContext() { + synchronized(lock) { + makeContextCurrentNative(0); + lock.notifyAll(); + } + } + private native int makeContextCurrentNative(int pointer); public void alcProcessContext(Context context) { diff --git a/src/java/net/java/games/sound3d/Source.java b/src/java/net/java/games/sound3d/Source.java index b6ecf37..5e4183d 100644 --- a/src/java/net/java/games/sound3d/Source.java +++ b/src/java/net/java/games/sound3d/Source.java @@ -148,7 +148,7 @@ public final class Source { * Gets the max distance where there will no longer be any attenuation of * the source. * - * @param the max ditance for source attentuation. + * @return the max ditance for source attentuation. */ public float getMaxDistance() { float[] result = new float[1]; @@ -255,7 +255,7 @@ public final class Source { /** * Gets the gain when outside the oriented cone. * - * @param coneOuterGain the gain when outside the oriented cone. + * @return the gain when outside the oriented cone. */ public float getConeOuterGain() { float[] result = new float[1]; @@ -422,7 +422,7 @@ public final class Source { /** * indicates whether looping is turned on or off. * - * @param isLooping true-looping is on, false-looping is off + * @return true-looping is on, false-looping is off */ public boolean getLooping() { boolean result = false; |