net.jinx.audio
Class SynthesizedSource

java.lang.Object
  extended by net.jinx.audio.Source
      extended by net.jinx.audio.SynthesizedSource

public class SynthesizedSource
extends Source


Constructor Summary
SynthesizedSource(net.java.games.joal.AL al, net.java.games.joal.ALC alc, SampleProcessor source, int samples, boolean is8Bit)
          Constructs a new SynthesizedSource.
 
Method Summary
 void delete()
          Frees the resources that this Source consumes.
 boolean isLooping()
          Returns false, since synthesized sound CANNOT loop in a normal sense.
 void play()
          Calls update to fill the playback buffers and then starts playback.
 void queueBuffer(Buffer buffer)
          Does nothing.
 void queueBuffers(Buffer[] buffers)
          Does nothing.
 void rewind()
          Does nothing, for much the same reasons looping is unsupported.
 void setBuffer(Buffer buffer)
          Does nothing.
 void setLooping(boolean loop)
          Does nothing, since synthesized sound CANNOT loop in a normal sense.
 void stop()
          Calls pause(), for now.
 void unqueueBuffer(Buffer buffer)
          Does nothing.
 void unqueueBuffers(Buffer[] buffers)
          Does nothing.
 void update()
          This should be called from the associated Audible implementation to ensure that data is synthesized and sent off to be played.
 
Methods inherited from class net.jinx.audio.Source
buffersProcessed, buffersQueued, getAL, getALC, getBooleanInt, getBuffer, getConeOuterGain, getDirection, getFloat, getGain, getInt, getMaxDistance, getMaxGain, getMinGain, getPitch, getPosition, getReferenceDistance, getRolloffFactor, getSourceID, getVelocity, isInitialized, isSourceRelative, pause, setBooleanInt, setConeOuterGain, setDirection, setDirection, setFloat, setGain, setInt, setMaxDistance, setMaxGain, setMinGain, setPitch, setPosition, setPosition, setReferenceDistance, setRolloffFactor, setSourceRelative, setVelocity, setVelocity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynthesizedSource

public SynthesizedSource(net.java.games.joal.AL al,
                         net.java.games.joal.ALC alc,
                         SampleProcessor source,
                         int samples,
                         boolean is8Bit)
Constructs a new SynthesizedSource.

Parameters:
al - the AL object to use for audio rendering.
alc - the ALC object to use for audio rendering.
source - the SampleProcessor that will be used to synthesize data. The isSource() method for this must return true, or an IllegalArgumentException will be thrown. This SampleProcessor must also have a non-null SampleFormat.
samples - determines how many samples should be buffered ahead for playback of the synthesized sound. This along with the sample rate of fmt indirectly determines the latency of the buffer (how often it is filled. The smaller this number is, the lower the latency, but this will cause the buffer to be filled more often, requiring more CPU time. I reccomend a number of samples equal to 1/40 a second to a couple of seconds, depending on your needs.
is8Bit - determines if the data should be fed to JOAL as 8 or 16 bit samples.
Throws:
java.lang.NullPointerException - is thrown if any parameter is null.
java.lang.IllegalArgumentException - is thrown when one of the parameters contains an error of some kind.
Method Detail

setLooping

public void setLooping(boolean loop)
Does nothing, since synthesized sound CANNOT loop in a normal sense. It may repeat, but it NEVER loops.

Overrides:
setLooping in class Source
Parameters:
loop - boolean value for setting this option.

isLooping

public boolean isLooping()
Returns false, since synthesized sound CANNOT loop in a normal sense. It may repeat, but it NEVER loops.

Overrides:
isLooping in class Source
Returns:
false.

play

public void play()
Calls update to fill the playback buffers and then starts playback.

Overrides:
play in class Source

stop

public void stop()
Calls pause(), for now.

Overrides:
stop in class Source

rewind

public void rewind()
Does nothing, for much the same reasons looping is unsupported.

Overrides:
rewind in class Source

setBuffer

public void setBuffer(Buffer buffer)
Does nothing. This Source handles it's own Buffers.

Overrides:
setBuffer in class Source
Parameters:
buffer - the Buffer to associate with this Source.

queueBuffers

public void queueBuffers(Buffer[] buffers)
Does nothing. This Source handles it's own Buffers.

Overrides:
queueBuffers in class Source
Parameters:
buffers - the Buffer objects to queue.

queueBuffer

public void queueBuffer(Buffer buffer)
Does nothing. This Source handles it's own Buffers.

Overrides:
queueBuffer in class Source
Parameters:
buffer - the Buffer object to queue.

unqueueBuffers

public void unqueueBuffers(Buffer[] buffers)
Does nothing. This Source handles it's own Buffers.

Overrides:
unqueueBuffers in class Source
Parameters:
buffers - the Buffer objects to dequeue.

unqueueBuffer

public void unqueueBuffer(Buffer buffer)
Does nothing. This Source handles it's own Buffers.

Overrides:
unqueueBuffer in class Source
Parameters:
buffer - the Buffer object to dequeue.

delete

public void delete()
Description copied from class: Source
Frees the resources that this Source consumes.

Overrides:
delete in class Source

update

public void update()
This should be called from the associated Audible implementation to ensure that data is synthesized and sent off to be played.