diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-05-19 15:54:52 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-06-29 14:18:14 -0400 |
commit | d27dc3557ec910cf891c3f74332653f05ecdd860 (patch) | |
tree | 050c377f710a139f038fb64a4115ff421773fffd /libs/ardour | |
parent | c66ea2c1700520b9a4e5386a53082edcc39ed0dc (diff) |
new Session::default_track_name_pattern (DataType) method, based on an idea in Tracks
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/session.h | 2 | ||||
-rw-r--r-- | libs/ardour/session.cc | 33 |
2 files changed, 25 insertions, 10 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index e08c9fb5c8..a2f8c164c8 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -567,6 +567,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop AudioEngine & engine() { return _engine; } AudioEngine const & engine () const { return _engine; } + static std::string default_track_name_pattern (DataType); + /* Time */ framepos_t transport_frame () const {return _transport_frame; } 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<boost::shared_ptr<MidiTrack> > 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<boost::shared_ptr<AudioTrack> > 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) { |