Browse Source

simpler and correct way of enumerating jack metadata port order

master
Nils 1 year ago
parent
commit
7dd9a4b20c
  1. 20
      engine/main.py

20
engine/main.py

@ -137,23 +137,19 @@ class Data(TemplateData):
highestLibId = max(self.libraries.keys())
highestInstrId = max(instId for libId, instId in Instrument.allInstruments.keys())
s = set()
clientName = cbox.JackIO.status().client_name
order = {}
orderCounter = 0
for (libraryId, instrumentId), instr in Instrument.allInstruments.items():
L = clientName + ":" + instr.midiInputPortName + "_L"
R = clientName + ":" + instr.midiInputPortName + "_R"
lnum = highestLibId * libraryId + instrumentId * 3 # * 3 to make room for stereo pairs and midi. #TODO: If we get non-stereo pairs this must be solved
assert not lnum in s, lnum
assert not lnum+1 in s, lnum+1
assert not lnum+2 in s, lnum+2
s.add(lnum)
s.add(lnum+1)
s.add(lnum+2)
order[L] = (lnum, instr)
order[R] = (lnum+1, instr)
order[clientName + ":" + instr.midiInputPortName] = (lnum+2, instr) #midi port
order[L] = (orderCounter, instr)
orderCounter += 1
order[R] = (orderCounter, instr)
orderCounter += 1
order[clientName + ":" + instr.midiInputPortName] = (orderCounter, instr) #midi port
orderCounter +=1
self._cachedJackMedataPortOrder = order

Loading…
Cancel
Save