
;; Accessing the Csound API via Clojure (a draft)

(defn on-thread [f]
  (doto (new Thread f) (.start)))

(defn
  #^{:doc "Plays the file named csd-file via the Csound API"}
  csound-play [csd-file]
  (let [cs (new csnd.Csound)]
    (on-thread #(when (= 0 (.Compile cs csd-file "-dodac"))
		  (while (= 0 (.PerformKsmps cs))) 
		  (.Reset cs)))))	      