                        :height      canvas-height
                        :style       #js {:opacity 0.3 :position "absolute" :left x-offset}
                        :ref         "canvas-ref"
-                       :onMouseDown (fn [e] (om/set-state! owner :mouse-down true) (om/set-state! owner :mouse-down-pos [(.-clientX e) (.-clientY e)]))
-                       :onMouseUp   #(om/set-state! owner :mouse-down false)
+                       :onMouseDown (fn [e] (om/update-state! owner
+                                              #(assoc % :mouse-down true :mouse-down-pos [(.-clientX e) (.-clientY e)])))
                        :onMouseOver #(om/set-state! owner :mouse-over true)
                        :onMouseOut  #(om/set-state! owner :mouse-over false)}
                   "no canvas"))))


    om/IRenderState
    (render-state [_ {:keys [canvas-width canvas-height]}]
      (dom/div #js {:style  #js {:position "relative"}}
        (dom/canvas #js {:width  canvas-width
                         :height canvas-height
                         :ref    "canvas-ref"}

                          :recorded-buffers []
                          :audio-context audio-context}))

(defn listen
  ([el type]
   (let [out (chan)]
     (events/listen el type
       (fn [e] (put! out e)))
     out))
  ([el type tx]
   (let [out (chan 1 tx)]
     (events/listen el type
       (fn [e] (put! out e)))
     out)))

(defn lin-interp [x0 x1 y0 y1]
  (fn [x]
