diff options
Diffstat (limited to 'src/unheard/instrument/util.clj')
| -rw-r--r-- | src/unheard/instrument/util.clj | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/unheard/instrument/util.clj b/src/unheard/instrument/util.clj index 0faa5b5..7c99f8b 100644 --- a/src/unheard/instrument/util.clj +++ b/src/unheard/instrument/util.clj @@ -3,16 +3,16 @@ (:import [javax.sound.midi ShortMessage])) (def matching-control-change - (filter (fn [^ShortMessage m] (= (.getCommand m) ShortMessage/CONTROL_CHANGE)))) + (filter (fn [^ShortMessage m] + (= (.getCommand m) ShortMessage/CONTROL_CHANGE)))) -(defn matching-channel [ch] +(defn matching-channel + [ch] (filter (fn [^ShortMessage m] (= (.getChannel m) ch)))) -(defn matching-data-1 [d1] - (filter (fn [^ShortMessage m] (= (.getData1 m) d1)))) +(defn matching-data-1 [d1] (filter (fn [^ShortMessage m] (= (.getData1 m) d1)))) -(def get-data-2 - (map (fn [^ShortMessage m] (.getData2 m)))) +(def get-data-2 (map (fn [^ShortMessage m] (.getData2 m)))) (defn matching-control "Returns a function filtering flow of ShortMessage `f` down to control @@ -25,15 +25,12 @@ " [init ch k] (fn [f] - ;; TODO: Should be signal - (m/stream - (m/reductions {} init - (m/eduction - (comp - matching-control-change - (matching-channel ch) - (matching-data-1 k) - get-data-2 - ;; TODO git-bug f109911 - (dedupe)) - f))))) + (m/stream (m/reductions {} + init + (m/eduction (comp matching-control-change + (matching-channel ch) + (matching-data-1 k) + get-data-2 + ;; TODO git-bug f109911 + (dedupe)) + f))))) |
