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