Class AudioSystem3D


  • public class AudioSystem3D
    extends Object
    The AudioSystem3D class provides a set of methods for creating and manipulating a 3D audio environment.
    Author:
    Athomas Goldberg
    • Constructor Detail

      • AudioSystem3D

        public AudioSystem3D()
    • Method Detail

      • init

        @Deprecated
        public static void init()
                         throws ALException
        Deprecated.
        Not required to be called due to static initialization
        Initialize the Sound3D environment.
        Throws:
        ALException
      • isAvailable

        public static boolean isAvailable()
        Returns the available state of this instance.

        The available state is affected by this instance overall availability, i.e. after instantiation.

      • getALError

        public int getALError()
      • createContext

        public static Context createContext​(Device device)
        Creates a new Sound3D Context for a specified device.
        Parameters:
        device - The device the Context is being created for.
        Returns:
        The new Sound3D context.
      • makeContextCurrent

        public static boolean makeContextCurrent​(Context context)
        Makes the specified context the current context.
        Parameters:
        context - the context to make current.
      • releaseContext

        public static boolean releaseContext​(Context context)
        Release the specified context.
        Parameters:
        context - the context to release.
      • openDevice

        public static Device openDevice​(String deviceName)
        Opens the named audio device.
        Parameters:
        deviceName - The specified device name, null for default.
        Returns:
        The device described by the specified name
      • generateBuffers

        public static Buffer[] generateBuffers​(int numBuffers)
        Generate an array of Sound3D buffers.
        Parameters:
        numBuffers - The number of Sound3D buffers to generate.
        Returns:
        an array of (initially enpty) Sound3D buffers.
      • loadBuffer

        public static Buffer loadBuffer​(String filename)
                                 throws IOException,
                                        UnsupportedAudioFileException
        Loads a Sound3D buffer with the specified audio file.
        Parameters:
        filename - the name of the file to load.
        Returns:
        a new Sound3D buffer containing the audio data from the specified file.
        Throws:
        IOException - If the file cannot be found or some other IO error occurs.
        UnsupportedAudioFileException - If the format of the audio data is not supported
      • loadBuffer

        public static Buffer loadBuffer​(InputStream stream)
                                 throws IOException,
                                        UnsupportedAudioFileException
        Loads a Sound3D buffer with the specified audio file.
        Parameters:
        stream - contains the stream associated with the audio file.
        Returns:
        a new Sound3D buffer containing the audio data from the passed stream.
        Throws:
        IOException - If the stream cannot be read or some other IO error occurs.
        UnsupportedAudioFileException - If the format of the audio data is not supported
      • loadSource

        public static Source loadSource​(String filename)
                                 throws IOException,
                                        UnsupportedAudioFileException
        Loads a Sound3D Source with the specified audio file. This is functionally equivalent to generateSource(loadBuffer(fileName));
        Parameters:
        filename - the name of the file to load.
        Returns:
        a new Sound3D Source containing the audio data from the specified file.
        Throws:
        IOException - If the file cannot be found or some other IO error occurs.
        UnsupportedAudioFileException - If the format of the audio data is not supported
      • loadSource

        public static Source loadSource​(InputStream stream)
                                 throws IOException,
                                        UnsupportedAudioFileException
        Loads a Sound3D Source with the specified audio stream. This is functionally equivalent to generateSource(loadBuffer(stream));
        Parameters:
        stream - contains the stream associated with the audio file.
        Returns:
        a new Sound3D Source containing the audio data from the passed stream.
        Throws:
        IOException - If the file cannot be found or some other IO error occurs.
        UnsupportedAudioFileException - If the format of the audio data is not supported
      • generateSources

        public static Source[] generateSources​(int numSources)
        Generates a set of uninitialized Source3D sources
        Parameters:
        numSources - the number of Sound3D sources to generate.
        Returns:
        an array of uninitialized sources.
      • generateSource

        public static Source generateSource​(Buffer buff)
        Generate a Sound3D source from an initialized Buffer.
        Parameters:
        buff - The buffer to be associate with the source.
        Returns:
        the newly generated Source.
      • getListener

        public static Listener getListener()
        Get the listener object associated with this Sound3D environment.
        Returns:
        The listener object.