Top Description Fields Constructors Methods
com.jogamp.openal.sound3d

public Class AudioSystem3D

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .IOException, .InputStream, com.jogamp.openal.AL, .ALC, .ALCcontext, .ALCdevice, .ALException, .ALFactory, .UnsupportedAudioFileException, com.jogamp.openal.util.WAVData, .WAVLoader

The AudioSystem3D class provides a set of methods for creating and manipulating a 3D audio environment.
Author
Athomas Goldberg

Field Summary

Modifier and TypeField and Description
private static AL
private static ALC
private static Listener

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Context

Returns:

The new Sound3D context.
createContext
(final Device
The device the Context is being created for.
device
)

Creates a new Sound3D Context for a specified device.

public static Buffer[]

Returns:

an array of (initially enpty) Sound3D buffers.
generateBuffers
(final int
The number of Sound3D buffers to generate.
numBuffers
)

Generate an array of Sound3D buffers.

public static Source

Returns:

the newly generated Source.
generateSource
(final Buffer
The buffer to generate the source from.
buff
)

Generate a Sound3D source from an initialized Buffer.

public static Source[]

Returns:

an array of uninitialized sources.
generateSources
(final int
the number of Sound3D sources to generate.
numSources
)

Generates a set of uninitialized Source3D sources

public static Listener

Returns:

The listener object.
getListener
()

Get the listener object associated with this Sound3D environment.

public static void
init()

Iniitalize the Sound3D environment.

public static Buffer

Returns:

a new Sound3D buffer containing the audio data from the specified file.
loadBuffer
(final String
the name of the file to load.
filename
)

Loads a Sound3D buffer with the specified audio file.

public static Buffer

Returns:

a new Sound3D buffer containing the audio data from the passed stream.
loadBuffer
(InputStream
contains the stream associated with the audio file.
stream
)

Loads a Sound3D buffer with the specified audio file.

public static Source

Returns:

a new Sound3D Source containing the audio data from the specified file.
loadSource
(final String
the name of the file to load.
filename
)

Loads a Sound3D Source with the specified audio file.

public static Source

Returns:

a new Sound3D Source containing the audio data from the passed stream.
loadSource
(final InputStream
contains the stream associated with the audio file.
stream
)

Loads a Sound3D Source with the specified audio stream.

public static void
makeContextCurrent(final Context
the context to make current.
context
)

Makes the specified context the current context.

public static Device

Returns:

The device described by the specifed name.
openDevice
(final String
The specified device name, On windows this will be DirectSound3D. We will be automating device discovery in upcoming versions of this class.
deviceName
)

Opens the specifified audio device.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alback to summary
private static AL al
alcback to summary
private static ALC alc
listenerback to summary
private static Listener listener

Constructor Detail

AudioSystem3Dback to summary
public AudioSystem3D()

Method Detail

createContextback to summary
public static Context createContext(final Device device)

Creates a new Sound3D Context for a specified device.

Parameters
device:Device

The device the Context is being created for.

Returns:Context

The new Sound3D context.

generateBuffersback to summary
public static Buffer[] generateBuffers(final int numBuffers)

Generate an array of Sound3D buffers.

Parameters
numBuffers:int

The number of Sound3D buffers to generate.

Returns:Buffer[]

an array of (initially enpty) Sound3D buffers.

generateSourceback to summary
public static Source generateSource(final Buffer buff)

Generate a Sound3D source from an initialized Buffer.

Parameters
buff:Buffer

The buffer to generate the source from.

Returns:Source

the newly generated Source.

generateSourcesback to summary
public static Source[] generateSources(final int numSources)

Generates a set of uninitialized Source3D sources

Parameters
numSources:int

the number of Sound3D sources to generate.

Returns:Source[]

an array of uninitialized sources.

getListenerback to summary
public static Listener getListener()

Get the listener object associated with this Sound3D environment.

Returns:Listener

The listener object.

initback to summary
public static void init() throws ALException

Iniitalize the Sound3D environment. This must be called before other methods in the class can be used.

loadBufferback to summary
public static Buffer loadBuffer(final String filename) throws IOException, UnsupportedAudioFileException

Loads a Sound3D buffer with the specified audio file.

Parameters
filename:String

the name of the file to load.

Returns:Buffer

a new Sound3D buffer containing the audio data from the specified file.

Exceptions
IOException:
If the file cannot be found or some other IO error occurs.
UnsupportedAudioFileException:
If the format of the audio data is not supported
loadBufferback to summary
public static Buffer loadBuffer(InputStream stream) throws IOException, UnsupportedAudioFileException

Loads a Sound3D buffer with the specified audio file.

Parameters
stream:InputStream

contains the stream associated with the audio file.

Returns:Buffer

a new Sound3D buffer containing the audio data from the passed stream.

Exceptions
IOException:
If the stream cannot be read or some other IO error occurs.
UnsupportedAudioFileException:
If the format of the audio data is not supported
loadSourceback to summary
public static Source loadSource(final String filename) throws IOException, UnsupportedAudioFileException

Loads a Sound3D Source with the specified audio file. This is functionally equivalent to generateSource(loadBuffer(fileName));

Parameters
filename:String

the name of the file to load.

Returns:Source

a new Sound3D Source containing the audio data from the specified file.

Exceptions
IOException:
If the file cannot be found or some other IO error occurs.
UnsupportedAudioFileException:
If the format of the audio data is not supported
loadSourceback to summary
public static Source loadSource(final InputStream stream) throws IOException, UnsupportedAudioFileException

Loads a Sound3D Source with the specified audio stream. This is functionally equivalent to generateSource(loadBuffer(stream));

Parameters
stream:InputStream

contains the stream associated with the audio file.

Returns:Source

a new Sound3D Source containing the audio data from the passed stream.

Exceptions
IOException:
If the file cannot be found or some other IO error occurs.
UnsupportedAudioFileException:
If the format of the audio data is not supported
makeContextCurrentback to summary
public static void makeContextCurrent(final Context context)

Makes the specified context the current context.

Parameters
context:Context

the context to make current.

openDeviceback to summary
public static Device openDevice(final String deviceName)

Opens the specifified audio device.

Parameters
deviceName:String

The specified device name, On windows this will be DirectSound3D. We will be automating device discovery in upcoming versions of this class.

Returns:Device

The device described by the specifed name.