 ;; stick an Out ugen on synths that don't explicitly use one.
 (intern-ugens (create-ns 'overtone.ugens))
 
-(defn refer-ugens 
+(defn refer-ugens
   "This is how you (use 'overtone.ugens)."
   []
   (let [local-map (ns-map *ns*)
         ugen-map (ns-map 'overtone.ugens)
-        collisions (intersection (set (keys local-map)) 
+        collisions (intersection (set (keys local-map))
                                  (set (keys ugen-map)))]
     (doseq [v collisions]
       (ns-unmap *ns* v))

  [args spec prop]
  (partition 2 (interleave args (map #(get % prop) (:args spec)))))

(defn- map-ugen-args 
  "Perform any argument mappings that needs to be done."
  [spec args]
  (let [args-specs (args-with-specs args spec :map)]


(defn ugen? [obj] (= ::ugen (type obj)))

(defn- make-buffer-id 
  "Returns a function that converts any buffer arguments to their :id property value."
  [fun]
  (fn [& args]
    (apply fun (map #(if (overtone.core.sc/buffer? %) (:id %) %) args))))

(defn- make-ugen-fn
  "Returns a function representing the given ugen that will fill in default arguments, rates, etc."
  [spec rate special]
  (let [expand-flags (map #(:expands? %) (:args spec))]
    (make-buffer-id
      (make-expanding (ugen-base-fn spec rate special) expand-flags))))

;; TODO: Figure out the complete list of control types
;; This is used to determine the controls we list in the synthdef, so we need
