         [overtone.sc.machinery.ugen fn-gen defaults common specs sc-ugen]
         [overtone.sc.machinery synthdef]
         [overtone.sc bindings ugens server node]
-        [overtone.helpers seq])
+        [overtone.helpers seq]
+        [clojure.pprint])
+
   (:require [overtone.util.log :as log]
             [clojure.set :as set]))
 

            (let [[ugens# constants#] (gather-ugens-and-constants
                                        (with-overloaded-ugens ~@ugen-form))
                  ugens# (topological-sort-ugens ugens#)
;;                  _# (println "main-tree[" (count ugens#) "]: " ugens#)
;;                  _# (println (str "*ugens*: [" (count *ugens*) "] " *ugens*))
                  main-tree# (set ugens#)
                  side-tree# (filter #(not (main-tree# %)) *ugens*)
;;                  _# (println "side-tree[" (count side-tree#) "]: " side-tree#)
                  ugens# (concat ugens# side-tree#)
                  constants# (into [] (set (concat constants# *constants*)))]
;;              (println "all ugens[" (count ugens#) "]: " ugens#)
       [~sname ~params ugens# constants#])))))

      (throw (Exception.
               (format "Cannot connect ugen arguments for %s ugen with args: %s" (:name ugen) (str (seq (:args ugen)))))))

    ;;Add link back to MaxLocalBufs ugen (always at root of tree) if
    ;;ugen is a local-buf.
    (if (= "LocalBuf" (:name ugen))
      (assoc ugen :inputs (concat (:inputs ugen) {:src 0 :index 0}))
      ugen)))

; TODO: Currently the output rate is hard coded to be the same as the
; computation rate of the ugen.  We probably need to have some meta-data
