 (defn home-page []
   [:div [:h1 "Welcome to Leipzig Live!"]
    [:div [:input {:type "text"
-                  :value (-> music deref print-str)
-                  :on-change #(-> % .-target .-value handle)}]]
+                  :value (-> state deref :music print-str)
+                  :on-change #(-> % .-target .-value handle)}]
+    [:button {:on-click toggle} "Start/stop"]]
    [:div
-    (evaluate @music)]])
+    (evaluate (-> @state :music))]])
 
 (defn current-page []
   [:div [(session/get :current-page)]])


;; -------------------------
;; Model
(defonce music (atom ""))

;; -------------------------
;; Behaviour

      {:eval cljs/js-eval}
      #(:value %)))

(defonce context (js/window.AudioContext.))
(defonce oscillator
  (let [oscillator (.createOscillator context)]
    (.connect oscillator (.-destination context))
    oscillator))

(defn beep []
  (.start oscillator 0))

(defn kill []
  (.stop oscillator 0))

(defn handle [expr-str]
  (swap! state assoc-in [:music] expr-str))

(defn toggle []
  (swap! state update-in [:playing?] not)
  (if (:playing? @state)
    (beep)
    (kill)))

;; -------------------------
;; Views
