|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpaulscode.sound.Channel
paulscode.sound.libraries.ChannelJOAL
public class ChannelJOAL
The ChannelJOAL class is used to reserve a sound-card voice using the
JOAL binding of OpenAL. Channels can be either normal or streaming
channels.
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
| Field Summary | |
|---|---|
int |
ALformat
OpenAL data format to use when playing back the assigned source. |
int[] |
ALSource
OpenAL's 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 | |
|---|---|
ChannelJOAL(int type,
int[] src)
Constructor: takes channelType identifier and a handle to the OpenAL identifier to use for this channel. |
|
| Method Summary | |
|---|---|
boolean |
attachBuffer(int[] 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 int[] ALSource
public int ALformat
public int sampleRate
public float millisPreviouslyPlayed
| Constructor Detail |
|---|
public ChannelJOAL(int type,
int[] 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(int[] buf)
buf - 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 | |||||||||