Loading/Saving of sessions containing MIDI tracks and/or busses
[ardour.git] / libs / ardour / route.cc
index 2ed06594857838a1635efa2d8264f7392534ed2b..8ad402c66a3eb5a4b28869e8d6de4f1afa9bb4fd 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <cmath>
 #include <fstream>
+#include <cassert>
 
 #include <sigc++/bind.h>
 #include <pbd/xml++.h>
 
 using namespace std;
 using namespace ARDOUR;
-//using namespace sigc;
+using namespace PBD;
 
 
 uint32_t Route::order_key_cnt = 0;
 
 
-Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg)
-       : IO (sess, name, input_min, input_max, output_min, output_max),
+Route::Route (Session& sess, string name, int input_min, int input_max, int output_min, int output_max, Flag flg, Buffer::Type default_type)
+       : IO (sess, name, input_min, input_max, output_min, output_max, default_type),
          _flags (flg),
          _midi_solo_control (*this, MIDIToggleControl::SoloControl, _session.midi_port()),
          _midi_mute_control (*this, MIDIToggleControl::MuteControl, _session.midi_port())
@@ -1346,6 +1347,10 @@ Route::state(bool full_state)
                snprintf (buf, sizeof (buf), "0x%x", _flags);
                node->add_property("flags", buf);
        }
+       
+       // FIXME: assumes there's only audio and MIDI types
+       node->add_property("default-type", Buffer::type_to_string(_default_type));
+
        node->add_property("active", _active?"yes":"no");
        node->add_property("muted", _muted?"yes":"no");
        node->add_property("soloed", _soloed?"yes":"no");
@@ -1541,6 +1546,11 @@ Route::set_state (const XMLNode& node)
        } else {
                _flags = Flag (0);
        }
+       
+       if ((prop = node.property ("default-type")) != 0) {
+               _default_type = Buffer::type_from_string(prop->value());
+               assert(_default_type != Buffer::NIL);
+       }
 
        if ((prop = node.property ("phase-invert")) != 0) {
                set_phase_invert(prop->value()=="yes"?true:false, this);