diff --git a/light9/effect/sequencer/eval_faders.py b/light9/effect/sequencer/eval_faders.py --- a/light9/effect/sequencer/eval_faders.py +++ b/light9/effect/sequencer/eval_faders.py @@ -38,23 +38,13 @@ class FaderEval: self.graph = graph self.faders: List[Fader] = [] - # self.simpleOutputs = SimpleOutputs(self.graph) log.info('fader adds handler') self.graph.addHandler(self._compile) self.lastLoopSucceeded = False - # self.codeWatcher = CodeWatcher(onChange=self.onCodeChange) - # have caller do this - #asyncio.create_task(self.startUpdating()) - - # async def startUpdating(self): - # await self.graph.addAsyncHandler(self.update) - # log.info('startupdating task done') - def onCodeChange(self): log.debug('seq.onCodeChange') self.graph.addHandler(self._compile) - #self.updateLoop() @metrics('compile_graph_fader').time() def _compile(self) -> None: @@ -68,17 +58,21 @@ class FaderEval: # this could go in a second, smaller addHandler call to avoid rebuilding Fader objs constantly for f in self.faders: - f.value = typedValue(float, self.graph, f.uri, L9['value']) + setting = typedValue(Node, self.graph, f.uri, L9['setting']) + f.value = typedValue(float, self.graph, setting, L9['value']) def computeOutput(self) -> DeviceSettings: - notesSettings:List[DeviceSettings] = [] + faderEffectOutputs: List[DeviceSettings] = [] now = UnixTime(time.time()) for f in self.faders: if f.value is None: raise TypeError('f.value should be set by now') effectSettings = EffectSettings(self.graph, [(f.effect, f.setEffectAttr, f.value)]) - notesSettings.append(f.ee.compute(effectSettings)) + if f.value < .001: + continue + + faderEffectOutputs.append(f.ee.compute(effectSettings)) # ee = effecteval.EffectEval(self.graph, f.effectClass, self.simpleOutputs) # deviceSettings, report = ee.outputFromEffect( @@ -89,4 +83,4 @@ class FaderEval: # log.info(f' 𝅘𝅥𝅮 {uriTail(f.uri)}: {effectSettings=} -> {deviceSettings=}') # if deviceSettings: # notesSettings.append(deviceSettings) - return DeviceSettings.merge(self.graph, notesSettings) + return DeviceSettings.merge(self.graph, faderEffectOutputs) diff --git a/light9/fade/Light9FadeUi.ts b/light9/fade/Light9FadeUi.ts --- a/light9/fade/Light9FadeUi.ts +++ b/light9/fade/Light9FadeUi.ts @@ -143,14 +143,15 @@ export class Light9Fader extends LitElem // console.timeEnd(`valueSync ${this.uri.value}`) return; } - - this.value = graph.floatValue(this.uri, graph.Uri(":value")); + const st = graph.uriValue(this.uri, U(":setting")); + this.value = graph.floatValue(st, graph.Uri(":value")); } onSliderInput(ev: CustomEvent) { if (this.graph === undefined) { return; } + const U = this.graph.U(); const prev = this.value; const v: number = (ev.target as any).valueAsNumber; this.value = parseFloat(v.toPrecision(3)); // rewrite pls @@ -158,7 +159,10 @@ export class Light9Fader extends LitElem return; } meter.tick(); - this.graph.patchObject(this.uri, this.graph.Uri(":value"), this.graph.LiteralRoundedFloat(this.value), this.ctx); + if (!this.setting) { + throw new Error("can't make new settings yet"); + } + this.graph.patchObject(this.setting, this.graph.Uri(":value"), this.graph.LiteralRoundedFloat(this.value), this.ctx); } onEffectChange(ev: CustomEvent) {