-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.clj
144 lines (106 loc) · 3.06 KB
/
config.clj
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
;; System configuration
(def dome-radius
"Inside radius of the geodesic dome frame in meters. Approximately 12.1 feet."
3.688)
(def barrel-radius
"Outside radius of the barrel lantern in meters. Approximately 4 inches."
0.099)
(def pixel-strip
"Strip definition with pixel count and inter-pixel spacing."
{:spacing 0.02 ; 2 cm
:pixels 240})
(defconfig :layout
(layout/join
#_
(layout/group :lantern
(layout/translate
[0 0 (- dome-radius 0.1)]
(layout/barrel barrel-radius 0.068 2 pixel-strip)))
(layout/group :dome
(layout/geodesic-grid
dome-radius
:pixel-spacing (:spacing pixel-strip)
:strut-pixels
[50 62 64 64]
:strip-struts
[[0 6 15 8]
[2 14 22 16]
[4 18 20 23]
[3 10 12 19]
[1 5 7 11]]))))
(defconfig :event-handler
(-> state/update-mode
(handler/mode-selector)
(handler/toggle-autocycle
:code [:R :R :R :R :start])
(handler/autocycle-modes
(comp #{:button/press :button/repeat} :type)
:period 60)
(handler/control-code :konami
:code [:up :up :down :down :left :right :left :right :B :A :start]
:mode :strobe)
(handler/control-code :strobe-shortcut
:code [:X :X :X :X :X :Y :start]
:mode :strobe)
(handler/control-code :lantern
:code [:L :R :L :R :X :Y :start]
:mode :lantern)
(handler/control-code :bombs
:code [:A :A :A :A :X :Y :start]
:mode :bombs)
(handler/buffer-keys 20)
#_(handler/log-events (comp #{:audio/beat :button/press} :type))
(handler/system-reset)))
(defconfig :web-options
{:port 8080
:min-threads 3
:max-threads 10
:max-queued 25})
;; Inputs
(definput :timer
timer/timer
(async/chan (async/dropping-buffer 3))
33)
(definput :audio
audio/audio-input
(async/chan (async/sliding-buffer 10))
100)
(definput :gamepad
gamepad/snes
(async/chan (async/dropping-buffer 10)))
;; Modes
(defmode :ant 6.0 7)
(def beachball-colors
[color/white color/red color/white color/yellow color/white color/blue])
(def american-colors
[color/blue color/blue color/blue color/white color/red color/white color/red color/white color/red color/white])
(def rainbow-colors
(map color/rainbow (range 0 1 0.1)))
(def fire-colors
(let [colors [(color/rgb 156/256 42/256 34/256) (color/rgb 226/256 87/256 34/256) (color/rgb 1.0 73/256 73/256) (color/rgb 1.0 189/256 91/256) (color/rgb 253/256 207/256 88/256)]]
(repeatedly 12 #(rand-nth colors))))
(defmode :beachball
[beachball-colors american-colors rainbow-colors fire-colors])
(defmode :bombs)
(defmode :dart)
(defmode :flicker 5 240)
(defmode :lantern 0.5)
(defmode :pulse (color/rgb 1 0 0))
(defmode :rainbow)
(defmode :ring)
(defmode :strip-eq)
(defmode :strobe
[(color/rgb 1 0 0)
(color/rgb 0 1 0)
(color/rgb 0 0 1)])
(defmode :tunes 27)
(register-mode :blue
(playasophy.wonderdome.mode.BlueMode.))
(defconfig :playlist
[:beachball
:dart
:tunes
:flicker
:rainbow
:strip-eq
:ant])