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 954edb7bd8 and f196256604
https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1471#note_1016904
This commit is contained in:
Robin Gareus 2021-08-04 14:41:40 +03:00
parent c1dddb1b25
commit 2007bf2d5f
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -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<std::string> audio_ports;
get_physical_inputs (DataType::AUDIO, audio_ports);
for (std::vector<std::string>::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);
}
}
}