com.golden.gamedev.engine.audio
Class WaveRenderer3

java.lang.Object
  |
  +--com.golden.gamedev.engine.audio.WaveRenderer3
All Implemented Interfaces:
BaseAudioRenderer

public class WaveRenderer3
extends Object
implements BaseAudioRenderer

Play wave (*.wav; *.au), and midi (*.mid) sound.
Experimental renderer.

Since this class not implement the essential isPlaying() method (don't know yet how to implement this), BaseAudio that use this class as the sample renderer will attempt to create new renderer for every playing sound.
If there're too many renderers created, it can cause buffer overflow.

Note:
Midi sound use soundbank that not delivered in JRE, only JDK can play midi sound. To play midi in JRE you must explicitly install soundbank.
Don't ask me how, i don't know either, please read JDK documentation.


Constructor Summary
WaveRenderer3()
           
 
Method Summary
 BaseAudioRenderer createRenderer()
          Creates another empty renderer based on this renderer.
 URL getAudioFile()
          Returns the audio file associated with this audio renderer.
 float getVolume()
          Returns this audio volume.
 boolean isPlaying()
          Returns true, if this audio is currently playing.
 void play()
          Begins playback of this audio renderer.
 void play(URL audiofile)
          Begins playback of specified audio file.
 void setLoop(boolean b)
          The sound is playing continuously until stop is called.
 void setVolume(float volume)
          Sets audio volume in [0.0f - 1.0f].
 void stop()
          Stops currently played audio.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaveRenderer3

public WaveRenderer3()
Method Detail

getAudioFile

public URL getAudioFile()
Description copied from interface: BaseAudioRenderer
Returns the audio file associated with this audio renderer.

Specified by:
getAudioFile in interface BaseAudioRenderer

isPlaying

public boolean isPlaying()
Description copied from interface: BaseAudioRenderer
Returns true, if this audio is currently playing.

Specified by:
isPlaying in interface BaseAudioRenderer

play

public void play(URL audiofile)
Description copied from interface: BaseAudioRenderer
Begins playback of specified audio file. If this audio is already playing, the audio will be restarted.

Specified by:
play in interface BaseAudioRenderer
Parameters:
audiofile - the audio file to be played by this renderer.

play

public void play()
Description copied from interface: BaseAudioRenderer
Begins playback of this audio renderer.

Specified by:
play in interface BaseAudioRenderer

stop

public void stop()
Description copied from interface: BaseAudioRenderer
Stops currently played audio.

Specified by:
stop in interface BaseAudioRenderer

setVolume

public void setVolume(float volume)
Description copied from interface: BaseAudioRenderer
Sets audio volume in [0.0f - 1.0f].

Specified by:
setVolume in interface BaseAudioRenderer

getVolume

public float getVolume()
Description copied from interface: BaseAudioRenderer
Returns this audio volume.

Specified by:
getVolume in interface BaseAudioRenderer

createRenderer

public BaseAudioRenderer createRenderer()
Description copied from interface: BaseAudioRenderer
Creates another empty renderer based on this renderer.

Specified by:
createRenderer in interface BaseAudioRenderer

setLoop

public void setLoop(boolean b)
Description copied from interface: BaseAudioRenderer
The sound is playing continuously until stop is called.

Note: if the internal renderer doesn't support built-in loop, please use thread that wait the sound ended and restart the sound.

Specified by:
setLoop in interface BaseAudioRenderer
Parameters:
b - true, the audio is playing continously.