public class SoundManager extends Object
Note: the sound manager is not thread safe (other than during its interactions with its internal background loading thread). It assumes that all sound loading and play requests will be made from a single thread.
| Modifier and Type | Method and Description |
|---|---|
SoundGroup |
createGroup(ClipProvider provider,
int sources)
Creates an object that can be used to manage and play a group of sounds.
|
static SoundManager |
createSoundManager(RunQueue rqueue)
Creates, initializes and returns the singleton sound manager instance.
|
float |
getBaseGain()
Returns the base gain used for sound effects (not music).
|
Listener |
getListener()
Returns a reference to the listener object.
|
ArrayList<Stream> |
getStreams()
Returns a reference to the list of active streams.
|
boolean |
isInitialized()
Returns true if we were able to initialize the sound system.
|
void |
loadClip(ClipProvider provider,
String path)
Loads a clip buffer for the sound clip loaded via the specified provider with the
specified path.
|
void |
loadClip(ClipProvider provider,
String path,
ClipBuffer.Observer observer)
Loads a clip buffer for the sound clip loaded via the specified provider with the
specified path.
|
void |
setBaseGain(float gain)
Configures the base gain (which must be a value between 0 and 1.0) which is multiplied to
the individual gain assigned to sound effects (but not music).
|
void |
setCacheSize(int bytes)
Configures the size of our sound cache.
|
void |
shutdown()
Shuts down the sound manager.
|
void |
updateStreams(float time)
Updates all of the streams controlled by the manager.
|
public static SoundManager createSoundManager(RunQueue rqueue)
rqueue - a queue that the sound manager can use to post short runnables that must be
executed on the same thread from which all other sound methods will be called.public void shutdown()
public boolean isInitialized()
public void setCacheSize(int bytes)
public Listener getListener()
public void setBaseGain(float gain)
public float getBaseGain()
public SoundGroup createGroup(ClipProvider provider, int sources)
SoundGroup.dispose().provider - indicates from where the sound group will load its sounds.sources - indicates the maximum number of simultaneous sounds that can play in this
group.public void updateStreams(float time)
time - the number of seconds elapsed since the last updatepublic void loadClip(ClipProvider provider, String path)
public void loadClip(ClipProvider provider, String path, ClipBuffer.Observer observer)
Copyright © 2015. All rights reserved.