当前位置: 首页>>代码示例>>Java>>正文


Java MusicFactory.createMusicFromAsset方法代码示例

本文整理汇总了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) { }
}
 
开发者ID:delight-im,项目名称:NationSoccer,代码行数:23,代码来源:ResourcesManager.java

示例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);
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:39,代码来源:PhoeniciaGame.java

示例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();
        }
    }
}
 
开发者ID:PLNech,项目名称:BactMan-Adventures,代码行数:11,代码来源:AbstractGameActivity.java

示例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);
	}
}
 
开发者ID:thoinv,项目名称:kaorisan,代码行数:13,代码来源:ResourcesManager.java

示例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());
    }
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:35,代码来源:ResourceManager.java

示例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();
    }        
}
 
开发者ID:jjhaggar,项目名称:ninja-trials,代码行数:16,代码来源:MusicTest.java


注:本文中的org.andengine.audio.music.MusicFactory.createMusicFromAsset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。