comparison clojure/com/aurellem/gb/gb_driver.clj @ 524:7ef5c73ea8fa

working on recording sound. almost have it, but there is still unexplained popping sounds.
author Robert McIntyre <rlm@mit.edu>
date Sat, 23 Jun 2012 23:10:31 -0500
parents d00096b6bf17
children fa7676dbf6f2
comparison
equal deleted inserted replaced
523:d00096b6bf17 524:7ef5c73ea8fa
191 (store-fn store) 191 (store-fn store)
192 (update-state))) 192 (update-state)))
193 ([new-data] 193 ([new-data]
194 (store-data @current-state new-data)))) 194 (store-data @current-state new-data))))
195 195
196 (def sound-data 196 (let [store (byte-array Gb/SOUND_SIZE)]
197 (cpu-data Gb/SOUND_SIZE 197 (defn sound-data
198 (fn [arr] 198 ([](sound-data @current-state))
199 (Gb/getFrameSound arr) 199 ([state]
200 (Gb/setSoundFrameWritten 0)))) 200 (set-state! state)
201 201 (Gb/getFrameSound store)
202 (Gb/setSoundFrameWritten 0)
203 store)))
204
202 (def memory 205 (def memory
203 (cpu-data Gb/GB_MEMORY #(Gb/getMemory %))) 206 (cpu-data Gb/GB_MEMORY #(Gb/getMemory %)))
204 207
205 (def ram 208 (def ram
206 (cpu-data Gb/RAM_SIZE #(Gb/getRAM %))) 209 (cpu-data Gb/RAM_SIZE #(Gb/getRAM %)))
303 ;; Glen Cook, Jeff Frohwein, and Rob Jones. 306 ;; Glen Cook, Jeff Frohwein, and Rob Jones.
304 (defn rgb->gb-rb [[r g b :as color]] 307 (defn rgb->gb-rb [[r g b :as color]]
305 (let [store (int-array 3)] 308 (let [store (int-array 3)]
306 (Gb/translateRGB (int-array color) store) 309 (Gb/translateRGB (int-array color) store)
307 (vec store))) 310 (vec store)))
311