summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-09-10 16:27:14 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-09-10 16:41:34 -0400
commitbfd66b2ea0155aea42eab4a889c0c662813e4fc7 (patch)
treec1b73f95e40f609cd56b299e70b96beab1b623bf /libs
parentc7e755b25c485f6d20a0c49230c558245511c9ba (diff)
use PortManager::port_name_prefix_is_unique to check for new route names
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/session.cc29
1 files changed, 26 insertions, 3 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index c3eca166df..99e3bdd958 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -2198,14 +2198,37 @@ Session::resort_routes_using (boost::shared_ptr<RouteList> r)
bool
Session::find_route_name (string const & base, uint32_t& id, string& name, bool definitely_add_number)
{
- if (!definitely_add_number && route_by_name (base) == 0) {
+ string el_base = base;
+
+ /* the base may conflict with ports that do not belong to existing
+ routes, but hidden objects like the click track. So check port names
+ before anything else.
+ */
+
+
+ if (!_engine.port_name_prefix_is_unique (base)) {
+ uint32_t unique_port_suffix = 1;
+
+ do {
+ string possible = string_compose (X_("%1-%2"), base, unique_port_suffix);
+ if (_engine.port_name_prefix_is_unique (possible)) {
+ el_base = possible;
+ break;
+ }
+
+ unique_port_suffix++;
+
+ } while (unique_port_suffix < UINT_MAX);
+ }
+
+ if (!definitely_add_number && route_by_name (el_base) == 0) {
/* juse use the base */
- name = base;
+ name = el_base;
return true;
}
do {
- name = string_compose ("%1 %2", base, id);
+ name = string_compose ("%1 %2", el_base, id);
if (route_by_name (name) == 0) {
return true;