Initial commit

This commit is contained in:
Jeremy Dormitzer 2019-11-09 16:04:54 -05:00
commit a01e932c29
3 changed files with 25 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.nrepl-port
.cpcache

1
deps.edn Normal file
View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1,22 @@
(ns midi-playground.midi
(:import [javax.sound.midi MidiSystem ShortMessage Receiver Sequencer Synthesizer]))
(defn midi-message [command channel data1 data2]
{:command command
:channel channel
:data1 data1
:data2 data2})
(defn map->ShortMessage [{:keys [command channel data1 data2]}]
(ShortMessage. command channel data1 data2))
(def default-receiver (MidiSystem/getReceiver))
(defn get-device-named [name]
(MidiSystem/getMidiDevice
(first
(filter #(= name (.getName %))
(MidiSystem/getMidiDeviceInfo)))))
(defn send-midi [rcvr midi-message]
(.send rcvr (map->ShortMessage midi-message) -1))