|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.media.sound.SoundPlayer
com.threerings.openal.OpenALSoundPlayer
public class OpenALSoundPlayer
Implements the abstract pieces of SoundPlayer via OpenAL.
| Nested Class Summary | |
|---|---|
protected class |
OpenALSoundPlayer.MediaALSoundManager
Extends sound manager to allow sounds to be pulled out of the locked map. |
protected class |
OpenALSoundPlayer.SoundGrabber
Loads a sound in its run method and calls subclasses with soundLoaded to let them know it's ready. |
protected class |
OpenALSoundPlayer.TickingQueue
Updates the sound manager's streams every STREAM_UPDATE_INTERVAL and processes sound runnables added to its queue. |
| Nested classes/interfaces inherited from class com.threerings.media.sound.SoundPlayer |
|---|
SoundPlayer.Frob, SoundPlayer.SoundType |
| Field Summary | |
|---|---|
protected SoundManager |
_alSoundManager
|
protected SoundGroup |
_group
|
protected SoundLoader |
_loader
|
protected Map<String,ClipBuffer> |
_locked
|
protected OpenALSoundPlayer.TickingQueue |
_ticker
|
protected int |
SOURCE_COUNT
Number of sounds that can be played simultaneously. |
protected static int |
STREAM_UPDATE_INTERVAL
Number of milliseconds to wait between stream updates. |
| Fields inherited from class com.threerings.media.sound.SoundPlayer |
|---|
_clipVol, _disabledTypes, _enabledObservers, DEFAULT, PAN_CENTER, PAN_LEFT, PAN_RIGHT |
| Constructor Summary | |
|---|---|
OpenALSoundPlayer(SoundLoader loader)
|
|
| Method Summary | |
|---|---|
protected SoundManager |
createSoundManager()
Creates our SoundManager. |
protected String[] |
getPaths(String pkgPath,
String key)
Returns bundle:path for all sounds under key in pkgPath. |
SoundLoader |
getSoundLoader()
Returns the loader used by this player. |
RunQueue |
getSoundQueue()
Gets the run queue on which sound should be played. |
Clip |
loadClip(String path)
Loads the specified clip from the appropriate source. |
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,
float gain,
float[] pos)
|
SoundPlayer.Frob |
loop(String pkgPath,
String key,
float pan)
Loop the specified sound, stopping as quickly as possible when stop is called. |
SoundPlayer.Frob |
loop(String pkgPath,
String key,
float pan,
float gain)
|
boolean |
play(SoundPlayer.SoundType type,
String pkgPath,
String key,
float gain,
float[] pos)
|
void |
play(String pkgPath,
String key,
float pan)
Play the specified sound after the specified delay. |
void |
play(String pkgPath,
String key,
float pan,
float gain)
|
void |
setClipVolume(float vol)
Sets the volume for all sound clips. |
void |
shutdown()
Shut the damn thing off. |
void |
stream(String bundle,
String path,
boolean loop,
ResultListener<Stream> listener)
Streams ogg files from the given bundle and path. |
void |
unlock(String pkgPath,
String... keys)
Unlock the specified sounds so that its resources can be freed. |
| Methods inherited from class com.threerings.media.sound.SoundPlayer |
|---|
addSoundEnabledObserver, getClipVolume, isEnabled, loop, loop, play, play, play, play, removeSoundEnabledObserver, setEnabled, shouldPlay, summarizeState |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final int STREAM_UPDATE_INTERVAL
protected OpenALSoundPlayer.TickingQueue _ticker
protected Map<String,ClipBuffer> _locked
protected SoundLoader _loader
protected SoundGroup _group
protected SoundManager _alSoundManager
protected final int SOURCE_COUNT
| Constructor Detail |
|---|
public OpenALSoundPlayer(SoundLoader loader)
| Method Detail |
|---|
public Clip loadClip(String path)
throws IOException
ClipProvider
loadClip in interface ClipProviderIOExceptionpublic SoundLoader getSoundLoader()
public RunQueue getSoundQueue()
SoundPlayerRunQueue.AWT.
getSoundQueue in class SoundPlayerpublic void setClipVolume(float vol)
SoundPlayer
setClipVolume in class SoundPlayervol - a volume parameter between 0f and 1f, inclusive.
public void lock(String pkgPath,
String... keys)
SoundPlayer
lock in class SoundPlayer
public void unlock(String pkgPath,
String... keys)
SoundPlayer
unlock in class SoundPlayer
public void stream(String bundle,
String path,
boolean loop,
ResultListener<Stream> listener)
throws IOException
IOException
public SoundPlayer.Frob loop(String pkgPath,
String key,
float pan)
SoundPlayer
loop in class SoundPlayer
public SoundPlayer.Frob loop(String pkgPath,
String key,
float pan,
float gain)
public SoundPlayer.Frob loop(SoundPlayer.SoundType type,
String pkgPath,
String key,
float gain,
float[] pos)
public void play(String pkgPath,
String key,
float pan)
SoundPlayer
play in class SoundPlayerpan - a value from -1f (all left) to +1f (all right).
public void play(String pkgPath,
String key,
float pan,
float gain)
public boolean play(SoundPlayer.SoundType type,
String pkgPath,
String key,
float gain,
float[] pos)
public void shutdown()
SoundPlayer
shutdown in class SoundPlayer
protected String[] getPaths(String pkgPath,
String key)
protected SoundManager createSoundManager()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||