comparison src/com/aurellem/capture/examples/Advanced.java @ 45:5cd9e6c65a93

system is shaping up
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Dec 2011 12:44:23 -0600
parents 388f9d062012
children 6ecfef90e9eb
comparison
equal deleted inserted replaced
44:388f9d062012 45:5cd9e6c65a93
3 import java.io.File; 3 import java.io.File;
4 import java.io.FileNotFoundException; 4 import java.io.FileNotFoundException;
5 import java.io.IOException; 5 import java.io.IOException;
6 import java.lang.reflect.Field; 6 import java.lang.reflect.Field;
7 import java.nio.ByteBuffer; 7 import java.nio.ByteBuffer;
8 import java.util.logging.Level;
9 import java.util.logging.Logger;
10 8
11 import javax.sound.sampled.AudioFormat; 9 import javax.sound.sampled.AudioFormat;
12 10
13 import org.tritonus.share.sampled.FloatSampleTools; 11 import org.tritonus.share.sampled.FloatSampleTools;
14 12
13 import com.aurellem.capture.AurellemSystemDelegate;
15 import com.aurellem.capture.Capture; 14 import com.aurellem.capture.Capture;
16 import com.aurellem.capture.IsoTimer; 15 import com.aurellem.capture.IsoTimer;
17 import com.aurellem.capture.audio.CompositeSoundProcessor; 16 import com.aurellem.capture.audio.CompositeSoundProcessor;
18 import com.aurellem.capture.audio.MultiListener; 17 import com.aurellem.capture.audio.MultiListener;
19 import com.aurellem.capture.audio.SoundProcessor; 18 import com.aurellem.capture.audio.SoundProcessor;
32 import com.jme3.scene.Geometry; 31 import com.jme3.scene.Geometry;
33 import com.jme3.scene.Node; 32 import com.jme3.scene.Node;
34 import com.jme3.scene.shape.Box; 33 import com.jme3.scene.shape.Box;
35 import com.jme3.scene.shape.Sphere; 34 import com.jme3.scene.shape.Sphere;
36 import com.jme3.system.AppSettings; 35 import com.jme3.system.AppSettings;
37 import com.jme3.system.Natives; 36 import com.jme3.system.JmeSystem;
38 37
39 38
40 /** 39 /**
41 * 40 *
42 * Demonstrates advanced use of the audio capture and recording features. 41 * Demonstrates advanced use of the audio capture and recording features.
88 87
89 public static void test(){ 88 public static void test(){
90 Advanced app = new Advanced(); 89 Advanced app = new Advanced();
91 AppSettings settings = new AppSettings(true); 90 AppSettings settings = new AppSettings(true);
92 settings.setAudioRenderer("Send"); 91 settings.setAudioRenderer("Send");
92 JmeSystem.setSystemDelegate(new AurellemSystemDelegate());
93 app.setSettings(settings); 93 app.setSettings(settings);
94 app.setShowSettings(false); 94 app.setShowSettings(false);
95 app.setPauseOnLostFocus(false); 95 app.setPauseOnLostFocus(false);
96 app.start(); 96 app.start();
97 } 97 }
218 //music.setRolloffFactor(1f); 218 //music.setRolloffFactor(1f);
219 music.setLooping(false); 219 music.setLooping(false);
220 audioRenderer.pauseSource(music); 220 audioRenderer.pauseSource(music);
221 } 221 }
222 222
223
224
225
226
227
228 public class Dancer implements SoundProcessor { 223 public class Dancer implements SoundProcessor {
229 Geometry entity; 224 Geometry entity;
230 float scale = 2; 225 float scale = 2;
231 public Dancer(Geometry entity){ 226 public Dancer(Geometry entity){
232 this.entity = entity; 227 this.entity = entity;
272 try {aux = new WaveFileWriter(new File("/home/r/tmp/ear"+n+".wav"));} 267 try {aux = new WaveFileWriter(new File("/home/r/tmp/ear"+n+".wav"));}
273 catch (FileNotFoundException e) {e.printStackTrace();} 268 catch (FileNotFoundException e) {e.printStackTrace();}
274 269
275 rf.registerSoundProcessor(auxListener, 270 rf.registerSoundProcessor(auxListener,
276 new CompositeSoundProcessor(new Dancer(ear), aux)); 271 new CompositeSoundProcessor(new Dancer(ear), aux));
277
278 } 272 }
279 } 273 }
280 274
281 275
282 public void simpleInitApp() { 276 public void simpleInitApp() {