summaryrefslogtreecommitdiff
path: root/dmx/dmxcontrol.py
blob: 8013934f66e9986d95d7f2ce1310f9b459906c90 (plain)
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
110
111
112
113
114
115

# rms = float(open('/tmp/rms', 'r').read()) / 20000.
# prevrms = prevrms * 0.64 + rms * 0.4
# print prevrms

#dmx.lounge_buero_ecke 268 {u'r': 249, u'b': 0, u'g': 19}
#dmx.lounge_midwest 373 {u'r': 255, u'b': 0, u'g': 118}
#dmx.lounge_buehne_links 5 {u'r': 3, u'b': 1, u'g': 1}
#dmx.lounge_traverse 86 {u'r': 58, u'b': 12, u'g': 16}
#dmx.lounge_decke 146 {u'r': 0, u'b': 144, u'g': 2}

gamountmul = 0.0 #0.33 # 1.4
gmul = 0.7

import time
t = time.time()

if type(effects[4]) != EffectRGBFadeJump:
    effects[4] = EffectRGBFadeJump(universe[4])
    print 'x'

fadet = None
# fadet = 1398550165
fadedur = 22.
if fadet != None:
    if t < fadet:
        fc = 0.0
    elif t > fadet:
        fc = min(max(1. - (t - fadet) / fadedur, 0.0), 1.0)
        print 'fc', fc
        gmul = gmul * fc
    else:
        print 'fade t =', fadet - t

# unused
if True:
    effects[0].camount = 0.22 * gamountmul
    effects[0].cphase = 0.0
    effects[0].jumpdecayset = 0.05 #0.49 # 0.19
    effects[0].jumpdecayfall = 0.90
    effects[0].jumpv = 0.0
    effects[0].fadespeed = 0.04
else:
    effects[0].h = 0.033
    effects[0].s = 1.0
    effects[0].v = 0.8
universe[0].mult = 0.55 * gmul

if False:
    effects[1].camount = 0.1 * gamountmul
    effects[1].cphase = 0.5
    effects[1].phasejump = 0.03 # 0.084
    effects[1].jumpdecayset = 0.1
    effects[1].jumpdecayfall = 0.90
    effects[1].jumpv = 0.3
else:
    effects[1].h = 0.14
    effects[1].s = 1.0
    effects[1].v = 1.0 # 3.7
universe[1].mult = 0.55 * gmul

from math import sin, cos, pi
def hsvmap(arg, h, s, v):
    #s = 0.7 + 0.3 * cos(arg*2*pi)
    #s = 0.7 * s
    return (h, s, v)
def hsvmap1(arg, h, s, v):
    s = 0.7 + 0.3 * cos(arg*2*pi)
    return (h, 0.5 * s, 0.3 + 0.7 * v)

effects[2].camount = 0.12 * gamountmul
effects[2].fadespeed = 0.025
effects[2].cphase = 0.5
effects[2].phasejump = 0.05 # 0.075
effects[2].jumpdecayset = 0.18 # 0.19
effects[2].jumpdecayfall = 0.935 #0.955
effects[2].jumpv = 0.6 # 0.8 #1.5
effects[2].hsvmap = hsvmap
universe[2].mult = 0.3 * gmul # + prevrms

effects[3].camount = 0.10 * gamountmul
effects[3].fadespeed = 0.04
effects[3].cphase = 0.0
effects[3].phasejump = 0.09 # 12 # 0.084
effects[3].jumpdecayset = 0.38 #0.432 # 0.29 # 0.27
effects[3].jumpdecayfall = 0.925 #0.955
effects[3].jumpv = 0.6 #0.8 #4.23
effects[3].hsvmap = hsvmap
# effects[3].r_phasejump = 0.3
universe[3].mult = 0.3 * gmul # + prevrms

if True:
    effects[4].camount = 0.12 * gamountmul
    effects[4].phasejump = 0.03 # 0.22
    effects[4].cphase = 0.5
    effects[4].jumpdecayset = 0.0 # 0.2
    effects[4].jumpdecayfall = 0.95
    effects[4].jumpv = 0.2
    effects[4].hsvmap = hsvmap1
else:
    effects[4].h = 0.18
    effects[4].s = 0.90
    effects[4].v = 3.8
universe[4].mult = 0.42 * gmul

effects[4].r_phasejump += 0.0004

effects[5].fadespeed = 0.03 # 0.06

# static
for e in effects:
    e.jumpv = 0
    # e.decay = 0

# bpm = 106.