com.golden.gamedev.engine
Interface BaseAudioRenderer

All Known Implementing Classes:
MidiRenderer, WaveRenderer, WaveRenderer3

public interface BaseAudioRenderer

The BaseAudioRenderer interface is a simple abstraction for playing audio sound.


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.
 

Method Detail

isPlaying

public boolean isPlaying()
Returns true, if this audio is currently playing.


getAudioFile

public URL getAudioFile()
Returns the audio file associated with this audio renderer.


play

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

Parameters:
audiofile - the audio file to be played by this renderer.

play

public void play()
Begins playback of this audio renderer.


stop

public void stop()
Stops currently played audio.


setLoop

public void setLoop(boolean b)
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.

Parameters:
b - true, the audio is playing continously.

setVolume

public void setVolume(float volume)
Sets audio volume in [0.0f - 1.0f].


getVolume

public float getVolume()
Returns this audio volume.


createRenderer

public BaseAudioRenderer createRenderer()
Creates another empty renderer based on this renderer.