diff --git a/engine/main.py b/engine/main.py index 6b23107..565f344 100644 --- a/engine/main.py +++ b/engine/main.py @@ -257,6 +257,21 @@ class Data(TemplateData): #print (3* len(list(self.allInstr()))) #without multi-out instruments this is the orderCounter in the end. self._cachedJackMedataPortOrder = order + #Add static ports + self._cachedJackMedataStaticPortOrder = {} + clientName = cbox.JackIO.status().client_name + mix_l = f"{clientName}:Stereo Mix L" + mix_r = f"{clientName}:Stereo Mix R" + aud_midi = f"{clientName}:{self.auditioner.midiInputPortName}" + aud_l = f"{clientName}:{self.auditioner.midiInputPortName}_L" + aud_r = f"{clientName}:{self.auditioner.midiInputPortName}_R" + self._cachedJackMedataStaticPortOrder = {} + self._cachedJackMedataStaticPortOrder[mix_l] = 0 + self._cachedJackMedataStaticPortOrder[mix_r] = 1 + self._cachedJackMedataStaticPortOrder[aud_l] = 2 + self._cachedJackMedataStaticPortOrder[aud_r] = 3 + self._cachedJackMedataStaticPortOrder[aud_midi] = 4 + def updateJackMetadataSorting(self): """ Tell cbox to reorder the tracks by metadata. @@ -269,24 +284,12 @@ class Data(TemplateData): logger.info("Calculating new port sorting/order based on permanent general list and currently enabled instruments") - #Add static ports - clientName = cbox.JackIO.status().client_name - mix_l = f"{clientName}:Stereo Mix L" - mix_r = f"{clientName}:Stereo Mix R" - aud_midi = f"{clientName}:{self.auditioner.midiInputPortName}" - aud_l = f"{clientName}:{self.auditioner.midiInputPortName}_L" - aud_r = f"{clientName}:{self.auditioner.midiInputPortName}_R" - staticOrder = {} - staticOrder[mix_l] = 0 - staticOrder[mix_r] = 1 - staticOrder[aud_l] = 2 - staticOrder[aud_r] = 3 - staticOrder[aud_midi] = 4 - offset = len(staticOrder.keys()) + + offset = len(self._cachedJackMedataStaticPortOrder.keys()) #Now the dynamic ports with static offset cleanedOrder = { fullportname : index+offset for fullportname, (index, instrObj) in self._cachedJackMedataPortOrder.items() if instrObj.enabled} - cleanedOrder.update(staticOrder) + cleanedOrder.update(self._cachedJackMedataStaticPortOrder) try: cbox.JackIO.Metadata.set_all_port_order(cleanedOrder) #wants a dict with {complete jack portname : sortIndex} except Exception as e: #No Jack Meta Data or Error with ports.