|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpaulscode.sound.Library
paulscode.sound.libraries.LibraryJOAL
public class LibraryJOAL
The LibraryJOAL class interfaces the JOAL binding of OpenAL.
This software is based on or using the JOAL Library available from
http://joal.dev.java.net/
JOAL License:
Copyright (c) 2003 Sun Microsystems, Inc. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
-Redistribution of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
-Redistribution in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of Sun Microsystems, Inc. or the names of contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
This software is provided "AS IS," without a warranty of any kind.
ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MIDROSYSTEMS, INC. ("SUN") AND ITS
LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A
RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT
OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS
BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
You acknowledge that this software is not designed or intended for use in the
design, construction, operation or maintenance of any nuclear facility.
SoundSystem LibraryJOAL License:
You are free to use this library for any purpose, commercial or otherwise.
You may modify this library or source code, and distribute it any way you
like, provided the following conditions are met:
1) You must abide by the conditions of the aforementioned JOAL License.
2) You may not falsely claim to be the author of this library or any
unmodified portion of it.
3) You may not copyright this library or a modified version of it and then
sue me for copyright infringement.
4) If you modify the source code, you must clearly document the changes
made before redistributing the modified source code, so other users know
it is not the original code.
5) You are not required to give me credit for this library in any derived
work, but if you do, you must also mention my website:
http://www.paulscode.com
6) I the author will not be responsible for any damages (physical,
financial, or otherwise) caused by the use if this library or any part
of it.
7) I the author do not guarantee, warrant, or make any representations,
either expressed or implied, regarding the use of this library or any
part of it.
Author: Paul Lamb
http://www.paulscode.com
| Nested Class Summary | |
|---|---|
static class |
LibraryJOAL.Exception
The LibraryJOAL.Exception class provides library-specific error information. |
| Field Summary |
|---|
| Fields inherited from class paulscode.sound.Library |
|---|
bufferMap, listener, normalChannels, reverseByteOrder, sourceMap, streamingChannels, streamThread |
| Constructor Summary | |
|---|---|
LibraryJOAL()
Constructor: Instantiates the source map, buffer map and listener information. |
|
| Method Summary | |
|---|---|
static boolean |
alPitchSupported()
Whether or not the AL_PITCH control is supported. |
void |
cleanup()
Stops all sources, shuts down OpenAL, and removes references to all instantiated objects. |
void |
copySources(java.util.HashMap<java.lang.String,Source> srcMap)
Creates sources based on the source map provided. |
protected Channel |
createChannel(int type)
Creates a new channel of the specified type (normal or streaming). |
void |
dopplerChanged()
The Doppler parameters have changed. |
static net.java.games.joal.AL |
getAL()
Returns a handle to OpenAL, or null if OpenAL is not initialized. |
java.lang.String |
getClassName()
Returns the name of the class. |
static java.lang.String |
getDescription()
Returns a longer description of this library type. |
static java.lang.String |
getTitle()
Returns the short title of this library type. |
void |
init()
Initializes OpenAL, creates the listener, and grabs up audio channels. |
static boolean |
libraryCompatible()
Checks if the OpenAL library type is compatible. |
boolean |
loadSound(FilenameURL filenameURL)
Pre-loads a sound into memory. |
boolean |
loadSound(SoundBuffer buffer,
java.lang.String identifier)
Saves the specified sample data, under the specified identifier. |
void |
newSource(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll)
Creates a new source and places it into the source map. |
void |
quickPlay(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
Creates and immediately plays a new source. |
void |
rawDataStream(javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
Opens a direct line for streaming audio data. |
void |
setListenerAngle(float angle)
Changes the listeners orientation to the specified 'angle' radians counterclockwise around the y-Axis. |
void |
setListenerData(ListenerData l)
Changes the listeners position and orientation using the specified listener data. |
void |
setListenerOrientation(float lookX,
float lookY,
float lookZ,
float upX,
float upY,
float upZ)
Changes the listeners orientation using the specified coordinates. |
void |
setListenerPosition(float x,
float y,
float z)
Changes the listener's position. |
void |
setListenerVelocity(float x,
float y,
float z)
Sets the listener's velocity, for use in Doppler effect. |
void |
setMasterVolume(float value)
Sets the overall volume to the specified value, affecting all sources. |
void |
unloadSound(java.lang.String filename)
Removes a pre-loaded sound from memory. |
| Methods inherited from class paulscode.sound.Library |
|---|
activate, checkFadeVolumes, cull, dequeueSound, errorCheck, errorMessage, fadeOut, fadeOutIn, feedRawAudioData, feedRawAudioData, flush, getAllLoadedFilenames, getAllSourcenames, getListenerData, getMidiChannel, getPitch, getSource, getSources, getVolume, importantMessage, listenerMoved, loadMidi, message, midiSourcename, millisecondsPlayed, moveListener, pause, play, play, printStackTrace, queueSound, removeSource, removeTemporarySources, replaySources, reverseByteOrder, rewind, setAttenuation, setDistOrRoll, setLooping, setMidiChannel, setPitch, setPosition, setPriority, setTemporary, setVelocity, setVolume, stop, turnListener, unloadMidi |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LibraryJOAL()
throws SoundSystemException
SoundSystemException| Method Detail |
|---|
public void init()
throws SoundSystemException
init in class LibrarySoundSystemExceptionpublic static boolean libraryCompatible()
protected Channel createChannel(int type)
SoundSystemConfig class.
createChannel in class Librarytype - Type of channel.
public void cleanup()
cleanup in class Librarypublic boolean loadSound(FilenameURL filenameURL)
loadSound in class LibraryfilenameURL - Filename/URL of the sound file to load.
public boolean loadSound(SoundBuffer buffer,
java.lang.String identifier)
loadSound in class Librarybuffer - the sample data and audio format to save.identifier - What to call the sample.
public void unloadSound(java.lang.String filename)
unloadSound in class Libraryfilename - Filename/identifier of the sound file to unload.public void setMasterVolume(float value)
setMasterVolume in class Libraryvalue - New volume, float value ( 0.0f - 1.0f ).
public void newSource(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll)
newSource in class Librarypriority - Setting this to true will prevent other sounds from overriding this one.toStream - Setting this to true will load the sound in pieces rather than all at once.toLoop - Should this source loop, or play only once.sourcename - A unique identifier for this source. Two sources may not use the same sourcename.filenameURL - Filename/URL of the sound file to play at this source.x - X position for this source.y - Y position for this source.z - Z position for this source.attModel - Attenuation model to use.distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".
public void rawDataStream(javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
rawDataStream in class LibraryaudioFormat - Format that the data will be in.priority - Setting this to true will prevent other sounds from overriding this one.sourcename - A unique identifier for this source. Two sources may not use the same sourcename.x - X position for this source.y - Y position for this source.z - Z position for this source.attModel - Attenuation model to use.distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".
public void quickPlay(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
quickPlay in class Librarypriority - Setting this to true will prevent other sounds from overriding this one.toStream - Setting this to true will load the sound in pieces rather than all at once.toLoop - Should this source loop, or play only once.sourcename - A unique identifier for this source. Two sources may not use the same sourcename.filenameURL - Filename/URL of the sound file to play at this source.x - X position for this source.y - Y position for this source.z - Z position for this source.attModel - Attenuation model to use.distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".temporary - Whether or not this source should be removed after it finishes playing.public void copySources(java.util.HashMap<java.lang.String,Source> srcMap)
copySources in class LibrarysrcMap - Sources to copy.
public void setListenerPosition(float x,
float y,
float z)
setListenerPosition in class Libraryx - Destination X coordinate.y - Destination Y coordinate.z - Destination Z coordinate.public void setListenerAngle(float angle)
setListenerAngle in class Libraryangle - Radians.
public void setListenerOrientation(float lookX,
float lookY,
float lookZ,
float upX,
float upY,
float upZ)
setListenerOrientation in class LibrarylookX - X element of the look-at direction.lookY - Y element of the look-at direction.lookZ - Z element of the look-at direction.upX - X element of the up direction.upY - Y element of the up direction.upZ - Z element of the up direction.public void setListenerData(ListenerData l)
setListenerData in class Libraryl - Listener data to use.
public void setListenerVelocity(float x,
float y,
float z)
setListenerVelocity in class Libraryx - Velocity along world x-axis.y - Velocity along world y-axis.z - Velocity along world z-axis.public void dopplerChanged()
dopplerChanged in class Librarypublic static net.java.games.joal.AL getAL()
public static boolean alPitchSupported()
public static java.lang.String getTitle()
public static java.lang.String getDescription()
public java.lang.String getClassName()
getClassName in class Library
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||