|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbe.hogent.tarsos.sampled.BlockingAudioPlayer
public final class BlockingAudioPlayer
This AudioProcessor can be used to sync events with sound. It uses a pattern described in JavaFX Special Effects Taking Java RIA to the Extreme with Animation, Multimedia, and Game Element Chapter 9 page 185:
The variable line is the Java Sound object that actually makes the sound. The write method on line is interesting because it blocks until it is ready for more data.If this AudioProcessor chained with other AudioProcessors the others should be able to operate in real time or process the signal on a separate thread.
Constructor Summary | |
---|---|
BlockingAudioPlayer(javax.sound.sampled.AudioFormat format,
int bufferSize,
int overlap)
Creates a new BlockingAudioPlayer. |
Method Summary | |
---|---|
void |
processFull(float[] audioFloatBuffer,
byte[] audioByteBuffer)
Process the first (complete) buffer. |
void |
processingFinished()
Notify the AudioProcessor that no more data is available and processing has finished. |
void |
processOverlapping(float[] audioBuffer,
byte[] audioByteBuffer)
Do the actual signal processing on an overlapping buffer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BlockingAudioPlayer(javax.sound.sampled.AudioFormat format, int bufferSize, int overlap) throws javax.sound.sampled.LineUnavailableException
format
- The AudioFormat of the buffer.bufferSize
- The size of each buffer in samples (not in bytes).overlap
- Defines how much consecutive buffers overlap in samples (not
in bytes).
javax.sound.sampled.LineUnavailableException
- If no output line is available.Method Detail |
---|
public void processFull(float[] audioFloatBuffer, byte[] audioByteBuffer)
AudioProcessor
processFull
in interface AudioProcessor
audioFloatBuffer
- The buffer to process using the float data type.audioByteBuffer
- The buffer to process using raw bytes.public void processOverlapping(float[] audioBuffer, byte[] audioByteBuffer)
AudioProcessor
processOverlapping
in interface AudioProcessor
audioBuffer
- The buffer to process using the float data type.audioByteBuffer
- The buffer to process using raw bytes.public void processingFinished()
AudioProcessor
processingFinished
in interface AudioProcessor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |