-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconfig.plisp
More file actions
56 lines (48 loc) · 2.14 KB
/
config.plisp
File metadata and controls
56 lines (48 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
(do
;; attach should generally be LOAD not exec
;; because it's more convenient to attach inline
;;(attach-message midi (load-file scripts/ot-beat-repeat))
;; this doesn't actually do anything... unless you plug/unplug stuff
(attach-message midi-add-device (` print-table (env)))
;; must happen AFTER midi init
;; lens should be EXEC not load
;; because it will be parsed w/ e.g. : for keys
;; TODO: attach by NAME which is more stable
;; TODO: do all this in CONFIG. this whole file is really CONFIG
;;(add-lens 2 (exec-file midi-lens/octatrack) (` 1 2 3 4 5 6 7 8 9))
(add-lens 2 (exec-file midi-lens/kaoss-pad-3) (` 1 2 3 4 5 6 7 8 9))
;; CC 16 on channel 16 -> crossfader
(attach-message midi (` ?
(&
(= (ch) 16)
(= (type) cc)
(= (@ (raw) 2) 16))
(tx audio-crossfader (: v (@ (raw) 3)))
))
;;(attach-message btn (` tx fetch-audio-params))
;;(attach-message btn (` ?
;; (& (= (n) 2) (= (v) 1))
;; (tx fetch-audio-params)))
;; Encoder 3 will select a program
;; Probably not in any sort of useful way, though, lol
;; Global define, so it doesn't get thrown in the garbage along with the event environment
;; (And no, that's not a great design - there's an abstraction missing here for sure!)
;; Sticking with 0-indexing here just because that makes modulo math easier
(gdef program-index 0)
(gdef number-words (` one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen))
(attach-message enc (` ?
(= (n) 3)
(do
(print-expr (smush [ (program-index) ] + [ (v) ] =))
;; This is where a persistent closure for program-index would be great
(gdef program-index
(% (+ (program-index) (v)) 17)
)
(print-expr (smush (program-index) ,a.k.a. (@ (number-words) (+ (program-index) 1))))
(tx program
(: n (+ (program-index) 1)) ;; 1 just seemed more reasonable than 0 lol
)
)
))
(print-expr (program-index))
)