Stop saving of garbage values to LADSPA preset files when an output parameter is...
[ardour.git] / libs / ardour / route_group.cc
index 9dbdad33d46fefb27d762c21a74b85ba7ee64240..ce760563acef7b480ccd3eb85f60e77451b63e71 100644 (file)
@@ -17,7 +17,6 @@
 
 */
 
-#define __STDC_FORMAT_MACROS
 #include <inttypes.h>
 
 #include <algorithm>
@@ -51,6 +50,7 @@ namespace ARDOUR {
                PropertyDescriptor<bool> recenable;
                PropertyDescriptor<bool> select;
                PropertyDescriptor<bool> edit;
+               PropertyDescriptor<bool> route_active;
        }       
 }
 
@@ -75,6 +75,8 @@ RouteGroup::make_property_quarks ()
         DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for select = %1\n",     Properties::select.property_id));
        Properties::edit.property_id = g_quark_from_static_string (X_("edit"));
         DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for edit = %1\n",       Properties::edit.property_id));
+       Properties::route_active.property_id = g_quark_from_static_string (X_("route-active"));
+        DEBUG_TRACE (DEBUG::Properties, string_compose ("quark for route-active = %1\n", Properties::route_active.property_id));
 }
 
 #define ROUTE_GROUP_DEFAULT_PROPERTIES  _relative (Properties::relative, false) \
@@ -85,7 +87,8 @@ RouteGroup::make_property_quarks ()
        , _solo (Properties::solo, false) \
        , _recenable (Properties::recenable, false) \
        , _select (Properties::select, false) \
-       , _edit (Properties::edit, false)
+       , _edit (Properties::edit, false) \
+       , _route_active (Properties::route_active, false)
 
 RouteGroup::RouteGroup (Session& s, const string &n)
        : SessionObject (s, n)
@@ -103,6 +106,7 @@ RouteGroup::RouteGroup (Session& s, const string &n)
        add_property (_recenable);
        add_property (_select);
        add_property (_edit);
+       add_property (_route_active);
 }
 
 RouteGroup::~RouteGroup ()
@@ -268,12 +272,14 @@ RouteGroup::set_state_2X (const XMLNode& node, int /*version*/)
                _solo = true;
                _recenable = true;
                _edit = false;
+               _route_active = true;
        } else if (node.name() == "EditGroup") {
                _gain = false;
                _mute = false;
                _solo = false;
                _recenable = false;
                _edit = true;
+               _route_active = false;
        }
 
        return 0;
@@ -333,6 +339,15 @@ RouteGroup::set_edit (bool yn)
        _edit = yn;
 }
 
+void
+RouteGroup::set_route_active (bool yn)
+{
+       if (is_route_active() == yn) {
+               return;
+       }
+       _route_active = yn;
+}
+
 void
 RouteGroup::set_active (bool yn, void* /*src*/)
 {
@@ -388,7 +403,7 @@ RouteGroup::audio_track_group (set<boost::shared_ptr<AudioTrack> >& ats)
 }
 
 void
-RouteGroup::make_subgroup ()
+RouteGroup::make_subgroup (bool aux, Placement placement)
 {
        RouteList rl;
        uint32_t nin = 0;
@@ -408,7 +423,7 @@ RouteGroup::make_subgroup ()
 
        try {
                /* use master bus etc. to determine default nouts */
-               rl = _session.new_audio_route (false, nin, 2, 0, 1);
+               rl = _session.new_audio_route (nin, 2, 0, 1);
        } catch (...) {
                return;
        }
@@ -416,11 +431,18 @@ RouteGroup::make_subgroup ()
        subgroup_bus = rl.front();
        subgroup_bus->set_name (_name);
 
-       boost::shared_ptr<Bundle> bundle = subgroup_bus->input()->bundle ();
+       if (aux) {
 
-       for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
-               (*i)->output()->disconnect (this);
-               (*i)->output()->connect_ports_to_bundle (bundle, this);
+               _session.add_internal_sends (subgroup_bus, placement, routes);
+
+       } else {
+
+               boost::shared_ptr<Bundle> bundle = subgroup_bus->input()->bundle ();
+               
+               for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
+                       (*i)->output()->disconnect (this);
+                       (*i)->output()->connect_ports_to_bundle (bundle, this);
+               }
        }
 }