Implement := operator
This commit is contained in:
parent
83524851fd
commit
f8506819af
@ -35,6 +35,19 @@
|
||||
:volume 50 ;; volume of performance
|
||||
:key [:C :major]}) ;; current key signature
|
||||
|
||||
(defn merge-perfs
|
||||
"Merges two performances"
|
||||
[p1 p2]
|
||||
(if (nil? (seq p1))
|
||||
p2
|
||||
(if (nil? (seq p2))
|
||||
p1
|
||||
(let [e1 (first p1)
|
||||
e2 (first p2)]
|
||||
(if (< (:duration e1) (:duration e2))
|
||||
(into [e1] (merge-perfs (rest p1) p2))
|
||||
(into [e2] (merge-perfs p1 (rest p2))))))))
|
||||
|
||||
(defn perform
|
||||
"Convert a music value to a performance value"
|
||||
[player-map context music]
|
||||
@ -56,11 +69,18 @@
|
||||
(let [[events dur] (perf player-map
|
||||
context
|
||||
m)]
|
||||
[(concat events-acc dur-acc)
|
||||
[(concat events-acc events)
|
||||
(+ dur-acc dur)]))
|
||||
[[] 0]
|
||||
ms)
|
||||
[:= & ms] :TODO
|
||||
[:= & ms] (reduce (fn [[merged-events max-dur] m]
|
||||
(let [[events dur] (perf player-map
|
||||
context
|
||||
m)]
|
||||
[(merge-perfs merged-events events)
|
||||
(max max-dur dur)]))
|
||||
[[] 0]
|
||||
ms)
|
||||
[:modify control m] :TODO)))
|
||||
|
||||
(defn metro
|
||||
|
Loading…
Reference in New Issue
Block a user