Heavy-duty abstraction work to split type-specific classes into
[ardour.git] / libs / ardour / route.cc
index f3162f9131a7a80fa529b2f3e102abbfe7e0a34c..effb8432d15171269f032802b1f1118cc54ccdb4 100644 (file)
 
 #include <cmath>
 #include <fstream>
+#include <cassert>
 
 #include <sigc++/bind.h>
 #include <pbd/xml++.h>
 
 #include <ardour/timestamps.h>
+#include <ardour/buffer.h>
 #include <ardour/audioengine.h>
 #include <ardour/route.h>
 #include <ardour/insert.h>
@@ -50,8 +52,8 @@ 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, DataType default_type)
+       : IO (sess, name, input_min, input_max, output_min, output_max, default_type),
          _flags (flg),
          _solo_control (*this, ToggleControllable::SoloControl),
          _mute_control (*this, ToggleControllable::MuteControl)
@@ -1330,6 +1332,9 @@ Route::state(bool full_state)
                snprintf (buf, sizeof (buf), "0x%x", _flags);
                node->add_property("flags", buf);
        }
+       
+       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");
@@ -1503,6 +1508,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 != NIL);
+       }
 
        if ((prop = node.property ("phase-invert")) != 0) {
                set_phase_invert(prop->value()=="yes"?true:false, this);