           dev-map      (apply hash-map (interleave (map :device devs) receivers))]
       (swap! midi-devices* merge dev-map)
       (when (pos? n-devs)
-         (log/info "Connected " n-devs " midi devices: " device-names)))
+        (log/info "Connected " n-devs " midi devices: " device-names)))
     (catch Exception ex
-      (println "Got exception in detect-midi-devices!" ex))))
-
-; The rate at which we poll for new midi devices
+      (println "Got exception in detect-midi-devices!" (.printStackTrace ex)))))
+
+;; The rate at which we poll for new midi devices
 (def MIDI-POLL-RATE 2000)
 
 (defonce __DEVICE-POLLER__
   (detect-midi-devices))
-;  (every MIDI-POLL-RATE #'detect-midi-devices INTERNAL-POOL :desc "Check for new midi devices"))
+;;  (every MIDI-POLL-RATE #'detect-midi-devices INTERNAL-POOL :desc "Check for new midi devices"))
 
 (defn midi-poly-player
   "Sets up the event handlers and manages synth instances to easily play

(ns overtone.studio.midi
  (:use [overtone.sc node]
        [overtone midi]
        [overtone.at-at :only (mk-pool every)]
        [overtone.libs.event]
        [overtone.sc.defaults :only [INTERNAL-POOL]])
  (:require [overtone.config.log :as log]))


(def EXCLUDED-DEVICES #{"Real Time Sequencer" "Java Sound Synthesizer"})

(defn midi-mk-full-device-key
  "Returns a unique key for the specific device. In the case of multiple
   identical devices, the final integer of the key, dev-num, will be
   different to ensure key uniqueness.

   Is able to handle either a MIDI device stored in this namespace via
   detect-midi-devices or a raw MIDI device map from overtone.midi. "
  [dev]
  (or (::full-device-key dev)
      (let [dev-num (or (::dev-num dev)
                        (::dev-num (get @midi-devices* (:device dev)))
                        -1)]
        [:midi-device (dev :vendor) (dev :name) (dev :description) dev-num])))



(defn midi-connected-devices
  "Return a list of maps representing all of the connected MIDI
   devices. Prefer using this fn to midi-devices from overtone.midi"
  []
  (vals @midi-devices*))

(defn midi-find-connected-devices
  "Returns a list of connected MIDI devices where the full device key
   either contains the search string or matches the search regexp
   depending on the type of parameter supplied"
  [search]
  (let [filter-pred (fn [dev]
                      (let [key-as-str (str (midi-mk-full-device-key dev))]
                        (if (= java.util.regex.Pattern (type search))
                          (re-find search key-as-str)
                          (.contains key-as-str search))))]
    (filter filter-pred (midi-connected-devices))))

(defn midi-find-connected-device
  "Returns the first connected MIDI device found where the full device
   key either contains the search string or matches the search regexp
   depending on the type of parameter supplied"
  [search]
  (first (midi-find-connected-devices search)))

(defn midi-mk-full-device-event-key
  "Creates the device-specific part of the key used for events generated
