X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Froute_group.cc;h=826341092f63384cf41d47bb86ea4a1f459c60e9;hb=498afeb63edeb8a5ce0103296ffda4216d64186d;hp=438d0395d01c8ecf007947bd919d0843ff395abd;hpb=e6eb059576eefd9a26c177627ae7dd3ba2feb727;p=ardour.git diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index 438d0395d0..826341092f 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -39,7 +39,7 @@ using namespace sigc; using namespace std; RouteGroup::RouteGroup (Session& s, const string &n, Flag f) - : _session (s), _name (n), _flags (f) + : _session (s), _name (n), _flags (f), _properties (Property (0)) { } @@ -130,6 +130,7 @@ RouteGroup::get_state (void) XMLNode *node = new XMLNode ("RouteGroup"); node->add_property ("name", _name); node->add_property ("flags", enum_2_string (_flags)); + node->add_property ("properties", enum_2_string (_properties)); return *node; } @@ -146,6 +147,10 @@ RouteGroup::set_state (const XMLNode& node) _flags = Flag (string_2_enum (prop->value(), _flags)); } + if ((prop = node.property ("properties")) != 0) { + _properties = Property (string_2_enum (prop->value(), _properties)); + } + return 0; } @@ -213,3 +218,46 @@ RouteGroup::audio_track_group (set& ats) } } +void +RouteGroup::make_subgroup () +{ + RouteList rl; + uint32_t nin = 0; + + for (list::iterator i = routes.begin(); i != routes.end(); ++i) { + nin = max (nin, (*i)->output()->n_ports().n_audio()); + } + + try { + /* use master bus etc. to determine default nouts */ + rl = _session.new_audio_route (nin, 2, 0, 1); + } catch (...) { + return; + } + + subgroup_bus = rl.front(); + subgroup_bus->set_name (_name); + + boost::shared_ptr bundle = subgroup_bus->input()->bundle (); + + for (list::iterator i = routes.begin(); i != routes.end(); ++i) { + (*i)->output()->disconnect (this); + (*i)->output()->connect_ports_to_bundle (bundle, this); + } +} + +void +RouteGroup::destroy_subgroup () +{ + if (!subgroup_bus) { + return; + } + + for (list::iterator i = routes.begin(); i != routes.end(); ++i) { + (*i)->output()->disconnect (this); + /* XXX find a new bundle to connect to */ + } + + _session.remove_route (subgroup_bus); + subgroup_bus.reset (); +}