paulscode.sound
Class Library

java.lang.Object
  extended by paulscode.sound.Library
Direct Known Subclasses:
LibraryJavaSound, LibraryJOAL, LibraryLWJGLOpenAL

public class Library
extends java.lang.Object

The Library class is the class from which all library types are extended. It provides generic methods for interfacing with the audio libraries supported by the SoundSystem. Specific libraries should extend this class and override the necessary methods. For consistant naming conventions, each sub-class should have the name prefix "Library". This class may also be used as the "No Sound Library" (i.e. silent mode) if no other audio libraries are supported by the host machine, or to mute all sound.

SoundSystem 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 may not falsely claim to be the author of this library or any unmodified portion of it.
2) You may not copyright this library or a modified version of it and then sue me for copyright infringement.
3) 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.
4) 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
5) 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.
6) 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
protected  java.util.HashMap<java.lang.String,SoundBuffer> bufferMap
          Map containing sound file data for easy lookup by filename / identifier.
protected  ListenerData listener
          Position and orientation of the listener.
protected  java.util.List<Channel> normalChannels
          Array containing maximum number of non-streaming audio channels.
protected  boolean reverseByteOrder
          Whether or not the library requires reversal of audio data byte order.
protected  java.util.HashMap<java.lang.String,Source> sourceMap
          Map containing all created sources for easy look-up by name.
protected  java.util.List<Channel> streamingChannels
          Array containing maximum number of non-streaming audio channels.
protected  StreamThread streamThread
          Handles processing for all streaming sources.
 
Constructor Summary
Library()
          Constructor: Instantiates the source map and listener information.
 
Method Summary
 void activate(java.lang.String sourcename)
          Activates a previously culled source, so it can be played again.
 void checkFadeVolumes()
          Makes sure the current volume levels of streaming sources and MIDI are correct.
 void cleanup()
          Stops all sources, shuts down sound library, and removes references to all instantiated objects.
 void copySources(java.util.HashMap<java.lang.String,Source> srcMap)
          Creates sources based on the source map provided.
protected  Channel createChannel(int type)
          Creates a new channel of the specified type (normal or streaming).
 void cull(java.lang.String sourcename)
          Culls the specified source.
 void dequeueSound(java.lang.String sourcename, java.lang.String filename)
          Removes the first occurrence of the specified filename from the specified source's list of sounds to play when previous playback ends.
 void dopplerChanged()
          Notifies the underlying library that the Doppler parameters have changed.
protected  boolean errorCheck(boolean error, java.lang.String message)
          Prints the specified message if error is true.
protected  void errorMessage(java.lang.String message)
          Prints an error message.
 void fadeOut(java.lang.String sourcename, FilenameURL filenameURL, long milis)
          Fades out the volume of whatever the specified source is currently playing, then begins playing the specified file at the source's previously assigned volume level.
 void fadeOutIn(java.lang.String sourcename, FilenameURL filenameURL, long milisOut, long milisIn)
          Fades out the volume of whatever the specified source is currently playing, then fades the volume back in playing the specified file.
 int feedRawAudioData(Source source, byte[] buffer)
          Feeds raw data through the specified source.
 int feedRawAudioData(java.lang.String sourcename, byte[] buffer)
          Feeds raw data through the specified source.
 void flush(java.lang.String sourcename)
          Clears all previously queued data from a stream.
 java.util.LinkedList<java.lang.String> getAllLoadedFilenames()
          Returns the filenames of all previously loaded sounds.
 java.util.LinkedList<java.lang.String> getAllSourcenames()
          Returns the sourcenames of all sources.
 java.lang.String getClassName()
          Returns the name of the class.
static java.lang.String getDescription()
          Returns a longer description of this library type.
 ListenerData getListenerData()
          Returns information about the listener.
 MidiChannel getMidiChannel()
          Returns a handle to the MIDI channel, or null if one does not exist.
 float getPitch(java.lang.String sourcename)
          Returns the pitch of the specified source.
 Source getSource(java.lang.String sourcename)
          Returns the Source object identified by the specified name.
 java.util.HashMap<java.lang.String,Source> getSources()
          Returns the sources map.
static java.lang.String getTitle()
          Returns the short title of this library type.
 float getVolume(java.lang.String sourcename)
          Returns the current volume of the specified source, or zero if the specified source was not found.
protected  void importantMessage(java.lang.String message)
          Prints an important message.
 void init()
          Initializes the sound library.
static boolean libraryCompatible()
          Checks if the no-sound library type is compatible.
 void listenerMoved()
          Tells all the sources that the listener has moved.
 void loadMidi(boolean toLoop, java.lang.String sourcename, FilenameURL filenameURL)
          Loads the specified MIDI file, and saves the source information about it.
 boolean loadSound(FilenameURL filenameURL)
          Pre-loads a sound into memory.
 boolean loadSound(SoundBuffer buffer, java.lang.String identifier)
          Saves the specified sample data, under the specified identifier.
protected  void message(java.lang.String message)
          Prints a message.
 boolean midiSourcename(java.lang.String sourcename)
          Checks if the sourcename matches the midi source.
 float millisecondsPlayed(java.lang.String sourcename)
          Returns the number of miliseconds since the specified source began playing.
 void moveListener(float x, float y, float z)
          Moves the listener relative to the current position.
 void newSource(boolean priority, boolean toStream, boolean toLoop, java.lang.String sourcename, FilenameURL filenameURL, float posX, float posY, float posZ, int attModel, float distOrRoll)
          Creates a new source using the specified information.
 void pause(java.lang.String sourcename)
          Pauses the specified source.
 void play(Source source)
          Plays the specified source.
 void play(java.lang.String sourcename)
          Looks up the specified source and plays it.
protected  void printStackTrace(java.lang.Exception e)
          Prints an exception's error message followed by the stack trace.
 void queueSound(java.lang.String sourcename, FilenameURL filenameURL)
          If the specified source is a streaming source or MIDI source, this method queues up the next sound to play when the previous playback ends.
 void quickPlay(boolean priority, boolean toStream, boolean toLoop, java.lang.String sourcename, FilenameURL filenameURL, float posX, float posY, float posZ, int attModel, float distOrRoll, boolean tmp)
          Creates and immediately plays a new source that will be removed when it finishes playing.
 void rawDataStream(javax.sound.sampled.AudioFormat audioFormat, boolean priority, java.lang.String sourcename, float posX, float posY, float posZ, int attModel, float distOrRoll)
          Opens a direct line for streaming audio data.
 void removeSource(java.lang.String sourcename)
          Stops and deletes the specified source.
 void removeTemporarySources()
          Searches for and removes all temporary sources that have finished playing.
 void replaySources()
          Plays all sources whose 'toPlay' varriable is true but are not currently playing (such as sources which were culled while looping and then reactivated).
 boolean reverseByteOrder()
          Indicates whether or not this library requires some codecs to reverse-order the audio data they generate.
 void rewind(java.lang.String sourcename)
          Rewinds the specified source.
 void setAttenuation(java.lang.String sourcename, int model)
          Sets the specified source's attenuation model.
 void setDistOrRoll(java.lang.String sourcename, float dr)
          Sets the specified source's fade distance or rolloff factor.
 void setListenerAngle(float angle)
          Changes the listeners orientation to the specified 'angle' radians counterclockwise around the y-Axis.
 void setListenerData(ListenerData l)
          Changes the listeners position and orientation using the specified listener data.
 void setListenerOrientation(float lookX, float lookY, float lookZ, float upX, float upY, float upZ)
          Changes the listeners orientation using the specified coordinates.
 void setListenerPosition(float x, float y, float z)
          Changes the listener's position.
 void setListenerVelocity(float x, float y, float z)
          Sets the listener's velocity, for use in Doppler effect.
 void setLooping(java.lang.String sourcename, boolean lp)
          Sets the specified source's looping parameter.
 void setMasterVolume(float value)
          Sets the overall volume to the specified value, affecting all sources.
 void setMidiChannel(MidiChannel c)
          Specifies the MIDI channel to use.
 void setPitch(java.lang.String sourcename, float value)
          Manually sets the specified source's pitch.
 void setPosition(java.lang.String sourcename, float x, float y, float z)
          Changes the specified source's position.
 void setPriority(java.lang.String sourcename, boolean pri)
          Sets the specified source's priority factor.
 void setTemporary(java.lang.String sourcename, boolean temporary)
          Defines whether or not the source should be removed after it finishes playing.
 void setVelocity(java.lang.String sourcename, float x, float y, float z)
          Sets the specified source's velocity, for use in Doppler effect.
 void setVolume(java.lang.String sourcename, float value)
          Manually sets the specified source's volume.
 void stop(java.lang.String sourcename)
          Stops the specified source.
 void turnListener(float angle)
          Turn the listener 'angle' radians counterclockwise around the y-Axis, relative to the current angle.
 void unloadMidi()
          Unloads the current Midi file.
 void unloadSound(java.lang.String filename)
          Removes a pre-loaded sound from memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listener

protected ListenerData listener
Position and orientation of the listener.


bufferMap

protected java.util.HashMap<java.lang.String,SoundBuffer> bufferMap
Map containing sound file data for easy lookup by filename / identifier.


sourceMap

protected java.util.HashMap<java.lang.String,Source> sourceMap
Map containing all created sources for easy look-up by name.


streamingChannels

protected java.util.List<Channel> streamingChannels
Array containing maximum number of non-streaming audio channels.


normalChannels

protected java.util.List<Channel> normalChannels
Array containing maximum number of non-streaming audio channels.


streamThread

protected StreamThread streamThread
Handles processing for all streaming sources.


reverseByteOrder

protected boolean reverseByteOrder
Whether or not the library requires reversal of audio data byte order.

Constructor Detail

Library

public Library()
        throws SoundSystemException
Constructor: Instantiates the source map and listener information. NOTES: The 'super()' method should be at the top of constructors for all extended classes. The varriable 'libraryType' should be given a new value in the constructors for all extended classes.

Throws:
SoundSystemException
Method Detail

cleanup

public void cleanup()
Stops all sources, shuts down sound library, and removes references to all instantiated objects.


init

public void init()
          throws SoundSystemException
Initializes the sound library.

Throws:
SoundSystemException

libraryCompatible

public static boolean libraryCompatible()
Checks if the no-sound library type is compatible.

Returns:
True or false.

createChannel

protected Channel createChannel(int type)
Creates a new channel of the specified type (normal or streaming). Possible values for channel type can be found in the SoundSystemConfig class.

Parameters:
type - Type of channel.
Returns:
The new channel.

loadSound

public boolean loadSound(FilenameURL filenameURL)
Pre-loads a sound into memory.

Parameters:
filenameURL - Filename/URL of the sound file to load.
Returns:
True if the sound loaded properly.

loadSound

public boolean loadSound(SoundBuffer buffer,
                         java.lang.String identifier)
Saves the specified sample data, under the specified identifier. This identifier can be later used in place of 'filename' parameters to reference the sample data.

Parameters:
buffer - the sample data and audio format to save.
identifier - What to call the sample.
Returns:
True if there weren't any problems.

getAllLoadedFilenames

public java.util.LinkedList<java.lang.String> getAllLoadedFilenames()
Returns the filenames of all previously loaded sounds.

Returns:
LinkedList of String filenames.

getAllSourcenames

public java.util.LinkedList<java.lang.String> getAllSourcenames()
Returns the sourcenames of all sources.

Returns:
LinkedList of String sourcenames.

unloadSound

public void unloadSound(java.lang.String filename)
Removes a pre-loaded sound from memory. This is a good method to use for freeing up memory after a large sound file is no longer needed. NOTE: the source will remain in memory after this method has been called, for as long as the sound is attached to an existing source.

Parameters:
filename - Filename/identifier of the sound file to unload.

rawDataStream

public void rawDataStream(javax.sound.sampled.AudioFormat audioFormat,
                          boolean priority,
                          java.lang.String sourcename,
                          float posX,
                          float posY,
                          float posZ,
                          int attModel,
                          float distOrRoll)
Opens a direct line for streaming audio data.

Parameters:
audioFormat - Format that the data will be in.
sourcename - A unique identifier for this source. Two sources may not use the same sourcename.
posX - X position for this source.
posY - Y position for this source.
posZ - Z position for this source.
attModel - Attenuation model to use.
distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".

newSource

public void newSource(boolean priority,
                      boolean toStream,
                      boolean toLoop,
                      java.lang.String sourcename,
                      FilenameURL filenameURL,
                      float posX,
                      float posY,
                      float posZ,
                      int attModel,
                      float distOrRoll)
Creates a new source using the specified information.

Parameters:
priority - Setting this to true will prevent other sounds from overriding this one.
toStream - Setting this to true will load the sound in pieces rather than all at once.
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.
posX - X position for this source.
posY - Y position for this source.
posZ - Z position for this source.
attModel - Attenuation model to use.
distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".

quickPlay

public void quickPlay(boolean priority,
                      boolean toStream,
                      boolean toLoop,
                      java.lang.String sourcename,
                      FilenameURL filenameURL,
                      float posX,
                      float posY,
                      float posZ,
                      int attModel,
                      float distOrRoll,
                      boolean tmp)
Creates and immediately plays a new source that will be removed when it finishes playing.

Parameters:
priority - Setting this to true will prevent other sounds from overriding this one.
toStream - Setting this to true will load the sound in pieces rather than all at once.
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 - The filename/URL of the sound file to play at this source.
posX - X position for this source.
posY - Y position for this source.
posZ - Z position for this source.
attModel - Attenuation model to use.
distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".

setTemporary

public void setTemporary(java.lang.String sourcename,
                         boolean temporary)
Defines whether or not the source should be removed after it finishes playing.

Parameters:
sourcename - The source's name.
temporary - True or False.

setPosition

public void setPosition(java.lang.String sourcename,
                        float x,
                        float y,
                        float z)
Changes the specified source's position.

Parameters:
sourcename - The source's name.
x - Destination X coordinate.
y - Destination Y coordinate.
z - Destination Z coordinate.

setPriority

public void setPriority(java.lang.String sourcename,
                        boolean pri)
Sets the specified source's priority factor. A priority source will not be overriden if there are too many sources playing at once.

Parameters:
sourcename - The source's name.
pri - True or False.

setLooping

public void setLooping(java.lang.String sourcename,
                       boolean lp)
Sets the specified source's looping parameter. If parameter lp is false, the source will play once and stop.

Parameters:
sourcename - The source's name.
lp - True or False.

setAttenuation

public void setAttenuation(java.lang.String sourcename,
                           int model)
Sets the specified source's attenuation model.

Parameters:
sourcename - The source's name.
model - Attenuation model to use.

setDistOrRoll

public void setDistOrRoll(java.lang.String sourcename,
                          float dr)
Sets the specified source's fade distance or rolloff factor.

Parameters:
sourcename - The source's name.
dr - Fade distance or rolloff factor.

setVelocity

public void setVelocity(java.lang.String sourcename,
                        float x,
                        float y,
                        float z)
Sets the specified source's velocity, for use in Doppler effect.

Parameters:
sourcename - The source's name.
x - Velocity along world x-axis.
y - Velocity along world y-axis.
z - Velocity along world z-axis.

setListenerVelocity

public void setListenerVelocity(float x,
                                float y,
                                float z)
Sets the listener's velocity, for use in Doppler effect.

Parameters:
x - Velocity along world x-axis.
y - Velocity along world y-axis.
z - Velocity along world z-axis.

dopplerChanged

public void dopplerChanged()
Notifies the underlying library that the Doppler parameters have changed.


millisecondsPlayed

public float millisecondsPlayed(java.lang.String sourcename)
Returns the number of miliseconds since the specified source began playing.

Returns:
miliseconds, or -1 if not playing or unable to calculate

feedRawAudioData

public int feedRawAudioData(java.lang.String sourcename,
                            byte[] buffer)
Feeds raw data through the specified source. The source must be a streaming source and it can not be already associated with a file or URL to stream from.

Parameters:
sourcename - Name of the streaming source to play from.
buffer - Byte buffer containing raw audio data to stream.
Returns:
Number of prior buffers that have been processed, or -1 if unable to queue the buffer (if the source was culled, for example).

feedRawAudioData

public int feedRawAudioData(Source source,
                            byte[] buffer)
Feeds raw data through the specified source. The source must be a streaming source and it can not be already associated with a file or URL to stream from.

Parameters:
source - Streaming source to play from.
buffer - Byte buffer containing raw audio data to stream.
Returns:
Number of prior buffers that have been processed, or -1 if unable to queue the buffer (if the source was culled, for example).

play

public void play(java.lang.String sourcename)
Looks up the specified source and plays it.

Parameters:
sourcename - Name of the source to play.

play

public void play(Source source)
Plays the specified source.

Parameters:
source - The source to play.

stop

public void stop(java.lang.String sourcename)
Stops the specified source.

Parameters:
sourcename - The source's name.

pause

public void pause(java.lang.String sourcename)
Pauses the specified source.

Parameters:
sourcename - The source's name.

rewind

public void rewind(java.lang.String sourcename)
Rewinds the specified source.

Parameters:
sourcename - The source's name.

flush

public void flush(java.lang.String sourcename)
Clears all previously queued data from a stream.

Parameters:
sourcename - The source's name.

cull

public void cull(java.lang.String sourcename)
Culls the specified source. A culled source will not play until it has been activated again.

Parameters:
sourcename - The source's name.

activate

public void activate(java.lang.String sourcename)
Activates a previously culled source, so it can be played again.

Parameters:
sourcename - The source's name.

setMasterVolume

public void setMasterVolume(float value)
Sets the overall volume to the specified value, affecting all sources.

Parameters:
value - New volume, float value ( 0.0f - 1.0f ).

setVolume

public void setVolume(java.lang.String sourcename,
                      float value)
Manually sets the specified source's volume.

Parameters:
sourcename - The source's name.
value - A float value ( 0.0f - 1.0f ).

getVolume

public float getVolume(java.lang.String sourcename)
Returns the current volume of the specified source, or zero if the specified source was not found.

Parameters:
sourcename - Source to read volume from.
Returns:
Float value representing the source volume (0.0f - 1.0f).

setPitch

public void setPitch(java.lang.String sourcename,
                     float value)
Manually sets the specified source's pitch.

Parameters:
sourcename - The source's name.
value - A float value ( 0.5f - 2.0f ).

getPitch

public float getPitch(java.lang.String sourcename)
Returns the pitch of the specified source.

Parameters:
sourcename - The source's name.
Returns:
Float value representing the source pitch (0.5f - 2.0f).

moveListener

public void moveListener(float x,
                         float y,
                         float z)
Moves the listener relative to the current position.

Parameters:
x - X offset.
y - Y offset.
z - Z offset.

setListenerPosition

public void setListenerPosition(float x,
                                float y,
                                float z)
Changes the listener's position.

Parameters:
x - Destination X coordinate.
y - Destination Y coordinate.
z - Destination Z coordinate.

turnListener

public void turnListener(float angle)
Turn the listener 'angle' radians counterclockwise around the y-Axis, relative to the current angle.

Parameters:
angle - Angle in radians.

setListenerAngle

public void setListenerAngle(float angle)
Changes the listeners orientation to the specified 'angle' radians counterclockwise around the y-Axis.

Parameters:
angle - Angle in radians.

setListenerOrientation

public void setListenerOrientation(float lookX,
                                   float lookY,
                                   float lookZ,
                                   float upX,
                                   float upY,
                                   float upZ)
Changes the listeners orientation using the specified coordinates.

Parameters:
lookX - X element of the look-at direction.
lookY - Y element of the look-at direction.
lookZ - Z element of the look-at direction.
upX - X element of the up direction.
upY - Y element of the up direction.
upZ - Z element of the up direction.

setListenerData

public void setListenerData(ListenerData l)
Changes the listeners position and orientation using the specified listener data.

Parameters:
l - Listener data to use.

copySources

public void copySources(java.util.HashMap<java.lang.String,Source> srcMap)
Creates sources based on the source map provided.

Parameters:
srcMap - Sources to copy.

removeSource

public void removeSource(java.lang.String sourcename)
Stops and deletes the specified source.

Parameters:
sourcename - The source's name.

removeTemporarySources

public void removeTemporarySources()
Searches for and removes all temporary sources that have finished playing.


replaySources

public void replaySources()
Plays all sources whose 'toPlay' varriable is true but are not currently playing (such as sources which were culled while looping and then reactivated).


queueSound

public void queueSound(java.lang.String sourcename,
                       FilenameURL filenameURL)
If the specified source is a streaming source or MIDI source, this method queues up the next sound to play when the previous playback ends. This method has no effect on non-streaming sources.

Parameters:
sourcename - Source identifier.
filenameURL - Filename/URL of the sound file to play next.

dequeueSound

public void dequeueSound(java.lang.String sourcename,
                         java.lang.String filename)
Removes the first occurrence of the specified filename from the specified source's list of sounds to play when previous playback ends. This method has no effect on non-streaming sources.

Parameters:
sourcename - Source identifier.
filename - Filename/identifier of the sound file to remove from the queue.

fadeOut

public void fadeOut(java.lang.String sourcename,
                    FilenameURL filenameURL,
                    long milis)
Fades out the volume of whatever the specified source is currently playing, then begins playing the specified file at the source's previously assigned volume level. If the filenameURL parameter is null or empty, the specified source will simply fade out and stop. The miliseconds parameter must be non-negative or zero. This method will remove anything that is currently in the specified source's list of queued sounds that would have played next when the current sound finished playing. This method may only be used for streaming and MIDI sources.

Parameters:
sourcename - Name of the source to fade out.
filenameURL - Filename/URL of the sound file to play next, or null for none.
milis - Number of miliseconds the fadeout should take.

fadeOutIn

public void fadeOutIn(java.lang.String sourcename,
                      FilenameURL filenameURL,
                      long milisOut,
                      long milisIn)
Fades out the volume of whatever the specified source is currently playing, then fades the volume back in playing the specified file. Final volume after fade-in completes will be equal to the source's previously assigned volume level. The filenameURL parameter may not be null or empty. The miliseconds parameters must be non-negative or zero. This method will remove anything that is currently in the specified source's list of queued sounds that would have played next when the current sound finished playing. This method may only be used for streaming and MIDI sources.

Parameters:
sourcename - Name of the source to fade out/in.
filenameURL - Filename/URL of the sound file to play next, or null for none.
milisOut - Number of miliseconds the fadeout should take.
milisIn - Number of miliseconds the fadein should take.

checkFadeVolumes

public void checkFadeVolumes()
Makes sure the current volume levels of streaming sources and MIDI are correct. This method is designed to help reduce the "jerky" fading behavior that happens when using some library and codec pluggins (such as LibraryJavaSound and CodecJOrbis). This method has no effect on normal "non-streaming" sources. It would normally be called somewhere in the main "game loop". IMPORTANT: To optimize frame-rates, do not call this method for every frame. It is better to just call this method at some acceptable "granularity" (play around with different granularities to find what sounds acceptable for a particular situation).


loadMidi

public void loadMidi(boolean toLoop,
                     java.lang.String sourcename,
                     FilenameURL filenameURL)
Loads the specified MIDI file, and saves the source information about it.

Parameters:
toLoop - Midi file should loop or play once.
sourcename - Source identifier.
filenameURL - Filename/URL of the MIDI file to load.

unloadMidi

public void unloadMidi()
Unloads the current Midi file.


midiSourcename

public boolean midiSourcename(java.lang.String sourcename)
Checks if the sourcename matches the midi source.

Parameters:
sourcename - Source identifier.
Returns:
True if sourcename and midi sourcename match.

getSource

public Source getSource(java.lang.String sourcename)
Returns the Source object identified by the specified name.

Parameters:
sourcename - The source's name.
Returns:
The source, or null if not found.

getMidiChannel

public MidiChannel getMidiChannel()
Returns a handle to the MIDI channel, or null if one does not exist.

Returns:
The MIDI channel.

setMidiChannel

public void setMidiChannel(MidiChannel c)
Specifies the MIDI channel to use.

Parameters:
c - New MIDI channel.

listenerMoved

public void listenerMoved()
Tells all the sources that the listener has moved.


getSources

public java.util.HashMap<java.lang.String,Source> getSources()
Returns the sources map.

Returns:
Map of all sources.

getListenerData

public ListenerData getListenerData()
Returns information about the listener.

Returns:
A ListenerData object.

reverseByteOrder

public boolean reverseByteOrder()
Indicates whether or not this library requires some codecs to reverse-order the audio data they generate.

Returns:
True if audio data should be reverse-ordered.

getTitle

public static java.lang.String getTitle()
Returns the short title of this library type.

Returns:
A short title.

getDescription

public static java.lang.String getDescription()
Returns a longer description of this library type.

Returns:
A longer description.

getClassName

public java.lang.String getClassName()
Returns the name of the class.

Returns:
"Library" + library title.

message

protected void message(java.lang.String message)
Prints a message.

Parameters:
message - Message to print.

importantMessage

protected void importantMessage(java.lang.String message)
Prints an important message.

Parameters:
message - Message to print.

errorCheck

protected boolean errorCheck(boolean error,
                             java.lang.String message)
Prints the specified message if error is true.

Parameters:
error - True or False.
message - Message to print if error is true.
Returns:
True if error is true.

errorMessage

protected void errorMessage(java.lang.String message)
Prints an error message.

Parameters:
message - Message to print.

printStackTrace

protected void printStackTrace(java.lang.Exception e)
Prints an exception's error message followed by the stack trace.

Parameters:
e - Exception containing the information to print.