Class OALObject

java.lang.Object
com.blackrook.gloop.openal.OALObject
Direct Known Subclasses:
OALBuffer, OALEffect, OALEffectSlot, OALFilter, OALSource

public abstract class OALObject extends Object
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

    Constructors
    Modifier
    Constructor
    Description
    protected
    Allocates a new OpenAL object.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract int
    Allocates a new type of this object in OpenAL.
    protected void
    Convenience method for clearing the OpenAL error state.
    void
    Destroys this object.
    boolean
    Tests if this OpenAL object equals the provided one.
    boolean
     
    protected final void
    Convenience method for checking for an OpenAL error and throwing a SoundException if an error is raised.
    protected abstract void
    Destroys this object (deallocates it on OpenAL).
    final int
     
    int
     
    Sets a new context as current, in order to hold a context as current for an AL call.
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • OALObject

      protected OALObject(OALContext context)
      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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals

      public boolean equals(OALObject obj)
      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

      protected OALSystem.ContextLock 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

      public String toString()
      Overrides:
      toString in class Object