      (if loop-flag
        (set! (.-loop source) true)
        (set! (.-loop source) false))
-     (set! (.-buffer source) buff)
+     (set! (.-buffer source)
+           (if (keyword? buff) (get-sound buff) buff))
      (.connect source gain)
      (.connect gain (.-destination audio-context))
      (set! (.-gain.value gain) g)

    (.send req)
    c))

(defn play-sound
  "pass this a buffer, and an optional gain parameter, and the
  sound will be played to the speakers"

(def audio-context (if js/window.AudioContext (js/window.AudioContext.) (js/window.webkitAudioContext.)))

(def default-gain 0.7)

;; where we store all the loaded sounds
(defonce !sounds (atom {}))

(defn load-sound
  "Initiates a download of the url as a sound. Returns a channel.
