com.jogamp.openal.sound3d
Class AudioSystem3D

java.lang.Object
  extended by com.jogamp.openal.sound3d.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 Summary
AudioSystem3D()
           
 
Method Summary
static Context createContext(Device device)
          Creates a new Sound3D Context for a specified device.
static Buffer[] generateBuffers(int numBuffers)
          Generate an array of Sound3D buffers.
static Source generateSource(Buffer buff)
          Generate a Sound3D source from an initialized Buffer.
static Source[] generateSources(int numSources)
          Generates a set of uninitialized Source3D sources
static Listener getListener()
          Get the listener object associated with this Sound3D environment.
static void init()
          Iniitalize the Sound3D environment.
static Buffer loadBuffer(InputStream stream)
          Loads a Sound3D buffer with the specified audio file.
static Buffer loadBuffer(String filename)
          Loads a Sound3D buffer with the specified audio file.
static Source loadSource(InputStream stream)
          Loads a Sound3D Source with the specified audio stream.
static Source loadSource(String filename)
          Loads a Sound3D Source with the specified audio file.
static void makeContextCurrent(Context context)
          Makes the specified context the current context.
static Device openDevice(String deviceName)
          Opens the specifified audio device.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioSystem3D

public AudioSystem3D()
Method Detail

init

public static void init()
                 throws ALException
Iniitalize the Sound3D environment. This must be called before other methods in the class can be used.

Throws:
ALException

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 void makeContextCurrent(Context context)
Makes the specified context the current context.

Parameters:
context - the context to make current.

openDevice

public static Device openDevice(String deviceName)
Opens the specifified audio device.

Parameters:
deviceName - The specified device name, On windows this will be DirectSound3D. We will be automating device discovery in upcoming versions of this class.
Returns:
The device described by the specifed 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 generate the source from.
Returns:
the newly generated Source.

getListener

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

Returns:
The listener object.