diff 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
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/gb/gb_driver.clj	Sat Jun 23 20:34:14 2012 -0500
     1.2 +++ b/clojure/com/aurellem/gb/gb_driver.clj	Sat Jun 23 23:10:31 2012 -0500
     1.3 @@ -193,12 +193,15 @@
     1.4      ([new-data]
     1.5         (store-data @current-state new-data))))
     1.6  
     1.7 -(def sound-data
     1.8 -  (cpu-data Gb/SOUND_SIZE
     1.9 -            (fn [arr]
    1.10 -              (Gb/getFrameSound arr)
    1.11 -              (Gb/setSoundFrameWritten 0))))
    1.12 -
    1.13 +(let [store (byte-array Gb/SOUND_SIZE)]
    1.14 +  (defn sound-data 
    1.15 +    ([](sound-data @current-state))
    1.16 +    ([state]
    1.17 +       (set-state! state)
    1.18 +       (Gb/getFrameSound store)
    1.19 +       (Gb/setSoundFrameWritten 0)
    1.20 +       store)))
    1.21 +  
    1.22  (def memory
    1.23    (cpu-data Gb/GB_MEMORY #(Gb/getMemory %)))
    1.24  
    1.25 @@ -304,4 +307,5 @@
    1.26  (defn rgb->gb-rb [[r g b :as color]]
    1.27    (let [store (int-array 3)]
    1.28      (Gb/translateRGB (int-array color) store)
    1.29 -    (vec store)))
    1.30 \ No newline at end of file
    1.31 +    (vec store)))
    1.32 +