public class Audio
extends java.lang.Object
To play a sound in your game, use the following steps:
.wav
, .m4a
, or .mp3
file with your audio clip.
You may find the Windows Voice Recorder utility handy for this,
or the program AudacityAudio.play(R.raw.monster_roar1)
Constructor and Description |
---|
Audio() |
Modifier and Type | Method and Description |
---|---|
static void |
onPause()
Called by the game engine to pause sound playing.
|
static void |
onResume(android.content.Context context)
Called by the game engine to resume sound playing after a pause.
|
static void |
play(int id)
Request that a sound be played.
|
public static void onResume(android.content.Context context)
public static void onPause()
public static void play(int id)
The sound will play exactly once (no looping yet). You may request up to six sounds playing simultaneously. If this is not enough, we can up that limit.
id
- resource ID of the .wav
, .m4a
, or .mp3
file with
your audio clip, for example R.raw.monster_roar1