use of com.jme3.audio.AudioNode in project jmonkeyengine by jMonkeyEngine.
the class TestAmbient method simpleInitApp.
@Override
public void simpleInitApp() {
float[] eax = new float[] { 15, 38.0f, 0.300f, -1000, -3300, 0, 1.49f, 0.54f, 1.00f, -2560, 0.162f, 0.00f, 0.00f, 0.00f, -229, 0.088f, 0.00f, 0.00f, 0.00f, 0.125f, 1.000f, 0.250f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.00f, 0x3f };
Environment env = new Environment(eax);
audioRenderer.setEnvironment(env);
waves = new AudioNode(assetManager, "Sound/Environment/Ocean Waves.ogg", false);
waves.setPositional(true);
waves.setLocalTranslation(new Vector3f(0, 0, 0));
waves.setMaxDistance(100);
waves.setRefDistance(5);
nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", true);
nature.setPositional(false);
nature.setVolume(3);
waves.playInstance();
nature.play();
// just a blue box to mark the spot
Box box1 = new Box(.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);
}
use of com.jme3.audio.AudioNode in project jmonkeyengine by jMonkeyEngine.
the class HelloAudio method initAudio.
/** 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.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", true);
// activate continuous playing
audio_nature.setLooping(true);
audio_nature.setPositional(true);
audio_nature.setVolume(3);
rootNode.attachChild(audio_nature);
// play continuously!
audio_nature.play();
}
use of com.jme3.audio.AudioNode in project jmonkeyengine by jMonkeyEngine.
the class AudioTrack method read.
/**
* Internal use only serialization
*
* @param im importer
* @throws IOException Exception
*/
public void read(JmeImporter im) throws IOException {
InputCapsule in = im.getCapsule(this);
audio = (AudioNode) in.readSavable("audio", null);
length = in.readFloat("length", length);
startOffset = in.readFloat("startOffset", 0);
}
use of com.jme3.audio.AudioNode in project jmonkeyengine by jMonkeyEngine.
the class AudioTrack method findAudio.
/**
* recursive function responsible for finding the newly cloned AudioNode
*
* @param spat
* @return
*/
private AudioNode findAudio(Spatial spat) {
if (spat instanceof AudioNode) {
//spat is an AudioNode
AudioNode em = (AudioNode) spat;
//getting the UserData TrackInfo so check if it should be attached to this Track
TrackInfo t = (TrackInfo) em.getUserData("TrackInfo");
if (t != null && t.getTracks().contains(this)) {
return em;
}
return null;
} else if (spat instanceof Node) {
for (Spatial child : ((Node) spat).getChildren()) {
AudioNode em = findAudio(child);
if (em != null) {
return em;
}
}
}
return null;
}
use of com.jme3.audio.AudioNode in project jmonkeyengine by jMonkeyEngine.
the class TestOgg method simpleUpdate.
@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();
}
}
Aggregations