Class AL
- java.lang.Object
-
- org.lwjgl.openal.AL
-
public final class AL extends java.lang.ObjectThis class must be used before any OpenAL function is called. It has the following responsibilities:- Creates instances of
ALCapabilitiesclasses. AnALCapabilitiesinstance contains flags for functionality that is available in an OpenAL context. Internally, it also contains function pointers that are only valid in that specific OpenAL context. - Maintains thread-local and global state for
ALCapabilitiesinstances, corresponding to OpenAL contexts that are current in those threads and the entire process, respectively.
ALCapabilities creation
Instances of
ALCapabilitiescan be created with theAL.createCapabilities(org.lwjgl.openal.ALCCapabilities)method. An OpenAL context must be current in the current thread or process before it is called. Calling this method is expensive, soALCapabilitiesinstances should be cached in user code.Thread-local state
Before a function for a given OpenAL context can be called, the corresponding
ALCapabilitiesinstance must be made current in the current thread or process. The user is also responsible for clearing the currentALCapabilitiesinstance when the context is destroyed or made current in another thread.Note that OpenAL contexts are made current process-wide by default. Current thread-local contexts are only available if the
ALC_EXT_thread_local_contextextension is supported by the OpenAL implementation. OpenAL Soft, the implementation that LWJGL ships with, supports this extension.- See Also:
ALC
- Creates instances of
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static ALCapabilitiescreateCapabilities(ALCCapabilities alcCaps)Creates a newALCapabilitiesinstance for the OpenAL context that is current in the current thread or process.static ALCapabilitiesgetCapabilities()Returns theALCapabilitiesfor the OpenAL context that is current in the current thread or process.static ALCapabilitiesgetCurrentCapabilities()Returns theALCapabilitiesfor the OpenAL context that is current in the current thread or process.static voidsetCurrentProcess(ALCapabilities caps)Sets the specifiedALCapabilitiesfor the current process-wide OpenAL context.static voidsetCurrentThread(ALCapabilities caps)Sets the specifiedALCapabilitiesfor the current OpenAL context in the current thread.
-
-
-
Method Detail
-
setCurrentProcess
public static void setCurrentProcess(ALCapabilities caps)
Sets the specifiedALCapabilitiesfor the current process-wide OpenAL context.If the current thread had a context current (see
AL.setCurrentThread(org.lwjgl.openal.ALCapabilities)), thoseALCapabilitiescleared. Any OpenAL functions called in the current thread, or any threads that have no context current, will use the specifiedALCapabilities.- Parameters:
caps- theALCapabilitiesto make current, or null
-
setCurrentThread
public static void setCurrentThread(ALCapabilities caps)
Sets the specifiedALCapabilitiesfor the current OpenAL context in the current thread.Any OpenAL functions called in the current thread will use the specified
ALCapabilities.- Parameters:
caps- theALCapabilitiesto make current, or null
-
getCurrentCapabilities
public static ALCapabilities getCurrentCapabilities()
Returns theALCapabilitiesfor the OpenAL context that is current in the current thread or process. If no OpenAL context is current in the current thread or process, null is returned.
-
getCapabilities
public static ALCapabilities getCapabilities()
Returns theALCapabilitiesfor the OpenAL context that is current in the current thread or process.- Throws:
java.lang.IllegalStateException- if no OpenAL context is current in the current thread or process
-
createCapabilities
public static ALCapabilities createCapabilities(ALCCapabilities alcCaps)
Creates a newALCapabilitiesinstance for the OpenAL context that is current in the current thread or process.- Parameters:
alcCaps- theALCCapabilitiesof the device associated with the current context- Returns:
- the ALCapabilities instance
-
-