Class ALC
- Loads the OpenAL native library into the JVM process.
- Creates instances of
ALCCapabilitiesclasses. AnALCCapabilitiesinstance contains flags for functionality that is available for an OpenAL device. Internally, it also contains function pointers that are only valid for that specific OpenAL device.
Library lifecycle
The OpenAL library is loaded automatically when this class is initialized. Set the Configuration.OPENAL_EXPLICIT_INIT option to override this
behavior. Manual loading/unloading can be achieved with the create() and destroy() functions. The name of the library loaded can be overridden
with the Configuration.OPENAL_LIBRARY_NAME option.
ALCCapabilities creation
Instances of ALCCapabilities can be created with the createCapabilities(long) method. Calling this method is expensive, so
ALCCapabilities instances should be cached in user code.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidcreate()Loads the OpenAL native library, using the default library name.static voidLoads the OpenAL native library, using the specified library name.static voidcreate(FunctionProviderLocal functionProvider) Initializes ALC with the specifiedFunctionProviderLocal.static ALCCapabilitiescreateCapabilities(long device) Creates a newALCCapabilitiesinstance for the specified OpenAL device.static ALCCapabilitiescreateCapabilities(long device, @Nullable IntFunction<PointerBuffer> bufferFactory) Creates a newALCCapabilitiesinstance for the specified OpenAL device.static voiddestroy()Unloads the OpenAL native library.static ALCCapabilitiesReturns theALCCapabilitiesfor the current thread.static FunctionProviderLocalReturns theFunctionProviderLocalfor the OpenAL native library.static voidsetCapabilities(@Nullable ALCCapabilities caps) Sets the specifiedALCCapabilitiesfor the current thread.
-
Method Details
-
create
public static void create()Loads the OpenAL native library, using the default library name. -
create
Loads the OpenAL native library, using the specified library name.- Parameters:
libName- the native library name
-
create
Initializes ALC with the specifiedFunctionProviderLocal. This method can be used to implement custom ALC library loading.- Parameters:
functionProvider- the provider of ALC function addresses
-
destroy
public static void destroy()Unloads the OpenAL native library. -
getFunctionProvider
Returns theFunctionProviderLocalfor the OpenAL native library. -
setCapabilities
Sets the specifiedALCCapabilitiesfor the current thread.Any ALC functions called in the current thread will use the specified
ALCCapabilities.- Parameters:
caps- theALCCapabilitiesto make current, or null
-
getCapabilities
Returns theALCCapabilitiesfor the current thread.- Throws:
IllegalStateException- if OpenAL has not been loaded.
-
createCapabilities
Creates a newALCCapabilitiesinstance for the specified OpenAL device.This method calls
setCapabilities(org.lwjgl.openal.ALCCapabilities)with the new instance before returning.- Parameters:
device- theALCdevicefor which to create the capabilities instance- Returns:
- the
ALCCapabilitiesinstance
-
createCapabilities
public static ALCCapabilities createCapabilities(long device, @Nullable IntFunction<PointerBuffer> bufferFactory) Creates a newALCCapabilitiesinstance for the specified OpenAL device.This method calls
setCapabilities(org.lwjgl.openal.ALCCapabilities)with the new instance before returning.- Parameters:
device- theALCdevicefor which to create the capabilities instancebufferFactory- a function that allocates aPointerBuffergiven a size. The buffer must be filled with zeroes. Ifnull, LWJGL will allocate a GC-managed buffer internally.- Returns:
- the
ALCCapabilitiesinstance
-