Changeset - ab893f0630b7
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-06-03 21:51:44
drewp@bigasterisk.com
try sending midi events to graph more often
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/midifade/midifade.py
Show inline comments
 
#!bin/python
 
"""
 
Read midi events, write fade levels to graph
 
"""
 
import asyncio
 
import logging
 
import traceback
 
from typing import Dict, List, cast
 
from light9.effect.edit import clamp
 

	
 
import mido
 
from rdfdb.syncedgraph.syncedgraph import SyncedGraph
 
from rdflib import RDF, ConjunctiveGraph, Literal, URIRef
 
from rdfdb.syncedgraph.readonly_graph import ReadOnlyConjunctiveGraph
 
from light9 import networking
 
from light9.namespaces import L9
 
from light9.newtypes import decimalLiteral
 
from light9.run_local import log
 
from light9.showconfig import showUri
 

	
 
mido.set_backend('alsa_midi.mido_backend')
 
MAX_SEND_RATE = 20
 
MAX_SEND_RATE = 30
 

	
 
_lastSet = {}  #midictlchannel:value7bit
 

	
 
currentFaders = {}  # midi control channel num : FaderUri
 
ctx = URIRef(showUri() + '/fade')
 

	
 
def compileCurrents(graph):
 
    currentFaders.clear()
 
    try:
 
        new = getChansToFaders(graph)
 
    except ValueError:
 
        return  # e.g. empty-graph startup
 
    currentFaders.update(new)
 

	
 

	
 
def getGraphMappingNode(g: ReadOnlyConjunctiveGraph|SyncedGraph) -> URIRef:
 
    mapping = g.value(L9['midiControl'], L9['map'])
 
    if mapping is None:
 
        raise ValueError('no :midiControl :map ?mapping')
 
    midiDev = g.value(mapping, L9['midiDev'])
 
    ourDev = 'bcf2000'
 
    if midiDev != Literal(ourDev):
 
        raise NotImplementedError(f'need {mapping} to have :midiDev {ourDev!r}')
 
    return mapping
0 comments (0 inline, 0 general)