 (ns ^:figwheel-always web-audio-cljs.core
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [goog.dom :as googdom]
+            [goog.dom]
             [goog.events :as events]
+            [goog.math]
             [web-audio-cljs.audio :as audio]
             [web-audio-cljs.utils :refer [l]]
             [cljs.core.async :refer [put! chan timeout sliding-buffer <! >!]])

          (recur (inc i) cur-val)
          (recur (inc i) max-val))))))

(defn draw-select-rect! [canvas-width canvas-height canvas-context x mouse-down?]
  (.clearRect canvas-context 0 0 canvas-width canvas-height)
  (.fillRect canvas-context x 0 100 100)
  (when mouse-down?
      (aset canvas-context "strokeStyle" "aliceblue")
      (aset canvas-context "lineWidth" 6)
      (.strokeRect canvas-context x 2 100 96)))

(defn draw-buffer! [width height canvas-context data]
  (let [step (.ceil js/Math (/ (.-length data) width))


    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"}
                    "no canvas")
               (om/build wave-selector-view data)))))

(defn buffers-list-view [data owner]
