|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpaulscode.sound.Source
paulscode.sound.libraries.SourceJavaSound
public class SourceJavaSound
The SourceJavaSound class provides an interface to the JavaSound library.
For more information about the Java Sound API, please 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
| Field Summary | |
|---|---|
protected ChannelJavaSound |
channelJavaSound
The source's basic Channel type-cast to a ChannelJavaSound. |
ListenerData |
listener
Handle to the listener information. |
| Fields inherited from class paulscode.sound.Source |
|---|
attModel, channel, codec, distanceFromListener, distOrRoll, fadeInGain, fadeInMilis, fadeOutGain, fadeOutMilis, filenameURL, gain, lastFadeCheck, libraryType, nextBuffers, nextCodec, pitch, position, preLoad, priority, rawDataFormat, rawDataStream, soundBuffer, soundSequenceLock, soundSequenceQueue, sourcename, sourceVolume, temporary, toLoop, toPlay, toStream, velocity |
| Constructor Summary | |
|---|---|
SourceJavaSound(ListenerData listener,
javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
Constructor: Creates a new streaming source that will be directly fed with raw audio data. |
|
SourceJavaSound(ListenerData listener,
boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
Constructor: Creates a new source using the specified parameters. |
|
SourceJavaSound(ListenerData listener,
Source old,
SoundBuffer soundBuffer)
Constructor: Creates a new source matching the specified source. |
|
| Method Summary | |
|---|---|
void |
calculateGain()
Calculates the gain for this source based on its attenuation model and distance from the listener. |
void |
calculatePan()
Calculates the panning for this source based on its position in relation to the listener. |
void |
calculatePitch()
Calculates the pitch for this source based on its position in relation to the listener. |
void |
changeSource(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
Changes the peripheral information about the source using the specified parameters. |
void |
cleanup()
Shuts the source down and removes references to all instantiated objects. |
void |
listenerMoved()
Called every time the listener's position or orientation changes. |
float |
min(float a,
float b)
|
void |
play(Channel c)
Plays the source on the specified channel. |
void |
positionChanged()
Updates the pan and gain. |
boolean |
preLoad()
Queues up the initial stream-buffers for the stream. |
void |
setAttenuation(int model)
Sets this source's attenuation model. |
void |
setDistOrRoll(float dr)
Sets this source's fade distance or rolloff factor, depending on the attenuation model. |
void |
setPitch(float value)
Manually sets this source's pitch. |
void |
setPosition(float x,
float y,
float z)
Moves the source to the specified position. |
void |
setVelocity(float x,
float y,
float z)
Sets this source's velocity, for use in Doppler effect. |
| Methods inherited from class paulscode.sound.Source |
|---|
activate, active, checkFadeOut, cull, dequeueSound, errorCheck, errorMessage, fadeOut, fadeOutIn, feedRawAudioData, flush, getClassName, getDistanceFromListener, getPitch, getSoundSequenceQueueSize, importantMessage, incrementSoundSequence, message, millisecondsPlayed, pause, paused, playing, printStackTrace, queueSound, readBuffersFromNextSoundInSequence, reverseByteOrder, rewind, setLooping, setPriority, setTemporary, stop, stopped, stream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ChannelJavaSound channelJavaSound
public ListenerData listener
| Constructor Detail |
|---|
public SourceJavaSound(ListenerData listener,
boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
listener - Handle to information about the listener.priority - Setting this to true will prevent other sounds from overriding this one.toStream - Setting this to true will create a streaming source.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.soundBuffer - Sound buffer to use if creating a new normal 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 'att'.temporary - Whether or not to remove this source after it finishes playing.
public SourceJavaSound(ListenerData listener,
Source old,
SoundBuffer soundBuffer)
listener - Handle to information about the listener.old - Source to copy information from.soundBuffer - Sound buffer to use if creating a new normal source.
public SourceJavaSound(ListenerData listener,
javax.sound.sampled.AudioFormat audioFormat,
boolean priority,
java.lang.String sourcename,
float x,
float y,
float z,
int attModel,
float distOrRoll)
listener - Handle to information about the listener.audioFormat - 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 'att'.| Method Detail |
|---|
public void cleanup()
cleanup in class Source
public void changeSource(boolean priority,
boolean toStream,
boolean toLoop,
java.lang.String sourcename,
FilenameURL filenameURL,
SoundBuffer soundBuffer,
float x,
float y,
float z,
int attModel,
float distOrRoll,
boolean temporary)
changeSource in class Sourcepriority - Setting this to true will prevent other sounds from overriding this one.toStream - Setting this to true will create a streaming source.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.soundBuffer - Sound buffer to use if creating a new normal 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 'att'.temporary - Whether or not to remove this source after it finishes playing.public void listenerMoved()
listenerMoved in class Source
public void setVelocity(float x,
float y,
float z)
setVelocity in class Sourcex - Velocity along world x-axis.y - Velocity along world y-axis.z - Velocity along world z-axis.
public void setPosition(float x,
float y,
float z)
setPosition in class Sourcex - X coordinate to move to.y - Y coordinate to move to.z - Z coordinate to move to.public void positionChanged()
positionChanged in class Sourcepublic void setPitch(float value)
setPitch in class Sourcevalue - A float value ( 0.5f - 2.0f ).public void setAttenuation(int model)
setAttenuation in class Sourcemodel - Attenuation model to use.public void setDistOrRoll(float dr)
setDistOrRoll in class Sourcedr - New value for fade distance or rolloff factor.public void play(Channel c)
play in class Sourcec - Channel to play on.public boolean preLoad()
preLoad in class Sourcepublic void calculateGain()
public void calculatePan()
public void calculatePitch()
public float min(float a,
float b)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||