Java Code Examples for com.jme3.audio.AudioNode#setLooping()

The following examples show how to use com.jme3.audio.AudioNode#setLooping() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HelloAudio.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/** 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!
}
 
Example 2
Source File: TestDoppler.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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);
    }
 
Example 3
Source File: SoundPerformer.java    From OpenRTS with MIT License 6 votes vote down vote up
@Override
public void perform(Actor a) {
	SoundActor actor = (SoundActor)a;
	AudioNode audio = actorDrawer.getAudioNode(actor.soundPath);
	audio.setPositional(actor.positional);
	if(actor.positional)
		audio.setLocalTranslation(TranslateUtil.toVector3f(actor.getParentModelActor().getPos()));
	
	audio.setLooping(actor.looping);
	audio.setVolume((float)(actor.volume));
	
	audio.setRefDistance(4);
	audio.setReverbEnabled(false);
	
	audio.playInstance();
	a.stopActing();
}
 
Example 4
Source File: HelloAudio.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
/** 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", 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/Nature.ogg", true);
  audio_nature.setLooping(true);  // activate continuous playing
  audio_nature.setPositional(true);
  audio_nature.setLocalTranslation(Vector3f.ZERO.clone());
  audio_nature.setVolume(3);
  rootNode.attachChild(audio_nature);
  audio_nature.play(); // play continuously!
}
 
Example 5
Source File: TestDoppler.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void simpleInitApp(){
    audioRenderer.setEnvironment(Environment.Dungeon);
    AL10.alDistanceModel(AL11.AL_EXPONENT_DISTANCE);
    
    ufo  = new AudioNode(assetManager, "Sound/Effects/Beep.ogg", false);
    ufo.setPositional(true);
    ufo.setLooping(true);
    ufo.setReverbEnabled(true);
    ufo.setRefDistance(100000000);
    ufo.setMaxDistance(100000000);
    ufo.play();
}
 
Example 6
Source File: TestWav.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
  audioSource = new AudioNode(assetManager, "Sound/Effects/Gun.wav",
          AudioData.DataType.Buffer);
  audioSource.setLooping(false);
}
 
Example 7
Source File: TestWav.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
  audioSource = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false);
  audioSource.setLooping(false);
}