public class AudioHandler
extends java.lang.Object
implements javax.microedition.media.PlayerListener
Modifier and Type | Field and Description |
---|---|
static AudioHandler |
instance
Our instance
|
static long |
vibration_end_time
The time at which the vibration should end, using standard currentTimeMillis representation
|
BUFFERING_STARTED, BUFFERING_STOPPED, CLOSED, DEVICE_AVAILABLE, DEVICE_UNAVAILABLE, DURATION_UPDATED, END_OF_MEDIA, ERROR, RECORD_ERROR, RECORD_STARTED, RECORD_STOPPED, SIZE_CHANGED, STARTED, STOPPED, STOPPED_AT_TIME, VOLUME_CHANGED
Constructor and Description |
---|
AudioHandler() |
Modifier and Type | Method and Description |
---|---|
void |
beep()
A debug method that just makes a beeping noise
|
void |
keepTheLightOn(long current_time)
Tries to keep the backlight on
|
int |
loadSound(int resid)
Tries to load a sound-resource in preparation for playing it in the future
|
void |
pauseSound(int resid)
Pauses the specified sound playing
|
void |
playerUpdate(javax.microedition.media.Player player,
java.lang.String event,
java.lang.Object eventData)
Handles any state changes that occur to the players
|
void |
playSound(int resid,
int priority,
int repeats)
Plays a sound if no higher priority sound is playing on the available channels.
|
boolean |
resumeSound(int resid)
Attempts to resume a paused piece of audio
|
void |
setVolume(int volume)
Tries to set the volume at which the music should be played
|
void |
stopAllSounds()
Stops the sound playing on all the channels
|
void |
stopSound(int resid)
Stops the specified sound playing
|
void |
unloadSound(int resid)
Unloads the cached version of this sound-resource
|
void |
vibrate(int duration)
Starts the phone's vibration
|
public static AudioHandler instance
public static long vibration_end_time
public void keepTheLightOn(long current_time)
public void vibrate(int duration)
duration
- Duration for the vibration in milliseconds; 0 = stop vibrating.public int loadSound(int resid)
public void unloadSound(int resid)
public void setVolume(int volume)
volume
- Specifies a value from zero, 0 - silent, to 100 - full volume.public void playSound(int resid, int priority, int repeats)
resid
- The RESID of the sound to playpriority
- High-priority sounds will bump low-priority onesrepeats
- How many times should the sound repeat (0 = infinitely)public void stopSound(int resid)
public void stopAllSounds()
public boolean resumeSound(int resid)
public void pauseSound(int resid)
public void beep()
public void playerUpdate(javax.microedition.media.Player player, java.lang.String event, java.lang.Object eventData)
playerUpdate
in interface javax.microedition.media.PlayerListener