          (.show)
          (.setAlwaysOnTop keep-on-top)))))
 
-(defn- start-scopes-runner
-  []
-  (periodic update-scopes (/ 1000 FPS) 0 @scope-pool*))
-
 (defn scopes-start
+  "Schedule the scope to be updated every (/ 1000 FPS) ms (unless the scopes are
+  already running in which case it does nothing."
   []
   (dosync
    (when-not @scopes-running?*
-     (start-scopes-runner)
+     (at-at/every (/ 1000 FPS) update-scopes scope-pool)
      (ref-set scopes-running?* true))))
 
 (defn- reset-data-arrays

           [javax.swing JFrame JPanel JSlider])
  (:use [clojure.stacktrace]
        [overtone.util lib]
        [overtone.music time]
        [overtone.lib event deps]
        [overtone.sc defaults core synth ugen buffer node]
        [overtone.studio.util])
  (:require [clojure.set :as set]
            [overtone.util.log :as log]))

(defonce SCOPE-BUF-SIZE 4096)
(defonce FPS 10)
(defonce scopes* (ref {}))
(defonce scope-pool* (agent (make-pool)))
(defonce scopes-running?* (ref false))
(defonce WIDTH 600)
(defonce HEIGHT 400)


(defn scopes-stop
  []
  (at-at/stop-and-reset-pool! scope-pool)
  (empty-scope-data)
  (dosync (ref-set scopes-running?* false)))

(defn- start-bus-synth
  [bus buf]
