Changeset - 3e89b00be550
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 10 years ago 2015-06-14 20:33:19
drewp@bigasterisk.com
more leds in sub workaround
Ignore-this: d2cb74ad15845be6c917716ec33eeb0d
1 file changed with 7 insertions and 7 deletions:
0 comments (0 inline, 0 general)
light9/effecteval/effectloop.py
Show inline comments
 
@@ -98,25 +98,24 @@ class EffectLoop(object):
 
        elapsed = time.time() - t1
 
        reactor.callLater(max(0, self.period - elapsed), self.updateTimeFromMusic)
 

	
 
    def estimatedSongTime(self):
 
        now = time.time()
 
        t = self.songTime
 
        if self.currentPlaying:
 
            t += max(0, now - self.songTimeFetch)
 
        return t
 

	
 
    @inlineCallbacks
 
    def sendLevels(self):
 
        print ''
 
        t1 = time.time()
 
        log.debug("time since last call: %.1f ms" % (1000 * (t1 - self.lastSendLevelsTime)))
 
        self.lastSendLevelsTime = t1
 
        try:
 
            with self.stats.sendLevels.time():
 
                if self.currentSong is not None:
 
                    log.debug('allEffectOutputs')
 
                    with self.stats.evals.time():
 
                        outputs = self.allEffectOutputs(self.estimatedSongTime())
 
                    log.debug('combineOutputs')
 
                    combined = self.combineOutputs(outputs)
 
                    self.logLevels(t1, combined)
 
@@ -226,34 +225,35 @@ class LedLoop(EffectLoop):
 
    def initOutput(self):
 
        self.board = ControlBoard()
 
        self.lastSent = {} # what's in arduino's memory
 
        
 
    def combineOutputs(self, outputs):
 
        combined = {'L': Z, 'R': Z,
 
                    'blacklight0': 0, 'blacklight1': 0,
 
                    'W': numpy.zeros((1, 3), dtype=numpy.float16)}
 
        
 
        for out in outputs:
 
            log.debug('combine output %r', out)
 

	
 

	
 
            # workaround- somehow these subs that drive fx aren't
 
            # sending their fx, so we react to the sub
 
            # sending their fx during playback (KC only), so we react
 
            # to the sub itself
 
            if isinstance(out, Submaster.Submaster) and '*' in out.name:
 
                level = float(out.name.split('*')[1])
 
                n = out.name.split('*')[0]
 
                if n == 'widered': out = Effects.Strip.solid('W', (1,0,0)) * level
 
                if n == 'widegreen': out = Effects.Strip.solid('W', (0,1,0)) * level
 
                if n == 'wideblue': out = Effects.Strip.solid('W', (0,0,1)) * level
 
                if n == 'whiteled': out = Effects.Strip.solid('W', (1,.5,.5)) * level
 
                if n == 'widered': out = Effects.Strip.solid('LRW', (1,0,0)) * level
 
                if n == 'widegreen': out = Effects.Strip.solid('LRW', (0,1,0)) * level
 
                if n == 'wideblue': out = Effects.Strip.solid('LRW', (0,0,1)) * level
 
                if n == 'whiteled': out = Effects.Strip.solid('LRW', (1,.7,.7)) * level
 
                if n == 'blacklight': out = Effects.Blacklight(level) # missing blues!
 
 
 
            if isinstance(out, Effects.Blacklight):
 
                # no picking yet
 
                #key = 'blacklight%s' % out.which
 
                for key in ['blacklight0', 'blacklight1']:
 
                    combined[key] = max(combined[key], out)
 
            elif isinstance(out, Effects.Strip):
 
                pixels = numpy.array(out.pixels, dtype=numpy.float16)
 
                for w in out.which:
 
                    combined[w] = numpy.maximum(
 
                        combined[w], pixels[:1,:] if w == 'W' else pixels)
 
                
0 comments (0 inline, 0 general)