     (doseq [[i val] (map-indexed vector bytes)]
       (aset (get (:next-display controller) row) (+ (* cell 17) i) (util/ubyte val)))))
 
+(defn- update-metronome-section
+  "Updates the sections of the interface related to metronome
+  control."
+  [controller]
+  (let [metronome (:metronome (:show controller))
+        metronome-button (:metronome control-buttons)
+        tap-tempo-button (:tap-tempo control-buttons)
+        metronome-mode @(:metronome-mode controller)]
+    ;; Should the first cell display metronome information?
+    (if (seq metronome-mode)
+      (let [metronome (:metronome (:show controller))
+            marker (rhythm/metro-marker metronome)
+            bpm (format "%.1f" (float (rhythm/metro-bpm metronome)))
+            chars (+ (count marker) (count bpm))
+            padding (apply str (take (- 17 chars) (repeat " ")))]
+        (swap! (:next-text-buttons controller)
+               assoc metronome-button (button-state metronome-button :bright))
+        (write-display-cell controller 1 0 (str marker padding bpm))
+        (write-display-cell controller 0 0 "Beat        BPM  ")
+        (when (:adjusting-beat metronome-mode)
+          (let [arrow-pos (if @(:shift-mode controller)
+                            (dec (.indexOf marker "." (inc (.indexOf marker "."))))
+                            (dec (count marker)))]
+            (aset (get (:next-display controller) 2) arrow-pos (:up-arrow special-symbols))))
+        (when (:adjusting-bpm metronome-mode)
+          (aset (get (:next-display controller) 2) 16 (:up-arrow special-symbols))))
+      (swap! (:next-text-buttons controller)
+             assoc metronome-button (button-state metronome-button :dim)))
+    ;; Regardless, flash the tap tempo button on beats
+    (swap! (:next-text-buttons controller)
+           assoc tap-tempo-button
+           (button-state tap-tempo-button
+                         (if (< (rhythm/metro-beat-phase metronome) 0.15)
+                           :bright :dim)))))
+
 (defn update-interface
   "Determine the desired current state of the interface, and send any
   changes needed to get it to that state."

   :quantize {:control 116 :kind :monochrome}
   :double   {:control 117 :kind :monochrome}
   :delete   {:control 118 :kind :monochrome}
   :undo     {:control 119 :kind :monochrome}
   
   })

(defn button-state
  "Calculate the numeric value that corresponds to a particular

         :last-text-buttons (atom {})
         :next-text-buttons (atom {})
         :metronome-mode (atom {:showing true})
         :shift-mode (atom false)
         :midi-handler (atom nil)
         :tap-tempo-handler (amidi/create-tempo-tap-handler (:metronome show))
         }]
