Package toxi.audio
Class JOALUtil
java.lang.Object
toxi.audio.JOALUtil
JOAL convenience wrapper. Full
documentation forthcoming. Please see the attached Processing demo & source
distribution of this package for basic usage.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes & releases all sources and buffers created via this class.boolean
boolean
deleteSource
(AudioSource src) boolean
deleteSource
(AudioSource src, boolean killBuffer) generateBuffers
(int numBuffers) Creates the specified number of audio sample buffers and returns an array ofAudioBuffer
wrappers.Convenience wrapper forgenerateSources(int)
to create a singleAudioSource
.generateSourceFromFile
(String file) Convenience wrapper bundlingloadBuffer(String)
&generateSource()
in a single method call.generateSources
(int numSources) Creates the specified number of hardware audio sources required to actually play the sample data stored inAudioBuffer
s.net.java.games.joal.AL
getAL()
Returns a direct reference to the OpenAL API.String[]
Retrieves a list of available OpenAL compatible audio devices.static JOALUtil
Returns theSoundListener
instance for the associated OpenAL context.boolean
init()
Initializes the OpenAL context.boolean
Initializes the OpenAL context and if parameter is true, will attempt to also setup an EAX environment.boolean
Checks if EAX are supported by the underlying hardware.Loads a WAV file from the givenInputStream
.loadBuffer
(String fileName) Loads a WAV file (mono/stereo) from the specified file namevoid
shutdown()
Destroys all objects, sources, buffers, contexts created by this class.
-
Field Details
-
HARDWARE
-
SOFTWARE
-
logger
-
-
Method Details
-
getInstance
-
deleteAll
public void deleteAll()Deletes & releases all sources and buffers created via this class. -
deleteBuffer
-
deleteSource
-
deleteSource
-
generateBuffers
Creates the specified number of audio sample buffers and returns an array ofAudioBuffer
wrappers.- Parameters:
numBuffers
- number of requested buffers- Returns:
- array
-
generateSource
Convenience wrapper forgenerateSources(int)
to create a singleAudioSource
.- Returns:
- audio source instance
-
generateSourceFromFile
Convenience wrapper bundlingloadBuffer(String)
&generateSource()
in a single method call. Generates a newAudioSource
and assigns the sample buffer created from the given WAV file.- Parameters:
file
- absolute path to WAV file- Returns:
- configured audio source instance
-
generateSources
Creates the specified number of hardware audio sources required to actually play the sample data stored inAudioBuffer
s.- Parameters:
numSources
- number of sources required- Returns:
- array
-
getAL
public net.java.games.joal.AL getAL()Returns a direct reference to the OpenAL API.- Returns:
- JOAL context
-
getDeviceList
Retrieves a list of available OpenAL compatible audio devices. This method can be called before a call toinit()
.- Returns:
- array of device names
-
getListener
Returns theSoundListener
instance for the associated OpenAL context.- Returns:
- listener object
-
init
public boolean init()Initializes the OpenAL context. Safe to be called multiple times (only first time is executed).- Returns:
- true, if successful
-
init
Initializes the OpenAL context and if parameter is true, will attempt to also setup an EAX environment. The method does nothing if it had been called previously and not beenshutdown()
meanwhile.- Parameters:
attemptEAX
-- Returns:
- true, if successful (does not care if EAX is supported & has succeeded).
-
isEAXSupported
public boolean isEAXSupported()Checks if EAX are supported by the underlying hardware.- Returns:
- true, if supported.
-
loadBuffer
Loads a WAV file from the givenInputStream
.- Parameters:
is
- input stream- Returns:
- buffer wrapper instance
- Throws:
UnsupportedAudioFileException
IOException
-
loadBuffer
Loads a WAV file (mono/stereo) from the specified file name- Parameters:
fileName
- audio file name- Returns:
- buffer wrapper instance
- Throws:
IOException
UnsupportedAudioFileException
-
shutdown
public void shutdown()Destroys all objects, sources, buffers, contexts created by this class.
-