diff options
author | Robin Gareus <robin@gareus.org> | 2016-12-11 00:03:44 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2016-12-11 00:04:08 +0100 |
commit | 39903a00235a6bd222da23bab177a960ce1c5947 (patch) | |
tree | 34947edd3af4537dc3ba9173411ec1bd206cc104 /libs/ardour | |
parent | 642b3573760646c902225eaba83c2bc10442e057 (diff) |
Check for reserved i/o that are not routes, fixes #7171
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/ardour.h | 2 | ||||
-rw-r--r-- | libs/ardour/globals.cc | 23 | ||||
-rw-r--r-- | libs/ardour/session.cc | 12 |
3 files changed, 17 insertions, 20 deletions
diff --git a/libs/ardour/ardour/ardour.h b/libs/ardour/ardour/ardour.h index 79b69124ac..c86c59eb03 100644 --- a/libs/ardour/ardour/ardour.h +++ b/libs/ardour/ardour/ardour.h @@ -52,7 +52,7 @@ namespace ARDOUR { extern LIBARDOUR_API PBD::Signal1<void,int> PluginScanTimeout; extern LIBARDOUR_API PBD::Signal0<void> GUIIdle; extern LIBARDOUR_API PBD::Signal3<bool,std::string,std::string,int> CopyConfigurationFiles; - extern LIBARDOUR_API std::vector<std::string> reserved_io_names; + extern LIBARDOUR_API std::map<std::string, bool> reserved_io_names; /** * @param with_vst true to enable VST Support diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index 974247aef5..45ac987eb1 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -144,7 +144,7 @@ PBD::Signal1<void,int> ARDOUR::PluginScanTimeout; PBD::Signal0<void> ARDOUR::GUIIdle; PBD::Signal3<bool,std::string,std::string,int> ARDOUR::CopyConfigurationFiles; -std::vector<std::string> ARDOUR::reserved_io_names; +std::map<std::string, bool> ARDOUR::reserved_io_names; static bool have_old_configuration_files = false; @@ -544,20 +544,17 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir support may not even be active. Without adding an API to control surface support that would list their port names, we do have to list them here. + + We also need to know if the given I/O is an actual route. + For routes (e.g. "master"), bus creation needs to be allowed the first time, + while for pure I/O (e.g. "Click") track/bus creation must always fail. */ - char const * const reserved[] = { - _("Monitor"), - _("Master"), - _("Control"), - _("Click"), - _("Mackie"), - 0 - }; - - for (int n = 0; reserved[n]; ++n) { - reserved_io_names.push_back (reserved[n]); - } + reserved_io_names[_("Monitor")] = true; + reserved_io_names[_("Master")] = true; + reserved_io_names[_("Control")] = false; + reserved_io_names[_("Click")] = false; + reserved_io_names[_("Mackie")] = false; libardour_initialized = true; diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 4bf070dc21..4f005b1001 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2366,12 +2366,12 @@ Session::find_route_name (string const & base, uint32_t& id, string& name, bool before anything else. */ - for (vector<string>::const_iterator reserved = reserved_io_names.begin(); reserved != reserved_io_names.end(); ++reserved) { - if (base == *reserved) { + for (map<string,bool>::const_iterator reserved = reserved_io_names.begin(); reserved != reserved_io_names.end(); ++reserved) { + if (base == reserved->first) { /* Check if this reserved name already exists, and if so, disallow it without a numeric suffix. */ - if (route_by_name (*reserved)) { + if (!reserved->second || route_by_name (reserved->first)) { definitely_add_number = true; if (id < 1) { id = 1; @@ -4075,9 +4075,9 @@ Session::io_name_is_legal (const std::string& name) const { boost::shared_ptr<RouteList> r = routes.reader (); - for (vector<string>::const_iterator reserved = reserved_io_names.begin(); reserved != reserved_io_names.end(); ++reserved) { - if (name == *reserved) { - if (!route_by_name (*reserved)) { + for (map<string,bool>::const_iterator reserved = reserved_io_names.begin(); reserved != reserved_io_names.end(); ++reserved) { + if (name == reserved->first) { + if (!route_by_name (reserved->first)) { /* first instance of a reserved name is allowed */ return true; } |