Created
May 18, 2011 09:20
-
-
Save cassiel/978270 to your computer and use it in GitHub Desktop.
first hack at the monome arc using clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Our legacy Java OSC library: | |
(def transmitter (net.loadbang.osc.comms.UDPTransmitter. (java.net.InetAddress/getByName "localhost") 10332)) | |
; Seriously non-idiomatic code. I'm only 20% of the way through the Joy of Clojure book... | |
(defn xmit [enc buffer] | |
"Transmit to encoder number enc, buffer is a sequence of integers." | |
(let [m (doto (net.loadbang.osc.data.Message. "/example/ring/map") (.addInteger enc))] | |
(doseq [n buffer] (.addInteger m n)) | |
(.transmit transmitter m) | |
)) | |
; There must be a better way to do this bit! | |
(def buf (map (fn [_] 5) (vec (range 64)))) | |
(xmit 1 buf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how I formatted my previous comment: