JOAL v2.6.0-rc-20250712
JOAL, OpenAL® API Binding for Java™ (public API).
com.jogamp.openal.sound3d.Context Class Reference

This class provides a Sound3D Context associated with a specified device. More...

Collaboration diagram for com.jogamp.openal.sound3d.Context:

Public Member Functions

 Context (final ALCcontext realContext, final Device device)
 Creates a new Context for a given ALCcontext for the specified device. More...
 
 Context (final Device device, final int[] attributes)
 Creates a new Context for a specified device including native ALCcontext creation. More...
 
boolean isDebugAvail ()
 Returns whether AL_EXT_debug is available for the current context. More...
 
boolean create (final int[] attributes)
 Creates the internal ALCcontext instance if getALContext() is null. More...
 
boolean recreate (final int[] attributes)
 Recreates the internal ALCcontext instance, i.e. More...
 
ALCcontext getALContext ()
 Returns the OpenAL ALCcontext. More...
 
boolean isValid ()
 Returns whether getALContext() is valid, i.e. More...
 
int getALCError ()
 Return ALC#alcGetError(ALCdevice) using getDevice(). More...
 
void destroy ()
 destroys this context freeing its resources. More...
 
int getLockCount ()
 Return the lock count of this context, i.e. More...
 
boolean tryMakeCurrent (final boolean throwException, final long timeoutMS) throws RuntimeException
 
boolean makeCurrent (final boolean throwException) throws ALException
 Makes the audio context current on the calling thread. More...
 
boolean release (final boolean throwException) throws ALException
 Releases control of this audio context from the current thread, if implementation utilizes context locking. More...
 
void suspend ()
 Suspend this context. More...
 
Device getDevice ()
 Gets the device associated with this context. More...
 
String toString ()
 

Static Public Member Functions

static Context getCurrentContext ()
 Returns this thread current context. More...
 

Public Attributes

final boolean hasALC_thread_local_context
 

Detailed Description

This class provides a Sound3D Context associated with a specified device.

Author
Athomas Goldberg, Sven Gothel, et al.

Definition at line 49 of file Context.java.

Constructor & Destructor Documentation

◆ Context() [1/2]

com.jogamp.openal.sound3d.Context.Context ( final ALCcontext  realContext,
final Device  device 
)

Creates a new Context for a given ALCcontext for the specified device.

Parameters
realContextALCcontext instance, maybe null
deviceThe device the Context belongs to, must be valid

Definition at line 63 of file Context.java.

Here is the call graph for this function:

◆ Context() [2/2]

com.jogamp.openal.sound3d.Context.Context ( final Device  device,
final int[]  attributes 
)

Creates a new Context for a specified device including native ALCcontext creation.

Parameters
deviceThe device the Context is being created for, must be valid.
attributeslist of ALCcontext attributes for context creation, maybe empty or null

Definition at line 85 of file Context.java.

Here is the call graph for this function:

Member Function Documentation

◆ create()

boolean com.jogamp.openal.sound3d.Context.create ( final int[]  attributes)

Creates the internal ALCcontext instance if getALContext() is null.

Parameters
attributeslost of ALCcontext attributes for context creation
Returns
true if the internal context has been successfully created, otherwise false

Definition at line 116 of file Context.java.

Here is the call graph for this function:

◆ destroy()

void com.jogamp.openal.sound3d.Context.destroy ( )

destroys this context freeing its resources.

Definition at line 171 of file Context.java.

Here is the caller graph for this function:

◆ getALCError()

int com.jogamp.openal.sound3d.Context.getALCError ( )

Return ALC#alcGetError(ALCdevice) using getDevice().

Definition at line 164 of file Context.java.

Here is the call graph for this function:

◆ getALContext()

ALCcontext com.jogamp.openal.sound3d.Context.getALContext ( )

Returns the OpenAL ALCcontext.

Definition at line 158 of file Context.java.

Here is the caller graph for this function:

◆ getCurrentContext()

static Context com.jogamp.openal.sound3d.Context.getCurrentContext ( )
static

Returns this thread current context.

If no context is current, returns null.

Returns
the context current on this thread, or null if no context is current.
See also
makeCurrent()
release()

Definition at line 206 of file Context.java.

Here is the caller graph for this function:

◆ getDevice()

Device com.jogamp.openal.sound3d.Context.getDevice ( )

Gets the device associated with this context.

Returns
the device associated with this context.

Definition at line 341 of file Context.java.

◆ getLockCount()

int com.jogamp.openal.sound3d.Context.getLockCount ( )

Return the lock count of this context, i.e.

0 if not locked, 1 if locked once, >1 for recursive locks.

Definition at line 211 of file Context.java.

◆ isDebugAvail()

boolean com.jogamp.openal.sound3d.Context.isDebugAvail ( )

Returns whether AL_EXT_debug is available for the current context.

See also
Device::isDebugAvail()

Definition at line 107 of file Context.java.

Here is the call graph for this function:

◆ isValid()

boolean com.jogamp.openal.sound3d.Context.isValid ( )

Returns whether getALContext() is valid, i.e.

not null, e.g. not destroy()'ed.

Definition at line 161 of file Context.java.

Here is the caller graph for this function:

◆ makeCurrent()

boolean com.jogamp.openal.sound3d.Context.makeCurrent ( final boolean  throwException) throws ALException

Makes the audio context current on the calling thread.

Recursive call to makeCurrent() and hence release() are supported.

At any point in time one context can only be current on one thread, and one thread can only have one context current.

Parameters
throwExceptionif true, throws ALException if getALContext() is null, current thread holds another context or failed to natively make current
Returns
true if getALContext() is valid, current thread holds no other context and context successfully made current, otherwise false
See also
release()

Definition at line 231 of file Context.java.

Here is the caller graph for this function:

◆ recreate()

boolean com.jogamp.openal.sound3d.Context.recreate ( final int[]  attributes)

Recreates the internal ALCcontext instance, i.e.

destroys it first if getALContext() not null.

Context is made current again if it was current before.

Parameters
attributeslost of ALCcontext attributes for context creation
Returns
true if the internal context has been successfully recreated and made current again if was current before, otherwise false

Definition at line 137 of file Context.java.

Here is the call graph for this function:

◆ release()

boolean com.jogamp.openal.sound3d.Context.release ( final boolean  throwException) throws ALException

Releases control of this audio context from the current thread, if implementation utilizes context locking.

Recursive call to makeCurrent() and hence release() are supported.

If native release fails, internal lock is not released.

Parameters
throwExceptionif true, throws ALException if context has not been previously made current on current thread or native release failed.
Returns
true if context has previously been made current on the current thread and successfully released, otherwise false
See also
makeCurrent()

Definition at line 302 of file Context.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ suspend()

void com.jogamp.openal.sound3d.Context.suspend ( )

Suspend this context.

Definition at line 332 of file Context.java.

Here is the call graph for this function:

◆ toString()

String com.jogamp.openal.sound3d.Context.toString ( )

Definition at line 346 of file Context.java.

◆ tryMakeCurrent()

boolean com.jogamp.openal.sound3d.Context.tryMakeCurrent ( final boolean  throwException,
final long  timeoutMS 
) throws RuntimeException

Definition at line 215 of file Context.java.

Member Data Documentation

◆ hasALC_thread_local_context

final boolean com.jogamp.openal.sound3d.Context.hasALC_thread_local_context

Definition at line 54 of file Context.java.


The documentation for this class was generated from the following file: