summaryrefslogtreecommitdiff
path: root/libs/ardour/session.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/session.cc')
-rw-r--r--libs/ardour/session.cc49
1 files changed, 48 insertions, 1 deletions
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index c6b15307c0..39ddbce1ad 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -376,8 +376,51 @@ Session::Session (AudioEngine &eng,
_engine.set_session (this);
_engine.reset_timebase ();
- BootMessage (_("Session loading complete"));
+#ifdef USE_TRACKS_CODE_FEATURES
+
+ EngineStateController::instance()->set_session(this);
+
+ if (_is_new ) {
+ if ( ARDOUR::Profile->get_trx () ) {
+ /* Waves Tracks: fill session with tracks basing on the amount of inputs.
+ * each available input must have corresponding track when session starts.
+ */
+
+ uint32_t how_many (0);
+
+ std::vector<std::string> inputs;
+ EngineStateController::instance()->get_physical_audio_inputs(inputs);
+
+ how_many = inputs.size();
+
+ list<boost::shared_ptr<AudioTrack> > tracks;
+
+ // Track names after driver
+ if (Config->get_tracks_auto_naming() == NameAfterDriver) {
+ string track_name = "";
+ for (std::vector<string>::size_type i = 0; i < inputs.size(); ++i) {
+ string track_name;
+ remove_pattern_from_string(inputs[i], "system:capture:", track_name);
+
+ list<boost::shared_ptr<AudioTrack> > single_track = new_audio_track (1, 1, Normal, 0, 1, track_name);
+ tracks.insert(tracks.begin(), single_track.front());
+ }
+ } else { // Default track names
+ tracks = new_audio_track (1, 1, Normal, 0, how_many, string());
+ }
+
+ if (tracks.size() != how_many) {
+ destroy ();
+ throw failed_constructor ();
+ }
+ }
+ }
+#endif
+
+ _is_new = false;
+ session_loaded ();
+ BootMessage (_("Session loading complete"));
}
Session::~Session ()
@@ -486,6 +529,10 @@ Session::destroy ()
_engine.remove_session ();
+#ifdef USE_TRACKS_CODE_FEATURES
+ EngineStateController::instance()->remove_session();
+#endif
+
/* deregister all ports - there will be no process or any other
* callbacks from the engine any more.
*/