self.realtimeMidiThroughLayer=self.scene.add_new_midi_layer(self.cboxMidiPortUid)#Create a midi layer for our input port. That layer support manipulation like transpose or channel routing.
cbox.JackIO.set_appsink_for_midi_input(self.cboxMidiPortUid,True)#This sounds like a program wide sink, but it is needed for every port.
cbox.JackIO.route_midi_input(self.cboxMidiPortUid,self.scene.uuid)#Route midi input to the scene.
cbox.JackIO.set_appsink_for_midi_input(self.cboxMidiPortUid,True)#This enables forwarding to Python for our midiProcessors get_new_events(self.parentInput.cboxMidiPortUid)
cbox.JackIO.route_midi_input(self.cboxMidiPortUid,self.scene.uuid)#Route midi input to the scene. Without this we have no sound, but the python processor will still work.
ifnotself._currentMidiThruOutputMidiPortUid==cboxMidiOutUuid:#most of the time this stays the same e.g. cursor left/right. we only care about up and down
cbox.JackIO.Metadata.set_port_order(f"{cbox.JackIO.status().client_name}:all",0)#first one. The other port order later start at 1 because we loop 1-based for channels.
#Set libfluidsynth! to 16 output pairs. We prepared 32 jack ports in the session start. "soundfont" is our given name, in the line below. This is a prepared config which will be looked up by add_new_instrument
cbox.Config.set("instrument:soundfont","output_pairs",16)#this is not the same as session.py cbox.Config.set("io", "outputs", METADATA["cboxOutputs"]). It is yet another layer and those two need connections
#Create the permanent instrument which loads changing sf2
router_midi_layer=router_scene.add_new_midi_layer(router_cboxMidiPortUid)#Create a midi layer for our input port. That layer supports manipulation like transpose or channel routing.
#cbox.JackIO.route_midi_input(router_cboxMidiPortUid, self.midiInput.scene.uuid) #routes directly to the instrument and ignores the layer options like channel forcing
#cbox.JackIO.route_midi_input(router_cboxMidiPortUid, self.midiInput.cboxMidiPortUid) #runs, but does nothing
#cbox.JackIO.route_midi_input(router_midi_layer, self.midiInput.cboxMidiPortUid) #does not run
message=QtCore.QCoreApplication.translate("TemplateChooseSessionDirectory","Please choose a directory for your session files. It is recommended to start through Argodejo/New Session Manager instead.")
message=QtCore.QCoreApplication.translate("TemplateChooseSessionDirectory","Please choose a directory for your session files. It is recommended to start through Agordejo/New Session Manager instead.")
parser.add_argument("-s","--save",action='store',dest="directory",help="Use this directory to save. Will be created or loaded from if already present. Deactivates Argodejo/New-Session-Manager support.")
parser.add_argument("-s","--save",action='store',dest="directory",help="Use this directory to save. Will be created or loaded from if already present. Deactivates Agordejo/New-Session-Manager support.")
parser.add_argument("-p","--profiler",action='store_true',help="(Development) Run the python profiler and produce a .cprof file at quit. The name will appear in your STDOUT.")
parser.add_argument("-m","--mute",action='store_true',help="(Development) Use a fake cbox module, effectively deactivating midi and audio.")
parser.add_argument("-V","--verbose",action='store_true',help="(Development) Switch the logger to INFO and print out all kinds of information to get a high-level idea of what the program is doing.")