Mercurial > jmeCapture
changeset 34:13d354e1184b
trying to track down very strange bug where a listener and aux listener at the same location hear different things
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 30 Oct 2011 14:58:01 -0700 |
parents | c4bfbf5d090e |
children | c969b04fa0dc |
files | src/com/aurellem/capture/audio/AudioSendRenderer.java src/com/aurellem/capture/examples/AdvancedAudio.java |
diffstat | 2 files changed, 31 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/src/com/aurellem/capture/audio/AudioSendRenderer.java Sun Oct 30 13:57:16 2011 -0700 1.2 +++ b/src/com/aurellem/capture/audio/AudioSendRenderer.java Sun Oct 30 14:58:01 2011 -0700 1.3 @@ -71,6 +71,7 @@ 1.4 catch (InterruptedException e) {e.printStackTrace();} 1.5 audioSend.addListener(); 1.6 this.listeners.add(l); 1.7 + l.setRenderer(this); 1.8 } 1.9 1.10 /**
2.1 --- a/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 13:57:16 2011 -0700 2.2 +++ b/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 14:58:01 2011 -0700 2.3 @@ -17,6 +17,7 @@ 2.4 import com.aurellem.capture.audio.WaveFileWriter; 2.5 import com.jme3.app.SimpleApplication; 2.6 import com.jme3.audio.AudioNode; 2.7 +import com.jme3.audio.AudioParam; 2.8 import com.jme3.audio.Listener; 2.9 import com.jme3.cinematic.MotionPath; 2.10 import com.jme3.cinematic.events.MotionTrack; 2.11 @@ -206,11 +207,11 @@ 2.12 rootNode.attachChild(music); 2.13 audioRenderer.playSource(music); 2.14 music.setPositional(true); 2.15 - //music.setVolume(1f); 2.16 - 2.17 - //music.setMaxDistance(200.0f); 2.18 - //music.setRefDistance(0.1f); 2.19 - //music.setRolloffFactor(5f); 2.20 + music.setVolume(1f); 2.21 + music.setReverbEnabled(false); 2.22 + music.setMaxDistance(200.0f); 2.23 + music.setRefDistance(1f); 2.24 + music.setRolloffFactor(5f); 2.25 audioRenderer.pauseSource(music); 2.26 2.27 } 2.28 @@ -219,12 +220,12 @@ 2.29 2.30 2.31 private Listener auxListener = new Listener(); 2.32 - public File data1 = new File("/home/r/tmp/data1.wav"); 2.33 - public File data2 = new File("/home/r/tmp/data2.wav"); 2.34 - public File data3 = new File("/home/r/tmp/data3.wav"); 2.35 - public File data4 = new File("/home/r/tmp/data4.wav"); 2.36 - public File data5 = new File("/home/r/tmp/data5.wav"); 2.37 - public File data6 = new File("/home/r/tmp/data6.wav"); 2.38 + //public File data1 = new File("/home/r/tmp/data1.wav"); 2.39 + //public File data2 = new File("/home/r/tmp/data2.wav"); 2.40 + //public File data3 = new File("/home/r/tmp/data3.wav"); 2.41 + //public File data4 = new File("/home/r/tmp/data4.wav"); 2.42 + //public File data5 = new File("/home/r/tmp/data5.wav"); 2.43 + //public File data6 = new File("/home/r/tmp/data6.wav"); 2.44 2.45 2.46 public class Dancer implements SoundProcessor { 2.47 @@ -258,7 +259,7 @@ 2.48 2.49 float max = Float.NEGATIVE_INFINITY; 2.50 for (float f : out){if (f > max) max = f;} 2.51 - 2.52 + audioSamples.clear(); 2.53 System.out.println(debug); 2.54 System.out.println(max); 2.55 2.56 @@ -284,22 +285,25 @@ 2.57 MultiListener rf = (MultiListener)this.audioRenderer; 2.58 2.59 2.60 + listener.setLocation(ear1.getLocalTranslation()); 2.61 + auxListener = new Listener(listener); 2.62 + 2.63 rf.addListener(auxListener); 2.64 - WaveFileWriter writer = null; 2.65 - WaveFileWriter writer2 = null; 2.66 - auxListener.setLocation(ear1.getLocalTranslation()); 2.67 - listener.setLocation(ear1.getLocalTranslation()); 2.68 - try {writer = new WaveFileWriter(new File("/home/r/tmp/out.wav"));} 2.69 + WaveFileWriter aux = null; 2.70 + WaveFileWriter main = null; 2.71 + 2.72 + 2.73 + try {aux = new WaveFileWriter(new File("/home/r/tmp/aux.wav"));} 2.74 catch (FileNotFoundException e) {e.printStackTrace();} 2.75 2.76 - try {writer2 = new WaveFileWriter(new File("/home/r/tmp/outmain.wav"));} 2.77 + try {main = new WaveFileWriter(new File("/home/r/tmp/main.wav"));} 2.78 catch (FileNotFoundException e) {e.printStackTrace();} 2.79 2.80 rf.registerSoundProcessor(auxListener, 2.81 - new CompositeSoundProcessor(new Dancer(ear1, "aux"), writer)); 2.82 + new CompositeSoundProcessor(new Dancer(ear1, "aux"), aux)); 2.83 2.84 rf.registerSoundProcessor( 2.85 - new CompositeSoundProcessor(new Dancer(ear1, "main"), writer2)); 2.86 + new CompositeSoundProcessor(new Dancer(ear1, "--------\nmain"), main)); 2.87 } 2.88 2.89 motionControl.play(); 2.90 @@ -358,6 +362,12 @@ 2.91 music.setLocalTranslation(bell.getLocalTranslation()); 2.92 music.setVelocity(bellVelocity); 2.93 2.94 + //audioRenderer.updateSourceParam(music, AudioParam.Position); 2.95 + //audioRenderer.updateSourceParam(music, AudioParam.Velocity); 2.96 + 2.97 + 2.98 + //System.out.println("main:" + listener.getVolume()); 2.99 + //System.out.println("aux:" + auxListener.getVolume()); 2.100 //org.lwjgl.openal.AL10.alSourcef(1, org.lwjgl.openal.AL10.AL_MIN_GAIN, 0f); 2.101 //org.lwjgl.openal.AL10.alSourcef(1, org.lwjgl.openal.AL10.AL_ROLLOFF_FACTOR, 5f); 2.102