public class Channel extends Object
| Modifier and Type | Field and Description |
|---|---|
Source |
attachedSource
Whatever source is attached to this channel.
|
int |
buffersUnqueued
Cumulative counter of the buffers played then unqued.
|
int |
channelType
Global identifier for the type of channel (normal or streaming).
|
protected Class |
libraryType
The library class associated with this type of channel.
|
| Constructor and Description |
|---|
Channel(int type)
Constructor: Takes channelType identifier as a paramater.
|
| Modifier and Type | Method and Description |
|---|---|
int |
buffersProcessed()
Returns the number of queued byte[] buffers that have finished playing.
|
void |
cleanup()
Shuts the channel down and removes references to all instantiated objects.
|
void |
close()
Stops the channel, dequeues any queued data, and closes the channel.
|
protected boolean |
errorCheck(boolean error,
String message)
Prints the specified message if error is true.
|
protected void |
errorMessage(String message)
Prints an error message.
|
int |
feedRawAudioData(byte[] buffer)
Feeds raw data to the stream.
|
void |
flush()
Dequeues all previously queued data.
|
String |
getClassName()
Returns the name of the class.
|
protected void |
importantMessage(String message)
Prints an important message.
|
protected void |
message(String message)
Prints a message.
|
float |
millisecondsPlayed()
Calculates the number of milliseconds since the channel began playing.
|
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.
|
protected void |
printStackTrace(Exception e)
Prints an exception's error message followed by the stack trace.
|
boolean |
processBuffer()
Plays the next queued byte[] buffer.
|
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(AudioFormat audioFormat)
Sets the channel up to receive the specified audio format.
|
void |
stop()
Stops playback for this channel and rewinds the attached source to the
beginning.
|
protected Class libraryType
public int channelType
SoundSystemConfig class.public Source attachedSource
public int buffersUnqueued
public Channel(int type)
SoundSystemConfig class.type - Type of channel (normal or streaming).public void cleanup()
public boolean preLoadBuffers(LinkedList<byte[]> bufferList)
bufferList - List of the first buffers to be played for a streaming source.public boolean queueBuffer(byte[] buffer)
buffer - The next buffer to be played for a streaming source.public int feedRawAudioData(byte[] buffer)
buffer - Buffer containing raw audio data to stream.public int buffersProcessed()
public float millisecondsPlayed()
public boolean processBuffer()
StreamThread.public void setAudioFormat(AudioFormat audioFormat)
public void flush()
public void close()
public void play()
public void pause()
public void stop()
public void rewind()
public boolean playing()
public String getClassName()
protected void message(String message)
message - Message to print.protected void importantMessage(String message)
message - Message to print.protected boolean errorCheck(boolean error,
String message)
error - True or False.message - Message to print if error is true.protected void errorMessage(String message)
message - Message to print.protected void printStackTrace(Exception e)
e - Exception containing the information to print.Copyright © 2017. All rights reserved.