本文整理汇总了Java中org.andengine.audio.music.MusicFactory类的典型用法代码示例。如果您正苦于以下问题:Java MusicFactory类的具体用法?Java MusicFactory怎么用?Java MusicFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MusicFactory类属于org.andengine.audio.music包,在下文中一共展示了MusicFactory类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadLocaleLevels
import org.andengine.audio.music.MusicFactory; //导入依赖的package包/类
private void loadLocaleLevels() {
// Load level assets
// TODO: Loading all level intros now is wasteful, need to hack SoundFactory to take a callback when loading finishes
Debug.d("Loading intros");
for (int i = 0; i < locale.levels.size(); i++) {
Level level = locale.levels.get(i);
Debug.d("Loading intros for level " + level.name);
for (int j = 0; j < level.intro.size(); j++) {
IntroPage page = level.intro.get(j);
Debug.d("Loading level intro sound file " + page.sound);
try {
levelSounds.put(page.sound, MusicFactory.createMusicFromAsset(PhoeniciaContext.musicManager, PhoeniciaContext.context, page.sound));
} catch (IOException e) {
Debug.w("Failed to load level intro sound: "+page.sound);
e.printStackTrace();
}
}
}
}
示例2: 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) { }
}
示例3: 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);
}
示例4: loadLocaleTour
import org.andengine.audio.music.MusicFactory; //导入依赖的package包/类
private void loadLocaleTour() throws IOException {
for (Stop stop : locale.tour.getStops()) {
for (Message msg : stop.getMessages()) {
if (msg != null && !msg.sound.isEmpty()) {
levelSounds.put(msg.sound, MusicFactory.createMusicFromAsset(PhoeniciaContext.musicManager, PhoeniciaContext.context, msg.sound));
}
}
}
}
示例5: 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();
}
}
}
示例6: 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);
}
}
示例7: onCreateScene
import org.andengine.audio.music.MusicFactory; //导入依赖的package包/类
/**
* Sceneサブクラスを返す.
*/
@Override
protected Scene onCreateScene() {
// サウンドファイルの格納場所を指定
SoundFactory.setAssetBasePath("mfx/");
// サウンドファイルの格納場所を指定
MusicFactory.setAssetBasePath("mfx/");
InitialScene initialScene = new InitialScene(this);
// 遷移管理用配列に追加
// getSceneArray().add(initialScene);
return initialScene;
}
示例8: createMedia
import org.andengine.audio.music.MusicFactory; //导入依赖的package包/类
public void createMedia(MusicType pMusicType) throws IOException {
if (mMusicArray.get(pMusicType.getValue()) != null) {
return;
}
mMusicArray.put(pMusicType.getValue(),
MusicFactory.createMusicFromAsset(
mBaseActivity.getMusicManager(), mBaseActivity,
pMusicType.getFileName()));
}
示例9: 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());
}
}
示例10: 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();
}
}
示例11: Engine
import org.andengine.audio.music.MusicFactory; //导入依赖的package包/类
public Engine(final EngineOptions pEngineOptions) {
/* Initialize Factory and Manager classes. */
BitmapTextureAtlasTextureRegionFactory.reset();
SoundFactory.onCreate();
MusicFactory.onCreate();
FontFactory.onCreate();
this.mVertexBufferObjectManager.onCreate();
this.mTextureManager.onCreate();
this.mFontManager.onCreate();
this.mShaderProgramManager.onCreate();
/* Apply EngineOptions. */
this.mEngineOptions = pEngineOptions;
if (this.mEngineOptions.hasEngineLock()) {
this.mEngineLock = pEngineOptions.getEngineLock();
} else {
this.mEngineLock = new EngineLock(false);
}
this.mCamera = pEngineOptions.getCamera();
/* Touch. */
if (this.mEngineOptions.getTouchOptions().needsMultiTouch()) {
this.setTouchController(new MultiTouchController());
} else {
this.setTouchController(new SingleTouchController());
}
/* Audio. */
if (this.mEngineOptions.getAudioOptions().needsSound()) {
this.mSoundManager = new SoundManager(this.mEngineOptions.getAudioOptions().getSoundOptions().getMaxSimultaneousStreams());
} else {
this.mSoundManager = null;
}
if (this.mEngineOptions.getAudioOptions().needsMusic()) {
this.mMusicManager = new MusicManager();
} else {
this.mMusicManager = null;
}
/* Start the UpdateThread. */
if (this.mEngineOptions.hasUpdateThread()) {
this.mUpdateThread = this.mEngineOptions.getUpdateThread();
} else {
this.mUpdateThread = new UpdateThread();
}
this.mUpdateThread.setEngine(this);
}
示例12: Engine
import org.andengine.audio.music.MusicFactory; //导入依赖的package包/类
public Engine(final EngineOptions pEngineOptions) {
/* Initialize Factory and Manager classes. */
BitmapTextureAtlasTextureRegionFactory.reset();
SoundFactory.onCreate();
MusicFactory.onCreate();
FontFactory.onCreate();
this.mVertexBufferObjectManager.onCreate();
this.mTextureManager.onCreate();
this.mFontManager.onCreate();
this.mShaderProgramManager.onCreate();
/* Apply EngineOptions. */
this.mEngineOptions = pEngineOptions;
if(this.mEngineOptions.hasEngineLock()) {
this.mEngineLock = pEngineOptions.getEngineLock();
} else {
this.mEngineLock = new EngineLock(false);
}
this.mCamera = pEngineOptions.getCamera();
/* Touch. */
if(this.mEngineOptions.getTouchOptions().needsMultiTouch()) {
this.setTouchController(new MultiTouchController());
} else {
this.setTouchController(new SingleTouchController());
}
/* Audio. */
if(this.mEngineOptions.getAudioOptions().needsSound()) {
this.mSoundManager = new SoundManager(this.mEngineOptions.getAudioOptions().getSoundOptions().getMaxSimultaneousStreams());
} else {
this.mSoundManager = null;
}
if(this.mEngineOptions.getAudioOptions().needsMusic()) {
this.mMusicManager = new MusicManager();
} else {
this.mMusicManager = null;
}
/* Start the UpdateThread. */
if(this.mEngineOptions.hasUpdateThread()) {
this.mUpdateThread = this.mEngineOptions.getUpdateThread();
} else {
this.mUpdateThread = new UpdateThread();
}
this.mUpdateThread.setEngine(this);
}