Mercurial > audio-send
diff org/ear.org @ 29:cdf320cb5949
updated test suite
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 10 Dec 2011 21:42:50 -0600 |
parents | f4c7260d397a |
children | 32c69ba451d9 |
line wrap: on
line diff
1.1 --- a/org/ear.org Sat Nov 19 20:09:50 2011 -0700 1.2 +++ b/org/ear.org Sat Dec 10 21:42:50 2011 -0600 1.3 @@ -90,7 +90,7 @@ 1.4 ** =send.c= 1.5 1.6 ** Header 1.7 -#+srcname: send-header 1.8 +#+name: send-header 1.9 #+begin_src C 1.10 #include "config.h" 1.11 #include <stdlib.h> 1.12 @@ -150,7 +150,7 @@ 1.13 only one context at a time. 1.14 1.15 ** Necessary State 1.16 -#+srcname: send-state 1.17 +#+name: send-state 1.18 #+begin_src C 1.19 //////////////////// State 1.20 1.21 @@ -178,7 +178,7 @@ 1.22 of the actual device state whenever a context is rendered. 1.23 1.24 ** Synchronization Macros 1.25 -#+srcname: sync-macros 1.26 +#+name: sync-macros 1.27 #+begin_src C 1.28 //////////////////// Context Creation / Synchronization 1.29 1.30 @@ -221,7 +221,7 @@ 1.31 synchronization code involving these similar low-level =OpenAL= functions. 1.32 1.33 ** Source Synchronization 1.34 -#+srcname: sync-sources 1.35 +#+name: sync-sources 1.36 #+begin_src C 1.37 void syncSources(ALsource *masterSource, ALsource *slaveSource, 1.38 ALCcontext *masterCtx, ALCcontext *slaveCtx){ 1.39 @@ -294,7 +294,7 @@ 1.40 good description of =OpenAL='s internals. 1.41 1.42 ** Context Synchronization 1.43 -#+srcname: sync-contexts 1.44 +#+name: sync-contexts 1.45 #+begin_src C 1.46 void syncContexts(ALCcontext *master, ALCcontext *slave){ 1.47 /* If there aren't sufficient sources in slave to mirror 1.48 @@ -332,7 +332,7 @@ 1.49 does not have the same number of sources as the master context. 1.50 1.51 ** Context Creation 1.52 -#+srcname: context-creation 1.53 +#+name: context-creation 1.54 #+begin_src C 1.55 static void addContext(ALCdevice *Device, ALCcontext *context){ 1.56 send_data *data = (send_data*)Device->ExtraData; 1.57 @@ -361,7 +361,7 @@ 1.58 eventually go. 1.59 1.60 ** Context Switching 1.61 -#+srcname: context-switching 1.62 +#+name: context-switching 1.63 #+begin_src C 1.64 //////////////////// Context Switching 1.65 1.66 @@ -407,7 +407,7 @@ 1.67 context separate from all the others. 1.68 1.69 ** Main Device Loop 1.70 -#+srcname: main-loop 1.71 +#+name: main-loop 1.72 #+begin_src C 1.73 //////////////////// Main Device Loop 1.74 1.75 @@ -464,7 +464,7 @@ 1.76 by the way LWJGL interfaces with =OpenAL=. 1.77 1.78 *** step 1.79 -#+srcname: jni-step 1.80 +#+name: jni-step 1.81 #+begin_src C 1.82 //////////////////// JNI Methods 1.83 1.84 @@ -491,7 +491,7 @@ 1.85 1.86 1.87 *** getSamples 1.88 -#+srcname: jni-get-samples 1.89 +#+name: jni-get-samples 1.90 #+begin_src C 1.91 /* 1.92 * Class: com_aurellem_send_AudioSend 1.93 @@ -522,7 +522,7 @@ 1.94 necessary to change the properties of any listener other than the 1.95 master one, since only the listener of the current active context is 1.96 affected by the normal =OpenAL= listener calls. 1.97 -#+srcname: listener-manage 1.98 +#+name: listener-manage 1.99 #+begin_src C 1.100 /* 1.101 * Class: com_aurellem_send_AudioSend 1.102 @@ -589,7 +589,7 @@ 1.103 =javax.sound.sampled.AudioFormat= object from data in the Device. This 1.104 way, there is no ambiguity about what the bits created by =step= and 1.105 returned by =getSamples= mean. 1.106 -#+srcname: jni-init 1.107 +#+name: jni-init 1.108 #+begin_src C 1.109 /* 1.110 * Class: com_aurellem_send_AudioSend 1.111 @@ -642,7 +642,7 @@ 1.112 ** Boring Device management stuff 1.113 This code is more-or-less copied verbatim from the other =OpenAL= 1.114 backends. It's the basis for =OpenAL='s primitive object system. 1.115 -#+srcname: device-init 1.116 +#+name: device-init 1.117 #+begin_src C 1.118 //////////////////// Device Initialization / Management 1.119 1.120 @@ -749,7 +749,7 @@ 1.121 1.122 #+include "../../jmeCapture/src/com/aurellem/capture/audio/SoundProcessor.java" src java 1.123 1.124 -#+srcname: ears 1.125 +#+name: ears 1.126 #+begin_src clojure 1.127 (ns cortex.hearing 1.128 "Simulate the sense of hearing in jMonkeyEngine3. Enables multiple 1.129 @@ -795,12 +795,13 @@ 1.130 1.131 * Example 1.132 1.133 -#+srcname: test-hearing 1.134 +#+name: test-hearing 1.135 #+begin_src clojure :results silent 1.136 -(ns test.hearing 1.137 +(ns cortex.test.hearing 1.138 (:use (cortex world util hearing)) 1.139 (:import (com.jme3.audio AudioNode Listener)) 1.140 - (:import com.jme3.scene.Node)) 1.141 + (:import com.jme3.scene.Node 1.142 + com.jme3.system.AppSettings)) 1.143 1.144 (defn setup-fn [world] 1.145 (let [listener (Listener.)] 1.146 @@ -812,17 +813,30 @@ 1.147 (.playSource (.getAudioRenderer world) node)))) 1.148 1.149 (defn test-basic-hearing [] 1.150 - (.start 1.151 (let [node1 (AudioNode. (asset-manager) "Sounds/pure.wav" false false)] 1.152 (world 1.153 (Node.) 1.154 {"key-space" (partial play-sound node1)} 1.155 setup-fn 1.156 - no-op)))) 1.157 + no-op))) 1.158 + 1.159 +(defn test-advanced-hearing 1.160 + "Testing hearing: 1.161 + You should see a blue sphere flying around several 1.162 + cubes. As the sphere approaches each cube, it turns 1.163 + green." 1.164 + [] 1.165 + (doto (com.aurellem.capture.examples.Advanced.) 1.166 + (.setSettings 1.167 + (doto (AppSettings. true) 1.168 + (.setAudioRenderer "Send"))) 1.169 + (.setShowSettings false) 1.170 + (.setPauseOnLostFocus false))) 1.171 + 1.172 #+end_src 1.173 1.174 This extremely basic program prints out the first sample it encounters 1.175 -at every time stamp. You can see the rendered sound begin printed at 1.176 +at every time stamp. You can see the rendered sound being printed at 1.177 the REPL. 1.178 1.179 - As a bonus, this method of capturing audio for AI can also be used 1.180 @@ -836,11 +850,10 @@ 1.181 <<ears>> 1.182 #+end_src 1.183 1.184 -#+begin_src clojure :tangle ../../cortex/src/test/hearing.clj 1.185 +#+begin_src clojure :tangle ../../cortex/src/cortex/test/hearing.clj 1.186 <<test-hearing>> 1.187 #+end_src 1.188 1.189 - 1.190 #+begin_src C :tangle ../Alc/backends/send.c 1.191 <<send-header>> 1.192 <<send-state>>