Mercurial > code > home > repos > light9
changeset 2351:1bb30b0eaa38
reformat
author | drewp@bigasterisk.com |
---|---|
date | Sat, 03 Jun 2023 15:46:04 -0700 |
parents | 72c589cb96d1 |
children | eedf30a2d44b |
files | light9/midifade/midifade.py |
diffstat | 1 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/midifade/midifade.py Sat Jun 03 15:45:27 2023 -0700 +++ b/light9/midifade/midifade.py Sat Jun 03 15:46:04 2023 -0700 @@ -26,6 +26,7 @@ currentFaders = {} # midi control channel num : FaderUri ctx = URIRef(showUri() + '/fade') + def compileCurrents(graph): currentFaders.clear() try: @@ -35,7 +36,7 @@ currentFaders.update(new) -def getGraphMappingNode(g: ReadOnlyConjunctiveGraph|SyncedGraph) -> URIRef: +def getGraphMappingNode(g: ReadOnlyConjunctiveGraph | SyncedGraph) -> URIRef: mapping = g.value(L9['midiControl'], L9['map']) if mapping is None: raise ValueError('no :midiControl :map ?mapping') @@ -50,9 +51,11 @@ mapping = getGraphMappingNode(g) return g.value(mapping, L9['outputs']) -def setCurMappedPage(g: SyncedGraph, mapping: URIRef, newPage:URIRef): + +def setCurMappedPage(g: SyncedGraph, mapping: URIRef, newPage: URIRef): g.patchObject(ctx, mapping, L9.outputs, newPage) + def getChansToFaders(g: SyncedGraph) -> Dict[int, URIRef]: fadePage = getCurMappedPage(g) ret = [] @@ -79,11 +82,12 @@ if curPage is None: curPage = allPages[0] idx = allPages.index(curPage) - newIdx = clamp(idx + dp, 0, len(allPages)-1) + newIdx = clamp(idx + dp, 0, len(allPages) - 1) print('change from ', idx, newIdx) - newPage =allPages[newIdx] + newPage = allPages[newIdx] setCurMappedPage(g, mapping, newPage) + def writeHwValueToGraph(graph: SyncedGraph, ctx, fader: URIRef, strength: float): log.info(f'setFader(fader={fader}, strength={strength:.03f}') valueLit = decimalLiteral(round(strength, 3)) @@ -155,7 +159,7 @@ fset = g.value(f, L9.setting) # could split this to a separate handler per fader value = g.value(fset, L9.value).toPython() - hwcurrent = self.getCurrentValue(midi_ctl_addr) + hwcurrent = self.getCurrentValue(midi_ctl_addr) hwgoal = int(value * 127) print(f'{f} {hwcurrent=} {hwgoal=}') if abs(hwcurrent - hwgoal) > 2: