comparison org/hearing.org @ 340:4f5a5d5f1613

added time dialation display for test suite.
author Robert McIntyre <rlm@mit.edu>
date Sat, 21 Jul 2012 11:18:47 -0500
parents e6233ef22a80
children 516a029e0be9
comparison
equal deleted inserted replaced
339:0efa36180e8a 340:4f5a5d5f1613
1025 You will see the worm fall onto a table. There is a long 1025 You will see the worm fall onto a table. There is a long
1026 horizontal bar which shows the waveform of whatever the worm is 1026 horizontal bar which shows the waveform of whatever the worm is
1027 hearing. When you play a sound, the bar should display a waveform. 1027 hearing. When you play a sound, the bar should display a waveform.
1028 1028
1029 Keys: 1029 Keys:
1030 <enter> : play sound" 1030 <enter> : play sound
1031 1031 l : play hymn"
1032 ([] (test-worm-hearing false)) 1032 ([] (test-worm-hearing false))
1033 ([record?] 1033 ([record?]
1034 (let [the-worm (doto (worm) (body!)) 1034 (let [the-worm (doto (worm) (body!))
1035 hearing (hearing! the-worm) 1035 hearing (hearing! the-worm)
1036 hearing-display (view-hearing) 1036 hearing-display (view-hearing)
1049 "key-l" 1049 "key-l"
1050 (fn [_ value] 1050 (fn [_ value]
1051 (if value (.play hymn)))}) 1051 (if value (.play hymn)))})
1052 (fn [world] 1052 (fn [world]
1053 (light-up-everything world) 1053 (light-up-everything world)
1054 (let [timer (IsoTimer. 60)]
1055 (.setTimer world timer)
1056 (display-dilated-time world timer))
1054 (if record? 1057 (if record?
1055 (do 1058 (do
1056 (com.aurellem.capture.Capture/captureVideo 1059 (com.aurellem.capture.Capture/captureVideo
1057 world 1060 world
1058 (File."/home/r/proj/cortex/render/worm-audio/frames")) 1061 (File. "/home/r/proj/cortex/render/worm-audio/frames"))
1059 (com.aurellem.capture.Capture/captureAudio 1062 (com.aurellem.capture.Capture/captureAudio
1060 world 1063 world
1061 (File."/home/r/proj/cortex/render/worm-audio/audio.wav"))))) 1064 (File. "/home/r/proj/cortex/render/worm-audio/audio.wav")))))
1062 1065
1063 (fn [world tpf] 1066 (fn [world tpf]
1064 (hearing-display 1067 (hearing-display
1065 (map #(% world) hearing) 1068 (map #(% world) hearing)
1066 (if record? 1069 (if record?
1067 (File. "/home/r/proj/cortex/render/worm-audio/hearing-data")))))))) 1070 (File. "/home/r/proj/cortex/render/worm-audio/hearing-data"))))))))
1068 #+end_src 1071 #+end_src
1072
1073 #+results: test-hearing-2
1074 : #'cortex.test.hearing/test-worm-hearing
1069 1075
1070 In this test, I load the worm with its newly formed ear and let it 1076 In this test, I load the worm with its newly formed ear and let it
1071 hear sounds. The sound the worm is hearing is localized to the origin 1077 hear sounds. The sound the worm is hearing is localized to the origin
1072 of the world, and you can see that as the worm moves farther away from 1078 of the world, and you can see that as the worm moves farther away from
1073 the origin when it is hit by balls, it hears the sound less intensely. 1079 the origin when it is hit by balls, it hears the sound less intensely.
1168 (:use cortex.test.body) 1174 (:use cortex.test.body)
1169 (:import (com.jme3.audio AudioNode Listener)) 1175 (:import (com.jme3.audio AudioNode Listener))
1170 (:import java.io.File) 1176 (:import java.io.File)
1171 (:import com.jme3.scene.Node 1177 (:import com.jme3.scene.Node
1172 com.jme3.system.AppSettings 1178 com.jme3.system.AppSettings
1173 com.jme3.math.Vector3f)) 1179 com.jme3.math.Vector3f)
1174 #+end_src 1180 (:import (com.aurellem.capture Capture IsoTimer RatchetTimer)))
1181 #+end_src
1182
1183 #+results: test-header
1184 : com.aurellem.capture.RatchetTimer
1175 1185
1176 * Source Listing 1186 * Source Listing
1177 - [[../src/cortex/hearing.clj][cortex.hearing]] 1187 - [[../src/cortex/hearing.clj][cortex.hearing]]
1178 - [[../src/cortex/test/hearing.clj][cortex.test.hearing]] 1188 - [[../src/cortex/test/hearing.clj][cortex.test.hearing]]
1179 #+html: <ul> <li> <a href="../org/hearing.org">This org file</a> </li> </ul> 1189 #+html: <ul> <li> <a href="../org/hearing.org">This org file</a> </li> </ul>