@Override public void onPlay() { audioNode.play(); }
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(); } }
@Override public void simpleInitApp(){ System.out.println("Playing without filter"); audioSource = new AudioNode(assetManager, "Sound/Effects/Foot steps.ogg", DataType.Buffer); audioSource.play(); }
nature.play();
/** * Set the time offset in the sound sample when to start playing. * * @param timeOffset The time offset * @throws IllegalArgumentException If timeOffset is negative */ public void setTimeOffset(float timeOffset) { if (timeOffset < 0f) { throw new IllegalArgumentException("Time offset cannot be negative"); } this.timeOffset = timeOffset; if (data instanceof AudioStream) { ((AudioStream) data).setTime(timeOffset); }else if(status == AudioSource.Status.Playing){ stop(); play(); } }
@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(); }
@Override public void simpleUpdate(float tpf){ if (audioSource.getStatus() != AudioSource.Status.Playing){ audioRenderer.deleteAudioData(audioSource.getAudioData()); System.out.println("Playing with low pass filter"); audioSource = new AudioNode(assetManager, "Sound/Effects/Foot steps.ogg", DataType.Buffer); audioSource.setDryFilter(new LowPassFilter(1f, .1f)); audioSource.setVolume(3); audioSource.play(); } }
private void btnPlayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayActionPerformed if (musicSource == null){ btnOpenActionPerformed(evt); return; } if (musicSource.getStatus() == Status.Playing){ musicSource.setPitch(1); ar.pauseSource(musicSource); }else{ musicSource.setPitch(1); musicSource.play(); } }//GEN-LAST:event_btnPlayActionPerformed
/** 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! }
@Override public void simpleInitApp() { flyCam.setMoveSpeed(10); Torus torus = new Torus(10, 6, 1, 3); Geometry g = new Geometry("Torus Geom", torus); g.rotate(-FastMath.HALF_PI, 0, 0); g.center(); g.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); // rootNode.attachChild(g); ufoNode = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", AudioData.DataType.Buffer); ufoNode.setLooping(true); ufoNode.setPitch(0.5f); ufoNode.setRefDistance(1); ufoNode.setMaxDistance(100000000); ufoNode.setVelocityFromTranslation(true); ufoNode.play(); Geometry ball = new Geometry("Beeper", new Sphere(10, 10, 0.1f)); ball.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m")); ufoNode.attachChild(ball); rootNode.attachChild(ufoNode); }
@Override public void simpleUpdate(float tpf) { //TODO: add update code time += tpf; if (time > 1f) { //audioBuffer.resetObject(); audioSource.play(); time = 0; } }
@Override public void onPlay() { audioNode.play(); }
@Override public void simpleUpdate(float tpf) { super.simpleUpdate(tpf); acumulative+=tpf; seconds += tpf; if(seconds > 1f) { System.out.println(numSeconds++); seconds = 0f; } if(numSeconds > 10) { System.out.println("Play!"); audioNode.play(); numSeconds = 0; } }
/** * Set the time offset in the sound sample when to start playing. * * @param timeOffset The time offset * @throws IllegalArgumentException If timeOffset is negative */ public void setTimeOffset(float timeOffset) { if (timeOffset < 0f) { throw new IllegalArgumentException("Time offset cannot be negative"); } this.timeOffset = timeOffset; if (data instanceof AudioStream) { ((AudioStream) data).setTime(timeOffset); }else if(status == AudioSource.Status.Playing){ stop(); play(); } }
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(); }
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(); }
/** * 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(); }
public void simpleUpdate(float tpf) { motionTimer.update(); if (music.getStatus() != AudioSource.Status.Playing){ music.play(); } Vector3f loc = cam.getLocation(); Quaternion rot = cam.getRotation(); listener.setLocation(loc); listener.setRotation(rot); music.setLocalTranslation(bell.getLocalTranslation()); } }