mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-16 03:36:32 +01:00
better more reliable checks on renamed, newly created and imported track/bus names
This commit is contained in:
parent
9f8fe4b0bc
commit
0613ddd1f9
4 changed files with 31 additions and 20 deletions
|
|
@ -52,6 +52,7 @@ namespace ARDOUR {
|
||||||
extern LIBARDOUR_API PBD::Signal1<void,int> PluginScanTimeout;
|
extern LIBARDOUR_API PBD::Signal1<void,int> PluginScanTimeout;
|
||||||
extern LIBARDOUR_API PBD::Signal0<void> GUIIdle;
|
extern LIBARDOUR_API PBD::Signal0<void> GUIIdle;
|
||||||
extern LIBARDOUR_API PBD::Signal3<bool,std::string,std::string,int> CopyConfigurationFiles;
|
extern LIBARDOUR_API PBD::Signal3<bool,std::string,std::string,int> CopyConfigurationFiles;
|
||||||
|
extern LIBARDOUR_API std::vector<std::string> reserved_io_names;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param with_vst true to enable VST Support
|
* @param with_vst true to enable VST Support
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,8 @@ PBD::Signal1<void,int> ARDOUR::PluginScanTimeout;
|
||||||
PBD::Signal0<void> ARDOUR::GUIIdle;
|
PBD::Signal0<void> ARDOUR::GUIIdle;
|
||||||
PBD::Signal3<bool,std::string,std::string,int> ARDOUR::CopyConfigurationFiles;
|
PBD::Signal3<bool,std::string,std::string,int> ARDOUR::CopyConfigurationFiles;
|
||||||
|
|
||||||
|
std::vector<std::string> ARDOUR::reserved_io_names;
|
||||||
|
|
||||||
static bool have_old_configuration_files = false;
|
static bool have_old_configuration_files = false;
|
||||||
|
|
||||||
namespace ARDOUR {
|
namespace ARDOUR {
|
||||||
|
|
@ -506,6 +508,25 @@ ARDOUR::init (bool use_windows_vst, bool try_optimization, const char* localedir
|
||||||
|
|
||||||
ARDOUR::AudioEngine::create ();
|
ARDOUR::AudioEngine::create ();
|
||||||
|
|
||||||
|
/* it is unfortunate that we need to include reserved names here that
|
||||||
|
refer to control surfaces. But there's no way to ensure a complete
|
||||||
|
lack of collisions without doing this, since the control surface
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
char const * reserved[] = {
|
||||||
|
_("Monitor"),
|
||||||
|
_("Master"),
|
||||||
|
_("Control"),
|
||||||
|
_("Click"),
|
||||||
|
_("Mackie"),
|
||||||
|
0
|
||||||
|
};
|
||||||
|
|
||||||
|
reserved_io_names = I18N (reserved);
|
||||||
|
|
||||||
libardour_initialized = true;
|
libardour_initialized = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -365,7 +365,7 @@ Route::ensure_track_or_route_name(string name, Session &session)
|
||||||
string newname = name;
|
string newname = name;
|
||||||
|
|
||||||
while (!session.io_name_is_legal (newname)) {
|
while (!session.io_name_is_legal (newname)) {
|
||||||
newname = bump_name_once (newname, '.');
|
newname = bump_name_once (newname, ' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
return newname;
|
return newname;
|
||||||
|
|
|
||||||
|
|
@ -2196,30 +2196,13 @@ Session::resort_routes_using (boost::shared_ptr<RouteList> r)
|
||||||
bool
|
bool
|
||||||
Session::find_route_name (string const & base, uint32_t& id, string& name, bool definitely_add_number)
|
Session::find_route_name (string const & base, uint32_t& id, string& name, bool definitely_add_number)
|
||||||
{
|
{
|
||||||
/* it is unfortunate that we need to include reserved names here that
|
|
||||||
refer to control surfaces. But there's no way to ensure a complete
|
|
||||||
lack of collisions without doing this, since the control surface
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
char const * const reserved[] = {
|
|
||||||
_("Monitor"),
|
|
||||||
_("Master"),
|
|
||||||
_("Control"),
|
|
||||||
_("Click"),
|
|
||||||
_("Mackie"),
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
/* the base may conflict with ports that do not belong to existing
|
/* the base may conflict with ports that do not belong to existing
|
||||||
routes, but hidden objects like the click track. So check port names
|
routes, but hidden objects like the click track. So check port names
|
||||||
before anything else.
|
before anything else.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (int n = 0; reserved[n]; ++n) {
|
for (vector<string>::const_iterator reserved = reserved_io_names.begin(); reserved != reserved_io_names.end(); ++reserved) {
|
||||||
if (base == reserved[n]) {
|
if (base == *reserved) {
|
||||||
definitely_add_number = true;
|
definitely_add_number = true;
|
||||||
if (id < 1) {
|
if (id < 1) {
|
||||||
id = 1;
|
id = 1;
|
||||||
|
|
@ -3875,6 +3858,12 @@ Session::io_name_is_legal (const std::string& name)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<RouteList> r = routes.reader ();
|
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) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
for (RouteList::iterator i = r->begin(); i != r->end(); ++i) {
|
||||||
if ((*i)->name() == name) {
|
if ((*i)->name() == name) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue