 (defonce server*        (ref nil))
 (defonce status*        (ref :no-audio))
 (defonce synths*        (ref nil))
-
-(defonce sc-world* (ref nil))
-
-;TODO: Figure out the real limits...  These are total guesses, but
-; it should be plenty.
-(def MAX-GROUPS 256)
-
-(def GROUP-BITS (BitSet. MAX-GROUPS))
-(.set GROUP-BITS 0) ; Group 0 is the persistent root group
+(defonce sc-world*      (ref nil))
 
 ; Server limits
 (defonce MAX-NODES 1024)

  (try
    (group-clear 0)
    (catch Exception e nil))
  (apply node-free (all-ids :node))
  (clear-ids :node)
  (alloc-id :node) ; ID zero is the root group
  (dosync (ref-set synths* (zipmap (keys @synths*)

(defn buffer? [buf]
  (= (type buf) ::buffer))

(defn- buf-or-id [b]
  (cond
    (buffer? b) (:id b)
    (number? b) b
    :default (throw (Exception. "Not a valid buffer: " b))))

(defn buffer-free
  "Free an audio buffer and the memory it was consuming."
  [buf]
  (free-id :audio-buffer (:id buf))
  (snd "/b_free" (:id buf)))

