       (let [effect (get fx index)
             info (get fx-meta index)
             cue (:cue info)
-            cue-var (case (count (:variables cue))
-                      0 nil ; No variables to adjust
-                      1 (first (:variables cue))
-                      (get (:variables cue) var-index))]
+            cue-vars (cue-vars-for-encoders (:variables cue) (get @(:cue-var-offsets controller) (:id info) 0))
+            cue-var (get cue-vars var-index)]
         (when cue-var
           (let [cur-val (cues/get-cue-variable cue cue-var :show (:show controller) :when-id (:id info))]
             (cond
               (or (number? cur-val) (#{:integer :float} (:type cue-var :float)))
               (controllers/add-overlay (:overlays controller)
-                                       (build-numeric-adjustment-overlay controller note cue effect info))
+                                       (build-numeric-adjustment-overlay controller note cue cue-var effect info))
 
               (or (= (type cur-val) :com.evocomputing.colors/color) (= (:type cue-var) :color))
               (controllers/add-overlay (:overlays controller)
-                                       (build-color-adjustment-overlay controller note cue effect info))
+                                       (build-color-adjustment-overlay controller note cue cue-var effect info))
 
               (or (= (type cur-val) Boolean) (= (:type cue-var) :boolean))
               (controllers/add-overlay (:overlays controller)
-                                       (build-boolean-adjustment-overlay controller note cue effect info))
+                                       (build-boolean-adjustment-overlay controller note cue cue-var effect info))
 
               :else  ; Something we don't know how to adjust
               nil)))))))

      ;; suppress the other one.
      (let [paired-note (if (odd? note) (dec note) (inc note))]
        (reify controllers/IOverlay
          (captured-controls [this] #{(control-for-top-encoder-note note)})
          (captured-notes [this] #{note paired-note})
          (adjust-interface [this _]
            (when (same-effect-active controller cue (:id info))
              (draw-boolean-gauge controller x 17 0 cue
                                   (first (:variables cue)) (:id info))
              true))
          (handle-control-change [this message]
            (adjust-boolean-value controller message cue
                                  (first (:variables cue)) (:id info)))
          (handle-note-on [this message]
            true)
          (handle-note-off [this message]

                                   (handle-note-off [this message])
                                   (handle-aftertouch [this message])))))))

(defn- handle-scroll-cue-vars
  "Process a tap on one of the pads which indicate the user wants to
  scroll forward in the list of cue variables."
  [controller note]
  (let [room (room-for-effects controller)
        fx-info @(:active-effects (:show controller))
        fx (vec (drop (- (count (:effects fx-info)) room) (:effects fx-info)))
        fx-meta (vec (drop (- (count (:meta fx-info)) room) (:meta fx-info)))
        offset (- 4 room)
        x (quot (- note 21) 2)
        index (- x offset)]
    (when (and (seq fx) (< index (count fx)))
      (let [effect (get fx index)
            info (get fx-meta index)
            cue (:cue info)
            var-count (count (:variables cue))]
        (when (> var-count 2)
          (swap! (:cue-var-offsets controller) update-in [(:id info)] #(mod (+ 2 (or % 0)) var-count))
          (controllers/add-overlay (:overlays controller)
                                   (reify controllers/IOverlay
                                     (captured-controls [this] #{note})
                                     (captured-notes [this] #{})
                                     (adjust-interface [this _]
                                       (aset (:next-top-pads controller) (inc (* 2 x)) (top-pad-state :bright :amber))
                                       true)
                                     (handle-control-change [this message]
                                       (when (and (= (:note message) note) (zero? (:velocity message)))
                                         :done))
                                     (handle-note-on [this message])
                                     (handle-note-off [this message])
                                     (handle-aftertouch [this message]))))))))

(defn- move-origin
  "Changes the origin of the controller, notifying any registered
  listeners."
