|
GTGE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.golden.gamedev.engine.BaseAudioRenderer
public abstract class BaseAudioRenderer
A simple abstraction for playing audio sound.
BaseAudioRenderer must have one empty constructor.
For example :
public class MP3AudioRenderer extends BaseAudioRenderer {
public MP3Renderer() { // you should provide an empty constructor
// init the class here
}
}
The empty constructor is used by BaseAudio to create a new
renderer instance to play new sound using Class.newInstance().
| Field Summary | |
|---|---|
static int |
END_OF_SOUND
Audio renderer status indicates that the audio has finished played. |
static int |
ERROR
Audio renderer status indicates that the audio is failed to play. |
static int |
PLAYING
Audio renderer status indicates that the audio is currently playing. |
protected int |
status
The audio renderer status. |
static int |
STOPPED
Audio renderer status indicates that the audio is currently stopped. |
protected float |
volume
The audio sound volume. |
| Constructor Summary | |
|---|---|
BaseAudioRenderer()
Creates new audio renderer. |
|
| Method Summary | |
|---|---|
URL |
getAudioFile()
Returns the audio resource URL associated with this audio renderer. |
int |
getStatus()
Returns the audio renderer status. |
float |
getVolume()
Returns audio volume. |
abstract boolean |
isAvailable()
Returns true, if this audio renderer is available to use or false if this renderer is not available to use (failed to initialized). |
boolean |
isLoop()
Returns whether the audio is playing continuosly or not. |
boolean |
isVolumeSupported()
Returns whether setting audio volume is supported or not. |
void |
play()
Restarts last or currently played audio. |
void |
play(URL audiofile)
Stops currently played audio and begins playback of specified audio file. |
protected abstract void |
playSound(URL audiofile)
Plays sound with specified audio file. |
protected abstract void |
replaySound(URL audiofile)
Replays last played sound. |
void |
setLoop(boolean loop)
Sets whether the sound should be playing continuously until stop method is called or not. |
protected void |
setSoundVolume(float volume)
Sets audio sound volume. |
void |
setVolume(float volume)
Sets audio volume in [0.0f - 1.0f]. |
void |
stop()
Stops currently played audio. |
protected abstract void |
stopSound()
Stops any playing sound. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int PLAYING
public static final int STOPPED
public static final int END_OF_SOUND
public static final int ERROR
protected int status
Use this to manage renderer's END_OF_SOUND status when the audio
has finished played or ERROR status if the audio is failed to
play in playSound(URL) method.
protected float volume
| Constructor Detail |
|---|
public BaseAudioRenderer()
play(URL),
setLoop(boolean)| Method Detail |
|---|
protected abstract void playSound(URL audiofile)
protected abstract void replaySound(URL audiofile)
protected abstract void stopSound()
protected void setSoundVolume(float volume)
public void play(URL audiofile)
audiofile - the audio file to be played by this renderer.public void play()
public void stop()
public void setLoop(boolean loop)
Note: the sound manager is the one that taking care the audio loop.
loop - true, the audio will be playing continouslypublic boolean isLoop()
public void setVolume(float volume)
public float getVolume()
public boolean isVolumeSupported()
public URL getAudioFile()
public int getStatus()
public abstract boolean isAvailable()
|
GTGE API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||