 
 (rf/reg-event-fx ::control
   [rf/debug]
-  (fn [fx [_ cc value midi?]]
-    (-> fx
-        (assoc-in [:db ::control cc] value)
-        ;; FIXME: (if-not midi?)
-        (assoc ::midi/midi [[176 cc value]]))))
+  (fn [fx [_ cc value from-midi?]]
+    (let [fx- (assoc-in fx [:db ::control cc] value)]
+      (if from-midi?
+        fx-
+        ;; If the event doesn't originate from midi, send it
+        (assoc fx- ::midi/midi
+          (if (vector? cc)
+            ;; NRPN
+            [[0xB0 0x63 (first cc)]
+             [0xB0 0x62 (second cc)]
+             [0xB0 0x06 value]]
+            ;; Regular CC
+            [[0xB0 cc value]]))))))
 
 (rf/reg-sub ::control
   (fn [db [_ cc]]

  [:div.filter-panel
    [:h2 "Filter"]])

(defn main-panel []
  (let [tab @(rf/subscribe [::panel])]
    [:main.main-panel

        "Osc"]
      [:li {:class (if (= tab :filter) "is-active")
            :on-click #(rf/dispatch [::panel :filter])}
        "Filter"]
      [:li {:class (if (= tab :env) "is-active")
            :on-click #(rf/dispatch [::panel :env])}
        "Env"]]))

(defn knob [{:keys [cc label min max]}]
  (let [value @(rf/subscribe [::control cc])]
