               (if (and (= channel 15) (and (= note 60) (= vel 64)))
                 (swap! bbeat inc)
                 ;(concat (print "note =") (println  note ))
-
                 (if (= channel 0)
                   (swap! bd assoc :note note :velocity vel)
                   ;(println (concat (print "stuff = ") (print note)))
+                  (if (= channel 1)
+                    (swap! sd assoc :note note :velocity vel)
+                    (if (= channel 2)
 
-                  (if (= channel 1)
-                    (swap! sd assoc :note note)
-                    )))
+                      ))))
 
               ))
           ::keyboard-handler)
+
+(on-event [:midi :control-change]
+          (fn [e]
+            ;(println e)
+            (let [data1 (:data1 e)
+                  data2 (:data2 e)
+                  channel (:channel e)]
+              (if (and  (= channel 2) (= data1 1))
+                (swap! ch assoc :pan data2)
+                )
+              )
+            )
+          ::control-handler
+          )
 
 
 

            ;(print " ")
            ;(print (:note e) )
            ;(print " ")
            ;(println (:velocity e))

            (let [note (:note e)
                  vel  (:velocity e)

  ;(newt/update-particles width height)
  {
                                        ;:fm @(:left fmtonestaps)
   :beat @bbeat
   :bd @bd
   :sd @sd
   :ch @ch
   :oh @oh
   :pc1 @pc1
   :pc2 @pc2
   :ld1 @ld1
   :ld2 @ld2
   :chords @chords
   :keys @keys

   ;:drumbus @(audio-bus-monitor 0)
   ;:contrabus @(audio-bus-monitor 2)
   ;:fmtonesbus @(audio-bus-monitor 4)
