Browse Source

simpler and correct way of enumerating jack metadata port order

master
Nils 3 years 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()) highestLibId = max(self.libraries.keys())
highestInstrId = max(instId for libId, instId in Instrument.allInstruments.keys()) highestInstrId = max(instId for libId, instId in Instrument.allInstruments.keys())
s = set()
clientName = cbox.JackIO.status().client_name clientName = cbox.JackIO.status().client_name
order = {} order = {}
orderCounter = 0
for (libraryId, instrumentId), instr in Instrument.allInstruments.items(): for (libraryId, instrumentId), instr in Instrument.allInstruments.items():
L = clientName + ":" + instr.midiInputPortName + "_L" L = clientName + ":" + instr.midiInputPortName + "_L"
R = clientName + ":" + instr.midiInputPortName + "_R" 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 order[L] = (orderCounter, instr)
assert not lnum+1 in s, lnum+1 orderCounter += 1
assert not lnum+2 in s, lnum+2 order[R] = (orderCounter, instr)
s.add(lnum) orderCounter += 1
s.add(lnum+1) order[clientName + ":" + instr.midiInputPortName] = (orderCounter, instr) #midi port
s.add(lnum+2) orderCounter +=1
order[L] = (lnum, instr)
order[R] = (lnum+1, instr)
order[clientName + ":" + instr.midiInputPortName] = (lnum+2, instr) #midi port
self._cachedJackMedataPortOrder = order self._cachedJackMedataPortOrder = order

Loading…
Cancel
Save