blc2 - Python library and frontend for running theatrical lighting and SFX. Written for the English 2041F fall 2019 theatre production of "The Cenci".

git clone https://benconnors.ca/git-repos/blc2

Log | Files | Refs

commit 1884a5197fbdf98bdaebafe2b25e3a7181967e30
parent 1f037f48e5badab2b758c4b9bd0541c5ccda7b3f
Author: Ben Connors <benconnors@outlook.com>
Date:   Fri,  8 Nov 2019 17:08:02 -0500

Move to OLA rendering; bugfix

- Chaser.advance not using proper audio ID
- Add OLA renderer as main one

Diffstat:
Mblc2/functions/chaser.py | 7+++----
Minterface/__main__.py | 4++--
Ainterface/ola.py | 22++++++++++++++++++++++
3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/blc2/functions/chaser.py b/blc2/functions/chaser.py @@ -213,7 +213,7 @@ class Chaser(Function): raise ValueError("Chaser is finished") if data.steps: data.steps[-1].end_time = t - data.steps[-1].start_time - data.steps.append(self.steps[n]._get_data(t, n)) + data.steps.append(self.steps[n]._get_data(t, data.audio_id)) data.audio_id += 1 return data @@ -230,9 +230,8 @@ class Chaser(Function): if not self._steps: return (), (), data elif not data.steps: - ## Cross your fingers this is unnecessary... - # if data.audio_id != 0: - # raise ValueError("Audio ID must be zero") + if data.audio_id != 0: + raise ValueError("Audio ID must be zero") n = self.first_step sd = self.steps[n]._get_data(0, 0) #pylint: disable=protected-access data.audio_id += 1 diff --git a/interface/__main__.py b/interface/__main__.py @@ -3,9 +3,9 @@ import os import sys from .interface import Interface -from .dummy import DummyOutput +from .ola import OLAOutput if len(sys.argv) > 2: raise ValueError("Usage: %s [workspace file]" % sys.argv[0]) -Interface(sys.argv[1] if len(sys.argv) == 2 else None, DummyOutput()).main() +Interface(sys.argv[1] if len(sys.argv) == 2 else None, OLAOutput()).main() diff --git a/interface/ola.py b/interface/ola.py @@ -0,0 +1,22 @@ +import array + +from ola.OlaClient import OlaClient + +class OLAOutput: + def set_values(self, values): + send = set() + for c, v in values.items(): + univ, addr = c.address + if univ not in self.universes: + self.universes[univ] = array.array('B', (0 for i in range(512))) + uni = self.universes[univ] + if uni[addr] != v: + uni[addr] = v + send.add(univ) + for univ in send: + self.client.SendDmx(univ, self.universes[univ]) + + def __init__(self): + self.client = OlaClient() + + self.universes = {1: array.array('B', (0 for i in range(512)))}