com.brackeen.javagamebook.sound
Class Filter3d
java.lang.Object
com.brackeen.javagamebook.sound.SoundFilter
com.brackeen.javagamebook.sound.Filter3d
public class Filter3d
- extends SoundFilter
The Filter3d class is a SoundFilter that creates a 3d sound
effect. The sound is filtered so that it is quiter the farther
away the sound source is from the listener.
Possible ideas to extend this class:
- pan the sound to the left and right speakers
- See Also:
FilteredSoundStream
|
Constructor Summary |
Filter3d(Sprite source,
Sprite listener,
int maxDistance)
Creates a new Filter3d object with the specified source
and listener Sprites. |
|
Method Summary |
void |
filter(byte[] samples,
int offset,
int length)
Filters the sound so that it gets more quiet with
distance. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NUM_SHIFTING_SAMPLES
private static final int NUM_SHIFTING_SAMPLES
- See Also:
- Constant Field Values
source
private Sprite source
listener
private Sprite listener
maxDistance
private int maxDistance
lastVolume
private float lastVolume
Filter3d
public Filter3d(Sprite source,
Sprite listener,
int maxDistance)
- Creates a new Filter3d object with the specified source
and listener Sprites. The Sprite's position can be
changed while this filter is running.
The maxDistance parameter is the maximum distance
that the sound can be heard.
filter
public void filter(byte[] samples,
int offset,
int length)
- Filters the sound so that it gets more quiet with
distance.
- Specified by:
filter in class SoundFilter