diff --git a/libs/ardour/ardour/port_manager.h b/libs/ardour/ardour/port_manager.h index 2e16d5ee68..ecef697de9 100644 --- a/libs/ardour/ardour/port_manager.h +++ b/libs/ardour/ardour/port_manager.h @@ -157,6 +157,7 @@ public: static bool port_is_virtual_piano (std::string const&); static bool port_is_control_only (std::string const&); + static bool port_is_physical_input_monitor_enable (std::string const&); /* other Port management */ diff --git a/libs/ardour/port_manager.cc b/libs/ardour/port_manager.cc index 4ec50bee4e..6a4adde7c0 100644 --- a/libs/ardour/port_manager.cc +++ b/libs/ardour/port_manager.cc @@ -1289,16 +1289,34 @@ PortManager::port_is_control_only (std::string const& name) return regexec (&compiled_pattern, name.c_str(), 0, 0, 0) == 0; } +static bool ends_with (std::string const& str, std::string const& end) +{ + const size_t str_size = str.size (); + const size_t end_size = end.size(); + if (str_size < end_size) { + return false; + } + return 0 == str.compare (str_size - end_size, end_size, end); +} + bool PortManager::port_is_virtual_piano (std::string const& name) { - static const std::string vkbd (":x-virtual-keyboard"); - static const size_t vkbd_size = vkbd.size (); - size_t name_size = name.size(); - if (vkbd_size > name_size) { - return false; + return ends_with (name, X_(":x-virtual-keyboard")); +} + +bool +PortManager::port_is_physical_input_monitor_enable (std::string const& name) +{ + if (Config->get_work_around_jack_no_copy_optimization () && AudioEngine::instance()->current_backend_name() == X_("JACK")) { + if (ends_with (name, X_(":physical_midi_input_monitor_enable"))) { + return true; + } + if (ends_with (name, X_(":physical_audio_input_monitor_enable"))) { + return true; + } } - return (0 == name.compare (name_size - vkbd_size, vkbd_size, vkbd)); + return false; } MidiPortFlags