|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.gameengine.icadroids.sound.GameSound
public final class GameSound
This class features a number of static methods that can be used to add sound to your game. This class should be used when you want to play short sound clips, the length of these clips should not be longer than about 5 seconds. For larger files, use the MusicPlayer class.
Constructor Summary | |
---|---|
GameSound()
Constructs an instance of this class. |
Method Summary | |
---|---|
static void |
addSound(int index,
java.lang.String soundID)
Adds a new sound to the SoundPool. |
static void |
cleanup()
Deallocates the resources and Instance of GameSound.This is called automatically when the application is be closed. |
static void |
initSounds(Context theContext)
Initializes the storage for the sounds. |
static void |
pauseSound(int index)
Pause a sound, call resumeSound to continue playing the specified sound. |
static void |
pauseSounds()
Pauses all sounds, call resumeSounds to continue playing sounds. |
static void |
playSound(int index,
int loopSound)
Plays a sound that has been added to the SoundPool with addSound |
static void |
resumeSound(int index)
Resumes the specified paused sound. |
static void |
resumeSounds()
Resumes all paused sounds. |
static void |
stopSound(int index)
Stops a sound |
static void |
stopSounds()
Stops all sounds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GameSound()
Method Detail |
---|
public static final void initSounds(Context theContext)
theContext
- The Application context.public static final void addSound(int index, java.lang.String soundID)
index
- The sound index where the sound will be stored.soundID
- The name of the sound that needs to be stored.public static final void playSound(int index, int loopSound)
index
- The Index of the Sound to be played, defined by addSound.loopSound
- The amount of times the music should loop, a negative value
will result in an endless loop.public static final void pauseSound(int index)
index
- index of the sound to be paused.public static final void pauseSounds()
public static final void resumeSound(int index)
index
- index of the sound to be resumedpublic static final void resumeSounds()
public static final void stopSound(int index)
index
- index of the sound to be stoppedpublic static final void stopSounds()
public static final void cleanup()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |