annotate light8/Config.py @ 41:02151923be45

subediting is incorporated into rsn, and begins to work
author drewp
date Sun, 07 Jul 2002 12:18:06 +0000
parents f3d65ae17a8f
children 71489bb71528
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
1 from random import randrange
45b12307c695 Initial revision
drewp
parents:
diff changeset
2 from time import time
45b12307c695 Initial revision
drewp
parents:
diff changeset
3 from __future__ import generators,division
45b12307c695 Initial revision
drewp
parents:
diff changeset
4 from Subs import *
45b12307c695 Initial revision
drewp
parents:
diff changeset
5
45b12307c695 Initial revision
drewp
parents:
diff changeset
6
45b12307c695 Initial revision
drewp
parents:
diff changeset
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
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
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
45b12307c695 Initial revision
drewp
parents:
diff changeset
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
45b12307c695 Initial revision
drewp
parents:
diff changeset
51 }
45b12307c695 Initial revision
drewp
parents:
diff changeset
52
45b12307c695 Initial revision
drewp
parents:
diff changeset
53 from util import maxes,scaledict
45b12307c695 Initial revision
drewp
parents:
diff changeset
54 FL=100
45b12307c695 Initial revision
drewp
parents:
diff changeset
55 def fulls(chans):
45b12307c695 Initial revision
drewp
parents:
diff changeset
56 # pass a list or multiple args
45b12307c695 Initial revision
drewp
parents:
diff changeset
57 return dict([(c,FL) for c in chans])
45b12307c695 Initial revision
drewp
parents:
diff changeset
58 def levs(chans,levs):
45b12307c695 Initial revision
drewp
parents:
diff changeset
59 return dict([(c,v) for c,v in zip(chans,levs)])
45b12307c695 Initial revision
drewp
parents:
diff changeset
60
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
61 def strobe(params, slideradjuster):
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
62 patterns = {
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
63 'blue' : fulls((23,27,31,35,'b0 4 b','b2 3 b')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
64 'cyc' : {42:FL,43:FL},
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
65 'scp all' : fulls((13,16,18,19,39)),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
66 '1-5' : fulls(range(1, 6)),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
67 }
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
68 params.add_param('offtime',SliderParam(range=(0.1,0.3), res=0.001,
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
69 initial=0.11, length=100))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
70 params.add_param('ontime',SliderParam(range=(0.0,0.8), res=0.001,
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
71 length=100))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
72 params.add_param('pattern',ListParam(patterns.keys()))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
73 params.add_param('current',LabelParam('none'))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
74 params.add_param('count',SliderParam(range=(0, 10), res=1, initial=0))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
75 lastchanged = time()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
76 state = 0
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
77 blinkcounter = 0
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
78 my_pattern = None
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
79
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
80 while 1:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
81 if params['count'] and blinkcounter > params['count']:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
82 blinkcounter = 0
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
83 slideradjuster.set(0)
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
84
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
85 if params['pattern'] != None:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
86 params['current'] = params['pattern']
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
87 my_pattern = params['pattern']
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
88
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
89 if state == 0:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
90 delay = params['offtime']
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
91 else:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
92 delay = params['ontime']
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
93
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
94 if time() > (lastchanged + delay):
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
95 # ready for change
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
96 state = not state
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
97 lastchanged = time()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
98 blinkcounter += 0.5
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
99
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
100 try: # protect against keyerrors (and possibly everything else)
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
101 if state:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
102 yield patterns[my_pattern]
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
103 else:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
104 yield scaledict(patterns[my_pattern], .1)
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
105 except:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
106 yield {}
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
107
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
108 def chase(params, slideradjuster):
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
109 patterns = {
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
110 'all': ( fulls(('b01','b21')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
111 fulls(('b02','b22')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
112 fulls(('b03','b23')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
113 fulls(('b04','b24')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
114 fulls(('b05','b25')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
115 fulls(('b06','b26')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
116 ),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
117 'red':( fulls(('b0 1 r','b2 2 r')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
118 fulls(('b0 5 r','b2 6 r'))),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
119 'randcol':([fulls((x,)) for x
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
120 in ("b21 b23 b25 b03 b06 b24 b22 "+
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
121 "b24 b03 b23 b01 b04 b05 b22 "+
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
122 "b02 b02 b26 b21 b06 b25 b26 "+
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
123 "b01 b04 b05").split()]),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
124 'ctrpong':[fulls((x,)) for x in (
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
125 "b11 b12 b13 b14 b15 b16 b15 b14 b13 b12".split())],
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
126 'l-r': ( fulls(('b01','b11','b21')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
127 fulls(('b02','b12','b22')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
128 fulls(('b03','b13','b23')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
129 fulls(('b04','b14','b24')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
130 fulls(('b05','b15','b25')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
131 fulls(('b06','b16','b26'))),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
132 'flutter':(
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
133 fulls(('main 6','b15')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
134 fulls(('main 1','b12')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
135 fulls(('main 2','b11')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
136 fulls(('b12', 'main 3')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
137 fulls(('b15', 'main 9')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
138 fulls(('b16', 'main 4')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
139 fulls(('main 4','b13')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
140 fulls(('main 3','b11')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
141 fulls(('main 8','b15')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
142 fulls(('main 9','b12')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
143 fulls(('b11', 'main 1')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
144 fulls(('main 5','b15')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
145 fulls(('b13', 'main 6')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
146 fulls(('b14', 'main 2')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
147 fulls(('main 7','b16')),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
148 ),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
149 'randstage':([fulls((x,)) for x
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
150 in ("""
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
151 b22 27 b04 26 b26 21 28 b25 23 b02 31 b05 32 34 b03 24 b01 25
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
152 b23 29 22 35 30 b24 33 36 """).split()]),
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
153
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
154 }
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
155
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
156 params.add_param('steptime',SliderParam(range=(.1,3),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
157 initial=.4,length=150))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
158 params.add_param('overlap',SliderParam(range=(0,8),initial=1.5))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
159 params.add_param('pattern',ListParam(options=patterns.keys(),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
160 initial='all'))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
161 params.add_param('current',LabelParam('none'))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
162
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
163 steps=()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
164
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
165 def fn(x):
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
166 warm=.1
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
167 # the _/\_ wave for each step. input 0..1, output 0..1
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
168 if x<0 or x>1:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
169 return warm
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
170 if x<.5:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
171 return warm+(1.0-warm)*(x*2)
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
172 else:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
173 return warm+(1.0-warm)*(2-(x*2))
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
174
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
175 def stepbrightness(stepnum,numsteps,overlap,pos):
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
176 startpos = stepnum/numsteps
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
177 p=( (pos-startpos)*(1.0+overlap) )%1.0
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
178 ret=fn( p )
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
179 #print "step %(stepnum)i/%(numsteps)i pos %(pos)f ,p=%(p)f is %(ret)f" % locals()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
180 return ret
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
181
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
182 queued=[] # list of steps, each step is starttime,stepcue
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
183 lastaddtime=time()-100
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
184 currentpattern='all'
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
185 steps=patterns[currentpattern]
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
186 stepsiter=iter(())
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
187 while 1:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
188 params['current'] = params['pattern']
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
189
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
190 # changed pattern?
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
191 if params['pattern']!=currentpattern and params['pattern'] in patterns:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
192 currentpattern=params['pattern']
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
193 steps=patterns[currentpattern]
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
194 stepsiter=iter(steps) # restart iterator
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
195
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
196 # time to put a new step in the queue?
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
197 if time()>lastaddtime+params['steptime']:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
198 lastaddtime=time()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
199 try:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
200 nextstep = stepsiter.next()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
201 except StopIteration:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
202 stepsiter=iter(steps)
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
203 nextstep=stepsiter.next()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
204 queued.append( (time(),nextstep) )
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
205
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
206 # loop over queue, putting still-active (scaled) steps in shiftedsteps
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
207 keepers=[]
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
208 shiftedsteps=[]
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
209 for started,s in queued:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
210 steptime = time()-started
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
211 finish = started+(1.0+params['overlap'])*params['steptime']
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
212 pos = (time()-started)/(finish-started)
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
213 if time()<finish:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
214 keepers.append((started,s))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
215 shiftedsteps.append( scaledict(s,fn(pos)) )
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
216
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
217 if len(keepers)>30:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
218 print "too many steps in chase - dumping some"
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
219 queued=keepers[:20]
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
220 else:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
221 queued=keepers
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
222
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
223
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
224 # pos=(time()%params['steptime'])/params['steptime'] # 0..1 animated variable
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
225 # shiftedsteps=[]
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
226 # for i,s in zip(range(0,len(steps)),steps):
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
227 # shiftedsteps.append( scaledict(s, stepbrightness(i,len(steps),params['overlap'],pos)) )
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
228 yield maxes(shiftedsteps)
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
229
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
230
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
231 def randomdimmer(params, slideradjuster):
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
232 params.add_param('magic', CheckboxParam())
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
233 params.add_param('cheese', TextParam())
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
234 params.add_param('stuff', ListParam(('a', 'b', 'c')))
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
235
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
236 curtime = time()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
237 dim = 1
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
238 while 4:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
239 if time() - curtime > 1:
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
240 dim = randrange(1, 64)
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
241 curtime = time()
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
242 yield {dim : 100, 20 : params.get_param_value('magic')}
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
243
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
244
4
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
245 subs = {
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
246 'over pit sm' : levs(range(1, 13),(100,0,0,91,77,79,86,55,92,77,59,0)),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
247 'over pit lg' : fulls(range(1, 13)),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
248 ('house', 'black') : { 68:100 },
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
249 ('cyc', 'lightBlue'):{42:FL,43:FL},
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
250 ('scp hot ctr', 'yellow'):{18:FL},
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
251 ('scp more', '#AAAA00'):{18:FL,14:FL},
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
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
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
257 'sidepost':fulls((45,46)),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
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
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
261 ('strobe', 'grey'):strobe,
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
262
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
263 # 'midstage' : dict([(r, 100) for r in range(11, 21)]),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
264 # 'backstage' : dict([(r, 100) for r in range(21, 31)]),
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
265 # 'frontchase' : mr_effect,
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
266 'chase' : chase,
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
267 'chase2' : chase,
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
268 # 'random' : randomdimmer,
f974a462133f added light8 from the posted light8-1.0.tgz
drewp
parents: 0
diff changeset
269 }
0
45b12307c695 Initial revision
drewp
parents:
diff changeset
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()