本文整理汇总了Java中org.andengine.audio.sound.Sound类的典型用法代码示例。如果您正苦于以下问题:Java Sound类的具体用法?Java Sound怎么用?Java Sound使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sound类属于org.andengine.audio.sound包,在下文中一共展示了Sound类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSound
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public Sound getSound(String soundName) {
final Sound sound = soundMap.get(soundName);
if (sound != null) {
Log.v(TAG, "getSound - returning Sound " + soundName);
} else {
Log.v(TAG, "getSound - missing Sound " + soundName);
}
return sound;
}
示例2: loadLocale
import org.andengine.audio.sound.Sound; //导入依赖的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: loadSound
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
private void loadSound(SoundAsset soundAsset) {
try {
SoundFactory.setAssetBasePath("mfx/");
Sound sound = SoundFactory.createSoundFromAsset(getEngine().getSoundManager(), getApplicationContext(), soundAsset.getFilename());
sound.setVolume(soundAsset.getVolume(), soundAsset.getVolume());
soundMap.put(soundAsset.getFilename(), sound);
} catch (IOException e) {
e.printStackTrace();
}
}
示例4: getInstance
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public static MediaManager getInstance(BaseGameActivity pBaseActivity) {
if (self == null) {
self = new MediaManager();
MediaManager.mBaseActivity = pBaseActivity;
MediaManager.mMusicArray = new SparseArray<Music>();
MediaManager.mSoundArray = new SparseArray<Sound>();
}
return self;
}
示例5: get
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
private Sound get(SoundType pSoundType) {
Sound sound = mSoundArray.get(pSoundType.getValue());
// 未生成, 解放済み
if (sound == null) {
throw new RuntimeException("not create pSoundType = " + pSoundType);
}
if (sound.isReleased()) {
throw new RuntimeException("released pSoundType = " + pSoundType);
}
return sound;
}
示例6: playSoundLoop
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public static void playSoundLoop(Sound s) {
if(s != null && s.isLoaded()) {
s.setVolume(getSoundVolume());
s.setLooping(true);
s.play();
}
}
示例7: init
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public static void init() throws IOException {
GameSounds.sounds = new HashMap<String, Sound>();
GameSounds.sounds.put(COLLECT, SoundFactory.createSoundFromAsset(PhoeniciaContext.soundManager, PhoeniciaContext.context, COLLECT));
GameSounds.sounds.put(COMPLETE, SoundFactory.createSoundFromAsset(PhoeniciaContext.soundManager, PhoeniciaContext.context, COMPLETE));
GameSounds.sounds.put(FAILED, SoundFactory.createSoundFromAsset(PhoeniciaContext.soundManager, PhoeniciaContext.context, FAILED));
}
示例8: putSound
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public void putSound(String soundName, Sound sound) {
soundMap.put(soundName, sound);
Log.v(TAG, "putSound - Added Sound " + soundName);
}
示例9: play
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public void play(SoundType pSoundType) {
Sound sound = get(pSoundType);
// 再生する
sound.play();
}
示例10: playSound
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public static void playSound(Sound s) {
if(s != null && s.isLoaded()) {
s.setVolume(getSoundVolume());
s.play();
}
}
示例11: stopSound
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
public static void stopSound(Sound s) {
if(s != null && s.isLoaded()) {
s.stop();
}
}
示例12: playSound
import org.andengine.audio.sound.Sound; //导入依赖的package包/类
private void playSound(Sound sound) {
if (sound != null && sound.isLoaded() && !sound.isReleased()) {
sound.play();
}
}