         scaled-init (* (/ (- init-val min-val)
                           (double (- max-val min-val)))
                        SLIDER-MAX)
-        slider (slider :value scaled-init :min 0 :max SLIDER-MAX :orientation :horizontal)
+        slider (slider :id (keyword name) :class :synth-control-slider
+                       :value scaled-init :min 0 :max SLIDER-MAX :orientation :horizontal)
         label  (label name)
         items  [[label "width 80:80:100"]
                 [spinner "width 80:80:80"]

(ns overtone.gui.control
  (:use [seesaw core mig])
  (:require [seesaw.bind :as bind]))

(native!)

    (bind/bind val-atom spinner)
    items))

(defn- control-dial
  [name init-val min-val max-val step val-atom]
  (let [spin-model (spinner-model (double init-val)
                                  :from (double min-val) :to (double max-val) :by (double step))
        spinner (spinner :model spin-model)
        dial (dial :id (keyword name) :class :synth-control-dial
                        :value init-val :min 0 :max SLIDER-MAX :orientation :horizontal)
        label  (label name)
        items  [[label "width 80:80:100"]
                [spinner "width 80:80:80"]
                [dial "wrap"]]]
    (bind/bind dial
               (comment bind/transform (fn [v]
                                 (let [val (+ min-val (* (- max-val min-val)
                                                         (/ v (double SLIDER-MAX))))]
                                   val)))
               val-atom)
    (bind/bind val-atom
               ;(bind/transform #(* (/ (- % min-val) (- max-val min-val)) SLIDER-MAX))
               dial)
    (bind/bind spinner val-atom)
    (bind/bind val-atom spinner)
    items))

(defn synth-controller
  "Create a GUI for the given synth or instrument.  Requires sufficient parameter metadata in the synthdef.

