|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpaulscode.sound.Channel
paulscode.sound.libraries.ChannelLWJGLOpenAL
public class ChannelLWJGLOpenAL
The ChannelLWJGLOpenAL class is used to reserve a sound-card voice using the
lwjgl binding of OpenAL. Channels can be either normal or streaming
channels.
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 | |
|---|---|
int |
ALformat
OpenAL data format to use when playing back the assigned source. |
java.nio.IntBuffer |
ALSource
OpenAL's IntBuffer identifier for this channel. |
float |
millisPreviouslyPlayed
Miliseconds of buffers previously played (streaming sources). |
int |
sampleRate
Sample rate (speed) to use for play-back. |
| Fields inherited from class paulscode.sound.Channel |
|---|
attachedSource, buffersUnqueued, channelType, libraryType |
| Constructor Summary | |
|---|---|
ChannelLWJGLOpenAL(int type,
java.nio.IntBuffer src)
Constructor: takes channelType identifier and a handle to the OpenAL IntBuffer identifier to use for this channel. |
|
| Method Summary | |
|---|---|
boolean |
attachBuffer(java.nio.IntBuffer buf)
Attaches an OpenAL sound-buffer identifier for the sound data to be played back for a normal source. |
int |
buffersProcessed()
Returns the number of queued byte[] buffers that have finished playing. |
void |
cleanup()
Empties the streamBuffers list, stops and deletes the ALSource, shuts the channel down, and removes references to all instantiated objects. |
void |
close()
Stops the channel, dequeues any queued data, and closes the channel. |
int |
feedRawAudioData(byte[] buffer)
Feeds raw data to the stream. |
void |
flush()
Dequeues all previously queued data. |
float |
millisecondsPlayed()
Calculates the number of milliseconds since the channel began playing. |
float |
millisInBuffer(int alBufferi)
Returns the number of milliseconds of audio contained in specified buffer. |
void |
pause()
Temporarily stops playback for this channel. |
void |
play()
Plays the currently attached normal source, opens this channel up for streaming, or resumes playback if this channel was paused. |
boolean |
playing()
Used to determine if a channel is actively playing a source. |
boolean |
preLoadBuffers(java.util.LinkedList<byte[]> bufferList)
Queues up the initial byte[] buffers of data to be streamed. |
boolean |
queueBuffer(byte[] buffer)
Queues up a byte[] buffer of data to be streamed. |
void |
rewind()
Rewinds the attached source to the beginning. |
void |
setAudioFormat(javax.sound.sampled.AudioFormat audioFormat)
Sets the channel up to receive the specified audio format. |
void |
setFormat(int format,
int rate)
Sets the channel up to receive the specified OpenAL audio format and sample rate. |
void |
stop()
Stops playback for this channel and rewinds the attached source to the beginning. |
| Methods inherited from class paulscode.sound.Channel |
|---|
errorCheck, errorMessage, getClassName, importantMessage, message, printStackTrace, processBuffer |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public java.nio.IntBuffer ALSource
public int ALformat
public int sampleRate
public float millisPreviouslyPlayed
| Constructor Detail |
|---|
public ChannelLWJGLOpenAL(int type,
java.nio.IntBuffer src)
SoundSystemConfig class.
type - Type of channel (normal or streaming).src - Handle to the OpenAL source identifier.| Method Detail |
|---|
public void cleanup()
cleanup in class Channelpublic boolean attachBuffer(java.nio.IntBuffer buf)
buf - Intbuffer identifier for the sound data to play.
public void setAudioFormat(javax.sound.sampled.AudioFormat audioFormat)
setAudioFormat in class ChannelaudioFormat - Format to use when playing the stream data.
public void setFormat(int format,
int rate)
format - Format to use.rate - Sample rate (speed) to use.public boolean preLoadBuffers(java.util.LinkedList<byte[]> bufferList)
preLoadBuffers in class ChannelbufferList - List of the first buffers to be played for a streaming source.
public boolean queueBuffer(byte[] buffer)
queueBuffer in class Channelbuffer - The next buffer to be played for a streaming source.
public int feedRawAudioData(byte[] buffer)
feedRawAudioData in class Channelbuffer - Buffer containing raw audio data to stream.
public float millisInBuffer(int alBufferi)
public float millisecondsPlayed()
millisecondsPlayed in class Channelpublic int buffersProcessed()
buffersProcessed in class Channelpublic void flush()
flush in class Channelpublic void close()
close in class Channelpublic void play()
play in class Channelpublic void pause()
pause in class Channelpublic void stop()
stop in class Channelpublic void rewind()
rewind in class Channelpublic boolean playing()
playing in class Channel
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||