Mercurial > cortex
diff org/hearing.org @ 283:23aadf376e9d
upgraded to latest jMonkeyEngine, streamlined tests
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Wed, 15 Feb 2012 16:56:01 -0700 |
parents | c39b8b29a79e |
children | 7e7f8d6d9ec5 |
line wrap: on
line diff
1.1 --- a/org/hearing.org Wed Feb 15 14:09:20 2012 -0700 1.2 +++ b/org/hearing.org Wed Feb 15 16:56:01 2012 -0700 1.3 @@ -1018,43 +1018,43 @@ 1.4 #+begin_src clojure 1.5 (in-ns 'cortex.test.hearing) 1.6 1.7 -(cortex.import/mega-import-jme3) 1.8 -(import java.io.File) 1.9 - 1.10 -(use 'cortex.body) 1.11 - 1.12 -(defn test-worm-hearing [] 1.13 - (let [the-worm (doto (worm) (body!)) 1.14 - hearing (hearing! the-worm) 1.15 - hearing-display (view-hearing) 1.16 +(defn test-worm-hearing 1.17 + ([] (test-worm-hearing false)) 1.18 + ([record?] 1.19 + (let [the-worm (doto (worm) (body!)) 1.20 + hearing (hearing! the-worm) 1.21 + hearing-display (view-hearing) 1.22 + 1.23 + tone (AudioNode. (asset-manager) 1.24 + "Sounds/pure.wav" false) 1.25 + 1.26 + hymn (AudioNode. (asset-manager) 1.27 + "Sounds/ear-and-eye.wav" false)] 1.28 + (world 1.29 + (nodify [the-worm (floor)]) 1.30 + (merge standard-debug-controls 1.31 + {"key-return" 1.32 + (fn [_ value] 1.33 + (if value (.play tone))) 1.34 + "key-l" 1.35 + (fn [_ value] 1.36 + (if value (.play hymn)))}) 1.37 + (fn [world] 1.38 + (light-up-everything world) 1.39 + (if record? 1.40 + (do 1.41 + (com.aurellem.capture.Capture/captureVideo 1.42 + world 1.43 + (File."/home/r/proj/cortex/render/worm-audio/frames")) 1.44 + (com.aurellem.capture.Capture/captureAudio 1.45 + world 1.46 + (File."/home/r/proj/cortex/render/worm-audio/audio.wav"))))) 1.47 1.48 - tone (AudioNode. (asset-manager) 1.49 - "Sounds/pure.wav" false) 1.50 - 1.51 - hymn (AudioNode. (asset-manager) 1.52 - "Sounds/ear-and-eye.wav" false)] 1.53 - (world 1.54 - (nodify [the-worm (floor)]) 1.55 - (merge standard-debug-controls 1.56 - {"key-return" 1.57 - (fn [_ value] 1.58 - (if value (.play tone))) 1.59 - "key-l" 1.60 - (fn [_ value] 1.61 - (if value (.play hymn)))}) 1.62 - (fn [world] 1.63 - (light-up-everything world) 1.64 - (com.aurellem.capture.Capture/captureVideo 1.65 - world 1.66 - (File."/home/r/proj/cortex/render/worm-audio/frames")) 1.67 - (com.aurellem.capture.Capture/captureAudio 1.68 - world 1.69 - (File."/home/r/proj/cortex/render/worm-audio/audio.wav"))) 1.70 - 1.71 - (fn [world tpf] 1.72 - (hearing-display 1.73 - (map #(% world) hearing) 1.74 - (File. "/home/r/proj/cortex/render/worm-audio/hearing-data")))))) 1.75 + (fn [world tpf] 1.76 + (hearing-display 1.77 + (map #(% world) hearing) 1.78 + (if record? 1.79 + (File. "/home/r/proj/cortex/render/worm-audio/hearing-data")))))))) 1.80 #+end_src 1.81 1.82 In this test, I load the worm with its newly formed ear and let it 1.83 @@ -1154,11 +1154,13 @@ 1.84 #+name: test-header 1.85 #+begin_src clojure 1.86 (ns cortex.test.hearing 1.87 - (:use (cortex world util hearing)) 1.88 + (:use (cortex world util hearing body)) 1.89 (:use cortex.test.body) 1.90 (:import (com.jme3.audio AudioNode Listener)) 1.91 + (:import java.io.File) 1.92 (:import com.jme3.scene.Node 1.93 - com.jme3.system.AppSettings)) 1.94 + com.jme3.system.AppSettings 1.95 + com.jme3.math.Vector3f)) 1.96 #+end_src 1.97 1.98 * Source Listing