Package com.jogamp.openal.sound3d
Class AudioSystem3D
- java.lang.Object
-
- 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
Constructors Constructor Description AudioSystem3D()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ContextcreateContext(Device device)Creates a new Sound3D Context for a specified device.static Buffer[]generateBuffers(int numBuffers)Generate an array of Sound3D buffers.static SourcegenerateSource(Buffer buff)Generate a Sound3D source from an initialized Buffer.static Source[]generateSources(int numSources)Generates a set of uninitialized Source3D sourcesintgetALError()static ListenergetListener()Get the listener object associated with this Sound3D environment.static voidinit()Deprecated.Not required to be called due to static initializationstatic booleanisAvailable()Returns theavailable stateof this instance.static BufferloadBuffer(InputStream stream)Loads a Sound3D buffer with the specified audio file.static BufferloadBuffer(String filename)Loads a Sound3D buffer with the specified audio file.static SourceloadSource(InputStream stream)Loads a Sound3D Source with the specified audio stream.static SourceloadSource(String filename)Loads a Sound3D Source with the specified audio file.static booleanmakeContextCurrent(Context context)Makes the specified context the current context.static DeviceopenDevice(String deviceName)Opens the named audio device.static booleanreleaseContext(Context context)Release the specified context.
-
-
-
Method Detail
-
init
@Deprecated public static void init() throws ALException
Deprecated.Not required to be called due to static initializationInitialize the Sound3D environment.- Throws:
ALException
-
isAvailable
public static boolean isAvailable()
Returns theavailable stateof this instance.The
available stateis 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.
-
-