|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpaulscode.sound.Source
paulscode.sound.libraries.SourceLWJGLOpenAL
public class SourceLWJGLOpenAL
The SourceLWJGLOpenAL class provides an interface to the lwjgl binding of OpenAL.
This software is based on or using the LWJGL Lightweight Java Gaming
Library available from
http://www.lwjgl.org/.
LWJGL License:
Copyright (c) 2002-2008 Lightweight Java Game Library Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions 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 'Light Weight Java Game Library' nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SoundSystem LibraryLWJGLOpenAL 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 LWJGL 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
| Field Summary |
|---|
| Fields inherited from class paulscode.sound.Source |
|---|
attModel, channel, codec, distanceFromListener, distOrRoll, fadeInGain, fadeInMilis, fadeOutGain, fadeOutMilis, filenameURL, gain, lastFadeCheck, libraryType, nextBuffers, nextCodec, pitch, position, preLoad, priority, rawDataFormat, rawDataStream, soundBuffer, soundSequenceLock, soundSequenceQueue, sourcename, sourceVolume, temporary, toLoop, toPlay, toStream, velocity |
| Constructor Summary | |
|---|---|
SourceLWJGLOpenAL(java.nio.FloatBuffer listenerPosition,
javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
Constructor: Creates a new streaming source that will be directly fed with raw audio data. |
|
SourceLWJGLOpenAL(java.nio.FloatBuffer listenerPosition,
java.nio.IntBuffer myBuffer,
boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
Constructor: Creates a new source using the specified parameters. |
|
SourceLWJGLOpenAL(java.nio.FloatBuffer listenerPosition,
java.nio.IntBuffer myBuffer,
Source old,
SoundBuffer soundBuffer)
Constructor: Creates a new source matching the specified source. |
|
| Method Summary | |
|---|---|
void |
changeSource(java.nio.FloatBuffer listenerPosition,
java.nio.IntBuffer myBuffer,
boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
Changes the peripheral information about the source using the specified parameters. |
void |
cleanup()
Shuts the source down and removes references to all instantiated objects. |
boolean |
incrementSoundSequence()
Removes the next filename from the sound sequence queue and assigns it to this source. |
void |
listenerMoved()
Called every time the listener's position or orientation changes. |
void |
play(Channel c)
Plays the source on the specified channel. |
void |
positionChanged()
Recalculates the distance from the listner and the gain. |
boolean |
preLoad()
Queues up the initial stream-buffers for the stream. |
void |
setAttenuation(int model)
Sets this source's attenuation model. |
void |
setDistOrRoll(float dr)
Sets this source's fade distance or rolloff factor, depending on the attenuation model. |
void |
setLooping(boolean lp)
Sets whether this source should loop or only play once. |
void |
setPitch(float value)
Manually sets this source's pitch. |
void |
setPosition(float x,
float y,
float z)
Moves the source to the specified position. |
void |
setVelocity(float x,
float y,
float z)
Sets this source's velocity, for use in Doppler effect. |
| Methods inherited from class paulscode.sound.Source |
|---|
activate, active, changeSource, checkFadeOut, cull, dequeueSound, errorCheck, errorMessage, fadeOut, fadeOutIn, feedRawAudioData, flush, getClassName, getDistanceFromListener, getPitch, getSoundSequenceQueueSize, importantMessage, message, millisecondsPlayed, pause, paused, playing, printStackTrace, queueSound, readBuffersFromNextSoundInSequence, reverseByteOrder, rewind, setPriority, setTemporary, stop, stopped, stream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SourceLWJGLOpenAL(java.nio.FloatBuffer listenerPosition,
java.nio.IntBuffer myBuffer,
boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
listenerPosition - FloatBuffer containing the listener's 3D coordinates.myBuffer - OpenAL IntBuffer sound-buffer identifier to use for a new normal source.priority - Setting this to true will prevent other sounds from overriding this one.toStream - Setting this to true will create a streaming source.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.soundBuffer - Buffer containing audio data, or null if not loaded yet.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 'att'.temporary - Whether or not to remove this source after it finishes playing.
public SourceLWJGLOpenAL(java.nio.FloatBuffer listenerPosition,
java.nio.IntBuffer myBuffer,
Source old,
SoundBuffer soundBuffer)
listenerPosition - FloatBuffer containing the listener's 3D coordinates.myBuffer - OpenAL IntBuffer sound-buffer identifier to use for a new normal source.old - Source to copy information from.soundBuffer - Buffer containing audio data, or null if not loaded yet.
public SourceLWJGLOpenAL(java.nio.FloatBuffer listenerPosition,
javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
listenerPosition - FloatBuffer containing the listener's 3D coordinates.audioFormat - 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 'att'.| Method Detail |
|---|
public void cleanup()
cleanup in class Source
public void changeSource(java.nio.FloatBuffer listenerPosition,
java.nio.IntBuffer myBuffer,
boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
listenerPosition - FloatBuffer containing the listener's 3D coordinates.myBuffer - OpenAL IntBuffer sound-buffer identifier to use for a new normal source.priority - Setting this to true will prevent other sounds from overriding this one.toStream - Setting this to true will create a streaming source.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.soundBuffer - Buffer containing audio data, or null if not loaded yet.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 'att'.temporary - Whether or not to remove this source after it finishes playing.public boolean incrementSoundSequence()
incrementSoundSequence in class Sourcepublic void listenerMoved()
listenerMoved in class Source
public void setPosition(float x,
float y,
float z)
setPosition in class Sourcex - X coordinate to move to.y - Y coordinate to move to.z - Z coordinate to move to.public void positionChanged()
positionChanged in class Sourcepublic void setLooping(boolean lp)
setLooping in class Sourcelp - True or false.public void setAttenuation(int model)
setAttenuation in class Sourcemodel - Attenuation model to use.public void setDistOrRoll(float dr)
setDistOrRoll in class Sourcedr - New value for fade distance or rolloff factor.
public void setVelocity(float x,
float y,
float z)
setVelocity in class Sourcex - Velocity along world x-axis.y - Velocity along world y-axis.z - Velocity along world z-axis.public void setPitch(float value)
setPitch in class Sourcevalue - A float value ( 0.5f - 2.0f ).public void play(Channel c)
play in class Sourcec - Channel to play on.public boolean preLoad()
preLoad in class Source
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||