                                               "/js/audio/adsr_node.js")]}}))
 
 (def fft-analyser-node-type
-  (NodeType. {:signal-in {:type :node
-                          :index 0
-                          :title "Signal"}}
+  (NodeType. {:signal-in (signal-in 0 "Signal")}
              {}
              {:inspector-fields [:fft]}
              false

             {:constructor "context.createDynamicsCompressor()"}))

(def midi-note-node-type
  (NodeType. {:device {:type :accessor
                       :name "device"
                       :default nil
                       :title "Device"
                       :data-type :midi-device
                       :serializable false}
              :note-mode {:type :constant
                          :name "noteMode"
                          :default "retrig"
                          :data-type :string
                          :title "Mode"
                          :choices ["retrig" "legato"]}
              :portamento {:type :constant
                           :name "portamento"
                           :default 0
                           :data-type :number
                           :range [0 5]
                           :title "Portamento"}
              :priority {:type :constant
                         :name "priority"
                         :default "last-on"
                         :data-type :string
                         :title "Priority"
                         :choices ["last-on" "highest" "lowest"]}}
             {:gate {:type :node
                     :index 0
                     :title "Gate"
                     :data-type :gate}
              :frequency {:type :node
                          :index 1
                          :title "Frequency"
                          :data-type :param}}
             nil
             false
             "MIDI Note"

    (merge basic-nodes midi-nodes)))

(def all-node-groups
  (letfn [(lookup [node-type-id]
            [node-type-id (all-node-types node-type-id)])]

    (let [generators [:oscillator :const-source]
          filters [:biquad-filter :gain :stereo-panner
                   :stereo-splitter :stereo-merger
                   :delay :compressor]
          envelopes [:adsr]
          midi-nodes [:midi-note :midi-cc]
          analysers [:scope :fft]
          interfaces [:input :output :audio-destination]]
      (map
       (fn [m] (update m :node-types (partial map lookup)))
       (concat [{:title "Generators" :node-types generators}
                {:title "Filters" :node-types filters}
                {:title "Envelopes" :node-types envelopes}]
               (if has-midi-support
                 [{:title "MIDI" :node-types midi-nodes}]
                 [])
               [{:title "Analysers" :node-types analysers}]
               [{:title "Interfaces" :node-types interfaces}])))))

(defn get-node-type [node-type-id]
  (all-node-types node-type-id))
