Class ToneGenerator
java.lang.Object
games.stendhal.client.sound.system.SignalProcessor
games.stendhal.client.sound.system.processors.ToneGenerator
Generates a PCM audio signal consisting of sine waveforms
with specified frequency and volume.
- Author:
- silvio
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTone(ToneGenerator.Tone tone) protected booleangenerate()This function should be overwritten by all classes that want to generate an PCM audio stream e.g.protected voidmodify(float[] data, int samples, int channels, int rate) This function should be overwritten by all classes that want to modify an PCM audio stream.Methods inherited from class games.stendhal.client.sound.system.SignalProcessor
connectTo, createChain, disconnect, finished, insert, propagate, quit, replace, request, split
-
Constructor Details
-
ToneGenerator
public ToneGenerator(int channels, int rate, int numFramesToBuffer)
-
-
Method Details
-
addTone
-
generate
protected boolean generate()Description copied from class:SignalProcessorThis function should be overwritten by all classes that want to generate an PCM audio stream e.g. a mp3 decoder, a frequency generator, ...- Overrides:
generatein classSignalProcessor- Returns:
true, until the stream is finished
-
modify
protected void modify(float[] data, int samples, int channels, int rate) Description copied from class:SignalProcessorThis function should be overwritten by all classes that want to modify an PCM audio stream. The audio data is uniform and interleaved. uniform: Each sample has a value between -1.0 and 1.0 interleaved: The channels are not separated. They are bundled in frames e.g. if there is stereo PCM data: data[0] and data[1] are the left and right channels of sample 0 data[2] and data[3] are the left and right channels of sample 1 data[4] and data[5] are the left and right channels of sample 2 and so on ... The number of samples can be calculated by: frames * channels- Overrides:
modifyin classSignalProcessor- Parameters:
data- the audio datasamples- the number of sample frames contained in "data"channels- number of channelsrate- the sample rate
-