|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.sound.SoundPlayer
public abstract class SoundPlayer
Loads, plays and loops sounds.
| Nested Class Summary | |
|---|---|
static interface |
SoundPlayer.Frob
A control for sounds. |
static class |
SoundPlayer.SoundType
Create instances of this for your application to differentiate between different types of sounds. |
| Field Summary | |
|---|---|
protected float |
_clipVol
Volume level for sound clips. |
protected Set<SoundPlayer.SoundType> |
_disabledTypes
A set of soundTypes for which sound is enabled. |
protected ObserverList<SoundEnabledObserver> |
_enabledObservers
|
static SoundPlayer.SoundType |
DEFAULT
The default sound type. |
static float |
PAN_CENTER
A pan value indicating that a sound should play from center. |
static float |
PAN_LEFT
A pan value indicating that a sound should play from the left only. |
static float |
PAN_RIGHT
A pan value indicating that a sound should play from the right only. |
| Constructor Summary | |
|---|---|
SoundPlayer()
|
|
| Method Summary | |
|---|---|
void |
addSoundEnabledObserver(SoundEnabledObserver listener)
|
float |
getClipVolume()
Get the volume for all sound clips. |
protected abstract RunQueue |
getSoundQueue()
Gets the run queue on which sound should be played. |
boolean |
isEnabled(SoundPlayer.SoundType type)
Is the specified soundtype enabled? |
abstract void |
lock(String pkgPath,
String... keys)
Optionally lock each of these keys prior to playing, to guarantee that it will be quickly available for playing. |
SoundPlayer.Frob |
loop(SoundPlayer.SoundType type,
String pkgPath,
String key)
Loop the specified sound, stopping as quickly as possible when stop is called. |
SoundPlayer.Frob |
loop(SoundPlayer.SoundType type,
String pkgPath,
String key,
float pan)
Loop the specified sound, stopping as quickly as possible when stop is called. |
protected abstract SoundPlayer.Frob |
loop(String pkgPath,
String key,
float pan)
Loop the specified sound, stopping as quickly as possible when stop is called. |
boolean |
play(SoundPlayer.SoundType type,
String pkgPath,
String key)
Play the specified sound as the specified type of sound, immediately. |
boolean |
play(SoundPlayer.SoundType type,
String pkgPath,
String key,
float pan)
Play the specified sound as the specified type of sound, immediately, with the specified pan value. |
boolean |
play(SoundPlayer.SoundType type,
String pkgPath,
String key,
int delay)
Play the specified sound after the specified delay. |
boolean |
play(SoundPlayer.SoundType type,
String pkgPath,
String key,
int delay,
float pan)
Play the specified sound after the specified delay. |
protected abstract void |
play(String pkgPath,
String key,
float pan)
Play the specified sound after the specified delay. |
void |
removeSoundEnabledObserver(SoundEnabledObserver listener)
|
void |
setClipVolume(float vol)
Sets the volume for all sound clips. |
void |
setEnabled(SoundPlayer.SoundType type,
boolean enabled)
Turns on or off the specified sound type. |
boolean |
shouldPlay(SoundPlayer.SoundType type)
Is sound on and is the specified soundtype enabled? |
abstract void |
shutdown()
Shut the damn thing off. |
String |
summarizeState()
Returns a string summarizing our volume settings and disabled sound types. |
abstract void |
unlock(String pkgPath,
String... keys)
Unlock the specified sounds so that its resources can be freed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final float PAN_LEFT
public static final float PAN_RIGHT
public static final float PAN_CENTER
public static final SoundPlayer.SoundType DEFAULT
protected float _clipVol
protected Set<SoundPlayer.SoundType> _disabledTypes
protected ObserverList<SoundEnabledObserver> _enabledObservers
| Constructor Detail |
|---|
public SoundPlayer()
| Method Detail |
|---|
public abstract void shutdown()
public String summarizeState()
public boolean isEnabled(SoundPlayer.SoundType type)
public boolean shouldPlay(SoundPlayer.SoundType type)
public void setEnabled(SoundPlayer.SoundType type,
boolean enabled)
public void addSoundEnabledObserver(SoundEnabledObserver listener)
public void removeSoundEnabledObserver(SoundEnabledObserver listener)
public void setClipVolume(float vol)
vol - a volume parameter between 0f and 1f, inclusive.public float getClipVolume()
public abstract void lock(String pkgPath,
String... keys)
public abstract void unlock(String pkgPath,
String... keys)
public boolean play(SoundPlayer.SoundType type,
String pkgPath,
String key)
public boolean play(SoundPlayer.SoundType type,
String pkgPath,
String key,
float pan)
pan - a value from -1f (all left) to +1f (all right).
public boolean play(SoundPlayer.SoundType type,
String pkgPath,
String key,
int delay)
delay - the delay in milliseconds.
public boolean play(SoundPlayer.SoundType type,
String pkgPath,
String key,
int delay,
float pan)
delay - the delay in milliseconds.pan - a value from -1f (all left) to +1f (all right).
protected abstract void play(String pkgPath,
String key,
float pan)
pan - a value from -1f (all left) to +1f (all right).
public SoundPlayer.Frob loop(SoundPlayer.SoundType type,
String pkgPath,
String key)
public SoundPlayer.Frob loop(SoundPlayer.SoundType type,
String pkgPath,
String key,
float pan)
protected abstract SoundPlayer.Frob loop(String pkgPath,
String key,
float pan)
protected abstract RunQueue getSoundQueue()
RunQueue.AWT.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||