 (defn tuning-chooser [e]
   (let [val (value (.getSource e))]
     (case val
-      "Equal"       (reset! tuning :equalTemperament)
-      "Pythagorean" (reset! tuning :pythagorean)
-      "Just"        (reset! tuning :justIntonation)
-      "O'Donnel"        (reset! tuning :odonnel)
-      "Neidhardt"        (reset! tuning :neidhardt)))
+      "Equal"       (reset! tuning equal-temperament)
+      "Pythagorean" (reset! tuning pythagorean)
+      "Just"        (reset! tuning just-intonation)
+      "O'Donnel"    (reset! tuning odonnel)
+      "Neidhardt"   (reset! tuning neidhardt)
+      "Custom"      nil ))
   ;;(println (midi->freq 60))
   )
 

        seesaw.chooser
        clojure.math.numeric-tower)
  (:require [overtone.core :as o]
            [clojure.string :as s]
            [eu.algoholic.smart_sort :as ss])
  (:gen-class))

      f)))


;; (defn make-mono-panel [id]
;;   (let [prefix (s/join ["monochord-" (str id) "-"])
;;         tonic-kw (keyword (s/join [prefix "tonic"]))
;;         tonic-label (label "Tonic: ")
;;         tonic-box (combobox :model keyboard)
;;         tonic-bar (horizontal-panel :items [tonic-label tonic-box])
;;         note-label (label "Ratio: ")
;;         note-ratio (text :text "" :editable? true)
;;         note-bar (horizontal-panel :items [note-label note-ratio])
;;         mode-button (button :text "Seq."
;;                             :listen [:action (fn [e]
;;                                                (let [src (.getSource e)
;;                                                      curval (config src :text)]
;;                                                  (if (= curval "Seq.")
;;                                                    (config! src :text "Chord")
;;                                                    (config! src :text "Seq."))))])
;;         play-button (button :text "Play"
;;                             :listen [:action
;;                                      (fn [e]
;;                                        (let [ton (str->midi (value tonic-box))
;;                                              tonfreq (midi->freq ton)
;;                                              ratiostr (value note-ratio)
;;                                              ratio (read-string ratiostr)
;;                                              notefreq (* tonfreq ratio)
;;                                              tonvec [tonfreq 1]
;;                                              notevec [notefreq 1]
;;                                              simul (= "Chord"
;;                                                       (config mode-button :text))
;;                                              score (if simul
;;                                                      [["Default" tonvec]
;;                                                       ["Default" notevec]]
;;                                                      [["Default" tonvec
;;                                                        notevec]])
;;                                              metro (o/metronome @tempo)]
;;                                          (play-score score false)))])
;;         pan (vertical-panel :id :monochord
;;                             :size [160 :by 105]
;;                             :items [tonic-bar note-bar mode-button play-button])
;;         f (frame :title (s/join ["Monochord " (str id)])
;;                  :id (s/join ["mono-" (str id)])
;;                  :content pan)]
;;     (-> f pack! show!)))

(def save-polychord)
(def load-polychord)
(def install-tuning)

(defn make-poly-panel [id]
  (let [prefix (s/join ["polychord-" (str id) "-"])
