summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-05-08 20:56:10 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2015-06-29 14:18:11 -0400
commit32224ee60800a86fb53cef05e157a9246be21018 (patch)
treed817626c9df6a1ca6f3c9bb78c2325b62167c94a
parentbebb03a0a4cf2f524dace6b5a61fc8da0b56adcb (diff)
add in more Tracks-related auto-(re)connect changes
-rw-r--r--libs/ardour/ardour/session.h5
-rw-r--r--libs/ardour/session.cc49
-rw-r--r--libs/ardour/session_state.cc30
3 files changed, 83 insertions, 1 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index f6837a6e47..9f560524f4 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -305,6 +305,9 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
*/
PBD::Signal0<void> RecordArmStateChanged; /* signals changes in recording arming */
+ /* Emited when session is loaded */
+ PBD::Signal0<void> SessionLoaded;
+
/* Transport mechanism signals */
/** Emitted on the following changes in transport state:
@@ -1266,6 +1269,8 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
int post_engine_init ();
int immediately_post_engine ();
void remove_empty_sounds ();
+
+ void session_loaded ();
void setup_midi_control ();
int midi_read (MIDI::Port *);
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.
*/
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 267eaa0928..eca01cbe99 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -355,6 +355,36 @@ Session::post_engine_init ()
return 0;
}
+void
+Session::session_loaded ()
+{
+ SessionLoaded();
+
+ _state_of_the_state = Clean;
+
+ DirtyChanged (); /* EMIT SIGNAL */
+
+ if (_is_new) {
+ save_state ("");
+ } else if (state_was_pending) {
+ save_state ("");
+ remove_pending_capture_state ();
+ state_was_pending = false;
+ }
+
+ /* Now, finally, we can fill the playback buffers */
+
+ BootMessage (_("Filling playback buffers"));
+
+ boost::shared_ptr<RouteList> rl = routes.reader();
+ for (RouteList::iterator r = rl->begin(); r != rl->end(); ++r) {
+ boost::shared_ptr<Track> trk = boost::dynamic_pointer_cast<Track> (*r);
+ if (trk && !trk->hidden()) {
+ trk->seek (_transport_frame, true);
+ }
+ }
+}
+
string
Session::raid_path () const
{