X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession.cc;h=eb6e97cd0e355c028e19533a0348d529d2728212;hb=d27dc3557ec910cf891c3f74332653f05ecdd860;hp=68a6acfc4dbb8769cbd5c8667f75bf1bb43dc0dd;hpb=c66ea2c1700520b9a4e5386a53082edcc39ed0dc;p=ardour.git diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 68a6acfc4d..eb6e97cd0e 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -2232,6 +2232,25 @@ Session::count_existing_track_channels (ChanCount& in, ChanCount& out) } } +string +Session::default_track_name_pattern (DataType t) +{ + switch (t) { + case DataType::AUDIO: + if (Profile->get_trx()) { + return _("Track "); + } else { + return _("Audio "); + } + break; + + case DataType::MIDI: + return _("MIDI "); + } + + return ""; +} + /** Caller must not hold process lock * @param name_template string to use for the start of the name, or "" to use "MIDI". * @param instrument plugin info for the instrument to insert pre-fader, if any @@ -2246,7 +2265,8 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, boost: RouteList new_routes; list > ret; - bool const use_number = (how_many != 1) || name_template.empty () || name_template == _("MIDI"); + const string name_pattern = default_track_name_pattern (DataType::MIDI); + bool const use_number = (how_many != 1) || name_template.empty () || (name_template == name_pattern); while (how_many) { if (!find_route_name (name_template.empty() ? _("MIDI") : name_template, ++track_id, track_name, use_number)) { @@ -2783,15 +2803,8 @@ Session::new_audio_track (int input_channels, int output_channels, TrackMode mod RouteList new_routes; list > ret; - string name_pattern; - - if (Profile->get_trx() ) { - name_pattern = "Track "; - } else { - name_pattern = "Audio "; - } - - bool const use_number = (how_many != 1) || name_template.empty () || name_template == _(name_pattern.c_str() ); + const string name_pattern = default_track_name_pattern (DataType::AUDIO); + bool const use_number = (how_many != 1) || name_template.empty () || (name_template == name_pattern); while (how_many) {