Class OALObject
java.lang.Object
com.blackrook.gloop.openal.OALObject
- Direct Known Subclasses:
OALBuffer, OALEffect, OALEffectSlot, OALFilter, OALSource
Generic OpenAL object type.
Since this is managed internally by OpenAL, the handles to these
objects are "names" (aka integer IDs) rather than memory addresses.
- Author:
- Matthew Tropiano
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOALObject(OALContext context) Allocates a new OpenAL object. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract intallocate()Allocates a new type of this object in OpenAL.protected voidConvenience method for clearing the OpenAL error state.voiddestroy()Destroys this object.booleanTests if this OpenAL object equals the provided one.booleanprotected final voidConvenience method for checking for an OpenAL error and throwing a SoundException if an error is raised.protected abstract voidfree()Destroys this object (deallocates it on OpenAL).final intgetName()inthashCode()protected OALSystem.ContextLockSets a new context as current, in order to hold a context as current for an AL call.toString()
-
Constructor Details
-
OALObject
Allocates a new OpenAL object. Calls allocate().- Parameters:
context- the managing context.
-
-
Method Details
-
getName
public final int getName()- Returns:
- this OALObject's OpenAL object id.
-
hashCode
-
equals
-
equals
Tests if this OpenAL object equals the provided one.- Parameters:
obj- the object to test.- Returns:
- true if so, false if not.
-
destroy
public void destroy()Destroys this object.- Throws:
SoundException- if an error occurred destroying the object.
-
allocate
protected abstract int allocate()Allocates a new type of this object in OpenAL. Called by OALObject constructor.- Returns:
- the ALId of this new object.
- Throws:
SoundException- if the allocation cannot happen.
-
free
protected abstract void free()Destroys this object (deallocates it on OpenAL). This is called by destroy().- Throws:
SoundException- if the deallocation cannot happen.
-
requestContext
Sets a new context as current, in order to hold a context as current for an AL call.- Returns:
- a context lock for notifying releasing control of the thread.
-
clearError
protected void clearError()Convenience method for clearing the OpenAL error state. -
errorCheck
protected final void errorCheck()Convenience method for checking for an OpenAL error and throwing a SoundException if an error is raised. -
toString
-