X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Froute_group.cc;h=826341092f63384cf41d47bb86ea4a1f459c60e9;hb=498afeb63edeb8a5ce0103296ffda4216d64186d;hp=f22deb5dbfd2c6b6420b7ae54f5339884c7856f2;hpb=449aab3c465bbbf66d221fac3d7ea559f1720357;p=ardour.git diff --git a/libs/ardour/route_group.cc b/libs/ardour/route_group.cc index f22deb5dbf..826341092f 100644 --- a/libs/ardour/route_group.cc +++ b/libs/ardour/route_group.cc @@ -24,20 +24,22 @@ #include -#include -#include +#include "pbd/error.h" +#include "pbd/enumwriter.h" -#include -#include -#include -#include +#include "ardour/amp.h" +#include "ardour/route_group.h" +#include "ardour/audio_track.h" +#include "ardour/audio_diskstream.h" +#include "ardour/configuration.h" +#include "ardour/session.h" using namespace ARDOUR; 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)) { } @@ -86,7 +88,7 @@ RouteGroup::get_min_factor(gain_t factor) gain_t g; for (list::iterator i = routes.begin(); i != routes.end(); i++) { - g = (*i)->gain(); + g = (*i)->amp()->gain(); if ( (g+g*factor) >= 0.0f) continue; @@ -105,7 +107,7 @@ RouteGroup::get_max_factor(gain_t factor) gain_t g; for (list::iterator i = routes.begin(); i != routes.end(); i++) { - g = (*i)->gain(); + g = (*i)->amp()->gain(); // if the current factor woulnd't raise this route above maximum if ( (g+g*factor) <= 1.99526231f) @@ -128,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; } @@ -144,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; } @@ -211,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 (); +}