             [afterglow.midi :as amidi]
             [afterglow.rhythm :as rhythm]
             [afterglow.show :as show]
+            [afterglow.show-context :refer [with-show]]
             [afterglow.util :as util]
             [clojure.math.numeric-tower :as math]
             [environ.core :refer [env]]


(defn- interpret-tempo-tap
  "React appropriately to a tempo tap, based on the sync mode of the
  show metronome."
  [controller]
  ;; TODO: Do other things when synced.
  ((:tap-tempo-handler controller)))

(defn- bpm-adjusting-interface
  "Add an arrow showing the BPM is being adjusted."

(defn- metronome-sync-label
  "Determine the sync type label to display under the BPM section."
  [controller]
  (with-show (:show controller)
    (case (:type (show/sync-status))
      :manual "Manual"
      :midi "MIDI"
      :dj-link "DJ Link"
      "Unknown")))

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