本文整理汇总了Java中org.andengine.audio.music.Music.play方法的典型用法代码示例。如果您正苦于以下问题:Java Music.play方法的具体用法?Java Music.play怎么用?Java Music.play使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.audio.music.Music
的用法示例。
在下文中一共展示了Music.play方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playLevelSound
import org.andengine.audio.music.Music; //导入方法依赖的package包/类
/**
* Play the given audio file
* @param soundFile
*/
public void playLevelSound(String soundFile, MediaPlayer.OnCompletionListener callback) {
Debug.d("Playing sound: "+soundFile);
if (!this.isStarted || !this.isRunning) {
Debug.d("Game hasn't started yet, not playing any sound");
return;
}
if (this.levelSounds.containsKey(soundFile)) {
Music sound = this.levelSounds.get(soundFile);
sound.setOnCompletionListener(callback);
sound.play();
} else {
Debug.d("No levelSounds: " + soundFile + "");
}
}
示例2: play
import org.andengine.audio.music.Music; //导入方法依赖的package包/类
public void play(MusicType pMusicType, boolean isStart) {
Music music = get(pMusicType);
// 再生中
if (music.isPlaying()) {
return;
}
stopPlayingMusic(); // 再生中のBGMは全部止めてから再生する
// 再生する(基本ループ)
music.setLooping(true);
music.play();
}
示例3: playMusic
import org.andengine.audio.music.Music; //导入方法依赖的package包/类
/**
* Begins playing music.
* @param m
*/
public static void playMusic(Music m) {
if(m != null && !m.isPlaying()) {
m.setVolume(getMusicVolume());
m.play();
}
}
示例4: playMusicLoop
import org.andengine.audio.music.Music; //导入方法依赖的package包/类
/**
* Play music in looping.
* @param m
*/
public static void playMusicLoop(Music m) {
if(m != null && !m.isPlaying()) {
m.setVolume(getMusicVolume());
m.setLooping(true);
m.play();
}
}
示例5: playMusic
import org.andengine.audio.music.Music; //导入方法依赖的package包/类
private void playMusic(Music music) {
if (music != null && !music.isReleased()) {
music.play();
}
}