Files
@ 79bc84310e80
Branch filter:
Location: light9/light8/io.py - annotation
79bc84310e80
2.9 KiB
text/x-python
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.
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.
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 | 0459cecf8145 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 45b12307c695 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 ae2ed47a5321 ae2ed47a5321 ae2ed47a5321 ae2ed47a5321 ae2ed47a5321 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 032b2b67bc10 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 609cb9ae53b1 70bd142d72c2 70bd142d72c2 70bd142d72c2 609cb9ae53b1 609cb9ae53b1 70bd142d72c2 609cb9ae53b1 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 ae2ed47a5321 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 0459cecf8145 0459cecf8145 0459cecf8145 70bd142d72c2 70bd142d72c2 70bd142d72c2 ae2ed47a5321 ae2ed47a5321 ae2ed47a5321 ae2ed47a5321 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 70bd142d72c2 |
class BaseIO:
def __init__(self):
self.dummy=1
self.__name__ = 'BaseIO'
# please override and set __name__ to your class name
def golive(self):
"""call this if you want to promote the dummy object becomes a live object"""
print "IO: %s is going live" % self.__name__
self.dummy=0
# you'd override with additional startup stuff here,
# perhaps even loading a module and saving it to a class
# attr so the subclass-specific functions can use it
def godummy(self):
print "IO: %s is going dummy" % self.__name__
self.dummy=1
# you might override this to close ports, etc
def isdummy(self):
return self.dummy
def __repr__(self):
if self.dummy:
return "<dummy %s instance>" % self.__name__
else:
return "<live %s instance>" % self.__name__
# the derived class will have more methods to do whatever it does,
# and they should return dummy values if self.dummy==1.
class ParportDMX(BaseIO):
def __init__(self, dimmers=68):
BaseIO.__init__(self)
self.__name__='ParportDMX'
self.dimmers = dimmers
def golive(self):
BaseIO.golive(self)
import parport
self.parport = parport
self.parport.getparport()
def sendlevels(self, levels):
if self.dummy:
return
levels = list(levels) + [0]
# if levels[14] > 0: levels[14] = 100 # non-dim
self.parport.outstart()
for p in range(1, self.dimmers + 2):
self.parport.outbyte(levels[p-1]*255 / 100)
class SerialPots(BaseIO):
"""
this is a dummy object (that returns zeros forever) until you call startup()
which makes it bind to the port, etc
"""
def __init__(self):
# no init here- call getport() to actually initialize
self.dummy=1
self.__name__='SerialPots' # i thought this was automatic!
def golive(self):
"""
ls -l /dev/i2c-0
crw-rw-rw- 1 root root 89, 0 Jul 11 12:27 /dev/i2c-0
"""
import serport
self.serport = serport
self.f = open("/dev/i2c-0","rw")
# this is for a chip with A0,A1,A2 lines all low:
port = 72
from fcntl import *
I2C_SLAVE = 0x0703 #/* Change slave address */
ioctl(self.f,I2C_SLAVE,port)
self.dummy=0
def godummy(self):
BaseIO.godummy(self)
self.f.close()
def getlevels(self):
if self.dummy:
return (0,0,0,0)
else:
return self.serport.read_all_adc(self.f.fileno())
if __name__=='__main__':
""" tester program that just dumps levels for a while """
from time import sleep
from serport import *
i=0
while i<100:
sleep(.033)
i=i+1
print read_all_adc(f.fileno())
|