|
|
|
@ -31,7 +31,11 @@ package jme3test.audio; |
|
|
|
|
import com.jme3.app.SimpleApplication; |
|
|
|
|
import com.jme3.audio.AudioNode; |
|
|
|
|
import com.jme3.audio.Environment; |
|
|
|
|
import com.jme3.material.Material; |
|
|
|
|
import com.jme3.math.ColorRGBA; |
|
|
|
|
import com.jme3.math.Vector3f; |
|
|
|
|
import com.jme3.scene.Geometry; |
|
|
|
|
import com.jme3.scene.shape.Box; |
|
|
|
|
|
|
|
|
|
public class TestAmbient extends SimpleApplication { |
|
|
|
|
|
|
|
|
@ -53,14 +57,24 @@ public class TestAmbient extends SimpleApplication { |
|
|
|
|
|
|
|
|
|
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", false); |
|
|
|
|
waves.setPositional(true); |
|
|
|
|
waves.setLocalTranslation(new Vector3f(4, -1, 30)); |
|
|
|
|
waves.setMaxDistance(5); |
|
|
|
|
waves.setRefDistance(1); |
|
|
|
|
waves.setLocalTranslation(new Vector3f(0, 0,0)); |
|
|
|
|
waves.setMaxDistance(100); |
|
|
|
|
waves.setRefDistance(5); |
|
|
|
|
|
|
|
|
|
nature = new AudioNode(assetManager, "Sound/Environment/River.ogg", true); |
|
|
|
|
nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true); |
|
|
|
|
nature.setVolume(3); |
|
|
|
|
audioRenderer.playSourceInstance(waves); |
|
|
|
|
audioRenderer.playSource(nature); |
|
|
|
|
|
|
|
|
|
waves.playInstance(); |
|
|
|
|
nature.play(); |
|
|
|
|
|
|
|
|
|
// just a blue box to mark the spot
|
|
|
|
|
Box box1 = new Box(Vector3f.ZERO, .5f, .5f, .5f); |
|
|
|
|
Geometry player = new Geometry("Player", box1); |
|
|
|
|
Material mat1 = new Material(assetManager, |
|
|
|
|
"Common/MatDefs/Misc/Unshaded.j3md"); |
|
|
|
|
mat1.setColor("Color", ColorRGBA.Blue); |
|
|
|
|
player.setMaterial(mat1); |
|
|
|
|
rootNode.attachChild(player); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|