debugging output
[ardour.git] / libs / ardour / session.cc
index e41ad6285079cc22c17a6a4561953aafcc0da540..19bfa295bf88c3461b4c01499a1040ef423c58f7 100644 (file)
@@ -63,6 +63,7 @@
 #include "ardour/butler.h"
 #include "ardour/click.h"
 #include "ardour/configuration.h"
+#include "ardour/control_protocol_manager.h"
 #include "ardour/crossfade.h"
 #include "ardour/cycle_timer.h"
 #include "ardour/data_type.h"
@@ -299,7 +300,7 @@ Session::destroy ()
 
        DEBUG_TRACE (DEBUG::Destruction, "delete sources\n");
        for (SourceMap::iterator i = sources.begin(); i != sources.end(); ++i) {
-               DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for source %1 ; pre-ref = %2\n", i->second->path(), i->second.use_count()));
+               DEBUG_TRACE(DEBUG::Destruction, string_compose ("Dropping for source %1 ; pre-ref = %2\n", i->second->name(), i->second.use_count()));
                i->second->drop_references ();
        }
 
@@ -517,6 +518,17 @@ Session::when_engine_running ()
 
        BootMessage (_("Setup signal flow and plugins"));
 
+       ControlProtocolManager::instance().set_session (this);
+
+       /* This must be done after the ControlProtocolManager set_session above,
+          as it will set states for ports which the ControlProtocolManager creates.
+       */
+       MIDI::Manager::instance()->set_port_states (Config->midi_port_states ());
+
+       /* And this must be done after the MIDI::Manager::set_port_states as
+        * it will try to make connections whose details are loaded by set_port_states.
+        */
+
        hookup_io ();
 
        if (_is_new && !no_auto_connect()) {
@@ -596,18 +608,20 @@ Session::when_engine_running ()
 
                                } else {
 
-                                       for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
-                                               uint32_t mod = n_physical_outputs.get (*t);
-                                               uint32_t limit = _monitor_out->n_outputs().get(*t);
+                                       /* Monitor bus is audio only */
+                                       uint32_t mod = n_physical_outputs.get (DataType::AUDIO);
+                                       uint32_t limit = _monitor_out->n_outputs().get (DataType::AUDIO);
 
+                                       if (mod != 0) {
+                                               
                                                for (uint32_t n = 0; n < limit; ++n) {
 
-                                                       Port* p = _monitor_out->output()->ports().port(*t, n);
+                                                       Port* p = _monitor_out->output()->ports().port(DataType::AUDIO, n);
                                                        string connect_to;
-                                                       if (outputs[*t].size() > (n % mod)) {
-                                                               connect_to = outputs[*t][n % mod];
+                                                       if (outputs[DataType::AUDIO].size() > (n % mod)) {
+                                                               connect_to = outputs[DataType::AUDIO][n % mod];
                                                        }
-
+                                                       
                                                        if (!connect_to.empty()) {
                                                                if (_monitor_out->output()->connect (p, connect_to, this)) {
                                                                        error << string_compose (
@@ -2520,6 +2534,8 @@ Session::playlist_region_added (boost::weak_ptr<Region> w)
        ops.push_back (Operations::region_fill);
        ops.push_back (Operations::fill_selection);
        ops.push_back (Operations::create_region);
+       ops.push_back (Operations::region_copy);
+       ops.push_back (Operations::fixed_time_region_copy);
        ops.sort ();
 
        /* See if any of the current operations match the ones that we want */
@@ -3646,7 +3662,7 @@ Session::write_one_track (AudioTrack& track, framepos_t start, framepos_t end,
 
                for (x = 0; x < 99999; ++x) {
                        snprintf (buf, sizeof(buf), "%s/%s-%d-bounce-%" PRIu32 "%s", sound_dir.c_str(), playlist->name().c_str(), chan_n, x+1, ext.c_str());
-                       if (access (buf, F_OK) != 0) {
+                       if (!Glib::file_test (buf, Glib::FILE_TEST_EXISTS)) {
                                break;
                        }
                }