better error message if VST SDK is not installed and neeed
[ardour.git] / libs / ardour / session.cc
index e8f6ec1023a12c3d21d6c7a71632b82df1ee8779..987a8377efa7d7e0afa85d28b6e9497b25001ccf 100644 (file)
@@ -278,7 +278,7 @@ Session::Session (AudioEngine &eng,
        
        new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
        if (new_session) {
-               if (create (new_session, mix_template, _engine.frame_rate() * 60 * 5)) {
+               if (create (new_session, mix_template, compute_initial_length())) {
                        cerr << "create failed\n";
                        throw failed_constructor ();
                }
@@ -334,6 +334,7 @@ Session::Session (AudioEngine &eng,
        first_stage_init (fullpath, snapshot_name);
 
        new_session = !g_file_test (_path.c_str(), GFileTest (G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR));
+
        if (new_session) {
                if (create (new_session, 0, initial_length)) {
                        throw failed_constructor ();
@@ -430,6 +431,10 @@ Session::~Session ()
        }
 
        AudioDiskstream::free_working_buffers();
+
+       /* this should cause deletion of the auditioner */
+
+       // auditioner.reset ();
        
 #undef TRACK_DESTRUCTION
 #ifdef TRACK_DESTRUCTION
@@ -1317,8 +1322,10 @@ Session::set_frame_rate (nframes_t frames_per_second)
 
        sync_time_vars();
 
+       Route::set_automation_interval ((jack_nframes_t) ceil ((double) frames_per_second * 0.25));
+
        // XXX we need some equivalent to this, somehow
-       // DestructiveFileSource::setup_standard_crossfades (frames_per_second);
+       // SndFileSource::setup_standard_crossfades (frames_per_second);
 
        set_dirty();
 
@@ -1546,11 +1553,17 @@ Session::resort_routes_using (shared_ptr<RouteList> r)
        
        for (i = r->begin(); i != r->end(); ++i) {
                trace_terminal (*i, *i);
-       }
-       
+       }       
+
        RouteSorter cmp;
        r->sort (cmp);
        
+       /* don't leave dangling references to routes in Route::fed_by */
+
+       for (i = r->begin(); i != r->end(); ++i) {
+               (*i)->fed_by.clear ();
+       }
+
 #if 0
        cerr << "finished route resort\n";
        
@@ -1884,8 +1897,9 @@ Session::remove_route (shared_ptr<Route> route)
        {       
                RCUWriter<RouteList> writer (routes);
                shared_ptr<RouteList> rs = writer.get_copy ();
-               rs->remove (route);
                
+               rs->remove (route);
+
                /* deleting the master out seems like a dumb
                   idea, but its more of a UI policy issue
                   than our concern.
@@ -3751,13 +3765,14 @@ Session::nbusses () const
 }
 
 void
-Session::add_curve(Curve *curve)
+Session::add_automation_list(AutomationList *al)
 {
-    curves[curve->id()] = curve;
+       automation_lists[al->id()] = al;
 }
 
-void
-Session::add_automation_list(AutomationList *al)
+nframes_t
+Session::compute_initial_length ()
 {
-    automation_lists[al->id()] = al;
+       return _engine.frame_rate() * 60 * 5;
 }
+