Mercurial > code > home > repos > light9
annotate light8/ConfigDummy.py @ 40:f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
these are mostly replaced with guys&dolls material (effects were not touched)
dance show went to a new dir called Configs/
author | drewp |
---|---|
date | Sun, 07 Jul 2002 12:17:30 +0000 |
parents | f974a462133f |
children | 71489bb71528 |
rev | line source |
---|---|
0 | 1 from random import randrange |
2 from time import time | |
3 from __future__ import generators,division | |
4 from Subs import * | |
5 | |
6 | |
7 patch = { | |
40
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
8 |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
9 'side l' : 45, # posts |
4 | 10 'side r' : 46, |
40
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
11 |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
12 ('patio1','main 1',) : 1, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
13 ('main 2',) : 2, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
14 ('main 3',) : 3, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
15 ('main 4',) : 4, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
16 ('main 5',) : 5, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
17 ('god','main 6') : 6, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
18 ('main 7',) : 7, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
19 ('main 8',) : 8, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
20 ('main 9',) : 9, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
21 ('main 10',) : 10, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
22 ('main 11',):11, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
23 ('patio2','main 12',):12, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
24 |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
25 'cycleft' : 43, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
26 'cycright' : 44, # ? might be a different circuit |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
27 |
0 | 28 'house':68, |
40
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
29 ('desk1' ,'b11'):54, # left bank over house |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
30 ('marry1' ,'b12'):53, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
31 ('b13',):52, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
32 ('hotbox1' ,'b14'):51, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
33 ('edge' ,'b15'):50, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
34 ('phone','b16'):49, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
35 ('cuba1' ,'b21'):55, # mid bank |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
36 ('b22',):56, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
37 ('b23',):57, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
38 ('b24'):58, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
39 ('b25'):59, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
40 ('desk2' ,'b26'):60, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
41 ('rock','b31'):61, # right bank |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
42 ('b32',):62, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
43 ('hotbox2' ,'b33'):63, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
44 ('b34',):64, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
45 ('marry2' ,'b35'):65, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
46 ('cuba2' ,'b36'):66, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
47 'oran1':21, 'oran2':25, 'oran3':29, 'oran4':33, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
48 'gree1':22, 'gree2':26, 'gree3':30, 'gree4':34, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
49 'blue1':23, 'blue2':27, 'blue3':31, 'blue4':35, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
50 'red1' :24, 'red2' :28, 'red3' :32, 'red4' :36, |
0 | 51 } |
52 | |
53 from util import maxes,scaledict | |
54 FL=100 | |
55 def fulls(chans): | |
56 # pass a list or multiple args | |
57 return dict([(c,FL) for c in chans]) | |
58 def levs(chans,levs): | |
59 return dict([(c,v) for c,v in zip(chans,levs)]) | |
60 | |
4 | 61 def strobe(params, slideradjuster): |
62 patterns = { | |
63 'blue' : fulls((23,27,31,35,'b0 4 b','b2 3 b')), | |
64 'cyc' : {42:FL,43:FL}, | |
65 'scp all' : fulls((13,16,18,19,39)), | |
40
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
66 '1-5' : fulls(range(1, 6)), |
4 | 67 } |
68 params.add_param('offtime',SliderParam(range=(0.1,0.3), res=0.001, | |
69 initial=0.11, length=100)) | |
70 params.add_param('ontime',SliderParam(range=(0.0,0.8), res=0.001, | |
71 length=100)) | |
72 params.add_param('pattern',ListParam(patterns.keys())) | |
73 params.add_param('current',LabelParam('none')) | |
74 params.add_param('count',SliderParam(range=(0, 10), res=1, initial=0)) | |
75 lastchanged = time() | |
76 state = 0 | |
77 blinkcounter = 0 | |
78 my_pattern = None | |
0 | 79 |
4 | 80 while 1: |
81 if params['count'] and blinkcounter > params['count']: | |
82 blinkcounter = 0 | |
83 slideradjuster.set(0) | |
0 | 84 |
4 | 85 if params['pattern'] != None: |
86 params['current'] = params['pattern'] | |
87 my_pattern = params['pattern'] | |
0 | 88 |
4 | 89 if state == 0: |
90 delay = params['offtime'] | |
91 else: | |
92 delay = params['ontime'] | |
93 | |
94 if time() > (lastchanged + delay): | |
95 # ready for change | |
96 state = not state | |
97 lastchanged = time() | |
98 blinkcounter += 0.5 | |
0 | 99 |
4 | 100 try: # protect against keyerrors (and possibly everything else) |
101 if state: | |
102 yield patterns[my_pattern] | |
103 else: | |
104 yield scaledict(patterns[my_pattern], .1) | |
105 except: | |
106 yield {} | |
0 | 107 |
4 | 108 def chase(params, slideradjuster): |
109 patterns = { | |
110 'all': ( fulls(('b01','b21')), | |
111 fulls(('b02','b22')), | |
112 fulls(('b03','b23')), | |
113 fulls(('b04','b24')), | |
114 fulls(('b05','b25')), | |
115 fulls(('b06','b26')), | |
116 ), | |
117 'red':( fulls(('b0 1 r','b2 2 r')), | |
118 fulls(('b0 5 r','b2 6 r'))), | |
119 'randcol':([fulls((x,)) for x | |
120 in ("b21 b23 b25 b03 b06 b24 b22 "+ | |
121 "b24 b03 b23 b01 b04 b05 b22 "+ | |
122 "b02 b02 b26 b21 b06 b25 b26 "+ | |
123 "b01 b04 b05").split()]), | |
124 'ctrpong':[fulls((x,)) for x in ( | |
125 "b11 b12 b13 b14 b15 b16 b15 b14 b13 b12".split())], | |
126 'l-r': ( fulls(('b01','b11','b21')), | |
127 fulls(('b02','b12','b22')), | |
128 fulls(('b03','b13','b23')), | |
129 fulls(('b04','b14','b24')), | |
130 fulls(('b05','b15','b25')), | |
131 fulls(('b06','b16','b26'))), | |
132 'flutter':( | |
133 fulls(('main 6','b15')), | |
134 fulls(('main 1','b12')), | |
135 fulls(('main 2','b11')), | |
136 fulls(('b12', 'main 3')), | |
137 fulls(('b15', 'main 9')), | |
138 fulls(('b16', 'main 4')), | |
139 fulls(('main 4','b13')), | |
140 fulls(('main 3','b11')), | |
141 fulls(('main 8','b15')), | |
142 fulls(('main 9','b12')), | |
143 fulls(('b11', 'main 1')), | |
144 fulls(('main 5','b15')), | |
145 fulls(('b13', 'main 6')), | |
146 fulls(('b14', 'main 2')), | |
147 fulls(('main 7','b16')), | |
148 ), | |
149 'randstage':([fulls((x,)) for x | |
150 in (""" | |
151 b22 27 b04 26 b26 21 28 b25 23 b02 31 b05 32 34 b03 24 b01 25 | |
152 b23 29 22 35 30 b24 33 36 """).split()]), | |
153 | |
154 } | |
155 | |
156 params.add_param('steptime',SliderParam(range=(.1,3), | |
157 initial=.4,length=150)) | |
158 params.add_param('overlap',SliderParam(range=(0,8),initial=1.5)) | |
159 params.add_param('pattern',ListParam(options=patterns.keys(), | |
160 initial='all')) | |
161 params.add_param('current',LabelParam('none')) | |
162 | |
163 steps=() | |
164 | |
165 def fn(x): | |
166 warm=.1 | |
167 # the _/\_ wave for each step. input 0..1, output 0..1 | |
168 if x<0 or x>1: | |
169 return warm | |
170 if x<.5: | |
171 return warm+(1.0-warm)*(x*2) | |
172 else: | |
173 return warm+(1.0-warm)*(2-(x*2)) | |
0 | 174 |
4 | 175 def stepbrightness(stepnum,numsteps,overlap,pos): |
176 startpos = stepnum/numsteps | |
177 p=( (pos-startpos)*(1.0+overlap) )%1.0 | |
178 ret=fn( p ) | |
179 #print "step %(stepnum)i/%(numsteps)i pos %(pos)f ,p=%(p)f is %(ret)f" % locals() | |
180 return ret | |
181 | |
182 queued=[] # list of steps, each step is starttime,stepcue | |
183 lastaddtime=time()-100 | |
184 currentpattern='all' | |
185 steps=patterns[currentpattern] | |
186 stepsiter=iter(()) | |
187 while 1: | |
188 params['current'] = params['pattern'] | |
189 | |
190 # changed pattern? | |
191 if params['pattern']!=currentpattern and params['pattern'] in patterns: | |
192 currentpattern=params['pattern'] | |
193 steps=patterns[currentpattern] | |
194 stepsiter=iter(steps) # restart iterator | |
195 | |
196 # time to put a new step in the queue? | |
197 if time()>lastaddtime+params['steptime']: | |
198 lastaddtime=time() | |
199 try: | |
200 nextstep = stepsiter.next() | |
201 except StopIteration: | |
202 stepsiter=iter(steps) | |
203 nextstep=stepsiter.next() | |
204 queued.append( (time(),nextstep) ) | |
205 | |
206 # loop over queue, putting still-active (scaled) steps in shiftedsteps | |
207 keepers=[] | |
208 shiftedsteps=[] | |
209 for started,s in queued: | |
210 steptime = time()-started | |
211 finish = started+(1.0+params['overlap'])*params['steptime'] | |
212 pos = (time()-started)/(finish-started) | |
213 if time()<finish: | |
214 keepers.append((started,s)) | |
215 shiftedsteps.append( scaledict(s,fn(pos)) ) | |
216 | |
217 if len(keepers)>30: | |
218 print "too many steps in chase - dumping some" | |
219 queued=keepers[:20] | |
220 else: | |
221 queued=keepers | |
222 | |
223 | |
224 # pos=(time()%params['steptime'])/params['steptime'] # 0..1 animated variable | |
225 # shiftedsteps=[] | |
226 # for i,s in zip(range(0,len(steps)),steps): | |
227 # shiftedsteps.append( scaledict(s, stepbrightness(i,len(steps),params['overlap'],pos)) ) | |
228 yield maxes(shiftedsteps) | |
229 | |
230 | |
231 def randomdimmer(params, slideradjuster): | |
232 params.add_param('magic', CheckboxParam()) | |
233 params.add_param('cheese', TextParam()) | |
234 params.add_param('stuff', ListParam(('a', 'b', 'c'))) | |
235 | |
236 curtime = time() | |
237 dim = 1 | |
238 while 4: | |
239 if time() - curtime > 1: | |
240 dim = randrange(1, 64) | |
241 curtime = time() | |
242 yield {dim : 100, 20 : params.get_param_value('magic')} | |
0 | 243 |
244 | |
4 | 245 subs = { |
246 'over pit sm' : levs(range(1, 13),(100,0,0,91,77,79,86,55,92,77,59,0)), | |
247 'over pit lg' : fulls(range(1, 13)), | |
248 ('house', 'black') : { 68:100 }, | |
249 ('cyc', 'lightBlue'):{42:FL,43:FL}, | |
250 ('scp hot ctr', 'yellow'):{18:FL}, | |
251 ('scp more', '#AAAA00'):{18:FL,14:FL}, | |
252 ('scp all', '#AAAA00'):fulls((13,16,18,19,39)), | |
40
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
253 ('col oran', '#EEEE99'):fulls('oran1 oran2 oran3 oran4'.split()), |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
254 ('col red', 'red'):fulls('red1 red2 red3 red4'.split()), |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
255 ('col blue', 'blue'):fulls('blue1 blue2 blue3 blue4'.split()), |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
256 ('col gree', 'green'):fulls('gree1 gree2 gree3 gree4'.split()), |
4 | 257 'sidepost':fulls((45,46)), |
258 'edges':fulls((55,60,49,54,61,66)), | |
40
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
259 'bank1ctr':fulls(('b22','b23','b24','b25')), |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
260 'god' : fulls((6,)), |
4 | 261 ('strobe', 'grey'):strobe, |
262 | |
263 # 'midstage' : dict([(r, 100) for r in range(11, 21)]), | |
264 # 'backstage' : dict([(r, 100) for r in range(21, 31)]), | |
265 # 'frontchase' : mr_effect, | |
266 'chase' : chase, | |
267 'chase2' : chase, | |
268 # 'random' : randomdimmer, | |
269 } | |
270 | |
40
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
271 subs["ba outrs"] = fulls("b11 b12 b13 b14 b15 b16 b31 b32 b33 b34 b35 b36".split()) |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
272 subs["ba some"] = {'b12':40,'b13':FL,'b14':FL,'b15':40, |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
273 'b32':40,'b33':FL,'b34':FL,'b35':40,} |
f3d65ae17a8f
these are mostly replaced with guys&dolls material (effects were not touched)
drewp
parents:
4
diff
changeset
|
274 subs['*curtain'] = subs['ba some'].copy() |