|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.brackeen.javagamebook.sound.SoundFilter
com.brackeen.javagamebook.sound.EchoFilter
public class EchoFilter
The EchoFilter class is a SoundFilter that emulates an echo.
FilteredSoundStream| Field Summary | |
|---|---|
private float |
decay
|
private short[] |
delayBuffer
|
private int |
delayBufferPos
|
| Constructor Summary | |
|---|---|
EchoFilter(int numDelaySamples,
float decay)
Creates an EchoFilter with the specified number of delay samples and the specified decay rate. |
|
| Method Summary | |
|---|---|
void |
filter(byte[] samples,
int offset,
int length)
Filters the sound samples to add an echo. |
int |
getRemainingSize()
Gets the remaining size, in bytes, of samples that this filter can echo after the sound is done playing. |
void |
reset()
Clears this EchoFilter's internal delay buffer. |
| Methods inherited from class com.brackeen.javagamebook.sound.SoundFilter |
|---|
filter, getSample, setSample |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private short[] delayBuffer
private int delayBufferPos
private float decay
| Constructor Detail |
|---|
public EchoFilter(int numDelaySamples,
float decay)
The number of delay samples specifies how long before the echo is initially heard. For a 1 second echo with mono, 44100Hz sound, use 44100 delay samples.
The decay value is how much the echo has decayed from the source. A decay value of .5 means the echo heard is half as loud as the source.
| Method Detail |
|---|
public int getRemainingSize()
getRemainingSize in class SoundFilterpublic void reset()
reset in class SoundFilter
public void filter(byte[] samples,
int offset,
int length)
filter in class SoundFilter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||