Skip to content

Commit

Permalink
create helper fn ugen-sequence-mode?
Browse files Browse the repository at this point in the history
  • Loading branch information
samaaron committed May 3, 2013
1 parent f97e3e2 commit 8c9688e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/overtone/sc/machinery/ugen/specs.clj
Original file line number Diff line number Diff line change
Expand Up @@ -224,16 +224,20 @@
arg-list (vec (map arg-map arg-names))]
(assoc ugen :args arg-list :arg-map arg-map :orig-args args)))

(defn ugen-sequence-mode?
[mode]
(or (= :append-sequence mode)
(= :append-sequence-set-num-outs mode)
(= :append-string mode)))

(defn- append-seq-args
"Handles argument modes :append-sequence and :append-sequence-set-num-outs,
and :append-string where some ugens take a seq or string for one argument
which needs to be appended to the end of the argument list when sent to SC.
(and in the case of strings need to be converted to a list of char ints)"
[spec ugen]
(let [args-specs (args-with-specs (:args ugen) spec :mode)
pred #(or (= :append-sequence (second %))
(= :append-sequence-set-num-outs (second %))
(= :append-string (second %)))
pred #(ugen-sequence-mode? (second %))
normal-args (map first (remove pred args-specs))
to-append (filter pred args-specs)
intify-strings (map (fn [[arg spec]]
Expand Down

0 comments on commit 8c9688e

Please sign in to comment.