add in more Tracks-related auto-(re)connect changes

This commit is contained in:
Paul Davis 2015-05-08 20:56:10 -04:00
parent bebb03a0a4
commit 32224ee608
3 changed files with 83 additions and 1 deletions

View File

@ -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 *);

View File

@ -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.
*/

View File

@ -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
{