diff clojure/com/aurellem/run/basic_choreo.clj @ 542:614eddc5b38c

working on generating first major video.
author Robert McIntyre <rlm@mit.edu>
date Mon, 25 Jun 2012 16:08:56 -0500
parents cd557c922cec
children 6c379ee3d46e
line wrap: on
line diff
     1.1 --- a/clojure/com/aurellem/run/basic_choreo.clj	Mon Jun 25 15:32:16 2012 -0500
     1.2 +++ b/clojure/com/aurellem/run/basic_choreo.clj	Mon Jun 25 16:08:56 2012 -0500
     1.3 @@ -1,40 +1,41 @@
     1.4 +;;;; "Basic Choreography" -- just show off audio/video
     1.5 +
     1.6  (ns com.aurellem.run.basic_choreo
     1.7    (:use (com.aurellem.gb saves gb-driver util constants
     1.8                           items vbm characters money
     1.9                           rlm-assembly))
    1.10    (:use (com.aurellem.run util music title save-corruption
    1.11                            bootstrap-0 bootstrap-1 image
    1.12 -                          ram-display))
    1.13 +                          ram-display final-cut))
    1.14    (:require clojure.string)
    1.15    (:import [com.aurellem.gb.gb_driver SaveState])
    1.16    (:import java.io.File))
    1.17  
    1.18 -
    1.19 -
    1.20  ;; take over game
    1.21  ;; [X] silence noise
    1.22 -;; [ ] run picture program to display pinkie pie mark
    1.23 -;; [ ] play pony song 
    1.24 -
    1.25 +;; [X] preload audio/video programs
    1.26 +;; [X] run picture program to display pinkie pie mark
    1.27 +;; [X] play pony song 
    1.28  
    1.29  (defn-memo silence-noise
    1.30 -  ([] (silence-noise (relocate-main-bootstrap)))
    1.31 +  ([] (silence-noise (launch-main-bootstrap-program)))
    1.32    ([script]
    1.33       (->> script
    1.34 -          (write-RAM 0xFF1A [0 0 0]))))
    1.35 +          (write-RAM 0xFF1A [0 0 0])
    1.36 +          (relocate-main-bootstrap))))
    1.37  
    1.38  (def music-program-start 0xC000)
    1.39  (def image-program-start 0xCE00)
    1.40  
    1.41 -(defn-memo write-pony-music-data
    1.42 -  ([] (write-pony-music-data (silence-noise)))
    1.43 +(defn-memo write-pony-music
    1.44 +  ([] (write-pony-music (silence-noise)))
    1.45    ([script]
    1.46       (let [bytes (midi-bytes
    1.47                    pony-csv
    1.48                    0xC400
    1.49                    0xC800
    1.50                    0xCC00
    1.51 -                  0xC000)]
    1.52 +                  music-program-start)]
    1.53         (->> script
    1.54              (write-RAM (:address (:voice-1 bytes))
    1.55                         (:data    (:voice-1 bytes)))
    1.56 @@ -46,12 +47,12 @@
    1.57                         (:data    (:kernel bytes)))))))
    1.58  
    1.59  (defn-memo write-image-display-program
    1.60 -  ([] (write-image-display-program (write-pony-music-data)))
    1.61 +  ([] (write-image-display-program (write-pony-music)))
    1.62    ([script]
    1.63 -     (let [return-to-bootstrap
    1.64 +     (let [goto-music
    1.65             (flatten
    1.66              [0xC3
    1.67 -             (disect-bytes-2 relocated-bootstrap-start)])]
    1.68 +             (reverse (disect-bytes-2 music-program-start))])]
    1.69         (->> script
    1.70              (write-RAM
    1.71               image-program-start
    1.72 @@ -59,14 +60,30 @@
    1.73                (display-image-kernel
    1.74                 image-program-start
    1.75                 pinkie-pie-mark)
    1.76 -              return-to-bootstrap))))))
    1.77 -     
    1.78 +              goto-music))))))
    1.79 +              
    1.80  (defn-memo activate-media
    1.81    ([] (activate-media (write-image-display-program)))
    1.82    ([script]
    1.83       (->> script
    1.84            (transfer-control image-program-start)
    1.85 -          (do-nothing 100)
    1.86 -          (transfer-control music-program-start))))
    1.87 +          (do-nothing 1800))))
    1.88  
    1.89  
    1.90 +
    1.91 +(def basic-render-dir
    1.92 +  (File. user-home "proj/vba-clojure/render/basic"))
    1.93 +
    1.94 +(defn basic-steps [] (first (activate-media)))
    1.95 +
    1.96 +(defn basic-step-1! []
    1.97 +  (render-files!
    1.98 +   basic-render-dir
    1.99 +   (root) (basic-steps)))
   1.100 +
   1.101 +(defn basic-step-2! []
   1.102 +  (generate-composite-frames!
   1.103 +   basic-render-dir
   1.104 +   basic-steps))
   1.105 +
   1.106 +(defn basic-step-3! [] (final-cut! basic-render-dir))