     14 ; Beat encoder
     (let [delta (sign-velocity (:velocity message))
           snapshot (rhythm/metro-snapshot (:metronome (:show controller)))]
-      (rhythm/metro-start (:metronome (:show controller)) (+ (:beat snapshot) delta))
-      (rhythm/metro-beat-phase (:metronome (:show controller) (:beat-phase snapshot))))
+      (if @(:shift-mode controller)
+        ;; User is adjusting the current bar
+        (rhythm/metro-bar-start (:metronome (:show controller)) (+ (:bar snapshot) delta))
+        ;; User is adjusting the current beat; keep the phase unchanged
+        (do
+          (rhythm/metro-start (:metronome (:show controller)) (+ (:beat snapshot) delta))
+          (rhythm/metro-beat-phase (:metronome (:show controller) (:beat-phase snapshot))))))
     
     15 ; BPM encoder
     (let [delta (/ (sign-velocity (:velocity message)) 10)
           bpm (rhythm/metro-bpm (:metronome (:show controller)))]
       (rhythm/metro-bpm (:metronome (:show controller)) (+ bpm delta)))
+
+    49 ; Shift button
+    (swap! (:shift-mode controller) (fn [_] (> (:velocity message) 0)))
 
     ;; Something we don't care about
     nil))

   :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))
         }]
