Mercurial > code > home > repos > light9
annotate light8/ExternalInput.py @ 167:79bc84310e80
changes from tonight's rehearsal:
changes from tonight's rehearsal:
- CueFader is closer to actually running the show, computes DMX levels
to send.
- KeyboardComposer is not a dummy. Use DMXDUMMY=1 to disable it.
- Submaster: subs can now be "temporary" -- i.e. they shouldn't be saved
or loaded. to save a temporary sub, make a copy of it with a proper name
since the computed name will be ugly.
Also, get_normalized_copy() and crossfade() methods added.
linear_fade helper (shouldn't be in Submaster, probably) added too.
- dmxchanedit: longer labels
- cuelist1 now has some bogus data in it and some crap removed
- dmxclient: now listens to the $DMXHOST and $DMXDUMMY env variables.
- patchdata: now up to date with this year's show
- danshow subs song{01..19}: removed. maybe we'll re-add them in an
archive directory.
author | dmcc |
---|---|
date | Tue, 08 Jul 2003 16:19:55 +0000 |
parents | d6c48d2d3bd6 |
children |
rev | line source |
---|---|
90
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
1 import thread, SocketServer, socket |
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
2 |
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
3 |
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
4 currentlevels = [0,0,0,0] |
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
5 |
0 | 6 |
7 class NetSliderHandler(SocketServer.StreamRequestHandler): | |
8 def handle(self): | |
9 data = self.rfile.readline(1000) | |
93
d6c48d2d3bd6
shrunk the useful range of the slider so there won't be any noise at the ends
drewp
parents:
90
diff
changeset
|
10 currentlevels[:] = [round(self.bounds(float(x)/255),3) for x in list(data.split())] |
d6c48d2d3bd6
shrunk the useful range of the slider so there won't be any noise at the ends
drewp
parents:
90
diff
changeset
|
11 def bounds(self,x): |
d6c48d2d3bd6
shrunk the useful range of the slider so there won't be any noise at the ends
drewp
parents:
90
diff
changeset
|
12 # the last .1 both ways shall not do anything |
d6c48d2d3bd6
shrunk the useful range of the slider so there won't be any noise at the ends
drewp
parents:
90
diff
changeset
|
13 x=x*1.1-.05 |
d6c48d2d3bd6
shrunk the useful range of the slider so there won't be any noise at the ends
drewp
parents:
90
diff
changeset
|
14 x=min(1,max(0,x)) |
d6c48d2d3bd6
shrunk the useful range of the slider so there won't be any noise at the ends
drewp
parents:
90
diff
changeset
|
15 return x |
0 | 16 |
90
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
17 def start_server(levelstorage=0): |
0 | 18 server = SocketServer.TCPServer( |
19 ('', socket.getservbyname('rlslider', 'tcp')), | |
20 NetSliderHandler) | |
21 server.serve_forever() | |
22 | |
23 class ExternalSliders: | |
24 def __init__(self, level_storage=[]): | |
25 self.level_storage = level_storage | |
26 self.spawn_server() | |
27 def test(self): | |
28 'Store fake inputs to test operations' | |
29 pass | |
30 def spawn_server(self): | |
31 pass | |
32 # thread.start_new_thread(start_server, (self.update)) | |
33 def update(self, *args): | |
34 self.level_storage[:] = args | |
35 def get_levels(self): | |
90
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
36 return currentlevels |
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
37 # import math, time |
d34a4956417a
rsn has a separate thread that receives rlslider connections from a potserver.py process,
drewp
parents:
78
diff
changeset
|
38 # return [max(0, math.sin(time.time() + i)) for i in range(4)] # bogus |
0 | 39 |
40 # return self.level_storage |