Top Description Inners Fields Constructors Methods
org.lwjgl.openal

public final Class ALC

extends Object
Class Inheritance
Imports
org.lwjgl.*, org.lwjgl.system.*, javax.annotation.*, java.nio.*, java.util.*, java.util.function.*

This class must be used before any OpenAL function is called. It has the following responsibilities:

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 method. Calling this method is expensive, so ALCCapabilities instances should be cached in user code.

See Also
AL

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
ALC.ICD

Function pointer provider.

private static class
ALC.ICDStatic

Write-once ICD.

private static class

Field Summary

Modifier and TypeField and Description
private static final ThreadLocal<ALCCapabilities>
private static FunctionProviderLocal
private static ALC.ICD
private static ALCCapabilities

Constructor Summary

AccessConstructor and Description
private
ALC()

Method Summary

Modifier and TypeMethod and Description
pack-priv static <T> T
check(T t)

private static ALCCapabilities
public static void
create()

Loads the OpenAL native library, using the default library name.

public static void
create(String
the native library name
libName
)

Loads the OpenAL native library, using the specified library name.

public static void
create(FunctionProviderLocal
the provider of ALC function addresses
functionProvider
)

Initializes ALC with the specified FunctionProviderLocal.

public static ALCCapabilities

Returns:

the ALCCapabilities instance
createCapabilities
(long
the ALCdevice for which to create the capabilities instance
device
)

Creates a new ALCCapabilities instance for the specified OpenAL device.

public static ALCCapabilities

Returns:

the ALCCapabilities instance
createCapabilities
(long
the ALCdevice for which to create the capabilities instance
device
,
IntFunction<PointerBuffer>
a function that allocates a PointerBuffer given a size. The buffer must be filled with zeroes. If null, LWJGL will allocate a GC-managed buffer internally.
bufferFactory
)

Creates a new ALCCapabilities instance for the specified OpenAL device.

public static void
destroy()

Unloads the OpenAL native library.

public static ALCCapabilities
getCapabilities()

Returns the ALCCapabilities for the current thread.

public static FunctionProviderLocal
getFunctionProvider()

Returns the FunctionProviderLocal for the OpenAL native library.

pack-priv static ALCCapabilities
public static void
setCapabilities(ALCCapabilities
the ALCCapabilities to make current, or null
caps
)

Sets the specified ALCCapabilities for the current thread.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

capabilitiesTLSback to summary
private static final ThreadLocal<ALCCapabilities> capabilitiesTLS
functionProviderback to summary
private static FunctionProviderLocal functionProvider
Annotations
@Nullable
icdback to summary
private static ALC.ICD icd
Annotations
@Nullable
routerback to summary
private static ALCCapabilities router
Annotations
@Nullable

Constructor Detail

ALCback to summary
private ALC()

Method Detail

checkback to summary
pack-priv static <T> T check(T t)
checkCapabilitiesback to summary
private static ALCCapabilities checkCapabilities(ALCCapabilities caps)
createback to summary
public static void create()

Loads the OpenAL native library, using the default library name.

createback to summary
public static void create(String libName)

Loads the OpenAL native library, using the specified library name.

Parameters
libName:String

the native library name

createback to summary
public static void create(FunctionProviderLocal functionProvider)

Initializes ALC with the specified FunctionProviderLocal. This method can be used to implement custom ALC library loading.

Parameters
functionProvider:FunctionProviderLocal

the provider of ALC function addresses

createCapabilitiesback to summary
public static ALCCapabilities createCapabilities(long device)

Creates a new ALCCapabilities instance for the specified OpenAL device.

This method calls setCapabilities with the new instance before returning.

Parameters
device:long

the ALCdevice for which to create the capabilities instance

Returns:ALCCapabilities

the ALCCapabilities instance

createCapabilitiesback to summary
public static ALCCapabilities createCapabilities(long device, IntFunction<PointerBuffer> bufferFactory)

Creates a new ALCCapabilities instance for the specified OpenAL device.

This method calls setCapabilities with the new instance before returning.

Parameters
device:long

the ALCdevice for which to create the capabilities instance

bufferFactory:IntFunction<PointerBuffer>

a function that allocates a PointerBuffer given a size. The buffer must be filled with zeroes. If null, LWJGL will allocate a GC-managed buffer internally.

Returns:ALCCapabilities

the ALCCapabilities instance

destroyback to summary
public static void destroy()

Unloads the OpenAL native library.

getCapabilitiesback to summary
public static ALCCapabilities getCapabilities()

Returns the ALCCapabilities for the current thread.

Exceptions
IllegalStateException:
if OpenAL has not been loaded.
getFunctionProviderback to summary
public static FunctionProviderLocal getFunctionProvider()

Returns the FunctionProviderLocal for the OpenAL native library.

getICDback to summary
pack-priv static ALCCapabilities getICD()
setCapabilitiesback to summary
public static void setCapabilities(ALCCapabilities caps)

Sets the specified ALCCapabilities for the current thread.

Any ALC functions called in the current thread will use the specified ALCCapabilities.

Parameters
caps:ALCCapabilities

the ALCCapabilities to make current, or null

org.lwjgl.openal back to summary

private Interface ALC.ICD

Known Direct Implementers
org.lwjgl.openal.ALC.ICDStatic

Function pointer provider.

Method Summary

Modifier and TypeMethod and Description
public ALCCapabilities
get()

public default void

Method Detail

getback to summary
public ALCCapabilities get()
Annotations
@Nullable
setback to summary
public default void set(ALCCapabilities caps)
org.lwjgl.openal back to summary

private Class ALC.ICDStatic

extends Object
implements ICD
Class Inheritance
All Implemented Interfaces
org.lwjgl.openal.ALC.ICD

Write-once ICD.

This is the default implementation that skips the thread/process lookup. When a new ALCCapabilities is set, we compare it to the write-once capabilities. If different function pointers are found, we fall back to the expensive lookup.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static ALCCapabilities

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ALCCapabilities
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

tempCapsback to summary
private static ALCCapabilities tempCaps
Annotations
@Nullable

Constructor Detail

ICDStaticback to summary
private ICDStatic()

Method Detail

getback to summary
public ALCCapabilities get()

Implements org.lwjgl.openal.ALC.ICD.get.

Annotations
@Override
setback to summary
public void set(ALCCapabilities caps)

Overrides default org.lwjgl.openal.ALC.ICD.set.

Annotations
@SuppressWarnings:AssignmentToStaticFieldFromInstanceMethod
@Override
org.lwjgl.openal back to summary

private final Class ALC.ICDStatic.WriteOnce

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final ALCCapabilities

Constructor Summary

AccessConstructor and Description
private

Field Detail

capsback to summary
pack-priv static final ALCCapabilities caps

Constructor Detail

WriteOnceback to summary
private WriteOnce()
org.lwjgl.openal back to summary

private Class ALC.SharedLibraryAL

extends Delegate
implements FunctionProviderLocal
Class Inheritance
All Implemented Interfaces
org.lwjgl.system.FunctionProviderLocal, org.lwjgl.system.FunctionProvider

Field Summary

Modifier and TypeField and Description
private final long
Inherited from org.lwjgl.system.SharedLibrary.Delegate:
library

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public long
getFunctionAddress(ByteBuffer
the encoded name of the function to query
functionName
)

Implements org.lwjgl.system.FunctionProvider.getFunctionAddress.

Returns the function address of the specified function.
public long
getFunctionAddress(long
the handle to a platform/device/context
handle
,
ByteBuffer
the encoded name of the function to query
functionName
)

Implements org.lwjgl.system.FunctionProviderLocal.getFunctionAddress.

Returns the function address of the specified function for the specified handle.
Inherited from org.lwjgl.system.SharedLibrary.Delegate:
addressfreegetNamegetPath

Field Detail

alcGetProcAddressback to summary
private final long alcGetProcAddress

Constructor Detail

SharedLibraryALback to summary
protected SharedLibraryAL(SharedLibrary library)

Method Detail

getFunctionAddressback to summary
public long getFunctionAddress(ByteBuffer functionName)

Implements org.lwjgl.system.FunctionProvider.getFunctionAddress.

Doc from org.lwjgl.system.FunctionProvider.getFunctionAddress.

Returns the function address of the specified function. If the function is not supported, returns 0L.

Parameters
functionName:ByteBuffer

the encoded name of the function to query

Returns:long

the function address or 0L if the function is not supported

Annotations
@Override
getFunctionAddressback to summary
public long getFunctionAddress(long handle, ByteBuffer functionName)

Implements org.lwjgl.system.FunctionProviderLocal.getFunctionAddress.

Doc from org.lwjgl.system.FunctionProviderLocal.getFunctionAddress.

Returns the function address of the specified function for the specified handle. If the function is not supported, returns 0L.

Parameters
handle:long

the handle to a platform/device/context

functionName:ByteBuffer

the encoded name of the function to query

Returns:long

the function address or 0L if the function is not supported

Annotations
@Override