comparison src/com/aurellem/capture/examples/AdvancedAudio.java @ 16:87f818f58975

more work on Advanced documentation
author Robert McIntyre <rlm@mit.edu>
date Fri, 28 Oct 2011 22:24:10 -0700
parents be5ac56826be
children dae169178d11
comparison
equal deleted inserted replaced
15:be5ac56826be 16:87f818f58975
60 org.lwjgl.input.Mouse.setGrabbed(false); 60 org.lwjgl.input.Mouse.setGrabbed(false);
61 app.start(); 61 app.start();
62 } 62 }
63 63
64 64
65 private Spatial teapot; 65
66 private boolean active = true; 66
67 private boolean playing = false;
68 private MotionPath path;
69 private MotionTrack motionControl; 67 private MotionTrack motionControl;
70 68
71 69
72 private void makeEar(Node root, Vector3f position){ 70 private void makeEar(Node root, Vector3f position){
73 Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); 71 Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
74 Geometry ear = new Geometry("ear", new Box(1.0f, 1.0f, 1.0f)); 72 Geometry ear = new Geometry("ear", new Box(1.0f, 1.0f, 1.0f));
75 ear.setLocalTranslation(position); 73 ear.setLocalTranslation(position);
76 mat.setColor("Color", ColorRGBA.Green); 74 mat.setColor("Color", ColorRGBA.Green);
77 ear.setMaterial(mat); 75 ear.setMaterial(mat);
78 root.attachChild(ear); 76 root.attachChild(ear);
79 } 77 }
80
81 78
82 private void createScene() { 79 private void createScene() {
83 Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); 80 Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
84 Geometry bell = new Geometry( "sound-emitter" , new Sphere(15,15,1)); 81 Geometry bell = new Geometry( "sound-emitter" , new Sphere(15,15,1));
85 mat.setColor("Color", ColorRGBA.Blue); 82 mat.setColor("Color", ColorRGBA.Blue);
86 bell.setMaterial(mat); 83 bell.setMaterial(mat);
87 rootNode.attachChild(bell); 84 rootNode.attachChild(bell);
88
89
90
91 85
92 DirectionalLight light = new DirectionalLight(); 86 DirectionalLight light = new DirectionalLight();
93 light.setDirection(new Vector3f(0, -1, 0).normalizeLocal()); 87 light.setDirection(new Vector3f(0, -1, 0).normalizeLocal());
94 light.setColor(ColorRGBA.White.mult(1.5f)); 88 light.setColor(ColorRGBA.White.mult(1.5f));
95 rootNode.addLight(light); 89 rootNode.addLight(light);
232 226
233 /** We create two audio nodes. */ 227 /** We create two audio nodes. */
234 private void initAudio() { 228 private void initAudio() {
235 //audioRenderer.setEnvironment(Environment.Cavern); 229 //audioRenderer.setEnvironment(Environment.Cavern);
236 /* gun shot sound is to be triggered by a mouse click. */ 230 /* gun shot sound is to be triggered by a mouse click. */
237 audio_gun = new AudioNode(assetManager, "Sound/Effects/Gun.wav", false); 231 audio_gun = new AudioNode(assetManager, "Sound/Environment/haydn.wav", false);
238 //audio_gun = new AudioNode(assetManager, "Sound/Effects/dream.wav", false, false); 232 //audio_gun = new AudioNode(assetManager, "Sound/Effects/dream.wav", false, false);
239 audio_gun.setLooping(false); 233 audio_gun.setLooping(false);
240 audio_gun.setVolume(2); 234 audio_gun.setVolume(2);
241 audio_gun.setPositional(true); 235 audio_gun.setPositional(true);
242 236
243 237
244 /* nature sound - keeps playing in a loop. */ 238 /* nature sound - keeps playing in a loop. */
245 audio_nature = new AudioNode(assetManager, "Sound/Environment/Nature.ogg", false, false); 239 audio_nature = new AudioNode(assetManager, "Sound/Environment/haydn.wav", false, false);
246 audio_nature.setLooping(true); 240 audio_nature.setLooping(true);
247 audio_nature.setPositional(true); 241 audio_nature.setPositional(true);
248 audio_nature.setLocalTranslation(Vector3f.ZERO.clone()); 242 audio_nature.setLocalTranslation(Vector3f.ZERO.clone());
249 audio_nature.setVolume(3); 243 audio_nature.setVolume(3);
250 audio_nature.updateGeometricState(); 244 audio_nature.updateGeometricState();