public class ChannelJavaSound extends Channel
| Modifier and Type | Field and Description |
|---|---|
Clip |
clip
Used to play back a normal source.
|
SourceDataLine |
sourceDataLine
Used to play back a streaming source.
|
attachedSource, buffersUnqueued, channelType, libraryType| Constructor and Description |
|---|
ChannelJavaSound(int type,
Mixer mixer)
Constructor: takes channelType identifier and a handle to the Mixer as
paramaters.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
attachBuffer(SoundBuffer buffer)
Attaches the SoundBuffer 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, 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.
|
void |
newMixer(Mixer m)
Changes the current mixer
|
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(LinkedList<byte[]> bufferList)
Queues up the initial byte[] buffers of data to be streamed.
|
boolean |
processBuffer()
Plays the next queued byte[] buffer.
|
boolean |
queueBuffer(byte[] buffer)
Queues up a byte[] buffer of data to be streamed.
|
boolean |
resetStream(AudioFormat format)
Sets the channel up to be streamed using the specified AudioFormat.
|
void |
rewind()
Rewinds the attached source to the beginning.
|
void |
setAudioFormat(AudioFormat audioFormat)
Sets the channel up to receive the specified audio format.
|
void |
setGain(float g)
Changes the volume.
|
void |
setLooping(boolean value)
Defines whether playback should loop or just play once.
|
void |
setPan(float p)
Changes the pan between left and right speaker to the specified value.
|
void |
setPitch(float p)
Changes the pitch to the specified value.
|
void |
stop()
Stops playback for this channel and rewinds the attached source to the
beginning.
|
errorCheck, errorMessage, getClassName, importantMessage, message, printStackTracepublic Clip clip
public SourceDataLine sourceDataLine
public ChannelJavaSound(int type,
Mixer mixer)
SoundSystemConfig class.type - Type of channel (normal or streaming).mixer - Handle to the JavaSound Mixer.public void cleanup()
public void newMixer(Mixer m)
m - New mixer to use.public boolean attachBuffer(SoundBuffer buffer)
buffer - SoundBuffer containing the wave data and format to attachpublic void setAudioFormat(AudioFormat audioFormat)
setAudioFormat in class ChannelaudioFormat - Format to use when playing the stream data.public boolean resetStream(AudioFormat format)
format - Format to use when playing the stream data.public void setLooping(boolean value)
value - Loop or not.public void setPan(float p)
p - Pan value to use.public void setGain(float g)
g - Gain value to use.public void setPitch(float p)
p - Float value between 0.5f and 2.0f.public boolean preLoadBuffers(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 boolean processBuffer()
StreamThread.processBuffer in class Channelpublic int feedRawAudioData(byte[] buffer)
feedRawAudioData in class Channelbuffer - Buffer containing raw audio data to stream.public int buffersProcessed()
buffersProcessed in class Channelpublic void close()
public void play()
public void pause()
public void stop()
public void rewind()
public float millisecondsPlayed()
millisecondsPlayed in class ChannelCopyright © 2017. All rights reserved.