   "Returns the set of MIDI input ports which are currently delivering
   MIDI clock messages."
   []
+  (when (empty? @midi-inputs)
+    (open-inputs-if-needed!)
+    (Thread/sleep 300)) ; Give the clock watcher a chance to spot messages
   (set (for [[k v] @clock-sources]
-         (when (< (- (now) (:timing-clock v)) 300) k))))
+         (when (< (- (now) (:timing-clock v)) 300) (get @midi-inputs k)))))
 
 (defn current-traktor-beat-phase-sources
   "Returns the set of MIDI input ports which are currently delivering

  our event distribution handler."
  [device]
  (let [opened (midi/midi-in device)]
    (taoensso.timbre/info "Opened MIDI input:" device)
    (midi/midi-handle-events opened incoming-message-handler)
    opened))


  "Open a MIDI output device."
  [device]
  (let [opened (midi/midi-out device)]
    (taoensso.timbre/info "Opened MIDI output:" opened)
    opened))

(defn mac?
