|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpaulscode.sound.Library
paulscode.sound.libraries.LibraryJavaSound
public class LibraryJavaSound
The LibraryJavaSound class interfaces the JavaSound library.
For more information about the JavaSound API, visit
http://java.sun.com/products/java-media/sound/
SoundSystem LibraryJavaSound 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
| Nested Class Summary | |
|---|---|
static class |
LibraryJavaSound.Exception
The LibraryJavaSound.Exception class provides library-specific error information. |
static class |
LibraryJavaSound.MixerRanking
The MixerRanking class is used to determine the capabilities of a mixer, and to give it a ranking based on the priority of those capabilities. |
| Field Summary |
|---|
| Fields inherited from class paulscode.sound.Library |
|---|
bufferMap, listener, normalChannels, reverseByteOrder, sourceMap, streamingChannels, streamThread |
| Constructor Summary | |
|---|---|
LibraryJavaSound()
Constructor: Instantiates the source map, buffer map and listener information. |
|
| Method Summary | |
|---|---|
void |
cleanup()
Stops all sources, 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 |
dopplerChanged()
The Doppler parameters have changed. |
java.lang.String |
getClassName()
Returns the name of the class. |
static java.lang.String |
getDescription()
Returns a longer description of this library type. |
static javax.sound.sampled.Mixer |
getMixer()
Returns a handle to the current JavaSound mixer, or null if no mixer has been set yet. |
static LibraryJavaSound.MixerRanking |
getMixerRanking()
|
static java.lang.String |
getTitle()
Returns the short title of this library type. |
void |
init()
Initializes Javasound. |
static boolean |
libraryCompatible()
Checks if the JavaSound library type is compatible. |
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. |
void |
newSource(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll)
Creates a new source and places it into the source map. |
void |
quickPlay(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
Creates and immediately plays a new source. |
void |
rawDataStream(javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
Opens a direct line for streaming audio data. |
static void |
setLineCount(int value)
|
void |
setListenerVelocity(float x,
float y,
float z)
Sets the listener's velocity, for use in Doppler effect. |
void |
setMasterVolume(float value)
Sets the overall volume to the specified value, affecting all sources. |
static void |
setMaxSampleRate(int value)
|
static void |
setMinSampleRate(int value)
|
static void |
setMixer(javax.sound.sampled.Mixer m)
Sets the current mixer. |
static void |
useGainControl(boolean value)
|
static void |
usePanControl(boolean value)
|
static void |
useSampleRateControl(boolean value)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LibraryJavaSound()
throws SoundSystemException
SoundSystemException| Method Detail |
|---|
public void init()
throws SoundSystemException
init in class LibrarySoundSystemExceptionpublic static boolean libraryCompatible()
protected Channel createChannel(int type)
SoundSystemConfig class.
createChannel in class Librarytype - Type of channel.
public void cleanup()
cleanup in class Librarypublic boolean loadSound(FilenameURL filenameURL)
loadSound in class LibraryfilenameURL - Filename/URL of a sound file to load.
public boolean loadSound(SoundBuffer buffer,
java.lang.String identifier)
loadSound in class Librarybuffer - the sample data and audio format to save.identifier - What to call the sample.
public void setMasterVolume(float value)
setMasterVolume in class Libraryvalue - New volume, float value ( 0.0f - 1.0f ).
public void newSource(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll)
newSource in class Librarypriority - 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.x - X position for this source.y - Y position for this source.z - Z position for this source.attModel - Attenuation model to use.distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".
public void rawDataStream(javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
rawDataStream in class LibraryaudioFormat - Format that the data will be in.priority - Setting this to true will prevent other sounds from overriding this one.sourcename - A unique identifier for this source. Two sources may not use the same sourcename.x - X position for this source.y - Y position for this source.z - Z position for this source.attModel - Attenuation model to use.distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".
public void quickPlay(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
quickPlay in class Librarypriority - 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.x - X position for this source.y - Y position for this source.z - Z position for this source.attModel - Attenuation model to use.distOrRoll - Either the fading distance or rolloff factor, depending on the value of "attmodel".temporary - Whether or not this source should be removed after it finishes playing.public void copySources(java.util.HashMap<java.lang.String,Source> srcMap)
copySources in class LibrarysrcMap - Sources to copy.
public void setListenerVelocity(float x,
float y,
float z)
setListenerVelocity in class Libraryx - Velocity along world x-axis.y - Velocity along world y-axis.z - Velocity along world z-axis.public void dopplerChanged()
dopplerChanged in class Librarypublic static javax.sound.sampled.Mixer getMixer()
public static void setMixer(javax.sound.sampled.Mixer m)
throws SoundSystemException
m - New mixer.
SoundSystemExceptionpublic static LibraryJavaSound.MixerRanking getMixerRanking()
public static void setMinSampleRate(int value)
public static void setMaxSampleRate(int value)
public static void setLineCount(int value)
public static void useGainControl(boolean value)
public static void usePanControl(boolean value)
public static void useSampleRateControl(boolean value)
public static java.lang.String getTitle()
public static java.lang.String getDescription()
public java.lang.String getClassName()
getClassName in class Library
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||