Mercurial > jmeCapture
changeset 35:c969b04fa0dc
working on divergence
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 31 Oct 2011 00:14:46 -0700 |
parents | 13d354e1184b |
children | 2a525e937d86 |
files | divergence/pure divergence/pure-with-play divergence/pure2 divergence/results.txt divergence/sqr-100Hz divergence/sqr-1kHz-1 divergence/sqr-1kHz-2 src/com/aurellem/capture/examples/AdvancedAudio.java |
diffstat | 8 files changed, 581 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/divergence/pure Mon Oct 31 00:14:46 2011 -0700 1.3 @@ -0,0 +1,96 @@ 1.4 +OPENAL-AURELLEM: alc_init_config!! 1.5 +creating new context via naddListener 1.6 +-------- 1.7 +main 1.8 +0.0 1.9 +aux 1.10 +0.0 1.11 +0 1.12 +I'm playing! <3 1.13 +-------- 1.14 +main 1.15 +6.408789E-4 1.16 +aux 1.17 +6.408789E-4 1.18 +1 1.19 +-------- 1.20 +main 1.21 +0.0012512398 1.22 +aux 1.23 +0.0012512398 1.24 +2 1.25 +-------- 1.26 +main 1.27 +0.0018921187 1.28 +aux 1.29 +0.0018921187 1.30 +3 1.31 +-------- 1.32 +main 1.33 +0.0024719615 1.34 +aux 1.35 +0.0024719615 1.36 +4 1.37 +-------- 1.38 +main 1.39 +0.0030212863 1.40 +aux 1.41 +0.0030212863 1.42 +5 1.43 +-------- 1.44 +main 1.45 +0.003540093 1.46 +aux 1.47 +0.003540093 1.48 +6 1.49 +-------- 1.50 +main 1.51 +0.004089418 1.52 +aux 1.53 +0.004089418 1.54 +7 1.55 +-------- 1.56 +main 1.57 +0.0045471885 1.58 +aux 1.59 +0.0045471885 1.60 +8 1.61 +-------- 1.62 +main 1.63 +0.004943923 1.64 +aux 1.65 +0.004913405 1.66 +9 1.67 +-------- 1.68 +main 1.69 +0.004943923 1.70 +aux 1.71 +0.004882887 1.72 +10 1.73 +-------- 1.74 +main 1.75 +0.004791333 1.76 +aux 1.77 +0.004760815 1.78 +11 1.79 +-------- 1.80 +main 1.81 +0.0046082246 1.82 +aux 1.83 +0.0045777066 1.84 +12 1.85 +-------- 1.86 +main 1.87 +0.0046082246 1.88 +aux 1.89 +0.0045777066 1.90 +13 1.91 +-------- 1.92 +main 1.93 +0.0044556344 1.94 +aux 1.95 +0.0044251163 1.96 +14 1.97 +AL lib: ALc.c:2463: alcCloseDevice(): destroying 1 Context(s) 1.98 +AL lib: ALc.c:2069: alcDestroyContext(): deleting 64 Source(s) 1.99 +AL lib: ALc.c:2471: alcCloseDevice(): deleting 1 Buffer(s)
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/divergence/pure-with-play Mon Oct 31 00:14:46 2011 -0700 2.3 @@ -0,0 +1,96 @@ 2.4 +OPENAL-AURELLEM: alc_init_config!! 2.5 +creating new context via naddListener 2.6 +-------- 2.7 +main 2.8 +0.0 2.9 +aux 2.10 +0.0 2.11 +0 2.12 +I'm playing! <3 2.13 +-------- 2.14 +main 2.15 +6.408789E-4 2.16 +aux 2.17 +6.408789E-4 2.18 +1 2.19 +-------- 2.20 +main 2.21 +0.0012512398 2.22 +aux 2.23 +0.0012512398 2.24 +2 2.25 +-------- 2.26 +main 2.27 +0.0018921187 2.28 +aux 2.29 +0.0018921187 2.30 +3 2.31 +-------- 2.32 +main 2.33 +0.0024719615 2.34 +aux 2.35 +0.0024719615 2.36 +4 2.37 +-------- 2.38 +main 2.39 +0.0030212863 2.40 +aux 2.41 +0.0030212863 2.42 +5 2.43 +-------- 2.44 +main 2.45 +0.003540093 2.46 +aux 2.47 +0.003540093 2.48 +6 2.49 +-------- 2.50 +main 2.51 +0.004089418 2.52 +aux 2.53 +0.004089418 2.54 +7 2.55 +-------- 2.56 +main 2.57 +0.0045471885 2.58 +aux 2.59 +0.0045471885 2.60 +8 2.61 +-------- 2.62 +main 2.63 +0.004943923 2.64 +aux 2.65 +0.004913405 2.66 +9 2.67 +-------- 2.68 +main 2.69 +0.004943923 2.70 +aux 2.71 +0.004882887 2.72 +10 2.73 +-------- 2.74 +main 2.75 +0.004791333 2.76 +aux 2.77 +0.004760815 2.78 +11 2.79 +-------- 2.80 +main 2.81 +0.0046082246 2.82 +aux 2.83 +0.0045777066 2.84 +12 2.85 +-------- 2.86 +main 2.87 +0.0046082246 2.88 +aux 2.89 +0.0045777066 2.90 +13 2.91 +-------- 2.92 +main 2.93 +0.0044556344 2.94 +aux 2.95 +0.0044251163 2.96 +14 2.97 +AL lib: ALc.c:2463: alcCloseDevice(): destroying 1 Context(s) 2.98 +AL lib: ALc.c:2069: alcDestroyContext(): deleting 64 Source(s) 2.99 +AL lib: ALc.c:2471: alcCloseDevice(): deleting 1 Buffer(s)
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/divergence/pure2 Mon Oct 31 00:14:46 2011 -0700 3.3 @@ -0,0 +1,96 @@ 3.4 +OPENAL-AURELLEM: alc_init_config!! 3.5 +creating new context via naddListener 3.6 +-------- 3.7 +main 3.8 +0.0 3.9 +aux 3.10 +0.0 3.11 +0 3.12 +I'm playing! <3 3.13 +-------- 3.14 +main 3.15 +6.408789E-4 3.16 +aux 3.17 +6.408789E-4 3.18 +1 3.19 +-------- 3.20 +main 3.21 +0.0012512398 3.22 +aux 3.23 +0.0012512398 3.24 +2 3.25 +-------- 3.26 +main 3.27 +0.0018921187 3.28 +aux 3.29 +0.0018921187 3.30 +3 3.31 +-------- 3.32 +main 3.33 +0.0024719615 3.34 +aux 3.35 +0.0024719615 3.36 +4 3.37 +-------- 3.38 +main 3.39 +0.0030212863 3.40 +aux 3.41 +0.0030212863 3.42 +5 3.43 +-------- 3.44 +main 3.45 +0.003540093 3.46 +aux 3.47 +0.003540093 3.48 +6 3.49 +-------- 3.50 +main 3.51 +0.004089418 3.52 +aux 3.53 +0.004089418 3.54 +7 3.55 +-------- 3.56 +main 3.57 +0.0045471885 3.58 +aux 3.59 +0.0045471885 3.60 +8 3.61 +-------- 3.62 +main 3.63 +0.004943923 3.64 +aux 3.65 +0.004913405 3.66 +9 3.67 +-------- 3.68 +main 3.69 +0.004943923 3.70 +aux 3.71 +0.004882887 3.72 +10 3.73 +-------- 3.74 +main 3.75 +0.004791333 3.76 +aux 3.77 +0.004760815 3.78 +11 3.79 +-------- 3.80 +main 3.81 +0.0046082246 3.82 +aux 3.83 +0.0045777066 3.84 +12 3.85 +-------- 3.86 +main 3.87 +0.0046082246 3.88 +aux 3.89 +0.0045777066 3.90 +13 3.91 +-------- 3.92 +main 3.93 +0.0044556344 3.94 +aux 3.95 +0.0044251163 3.96 +14 3.97 +AL lib: ALc.c:2463: alcCloseDevice(): destroying 1 Context(s) 3.98 +AL lib: ALc.c:2069: alcDestroyContext(): deleting 64 Source(s) 3.99 +AL lib: ALc.c:2471: alcCloseDevice(): deleting 1 Buffer(s)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/divergence/results.txt Mon Oct 31 00:14:46 2011 -0700 4.3 @@ -0,0 +1,21 @@ 4.4 +sqr-1khz, a mono 16 bit sound file, diverges at sample 9 4.5 +haydn, a stereo 16 bit, does not diverge to 350 samples. 4.6 +pure, mono 16 bit, diverges at sample 9 4.7 +sqr-10Hz, a mono 16 bit, diverges at sample 10 4.8 +sqr-100Hz also diverges at 10. 4.9 + 4.10 + 4.11 + 4.12 +calling audioRenderer.updateSourceParams in main update loop doesn't 4.13 +change output 4.14 + 4.15 +audioRenderer.playSource vs source.play doesn't make a difference with 4.16 +pure (and probably doesn't make any difference) 4.17 + 4.18 + 4.19 +channel starts at -1, changes to 0 when playing starts, then stays the 4.20 +same through divergence. 4.21 + 4.22 + 4.23 + 4.24 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/divergence/sqr-100Hz Mon Oct 31 00:14:46 2011 -0700 5.3 @@ -0,0 +1,94 @@ 5.4 +OPENAL-AURELLEM: alc_init_config!! 5.5 +creating new context via naddListener 5.6 +-------- 5.7 +main 5.8 +0.0 5.9 +aux 5.10 +0.0 5.11 +0 5.12 +I'm playing! <3 5.13 +-------- 5.14 +main 5.15 +0.0046997787 5.16 +aux 5.17 +0.0046997787 5.18 +1 5.19 +-------- 5.20 +main 5.21 +0.004943923 5.22 +aux 5.23 +0.004943923 5.24 +2 5.25 +-------- 5.26 +main 5.27 +0.004943923 5.28 +aux 5.29 +0.004943923 5.30 +3 5.31 +-------- 5.32 +main 5.33 +0.004852369 5.34 +aux 5.35 +0.004852369 5.36 +4 5.37 +-------- 5.38 +main 5.39 +0.0046082246 5.40 +aux 5.41 +0.0046082246 5.42 +5 5.43 +-------- 5.44 +main 5.45 +0.0046082246 5.46 +aux 5.47 +0.0046082246 5.48 +6 5.49 +-------- 5.50 +main 5.51 +0.0045166705 5.52 +aux 5.53 +0.0045166705 5.54 +7 5.55 +-------- 5.56 +main 5.57 +0.004303044 5.58 +aux 5.59 +0.004303044 5.60 +8 5.61 +-------- 5.62 +main 5.63 +0.004303044 5.64 +aux 5.65 +0.004303044 5.66 +9 5.67 +-------- 5.68 +main 5.69 +0.004150454 5.70 +aux 5.71 +0.004119936 5.72 +10 5.73 +-------- 5.74 +main 5.75 +0.0040589 5.76 +aux 5.77 +0.004028382 5.78 +11 5.79 +-------- 5.80 +main 5.81 +0.0040589 5.82 +aux 5.83 +0.004028382 5.84 +12 5.85 +-------- 5.86 +main 5.87 +0.0039978637 5.88 +aux 5.89 +0.0039673457 5.90 +13 5.91 +-------- 5.92 +main 5.93 +0.0038147555 5.94 +aux 5.95 +0.0037842374 5.96 +14 5.97 +
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/divergence/sqr-1kHz-1 Mon Oct 31 00:14:46 2011 -0700 6.3 @@ -0,0 +1,77 @@ 6.4 +creating new context via naddListener 6.5 +-------- 6.6 +main 6.7 +0.0 6.8 +aux 6.9 +0.0 6.10 +I'm playing! <3 6.11 +-------- 6.12 +main 6.13 +0.004791333 6.14 +aux 6.15 +0.004791333 6.16 +-------- 6.17 +main 6.18 +0.004943923 6.19 +aux 6.20 +0.004943923 6.21 +-------- 6.22 +main 6.23 +0.004943923 6.24 +aux 6.25 +0.004943923 6.26 +-------- 6.27 +main 6.28 +0.004852369 6.29 +aux 6.30 +0.004852369 6.31 +-------- 6.32 +main 6.33 +0.0046082246 6.34 +aux 6.35 +0.0046082246 6.36 +-------- 6.37 +main 6.38 +0.0044861524 6.39 +aux 6.40 +0.0044861524 6.41 +-------- 6.42 +main 6.43 +0.0044861524 6.44 +aux 6.45 +0.0044861524 6.46 +-------- 6.47 +main 6.48 +0.004303044 6.49 +aux 6.50 +0.004303044 6.51 +-------- 6.52 +main 6.53 +0.004242008 6.54 +aux 6.55 +0.004180972 6.56 +-------- 6.57 +main 6.58 +0.004242008 6.59 +aux 6.60 +0.004180972 6.61 +-------- 6.62 +main 6.63 +0.004150454 6.64 +aux 6.65 +0.004119936 6.66 +-------- 6.67 +main 6.68 +0.0039673457 6.69 +aux 6.70 +0.0039368276 6.71 +-------- 6.72 +main 6.73 +0.0039673457 6.74 +aux 6.75 +0.0039368276 6.76 +-------- 6.77 +main 6.78 +0.0039063096 6.79 +aux 6.80 +0.0038757916
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/divergence/sqr-1kHz-2 Mon Oct 31 00:14:46 2011 -0700 7.3 @@ -0,0 +1,77 @@ 7.4 +creating new context via naddListener 7.5 +-------- 7.6 +main 7.7 +0.0 7.8 +aux 7.9 +0.0 7.10 +I'm playing! <3 7.11 +-------- 7.12 +main 7.13 +0.004791333 7.14 +aux 7.15 +0.004791333 7.16 +-------- 7.17 +main 7.18 +0.004943923 7.19 +aux 7.20 +0.004943923 7.21 +-------- 7.22 +main 7.23 +0.004943923 7.24 +aux 7.25 +0.004943923 7.26 +-------- 7.27 +main 7.28 +0.004852369 7.29 +aux 7.30 +0.004852369 7.31 +-------- 7.32 +main 7.33 +0.0046082246 7.34 +aux 7.35 +0.0046082246 7.36 +-------- 7.37 +main 7.38 +0.0044861524 7.39 +aux 7.40 +0.0044861524 7.41 +-------- 7.42 +main 7.43 +0.0044861524 7.44 +aux 7.45 +0.0044861524 7.46 +-------- 7.47 +main 7.48 +0.004303044 7.49 +aux 7.50 +0.004303044 7.51 +-------- 7.52 +main 7.53 +0.004242008 7.54 +aux 7.55 +0.004180972 7.56 +-------- 7.57 +main 7.58 +0.004242008 7.59 +aux 7.60 +0.004180972 7.61 +-------- 7.62 +main 7.63 +0.004150454 7.64 +aux 7.65 +0.004119936 7.66 +-------- 7.67 +main 7.68 +0.0039673457 7.69 +aux 7.70 +0.0039368276 7.71 +-------- 7.72 +main 7.73 +0.0039673457 7.74 +aux 7.75 +0.0039368276 7.76 +-------- 7.77 +main 7.78 +0.0039063096 7.79 +aux 7.80 +0.0038757916
8.1 --- a/src/com/aurellem/capture/examples/AdvancedAudio.java Sun Oct 30 14:58:01 2011 -0700 8.2 +++ b/src/com/aurellem/capture/examples/AdvancedAudio.java Mon Oct 31 00:14:46 2011 -0700 8.3 @@ -4,6 +4,8 @@ 8.4 import java.io.FileNotFoundException; 8.5 import java.io.IOException; 8.6 import java.nio.ByteBuffer; 8.7 +import java.util.logging.Level; 8.8 +import java.util.logging.Logger; 8.9 8.10 import javax.sound.sampled.AudioFormat; 8.11 8.12 @@ -59,7 +61,7 @@ 8.13 public class AdvancedAudio extends SimpleApplication { 8.14 8.15 public static void main(String[] args) { 8.16 - 8.17 + Logger.getLogger("com.jme3").setLevel(Level.OFF); 8.18 AdvancedAudio app = new AdvancedAudio(); 8.19 AppSettings settings = new AppSettings(true); 8.20 settings.setAudioRenderer("Send"); 8.21 @@ -205,14 +207,16 @@ 8.22 music = new AudioNode(assetManager, "Sound/Environment/pure.wav", false); 8.23 8.24 rootNode.attachChild(music); 8.25 - audioRenderer.playSource(music); 8.26 + //audioRenderer.playSource(music); 8.27 music.setPositional(true); 8.28 music.setVolume(1f); 8.29 music.setReverbEnabled(false); 8.30 music.setMaxDistance(200.0f); 8.31 music.setRefDistance(1f); 8.32 music.setRolloffFactor(5f); 8.33 - audioRenderer.pauseSource(music); 8.34 + 8.35 + 8.36 + //audioRenderer.pauseSource(music); 8.37 8.38 } 8.39 8.40 @@ -281,11 +285,12 @@ 8.41 initAudio(); 8.42 initKeys(); 8.43 createScene(); 8.44 + listener.setLocation(ear1.getLocalTranslation()); 8.45 if (this.audioRenderer instanceof MultiListener){ 8.46 MultiListener rf = (MultiListener)this.audioRenderer; 8.47 8.48 8.49 - listener.setLocation(ear1.getLocalTranslation()); 8.50 + 8.51 auxListener = new Listener(listener); 8.52 8.53 rf.addListener(auxListener); 8.54 @@ -323,10 +328,10 @@ 8.55 @Override 8.56 public void onAction(String name, boolean keyPressed, float tpf) { 8.57 if (name.equals("Shoot") && !keyPressed) { 8.58 - System.out.println("I'm playing! <3"); 8.59 - System.out.println(bell.getLocalTranslation().subtract(cam.getLocation()).length()); 8.60 - bell.getMaterial().setColor("Color", ColorRGBA.randomColor()); 8.61 - audioRenderer.playSource(music); 8.62 + 8.63 + System.out.println(bell.getLocalTranslation().subtract(listener.getLocation()).length()); 8.64 + //bell.getMaterial().setColor("Color", ColorRGBA.randomColor()); 8.65 + //audioRenderer.playSource(music); 8.66 System.out.println(music.getRefDistance()); 8.67 8.68 } 8.69 @@ -336,31 +341,35 @@ 8.70 /** Move the listener with the camera - for 3D audio. */ 8.71 8.72 8.73 - private Vector3f prevBellPos = Vector3f.ZERO; 8.74 - 8.75 + //private Vector3f prevBellPos = Vector3f.ZERO; 8.76 + private int countdown = 0; 8.77 8.78 public void simpleUpdate(float tpf) { 8.79 //Vector3f loc = cam.getLocation(); 8.80 //Quaternion rot = cam.getRotation(); 8.81 //listener.setLocation(loc); 8.82 //listener.setRotation(rot); 8.83 + System.out.println(countdown); 8.84 + if (countdown++ == 14) { this.requestClose(false);} 8.85 8.86 - 8.87 + System.out.println("channel "+ music.getChannel()); 8.88 //listener.setLocation(cam.getLocation()); 8.89 //listener.setRotation(cam.getRotation()); 8.90 //auxListener.setLocation(loc); 8.91 //auxListener.setRotation(rot); 8.92 if (music.getStatus() != AudioNode.Status.Playing){ 8.93 - audioRenderer.playSource(music); 8.94 + //audioRenderer.playSource(music); 8.95 + music.play(); 8.96 bell.getMaterial().setColor("Color", ColorRGBA.randomColor()); 8.97 + System.out.println("I'm playing! <3"); 8.98 } 8.99 //audioRenderer.updateSourceParam(music, AudioParam.Direction); 8.100 8.101 - Vector3f bellVelocity = bell.getLocalTranslation().subtract(prevBellPos).mult(1.0f/tpf); 8.102 - prevBellPos = bell.getLocalTranslation(); 8.103 + //Vector3f bellVelocity = bell.getLocalTranslation().subtract(prevBellPos).mult(1.0f/tpf); 8.104 + //prevBellPos = bell.getLocalTranslation(); 8.105 8.106 music.setLocalTranslation(bell.getLocalTranslation()); 8.107 - music.setVelocity(bellVelocity); 8.108 + //music.setVelocity(bellVelocity); 8.109 8.110 //audioRenderer.updateSourceParam(music, AudioParam.Position); 8.111 //audioRenderer.updateSourceParam(music, AudioParam.Velocity);