 (defonce ^{:doc "Controllers which are currently bound to shows,
   indexed by the controller binding ID."}
   active-bindings (atom {}))
-
-(defn sign-velocity
-  "Convert a midi velocity to its signed equivalent, to translate
-  encoder rotations, which are twos-complement seven bit numbers."
-  [val]
-   (if (>= val 64)
-     (- val 128)
-     val))
 
 (defn- overlay-handled?
   "See if there is an interface overlay active which wants to consume

  ;; TODO: Do other things when synced.
  ((:tap-tempo-handler controller)))

(defn- enter-metronome-showing
  "Activate the persistent metronome display, with sync and reset pads
  illuminated."

  (add-overlay controller
               (reify IOverlay
                 (captured-controls [this] #{15})
                 (captured-notes [this] #{9 1})
                 (adjust-interface [this controller]
                   (bpm-adjusting-interface controller))
                 (handle-control-change [this controller message]
                   (adjust-bpm-from-encoder controller message))
                 (handle-note-on [this controller message]
                   ;; Suppress the extra encoder above the BPM display.
                   ;; We can't get a note on for the BPM encoder, because
                   ;; that was the event that created this overlay.
                   true)
                 (handle-note-off [this controller message]
                   (when (= (:note message) 9)
                     ;; They released us, end the overlay
                     (swap! (:metronome-mode controller) dissoc :adjusting-bpm)
                     :done)))))

(defn- beat-encoder-touched
  "Add a user interface overlay to give feedback when turning the beat
