public SoundHandle loadSound(SoundSystem soundSystem, String filename) { AudioNode an = new AudioNode(assetManager, filename, AudioData.DataType.Buffer); an.setPositional(false); return new SoundHandleJme(ar, an); }
@Override public void initEvent(Application app, Cinematic cinematic) { super.initEvent(app, cinematic); audioNode = new AudioNode(app.getAssetManager(), path, stream); audioNode.setPositional(false); setLoopMode(loopMode); }
@Override public void simpleInitApp(){ assetManager.registerLocator("https://web.archive.org/web/20170625151521if_/http://www.vorbis.com/music/", UrlLocator.class); AudioNode audioSource = new AudioNode(assetManager, "Lumme-Badloop.ogg", AudioData.DataType.Stream); audioSource.setPositional(false); audioSource.setReverbEnabled(false); audioSource.play(); }
/** We create two audio nodes. */ private void initAudio() { /* gun shot sound is to be triggered by a mouse click. */ audio_gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav", DataType.Buffer); audio_gun.setPositional(false); audio_gun.setLooping(false); audio_gun.setVolume(2); rootNode.attachChild(audio_gun); /* nature sound - keeps playing in a loop. */ audio_nature = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", DataType.Stream); audio_nature.setLooping(true); // activate continuous playing audio_nature.setPositional(true); audio_nature.setVolume(3); rootNode.attachChild(audio_nature); audio_nature.play(); // play continuously! }
public void play() { if (fileName != null){ if (node != null){ node.stop(); } node = new AudioNode(am, fileName,AudioData.DataType.Stream); node.setPositional(false); node.setVolume(volume); node.play(); }else{ node.playInstance(); } }
waves.setPositional(true); waves.setLocalTranslation(new Vector3f(0, 0,0)); waves.setMaxDistance(100); nature.setPositional(false); nature.setVolume(3);
public void onSoundChanged(SoundFile soundFile) { AudioNode node = SoundsLoader.getAudioNode(assetManager, soundFile); node.setLooping(false); node.setPositional(false); node.play(); }
private void playSound(boolean enabled) { String file = String.format("Sounds/Global/MistressHW/ms_1ft0%s.mp2", enabled ? "1" : "2"); AudioNode sound = new AudioNode(app.getAssetManager(), file, DataType.Buffer); sound.setLooping(false); sound.setPositional(false); sound.play(); }
private void playSpeech(String file) { speech = new AudioNode(app.getAssetManager(), file, DataType.Buffer); if (speech == null) { logger.log(Level.WARNING, "Audio file {0} not found", file); return; } speech.setLooping(false); speech.setPositional(false); speech.play(); }
@Override public void initEvent(Application app, Cinematic cinematic) { super.initEvent(app, cinematic); audioNode = new AudioNode(app.getAssetManager(), path, stream); audioNode.setPositional(false); setLoopMode(loopMode); }
private void playBackground() { String file = this.getRandomSoundFile(); background = new AudioNode(app.getAssetManager(), file, DataType.Buffer); if (background == null) { logger.log(Level.WARNING, "Audio file {0} not found", file); return; } background.setLooping(false); background.setPositional(false); background.setVolume(0.2f); background.play(); }
soundnode.setPositional(true); soundnode.setReverbEnabled(true); soundnode.setRefDistance(50f); soundnode.setPositional(false);
/** * Plays a positional sound in an given tile * * @param x x coordinate * @param y y coordinate * @param soundFile the sound file */ public void playSoundAtTile(int x, int y, String soundFile) { // We might cache these per file? Then they would be persistent, just move them, does it matter? // Since creation of new objects and all, I don't know if they stay in the scene graph.. AudioNode audio = new AudioNode(assetManager, ConversionUtils.getCanonicalAssetKey(AssetsConverter.SOUNDS_FOLDER + soundFile), AudioData.DataType.Buffer); audio.setPositional(true); audio.setReverbEnabled(false); audio.setLocalTranslation(x, 0, y); worldNode.attachChild(audio); audio.play(); }
@Override protected void controlUpdate(float tpf) { if (moved == false) { if (lastTime != null) { long elapsedTime = System.currentTimeMillis() - lastTime; if (active) { // If the spatial starts in the base location, play the sound if (getSpatial().getLocalTranslation().equals(baseLocation)) { AudioNode fx = new AudioNode(assetManager, "Sounds/Global/GuiHD/RockRise nl.mp2", DataType.Buffer); fx.setLooping(false); fx.setPositional(true); fx.play(); } // Play the animation playAnimation(ACTIVATE_ANIMATION_LENGTH, baseLocation, baseLocation.add(MOVE_VECTOR), elapsedTime); } else { playAnimation(DEACTIVATE_ANIMATION_LENGTH, baseLocation.add(MOVE_VECTOR), baseLocation, elapsedTime); } } else { lastTime = System.currentTimeMillis(); baseProgess = baseLocation.distance(spatial.getLocalTranslation()) / baseLocation.distance(baseLocation.add(MOVE_VECTOR)); if (!active) { baseProgess = 1f - baseProgess; } } } }
private void initAudio() { org.lwjgl.input.Mouse.setGrabbed(false); music = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", false); rootNode.attachChild(music); audioRenderer.playSource(music); music.setPositional(true); music.setVolume(1f); music.setReverbEnabled(false); music.setDirectional(false); music.setMaxDistance(200.0f); music.setRefDistance(1f); //music.setRolloffFactor(1f); music.setLooping(false); audioRenderer.pauseSource(music); }
state.levelBriefing.setLooping(false); state.levelBriefing.setDirectional(false); state.levelBriefing.setPositional(false); state.levelBriefing.play();
audioNode.setVolume(1); audioNode.setRefDistance(10f); audioNode.setPositional(true); audioNode.setMaxDistance(10000000); audioNode.setLocalTranslation(Vector3f.ZERO);