Game Development Reference
In-Depth Information
@Override
public void onCompletion(MediaPlayer mp) {
mPlaying = false;
if (mLoop) {
mp.start();
}
}
});
}
public synchronized void play() {
if (mPlaying)
return;
if (mPlayer != null) {
mPlaying = true;
mPlayer.start();
}
}
public synchronized void stop() {
try {
mLoop = false;
if (mPlaying) {
mPlaying = false;
mPlayer.pause();
}
} catch (Exception e) {
System.err.println("AduioClip::stop " + name + " "
+ e.toString());
}
}
public synchronized void loop() {
mLoop = true;
mPlaying = true;
mPlayer.start();
}
public void release() {
if (mPlayer != null) {
mPlayer.release();
mPlayer = null;
}
}
}
Search WWH ::




Custom Search