本文整理汇总了Java中org.andengine.audio.music.MusicFactory.createMusicFromAsset方法的典型用法代码示例。如果您正苦于以下问题:Java MusicFactory.createMusicFromAsset方法的具体用法?Java MusicFactory.createMusicFromAsset怎么用?Java MusicFactory.createMusicFromAsset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.andengine.audio.music.MusicFactory
的用法示例。
在下文中一共展示了MusicFactory.createMusicFromAsset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadSounds
import org.andengine.audio.music.MusicFactory; //导入方法依赖的package包/类
private void loadSounds(int volumeMode) {
try {
if (volumeMode == MyApp.VOLUME_ON) {
mAudio_Music = MusicFactory.createMusicFromAsset(mEngine.getMusicManager(), mActivity, SOUND_DIR+"crowd.ogg");
mAudio_Music.setLooping(true);
mAudio_Whistle = SoundFactory.createSoundFromAsset(mEngine.getSoundManager(), mActivity, SOUND_DIR+"whistle.ogg");
mAudio_Jump = SoundFactory.createSoundFromAsset(mEngine.getSoundManager(), mActivity, SOUND_DIR+"jump.ogg");
mAudio_Applause = SoundFactory.createSoundFromAsset(mEngine.getSoundManager(), mActivity, SOUND_DIR+"applause.ogg");
mAudio_Boo = SoundFactory.createSoundFromAsset(mEngine.getSoundManager(), mActivity, SOUND_DIR+"boo.ogg");
mAudio_Kick = SoundFactory.createSoundFromAsset(mEngine.getSoundManager(), mActivity, SOUND_DIR+"kick.ogg");
}
else {
mAudio_Music = null;
mAudio_Whistle = null;
mAudio_Jump = null;
mAudio_Applause = null;
mAudio_Boo = null;
mAudio_Kick = null;
}
}
catch (IOException e) { }
}
示例2: loadLocale
import org.andengine.audio.music.MusicFactory; //导入方法依赖的package包/类
private void loadLocale(ProgressDisplay progress) throws IOException {
// Initialize game shell textures
Texture newShell = new AssetBitmapTexture(PhoeniciaContext.textureManager, PhoeniciaContext.assetManager, this.locale.shell_src);
newShell.load();
GameUI.init(newShell);
// For storing sound data
blockSounds = new HashMap<String, Sound>();
// Load background music
try {
this.music = MusicFactory.createMusicFromAsset(PhoeniciaContext.musicManager, PhoeniciaContext.context, locale.music_src);
this.music.setLooping(true);
this.music.setVolume(0.3f);
} catch (Exception e) {
Debug.e("Failed to load background music asset: "+locale.music_src);
}
progress.setProgress(0.3f);
this.loadLocaleMap();
progress.setProgress(0.4f);
this.loadLocaleDefaults();
this.loadLocalePeople();
progress.setProgress(0.5f);
this.loadLocaleTour();
progress.setProgress(0.6f);
this.loadLocaleNumbers();
progress.setProgress(0.65f);
this.loadLocaleLetters();
progress.setProgress(0.7f);
this.loadLocaleWords();
progress.setProgress(0.8f);
this.loadLocaleGames();
progress.setProgress(0.9f);
this.loadLocaleDecorations();
this.loadLocaleLevels();
progress.setProgress(0.99f);
}
示例3: loadMusic
import org.andengine.audio.music.MusicFactory; //导入方法依赖的package包/类
private void loadMusic() {
if (music == null) {
try {
music = MusicFactory.createMusicFromAsset(mEngine.getMusicManager(), this, "mfx/games.mp3");
music.setLooping(true);
} catch (IOException e) {
e.printStackTrace();
}
}
}
示例4: loadGameAudio
import org.andengine.audio.music.MusicFactory; //导入方法依赖的package包/类
private void loadGameAudio() {
MusicFactory.setAssetBasePath("sounds/");
try {
this.mSwooshing = MusicFactory.createMusicFromAsset(activity.getMusicManager(), activity, "swooshing.ogg");
this.mPoint = MusicFactory.createMusicFromAsset(activity.getMusicManager(), activity, "point.ogg");
this.mDie = MusicFactory.createMusicFromAsset(activity.getMusicManager(), activity, "die.ogg");
this.mHit = MusicFactory.createMusicFromAsset(activity.getMusicManager(), activity, "hit.ogg");
this.mWing = MusicFactory.createMusicFromAsset(activity.getMusicManager(), activity, "wing.ogg");
} catch (final IOException e) {
Debug.e(e);
}
}
示例5: loadMusicsResources
import org.andengine.audio.music.MusicFactory; //导入方法依赖的package包/类
public synchronized void loadMusicsResources() {
MusicFactory.setAssetBasePath("music/");
try {
credits = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "credits.ogg");
ending = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "ending.ogg");
intro1 = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "intro1.ogg");
intro2 = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "intro2.ogg");
map = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "map.ogg");
records = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "records.ogg");
trialJump = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "trial_jump.ogg");
trialCut = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "trial_cut_music.ogg");
trialRun = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "trial_run.ogg");
trialShurikens = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "trial_shurikens.ogg");
loseMusic = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "result_lose.ogg");
winMusic = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "result_win.ogg");
gameOverMusic = MusicFactory.createMusicFromAsset(
this.activity.getMusicManager(), this.context, "game_over.ogg");
}
catch (final IOException e) {
Log.v("Sounds Load","Exception:" + e.getMessage());
}
}
示例6: onLoadScene
import org.andengine.audio.music.MusicFactory; //导入方法依赖的package包/类
@Override
public void onLoadScene() {
// Sonido:
SoundFactory.setAssetBasePath("sounds/");
MusicFactory.setAssetBasePath("music/");
try {
cutMusic = MusicFactory.createMusicFromAsset(
ResourceManager.getInstance().activity.getMusicManager(),
ResourceManager.getInstance().context,
"trial_cut_music.ogg");
} catch (final IOException e) {
Log.v("Sounds Load","Exception: " + e.getMessage());
e.printStackTrace();
}
}