From 2007bf2d5f6fc83bb7f266fc711defc3583ac514 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 4 Aug 2021 14:41:40 +0300 Subject: [PATCH] Work around pipewire MIDI monitoring issues As opposed to JACK, pipewire does not unconditionally make MIDI bufffers of terminal/physical ports available to clients. Since it works with JACK, it is something that eventually needs to be fixed in pipewire. Until then this mitigates the issue. see also 954edb7bd84270 and f1962566049 https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1471#note_1016904 --- libs/ardour/port_manager.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index b55b80e4cd..cc7d688cf4 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -739,7 +739,8 @@ PortManager::reestablish_ports () if (Config->get_work_around_jack_no_copy_optimization () && AudioEngine::instance()->current_backend_name() == X_("JACK")) { - port_engine().register_port (X_("physical_input_monitor_enable"), DataType::AUDIO, ARDOUR::PortFlags (IsInput|IsTerminal|Hidden)); + port_engine().register_port (X_("physical_audio_input_monitor_enable"), DataType::AUDIO, ARDOUR::PortFlags (IsInput|IsTerminal|Hidden)); + port_engine().register_port (X_("physical_midi_input_monitor_enable"), DataType::MIDI, ARDOUR::PortFlags (IsInput|IsTerminal|Hidden)); } update_input_ports (true); @@ -783,7 +784,7 @@ PortManager::reconnect_ports () } if (Config->get_work_around_jack_no_copy_optimization () && AudioEngine::instance()->current_backend_name() == X_("JACK")) { - std::string const our_name = AudioEngine::instance()->make_port_name_non_relative (X_("physical_input_monitor_enable")); + std::string const our_name = AudioEngine::instance()->make_port_name_non_relative (X_("physical_audio_input_monitor_enable")); std::vector audio_ports; get_physical_inputs (DataType::AUDIO, audio_ports); for (std::vector::iterator p = audio_ports.begin(); p != audio_ports.end(); ++p) { @@ -949,6 +950,11 @@ PortManager::update_input_ports (bool clear) } #endif mpw->insert (make_pair (*p, MIDIInputPort (32))); + + if (Config->get_work_around_jack_no_copy_optimization () && AudioEngine::instance()->current_backend_name() == X_("JACK")) { + std::string const our_name = AudioEngine::instance()->make_port_name_non_relative (X_("physical_midi_input_monitor_enable")); + port_engine().connect (*p, our_name); + } } }