You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(134) |
Sep
(52) |
Oct
(13) |
Nov
(342) |
Dec
(163) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(44) |
Feb
(62) |
Mar
(158) |
Apr
(38) |
May
(70) |
Jun
(58) |
Jul
(104) |
Aug
(207) |
Sep
(83) |
Oct
(122) |
Nov
(23) |
Dec
(49) |
| 2004 |
Jan
(119) |
Feb
(132) |
Mar
(192) |
Apr
(140) |
May
(77) |
Jun
(74) |
Jul
(201) |
Aug
(63) |
Sep
(102) |
Oct
(70) |
Nov
(173) |
Dec
(78) |
| 2005 |
Jan
(174) |
Feb
(197) |
Mar
(105) |
Apr
(59) |
May
(77) |
Jun
(43) |
Jul
(21) |
Aug
(18) |
Sep
(47) |
Oct
(37) |
Nov
(74) |
Dec
(50) |
| 2006 |
Jan
(44) |
Feb
(19) |
Mar
(32) |
Apr
(24) |
May
(31) |
Jun
(55) |
Jul
(138) |
Aug
(28) |
Sep
(12) |
Oct
(41) |
Nov
(58) |
Dec
(24) |
| 2007 |
Jan
(28) |
Feb
(14) |
Mar
(10) |
Apr
(68) |
May
(30) |
Jun
(26) |
Jul
(18) |
Aug
(63) |
Sep
(19) |
Oct
(29) |
Nov
(20) |
Dec
(10) |
| 2008 |
Jan
(38) |
Feb
(7) |
Mar
(37) |
Apr
(120) |
May
(41) |
Jun
(36) |
Jul
(39) |
Aug
(24) |
Sep
(28) |
Oct
(30) |
Nov
(36) |
Dec
(75) |
| 2009 |
Jan
(46) |
Feb
(22) |
Mar
(50) |
Apr
(70) |
May
(134) |
Jun
(105) |
Jul
(75) |
Aug
(34) |
Sep
(38) |
Oct
(34) |
Nov
(19) |
Dec
(20) |
| 2010 |
Jan
(11) |
Feb
(20) |
Mar
(65) |
Apr
(83) |
May
(104) |
Jun
(73) |
Jul
(78) |
Aug
(57) |
Sep
(43) |
Oct
(35) |
Nov
(9) |
Dec
(4) |
| 2011 |
Jan
(21) |
Feb
(11) |
Mar
(18) |
Apr
(10) |
May
(18) |
Jun
(15) |
Jul
(48) |
Aug
(25) |
Sep
(17) |
Oct
(45) |
Nov
(15) |
Dec
(12) |
| 2012 |
Jan
(21) |
Feb
(9) |
Mar
(12) |
Apr
(9) |
May
(9) |
Jun
(5) |
Jul
(1) |
Aug
(10) |
Sep
(12) |
Oct
(1) |
Nov
(28) |
Dec
(5) |
| 2013 |
Jan
(4) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2014 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
| 2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
| 2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
1
(2) |
2
(1) |
3
|
4
|
5
|
|
6
(1) |
7
|
8
(1) |
9
|
10
|
11
|
12
|
|
13
(3) |
14
|
15
|
16
|
17
|
18
(1) |
19
(4) |
|
20
(3) |
21
(1) |
22
(1) |
23
|
24
|
25
|
26
(1) |
|
27
(5) |
28
|
29
|
30
(1) |
31
(5) |
|
|
|
From: <ma...@us...> - 2007-05-19 20:47:55
|
Revision: 2823
http://svn.sourceforge.net/java-game-lib/?rev=2823&view=rev
Author: matzon
Date: 2007-05-19 13:47:53 -0700 (Sat, 19 May 2007)
Log Message:
-----------
remove context from the devices list of context on context destroy
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2007-05-19 20:40:04 UTC (rev 2822)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2007-05-19 20:47:53 UTC (rev 2823)
@@ -359,6 +359,8 @@
synchronized(ALC10.contexts) {
nalcDestroyContext(getContext(context));
context.setInvalid();
+ ALCdevice device = alcGetContextsDevice(context);
+ device.removeContext(context);
}
}
native static void nalcDestroyContext(long context);
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-05-19 20:40:04 UTC (rev 2822)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-05-19 20:47:53 UTC (rev 2823)
@@ -89,6 +89,17 @@
contexts.put(new Long(context.context), context);
}
}
+
+ /**
+ * Remove context associated with device
+ *
+ * @param context Context to disassociate with device
+ */
+ void removeContext(ALCcontext context) {
+ synchronized (contexts) {
+ contexts.remove(new Long(context.context));
+ }
+ }
/**
* Marks this device and all of its contexts invalid
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-05-19 20:40:37
|
Revision: 2821
http://svn.sourceforge.net/java-game-lib/?rev=2821&view=rev
Author: matzon
Date: 2007-05-19 13:39:50 -0700 (Sat, 19 May 2007)
Log Message:
-----------
dont compare validity on equals
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java 2007-05-19 19:37:57 UTC (rev 2820)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java 2007-05-19 20:39:50 UTC (rev 2821)
@@ -72,7 +72,7 @@
*/
public boolean equals(Object context) {
if(context instanceof ALCcontext) {
- return ((ALCcontext)context).context == this.context && ((ALCcontext)context).valid == this.valid;
+ return ((ALCcontext)context).context == this.context;
}
return super.equals(context);
}
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-05-19 19:37:57 UTC (rev 2820)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-05-19 20:39:50 UTC (rev 2821)
@@ -74,7 +74,7 @@
*/
public boolean equals(Object device) {
if(device instanceof ALCdevice) {
- return ((ALCdevice)device).device == this.device && ((ALCdevice)device).valid == this.valid;
+ return ((ALCdevice)device).device == this.device;
}
return super.equals(device);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-05-19 20:40:06
|
Revision: 2822
http://svn.sourceforge.net/java-game-lib/?rev=2822&view=rev
Author: matzon
Date: 2007-05-19 13:40:04 -0700 (Sat, 19 May 2007)
Log Message:
-----------
moved invalidation into sycnhronized block
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2007-05-19 20:39:50 UTC (rev 2821)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2007-05-19 20:40:04 UTC (rev 2822)
@@ -221,8 +221,8 @@
*/
public static boolean alcCloseDevice(ALCdevice device) {
boolean result = nalcCloseDevice(getDevice(device));
- device.setInvalid();
synchronized (devices) {
+ device.setInvalid();
devices.remove(new Long(device.device));
}
return result;
@@ -253,8 +253,8 @@
ALCcontext context = new ALCcontext(context_address);
synchronized (ALC10.contexts) {
contexts.put(new Long(context_address), context);
+ device.addContext(context);
}
- device.addContext(context);
return context;
}
return null;
@@ -356,8 +356,10 @@
* @param context address of context to Destroy
*/
public static void alcDestroyContext(ALCcontext context) {
- nalcDestroyContext(getContext(context));
- context.setInvalid();
+ synchronized(ALC10.contexts) {
+ nalcDestroyContext(getContext(context));
+ context.setInvalid();
+ }
}
native static void nalcDestroyContext(long context);
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2007-05-19 20:39:50 UTC (rev 2821)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2007-05-19 20:40:04 UTC (rev 2822)
@@ -109,8 +109,8 @@
*/
public static boolean alcCaptureCloseDevice(ALCdevice device) {
boolean result = nalcCaptureCloseDevice(ALC10.getDevice(device));
- device.setInvalid();
synchronized (ALC10.devices) {
+ device.setInvalid();
ALC10.devices.remove(new Long(device.device));
}
return result;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ma...@us...> - 2007-05-19 19:39:07
|
Revision: 2820
http://svn.sourceforge.net/java-game-lib/?rev=2820&view=rev
Author: matzon
Date: 2007-05-19 12:37:57 -0700 (Sat, 19 May 2007)
Log Message:
-----------
fixed address checking issue
fixed issue with ALC error checking not taking a device into account
now tracking device and context create and destroy
made the create with open default device option public
misc cleaning up and commenting
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/openal/AL.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
trunk/LWJGL/src/java/org/lwjgl/openal/Util.java
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/AL.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2007-05-18 07:15:35 UTC (rev 2819)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/AL.java 2007-05-19 19:37:57 UTC (rev 2820)
@@ -31,15 +31,15 @@
*/
package org.lwjgl.openal;
-import java.util.Vector;
-
import org.lwjgl.LWJGLException;
import org.lwjgl.LWJGLUtil;
import org.lwjgl.Sys;
/**
- * <br>
- * This is the OpenAL class. It extends the latest core.
+ * <p>
+ * The AL class implements the actual creation code for linking to the native library
+ * OpenAL.
+ * </p>
*
* @author Brian Matzon <br...@ma...>
* @version $Revision$
@@ -108,7 +108,7 @@
* @param openDevice Whether to automatically open the device
* @see #create(String, int, int, boolean)
*/
- static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice)
+ public static void create(String deviceArguments, int contextFrequency, int contextRefresh, boolean contextSynchronized, boolean openDevice)
throws LWJGLException {
if (created)
@@ -196,6 +196,7 @@
*/
public static void destroy() {
if (context != null) {
+ ALC10.alcMakeContextCurrent(null);
ALC10.alcDestroyContext(context);
context = null;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2007-05-18 07:15:35 UTC (rev 2819)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC10.java 2007-05-19 19:37:57 UTC (rev 2820)
@@ -33,6 +33,7 @@
import java.nio.Buffer;
import java.nio.IntBuffer;
+import java.util.HashMap;
import org.lwjgl.BufferChecks;
import org.lwjgl.LWJGLException;
@@ -40,11 +41,6 @@
/**
*
* <p>
- * This is the context class for OpenAL. This class implements functions
- * in alc.h
- * </p>
- *
- * <p>
* ALC introduces the notion of a Device. A Device can be, depending on the
* implementation, a hardware device, or a daemon/OS service/actual server. This
* mechanism also permits different drivers (and hardware) to coexist within the same
@@ -54,19 +50,18 @@
* specifiers (represented as strings).
* </p>
*
- * <p>
- * <b>NOTE:</b><br>
- * The LWJGL implementation of OpenAL does not expose the device, nor the context.
- * Whenever <code>AL</code> is created using the <code>create</code> method, an underlying
- * device and context is created. Thus more advanced usage of multiple contexts and/or devices
- * are not possible. The above mentioned features are very rarely used in games.
- * </p>
- *
* @author Brian Matzon <br...@ma...>
* @version $Revision: 2286 $
* $Id: ALC.java 2286 2006-03-23 19:32:21 +0000 (to, 23 mar 2006) matzon $
*/
public final class ALC10 {
+
+ /** List of active contexts */
+ static HashMap contexts = new HashMap();
+
+ /** List of active devices */
+ static HashMap devices = new HashMap();
+
/** Bad value */
public static final int ALC_INVALID = 0;
@@ -158,10 +153,10 @@
public static String alcGetString(ALCdevice device, int pname) {
String result;
result = nalcGetString(getDevice(device), pname);
- Util.checkALCError();
+ Util.checkALCError(device);
return result;
}
- private native static String nalcGetString(long device, int pname);
+ native static String nalcGetString(long device, int pname);
/**
* The application can query ALC for information using an integer query function.
@@ -186,9 +181,9 @@
public static void alcGetInteger(ALCdevice device, int pname, IntBuffer integerdata) {
BufferChecks.checkDirect(integerdata);
nalcGetIntegerv(getDevice(device), pname, integerdata.remaining(), integerdata, integerdata.position());
- Util.checkALCError();
+ Util.checkALCError(device);
}
- private native static void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset);
+ native static void nalcGetIntegerv(long device, int pname, int size, Buffer integerdata, int offset);
/**
* The <code>alcOpenDevice</code> function allows the application (i.e. the client program) to
@@ -203,9 +198,13 @@
* @return opened device, or null
*/
public static ALCdevice alcOpenDevice(String devicename) {
- long device = nalcOpenDevice(devicename);
- if(device > 0) {
- return new ALCdevice(device);
+ long device_address = nalcOpenDevice(devicename);
+ if(device_address != 0) {
+ ALCdevice device = new ALCdevice(device_address);
+ synchronized (ALC10.devices) {
+ devices.put(new Long(device_address), device);
+ }
+ return device;
}
return null;
}
@@ -221,7 +220,13 @@
* @param device address of native device to close
*/
public static boolean alcCloseDevice(ALCdevice device) {
- return nalcCloseDevice(getDevice(device));
+ boolean result = nalcCloseDevice(getDevice(device));
+ device.setInvalid();
+ synchronized (devices) {
+ devices.remove(new Long(device.device));
+ }
+ return result;
+
}
native static boolean nalcCloseDevice(long device);
@@ -241,16 +246,20 @@
* @return New context, or null if creation failed
*/
public static ALCcontext alcCreateContext(ALCdevice device, IntBuffer attrList) {
- long context = nalcCreateContext(getDevice(device), attrList);
- Util.checkALCError();
+ long context_address = nalcCreateContext(getDevice(device), attrList);
+ Util.checkALCError(device);
- if(context > 0) {
- return new ALCcontext(context);
+ if(context_address != 0) {
+ ALCcontext context = new ALCcontext(context_address);
+ synchronized (ALC10.contexts) {
+ contexts.put(new Long(context_address), context);
+ }
+ device.addContext(context);
+ return context;
}
-
return null;
}
- private native static long nalcCreateContext(long device, IntBuffer attrList);
+ native static long nalcCreateContext(long device, IntBuffer attrList);
/**
* To make a Context current with respect to AL Operation (state changes by issueing
@@ -269,7 +278,7 @@
public static int alcMakeContextCurrent(ALCcontext context) {
return nalcMakeContextCurrent(getContext(context));
}
- public native static int nalcMakeContextCurrent(long context);
+ native static int nalcMakeContextCurrent(long context);
/**
* The current context is the only context accessible to state changes by AL commands
@@ -285,7 +294,7 @@
public static void alcProcessContext(ALCcontext context) {
nalcProcessContext(getContext(context));
}
- private native static void nalcProcessContext(long context);
+ native static void nalcProcessContext(long context);
/**
* The application can query for, and obtain an handle to, the current context for the
@@ -294,13 +303,16 @@
* @return Current ALCcontext
*/
public static ALCcontext alcGetCurrentContext() {
- long context = nalcGetCurrentContext();
- if(context > 0) {
- return new ALCcontext(context);
+ ALCcontext context = null;
+ long context_address = nalcGetCurrentContext();
+ if(context_address != 0) {
+ synchronized (ALC10.contexts) {
+ context = (ALCcontext) ALC10.contexts.get(new Long(context_address));
+ }
}
- return null;
+ return context;
}
- public native static long nalcGetCurrentContext();
+ native static long nalcGetCurrentContext();
/**
* The application can query for, and obtain an handle to, the device of a given context.
@@ -309,13 +321,16 @@
* @param ALCdevice associated with context
*/
public static ALCdevice alcGetContextsDevice(ALCcontext context) {
- long device = nalcGetContextsDevice(getContext(context));
- if (device > 0) {
- return new ALCdevice(device);
+ ALCdevice device = null;
+ long device_address = nalcGetContextsDevice(getContext(context));
+ if (device_address != 0) {
+ synchronized (ALC10.devices) {
+ device = (ALCdevice) ALC10.devices.get(new Long(device_address));
+ }
}
- return null;
+ return device;
}
- private native static long nalcGetContextsDevice(long context);
+ native static long nalcGetContextsDevice(long context);
/**
* The application can suspend any context from processing (including the current
@@ -332,7 +347,7 @@
public static void alcSuspendContext(ALCcontext context) {
nalcSuspendContext(getContext(context));
}
- private native static void nalcSuspendContext(long context);
+ native static void nalcSuspendContext(long context);
/**
* The correct way to destroy a context is to first release it using <code>alcMakeCurrent</code> and
@@ -342,6 +357,7 @@
*/
public static void alcDestroyContext(ALCcontext context) {
nalcDestroyContext(getContext(context));
+ context.setInvalid();
}
native static void nalcDestroyContext(long context);
@@ -363,7 +379,7 @@
public static int alcGetError(ALCdevice device) {
return nalcGetError(getDevice(device));
}
- private native static int nalcGetError(long device);
+ native static int nalcGetError(long device);
/**
* Verify that a given extension is available for the current context and the device it
@@ -376,10 +392,10 @@
*/
public static boolean alcIsExtensionPresent(ALCdevice device, String extName) {
boolean result = nalcIsExtensionPresent(getDevice(device), extName);
- Util.checkALCError();
+ Util.checkALCError(device);
return result;
}
- private native static boolean nalcIsExtensionPresent(long device, String extName);
+ native static boolean nalcIsExtensionPresent(long device, String extName);
/**
* Enumeration/token values are device independend, but tokens defined for
@@ -393,13 +409,14 @@
*/
public static int alcGetEnumValue(ALCdevice device, String enumName) {
int result = nalcGetEnumValue(getDevice(device), enumName);
- Util.checkALCError();
+ Util.checkALCError(device);
return result;
}
- private native static int nalcGetEnumValue(long device, String enumName);
+ native static int nalcGetEnumValue(long device, String enumName);
static long getDevice(ALCdevice device) {
if(device != null) {
+ Util.checkALCValidDevice(device);
return device.device;
}
return 0L;
@@ -407,6 +424,7 @@
static long getContext(ALCcontext context) {
if(context != null) {
+ Util.checkALCValidContext(context);
return context.context;
}
return 0L;
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2007-05-18 07:15:35 UTC (rev 2819)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALC11.java 2007-05-19 19:37:57 UTC (rev 2820)
@@ -40,8 +40,13 @@
/**
+ * <p>
+ * The ALC11 class implements features in OpenAL 1.1, specifically
+ * ALC methods and properties.
+ * </p>
*
* @author Brian Matzon <br...@ma...>
+ * @see ALC10
* @version $Revision: 2286 $
* $Id: ALC.java 2286 2006-03-23 19:32:21 +0000 (to, 23 mar 2006) matzon $
*/
@@ -81,9 +86,13 @@
* @return ALCdevice if it was possible to open a device
*/
public static ALCdevice alcCaptureOpenDevice(String devicename, int frequency, int format, int buffersize) {
- long device = nalcCaptureOpenDevice(devicename, frequency, format, buffersize);
- if(device > 0) {
- return new ALCdevice(device);
+ long device_address = nalcCaptureOpenDevice(devicename, frequency, format, buffersize);
+ if(device_address != 0) {
+ ALCdevice device = new ALCdevice(device_address);
+ synchronized (ALC10.devices) {
+ ALC10.devices.put(new Long(device_address), device);
+ }
+ return device;
}
return null;
}
@@ -99,7 +108,12 @@
* @return true if device was successfully closed
*/
public static boolean alcCaptureCloseDevice(ALCdevice device) {
- return nalcCaptureCloseDevice(ALC10.getDevice(device));
+ boolean result = nalcCaptureCloseDevice(ALC10.getDevice(device));
+ device.setInvalid();
+ synchronized (ALC10.devices) {
+ ALC10.devices.remove(new Long(device.device));
+ }
+ return result;
}
static native boolean nalcCaptureCloseDevice(long device);
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java 2007-05-18 07:15:35 UTC (rev 2819)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALCcontext.java 2007-05-19 19:37:57 UTC (rev 2820)
@@ -36,8 +36,14 @@
import org.lwjgl.BufferUtils;
/**
- * <br>
- * Wrapper class, to make ALC contexts behave like the orginal api.
+ * The ALCcontext class represents a context opened in OpenAL space.
+ *
+ * All operations of the AL core API affect a current AL context. Within the scope of AL,
+ * the ALC is implied - it is not visible as a handle or function parameter. Only one AL
+ * Context per process can be current at a time. Applications maintaining multiple AL
+ * Contexts, whether threaded or not, have to set the current context accordingly.
+ * Applications can have multiple threads that share one more or contexts. In other words,
+ * AL and ALC are threadsafe.
*
* @author Brian Matzon <br...@ma...>
* @version $Revision$
@@ -45,9 +51,12 @@
*/
public final class ALCcontext {
- /** address of actual context */
+ /** Address of actual context */
final long context;
-
+
+ /** Whether this context is valid */
+ private boolean valid = false;
+
/**
* Creates a new instance of ALCcontext
*
@@ -55,6 +64,7 @@
*/
ALCcontext(long context) {
this.context = context;
+ this.valid = true;
}
/*
@@ -62,7 +72,7 @@
*/
public boolean equals(Object context) {
if(context instanceof ALCcontext) {
- return ((ALCcontext)context).context == this.context;
+ return ((ALCcontext)context).context == this.context && ((ALCcontext)context).valid == this.valid;
}
return super.equals(context);
}
@@ -87,4 +97,19 @@
return attribList;
}
+
+ /**
+ * Marks this context as invalid
+ *
+ */
+ void setInvalid() {
+ valid = false;
+ }
+
+ /**
+ * @return true if this context is still valid
+ */
+ public boolean isValid() {
+ return valid;
+ }
}
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-05-18 07:15:35 UTC (rev 2819)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/ALCdevice.java 2007-05-19 19:37:57 UTC (rev 2820)
@@ -31,9 +31,18 @@
*/
package org.lwjgl.openal;
+import java.util.HashMap;
+import java.util.Iterator;
+
/**
- * <br>
- * Wrapper class, to make ALC devices behave like the orginal api.
+ * The ALCdevice class represents a device opened in OpenAL space.
+ *
+ * ALC introduces the notion of a Device. A Device can be, depending on the
+ * implementation, a hardware device, or a daemon/OS service/actual server. This
+ * mechanism also permits different drivers (and hardware) to coexist within the same
+ * system, as well as allowing several applications to share system resources for audio,
+ * including a single hardware output device. The details are left to the implementation,
+ * which has to map the available backends to unique device specifiers.
*
* @author Brian Matzon <br...@ma...>
* @version $Revision$
@@ -41,9 +50,15 @@
*/
public final class ALCdevice {
- /** address of actual device */
+ /** Address of actual device */
final long device;
+ /** Whether this device is valid */
+ private boolean valid = false;
+
+ /** List of contexts belonging to the device */
+ private HashMap contexts = new HashMap();
+
/**
* Creates a new instance of ALCdevice
*
@@ -51,6 +66,7 @@
*/
ALCdevice(long device) {
this.device = device;
+ this.valid = true;
}
/*
@@ -58,8 +74,40 @@
*/
public boolean equals(Object device) {
if(device instanceof ALCdevice) {
- return ((ALCdevice)device).device == this.device;
+ return ((ALCdevice)device).device == this.device && ((ALCdevice)device).valid == this.valid;
}
return super.equals(device);
+ }
+
+ /**
+ * Adds a context to the device
+ *
+ * @param context context to add to the list of contexts for this device
+ */
+ void addContext(ALCcontext context) {
+ synchronized (contexts) {
+ contexts.put(new Long(context.context), context);
+ }
+ }
+
+ /**
+ * Marks this device and all of its contexts invalid
+ */
+ void setInvalid() {
+ valid = false;
+ synchronized (contexts) {
+ for(Iterator i = contexts.values().iterator(); i.hasNext();) {
+ ALCcontext context = (ALCcontext) i.next();
+ context.setInvalid();
+ }
+ }
+ contexts.clear();
}
+
+ /**
+ * @return true if this device is still valid
+ */
+ public boolean isValid() {
+ return valid;
+ }
}
Modified: trunk/LWJGL/src/java/org/lwjgl/openal/Util.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/openal/Util.java 2007-05-18 07:15:35 UTC (rev 2819)
+++ trunk/LWJGL/src/java/org/lwjgl/openal/Util.java 2007-05-19 19:37:57 UTC (rev 2820)
@@ -33,9 +33,10 @@
/**
- * Simple utility class.
+ * Simple utility class for checking AL/ALC errors
*
* @author cix_foo <ci...@us...>
+ * @author Brian Matzon <br...@ma...>
* @version $Revision$
*/
@@ -44,15 +45,42 @@
private Util() {
}
- public static void checkALCError() {
- int err = ALC10.alcGetError(AL.getDevice());
+ /**
+ * Checks for any ALC errors and throws an unchecked exception on errors
+ * @param device Device for which to check ALC errors
+ */
+ public static void checkALCError(ALCdevice device) {
+ int err = ALC10.alcGetError(device);
if (err != ALC10.ALC_NO_ERROR)
throw new OpenALException(ALC10.alcGetString(AL.getDevice(), err));
}
+ /**
+ * Checks for any AL errors and throws an unchecked exception on errors
+ */
public static void checkALError() {
int err = AL10.alGetError();
if (err != AL10.AL_NO_ERROR)
throw new OpenALException(err);
}
+
+ /**
+ * Checks for a valid device
+ * @param device ALCdevice to check the validity of
+ */
+ public static void checkALCValidDevice(ALCdevice device) {
+ if(!device.isValid()) {
+ throw new OpenALException("Invalid device: " + device);
+ }
+ }
+
+ /**
+ * Checks for a valid context
+ * @param context ALCcontext to check the validity of
+ */
+ public static void checkALCValidContext(ALCcontext context) {
+ if(!context.isValid()) {
+ throw new OpenALException("Invalid context: " + context);
+ }
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|