Skip to content

Commit

Permalink
Change the MIDI & audio ports used to interface with zynthian.
Browse files Browse the repository at this point in the history
  • Loading branch information
jofemodo committed Mar 8, 2024
1 parent e4acfc2 commit 817a672
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions mod/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -1184,8 +1184,8 @@ def init_jack(self):
self.midi_aggregated_mode = has_midi_merger_output_port() or has_midi_broadcaster_input_port()

#Add monitor ports for Zynthian routing
self.audioportsIn.append("zynmixer_send_0")
self.audioportsIn.append("zynmixer_send_1")
self.audioportsIn.append("zynthian_send_0")
self.audioportsIn.append("zynthian_send_1")

return True

Expand Down Expand Up @@ -2090,7 +2090,7 @@ def report_current_state(self, websocket):
websocket.write_message("add_hw_port /graph/%s midi 0 %s %i" % (name.split(":",1)[-1], title, i+2))

# Zynthian Router
websocket.write_message("add_hw_port /graph/zynthian_main_out midi 0 Zynthian_Main_Out 1")
websocket.write_message("add_hw_port /graph/zynthian_midi_out midi 0 Zynthian_MIDI_Out 1")

# MIDI Out
if self.midi_aggregated_mode:
Expand All @@ -2115,7 +2115,7 @@ def report_current_state(self, websocket):
websocket.write_message("add_hw_port /graph/%s midi 1 %s %i" % (name.split(":",1)[-1], title, i+2))

# Zynthian Router
websocket.write_message("add_hw_port /graph/zynthian_main_in midi 1 Zynthian_Main_In 1")
websocket.write_message("add_hw_port /graph/zynthian_midi_in midi 1 Zynthian_MIDI_In 1")

if self.midi_loopback_enabled:
websocket.write_message("add_hw_port /graph/midi_loopback midi 1 MIDI_Loopback 42")
Expand Down Expand Up @@ -3364,19 +3364,23 @@ def _fix_host_connection_port(self, port):
if data[2] == "capture_2":
return self.jack_hw_capture_prefix + "2"

# Zynthian ports: ---------------------------
# Zynmixer Send => Audio routed from Zynthian Layer
if data[2].startswith("zynmixer_send_"):
num = data[2].replace("zynmixer_send_","",1)
#----------------------------------------------------------
# Zynthian Ports:
#----------------------------------------------------------
# Zynmixer => Audio routed from Zynthian to mod-ui
if data[2].startswith("zynthian_send_"):
num = data[2][len("zynthian_send_"):]
if num=="0":
return "zynmixer:send_a"
return "zynmixer:output_moduia"
elif num=="1":
return "zynmixer:send_b"
# ZynMidiRouter => MIDI routed to/from Zynthian
if data[2].startswith("zynthian_"):
subport = data[2].replace("zynthian_","",1)
return "ZynMidiRouter:{}".format(subport)
# -------------------------------------------
return "zynmixer:output_moduib"
# ZynMidiRouter => MIDI routed from Zynthian to mod-ui
elif data[2].startswith("zynthian_midi_out"):
return "ZynMidiRouter:mod_out"
# ZynMidiRouter => MIDI routed from mod-ui to Zynthian
elif data[2].startswith("zynthian_midi_in"):
return "ZynMidiRouter:main_in"
# ----------------------------------------------------------

# Default guess
return "system:%s" % data[2]
Expand Down

0 comments on commit 817a672

Please sign in to comment.