Changeset - f7e564b42af3
[Not reviewed]
default
0 3 0
drewp@bigasterisk.com - 20 months ago 2023-06-03 22:22:38
drewp@bigasterisk.com
new grandmaster scales all faders
3 files changed with 44 insertions and 2 deletions:
0 comments (0 inline, 0 general)
light9/effect/sequencer/eval_faders.py
Show inline comments
 
@@ -44,8 +44,10 @@ class FaderEval:
 
        self.graph = graph
 
        self.lib = lib
 
        self.faders: List[Fader] = []
 
        self.grandMaster = 1.0
 

	
 
        self.graph.addHandler(self._compile)
 
        self.graph.addHandler(self._compileGm)
 
        self.lastLoopSucceeded = False
 

	
 
    @COMPILE.time()
 
@@ -73,6 +75,15 @@ class FaderEval:
 
        setAttr = typedValue(EffectAttr, self.graph, setting, L9['effectAttr'])
 
        return (Fader(self.graph, self.lib, cast(URIRef, fader), effect, setAttr))
 

	
 
    def _compileGm(self):
 
        try:
 
            self.grandMaster = typedValue(float, self.graph,
 
                                          L9.grandMaster,
 
                                          L9.value)
 
            print('got gm', self.grandMaster)
 
        except ValueError:
 
            return
 
        
 
    @COMPUTE_ALL_FADERS.time()
 
    def computeOutput(self) -> DeviceSettings:
 
        faderEffectOutputs: List[DeviceSettings] = []
 
@@ -82,7 +93,9 @@ class FaderEval:
 
                if f.value is None:
 
                    log.warning(f'{f.value=}; should be set during _compile. Skipping {f.uri}')
 
                    continue
 
                effectSettings = EffectSettings(self.graph, [(f.effect, f.setEffectAttr, f.value)])
 
                v = f.value
 
                v *= self.grandMaster
 
                effectSettings = EffectSettings(self.graph, [(f.effect, f.setEffectAttr, v)])
 

	
 
                ds = f.ee.compute(now, effectSettings)
 
                faderEffectOutputs.append(ds)
light9/fade/Light9FadeUi.ts
Show inline comments
 
@@ -36,6 +36,9 @@ export class Light9FadeUi extends LitEle
 
      .mappedToHw {
 
        background: #393945;
 
      }
 
      #gm light9-fader {
 
        width: 300px;
 
      }
 
    `,
 
  ];
 
  render() {
 
@@ -43,7 +46,9 @@ export class Light9FadeUi extends LitEle
 
      <rdfdb-synced-graph></rdfdb-synced-graph>
 

	
 
      <h1>Fade</h1>
 

	
 
<div id="gm">
 
  <light9-fader .value=${this.grandMaster} @change=${this.gmChanged}></light9-fader>grand master
 
</div>
 
      ${(this.fadePages?.pages || []).map(this.renderPage.bind(this))}
 

	
 
      <div><button @click=${this.addPage}>Add new page</button></div>
 
@@ -70,12 +75,14 @@ export class Light9FadeUi extends LitEle
 

	
 
  @property() fadePages?: FadePages;
 
  @property() currentHwPage?: NamedNode;
 
  @property() grandMaster?: number;
 

	
 
  constructor() {
 
    super();
 
    getTopGraph().then((g) => {
 
      this.graph = g;
 
      this.graph.runHandler(this.compile.bind(this), `faders layout`);
 
      this.graph.runHandler(this.compileGm.bind(this), `faders gm`);
 
    });
 
  }
 
  connectedCallback(): void {
 
@@ -109,6 +116,27 @@ export class Light9FadeUi extends LitEle
 
      this.currentHwPage = this.graph.uriValue(mc, U(":outputs"));
 
    } catch (e) { }
 
  }
 
  compileGm() {
 
    const U = this.graph.U();
 
    this.grandMaster = undefined
 
    let newVal
 
    try {
 

	
 
      newVal = this.graph.floatValue(U(':grandMaster'), U(':value'))
 
    } catch (e) {
 
      return
 
    }
 
    this.grandMaster = newVal;
 

	
 
  }
 
  gmChanged(ev: CustomEvent) {
 
    const U = this.graph.U();
 
    const newVal = ev.detail.value
 
    // this.grandMaster = newVal;
 
    this.graph.patchObject(U(':grandMaster'), U(':value'), this.graph.LiteralRoundedFloat(newVal), this.ctx)
 

	
 
  }
 

	
 

	
 
  mapThisToHw(page: NamedNode) {
 
    const U = this.graph.U();
show/dance2023/fade.n3
Show inline comments
 
@@ -4,6 +4,7 @@
 
@prefix show: <http://light9.bigasterisk.com/show/dance2023/> .
 
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
 

	
 
:grandMaster :value 1.00 .
 
:midiControl :map :midiControl0 .
 

	
 
show:fadePage0 a :FadePage; rdfs:label "unnamed"; :fader show:fader0, show:fader1, show:fader2, show:fader3, show:fader4, show:fader5, show:fader6, show:fader7 .
0 comments (0 inline, 0 general)