Class ALAudioSink

  • All Implemented Interfaces:
    AudioSink

    public final class ALAudioSink
    extends Object
    implements AudioSink
    OpenAL AudioSink implementation.

    Besides given AudioSink functionality, implementation is fully functional regarding AudioFormat and all OpenAL parameter.

    • All OpenAL parameter can be queried
    • Instance can be constructed with an OpenAL device and context, see #ALAudioSink(ALCdevice, ALCcontext)
    • Initialization can be performed with OpenAL paramters, see #init(int, int, int, int, int, float, int, int, int)

    • Constructor Detail

      • ALAudioSink

        public ALAudioSink()
                    throws ALException
        Create a new instance with a new default ALCdevice
        Throws:
        ALException - if the default ALCdevice couldn't be fully created including its context.
      • ALAudioSink

        public ALAudioSink​(String deviceName)
                    throws ALException
        Create a new instance with a new named ALCdevice
        Parameters:
        deviceName - name of
        Throws:
        ALException - if the default ALCdevice couldn't be fully created including its context.
      • ALAudioSink

        public ALAudioSink​(Device alDevice)
                    throws ALException
        Create a new instance with an optional given ALCdevice
        Parameters:
        alDevice - optional OpenAL Device, a default device is opened if null.
        Throws:
        ALException - if the default ALCdevice couldn't be fully created including its context.
    • Method Detail

      • isInitialized

        public static boolean isInitialized()
        Returns true if OpenAL has been loaded and static fields ALC, AL and ALExt have been initialized successfully, otherwise false.
      • getAL

        public static final AL getAL()
        Return OpenAL global AL.
      • getALC

        public static final ALC getALC()
        Return OpenAL global ALC.
      • getALExt

        public static final ALExt getALExt()
        Return OpenAL global ALExt.
      • getDevice

        public final Device getDevice()
        Return this instance's OpenAL Device.
      • getContext

        public final Context getContext()
        Return this instance's OpenAL Context.
      • getSource

        public final Source getSource()
        Return this instance's OpenAL Source.
      • hasSOFTBufferSamples

        public final boolean hasSOFTBufferSamples()
        Return whether OpenAL extension AL_SOFT_buffer_samples is available.
      • hasEXTMcFormats

        public final boolean hasEXTMcFormats()
        Return whether OpenAL extension AL_EXT_MCFORMATS is available.
      • hasEXTFloat32

        public final boolean hasEXTFloat32()
        Return whether OpenAL extension AL_EXT_FLOAT32 is available.
      • hasEXTDouble

        public final boolean hasEXTDouble()
        Return whether OpenAL extension AL_EXT_DOUBLE is available.
      • hasALCThreadLocalContext

        public final boolean hasALCThreadLocalContext()
        Return whether OpenAL extension ALC_EXT_thread_local_context is available.
      • getALChannelLayout

        public final int getALChannelLayout()
        Return this instance's OpenAL channel layout, set after #init(AudioFormat, float, int, int, int).
      • getALSampleType

        public final int getALSampleType()
        Return this instance's OpenAL sample type, set after #init(AudioFormat, float, int, int, int).
      • getALFormat

        public final int getALFormat()
        Return this instance's OpenAL format, set after #init(AudioFormat, float, int, int, int).
      • makeCurrent

        public final boolean makeCurrent​(boolean throwException)
        Specified by:
        makeCurrent in interface AudioSink
      • release

        public final boolean release​(boolean throwException)
        Specified by:
        release in interface AudioSink
      • getPerfString

        public final String getPerfString()
      • setChannelLimit

        public final void setChannelLimit​(int cc)
        Specified by:
        setChannelLimit in interface AudioSink
      • init

        public final boolean init​(AudioFormat requestedFormat,
                                  int frameDuration,
                                  int initialQueueSize,
                                  int queueGrowAmount,
                                  int queueLimit)
        Specified by:
        init in interface AudioSink
      • destroy

        public final void destroy()
        Specified by:
        destroy in interface AudioSink
      • isAvailable

        public final boolean isAvailable()
        Specified by:
        isAvailable in interface AudioSink
      • isPlaying

        public final boolean isPlaying()
        Specified by:
        isPlaying in interface AudioSink
      • play

        public final void play()
        Specified by:
        play in interface AudioSink
      • pause

        public final void pause()
        Specified by:
        pause in interface AudioSink
      • setPlaySpeed

        public final boolean setPlaySpeed​(float rate)
        Specified by:
        setPlaySpeed in interface AudioSink
      • getVolume

        public final float getVolume()
        Specified by:
        getVolume in interface AudioSink
      • setVolume

        public final boolean setVolume​(float v)
        Specified by:
        setVolume in interface AudioSink
      • flush

        public final void flush()
        Specified by:
        flush in interface AudioSink
      • getPTS

        public final int getPTS()
        Specified by:
        getPTS in interface AudioSink