mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-03 20:29:35 +01:00
Use shared_ptr to manage RouteGroups everywhere (libs edition)
This also drops Session::_all_route_group which was not used, and makes a little more use of PBD::Unwinder in a few route group-related contexts.
This commit is contained in:
parent
0f9e0afd2b
commit
371bb416a0
20 changed files with 129 additions and 143 deletions
|
|
@ -69,12 +69,11 @@ class Session;
|
|||
*
|
||||
* A route can at most be in one group.
|
||||
*/
|
||||
class LIBARDOUR_API RouteGroup : public SessionObject
|
||||
class LIBARDOUR_API RouteGroup : public SessionObject, public std::enable_shared_from_this<RouteGroup>
|
||||
{
|
||||
public:
|
||||
public:
|
||||
static void make_property_quarks();
|
||||
|
||||
RouteGroup (Session& s, const std::string &n);
|
||||
~RouteGroup ();
|
||||
|
||||
bool is_active () const { return _active.val(); }
|
||||
|
|
@ -117,12 +116,7 @@ public:
|
|||
int add (std::shared_ptr<Route>);
|
||||
int remove (std::shared_ptr<Route>);
|
||||
|
||||
template<typename Function>
|
||||
void foreach_route (Function f) {
|
||||
for (RouteList::iterator i = routes->begin(); i != routes->end(); ++i) {
|
||||
f (i->get());
|
||||
}
|
||||
}
|
||||
template<typename Function> void foreach_route (Function f) { for (auto & r : *routes) {f (r); } }
|
||||
|
||||
/* to use these, #include "ardour/route_group_specialized.h" */
|
||||
|
||||
|
|
@ -145,9 +139,9 @@ public:
|
|||
std::shared_ptr<RouteList> route_list() { return routes; }
|
||||
|
||||
/** Emitted when a route has been added to this group */
|
||||
PBD::Signal<void(RouteGroup *, std::weak_ptr<ARDOUR::Route> )> RouteAdded;
|
||||
PBD::Signal<void(std::shared_ptr<RouteGroup>, std::weak_ptr<ARDOUR::Route> )> RouteAdded;
|
||||
/** Emitted when a route has been removed from this group */
|
||||
static PBD::Signal<void(RouteGroup *, std::weak_ptr<ARDOUR::Route> )> RouteRemoved;
|
||||
static PBD::Signal<void(std::shared_ptr<RouteGroup>, std::weak_ptr<ARDOUR::Route> )> RouteRemoved;
|
||||
|
||||
XMLNode& get_state () const;
|
||||
|
||||
|
|
@ -167,7 +161,11 @@ public:
|
|||
* to libardour color */
|
||||
void migrate_rgba (uint32_t color) { _rgba = color; }
|
||||
|
||||
private:
|
||||
protected:
|
||||
friend class Session;
|
||||
RouteGroup (Session& s, const std::string &n);
|
||||
|
||||
private:
|
||||
std::shared_ptr<RouteList> routes;
|
||||
std::shared_ptr<Route> _subgroup_bus;
|
||||
std::weak_ptr<VCA> group_master;
|
||||
|
|
|
|||
|
|
@ -21,12 +21,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "ardour/libardour_visibility.h"
|
||||
|
||||
#include "pbd/controllable.h"
|
||||
#include "pbd/signals.h"
|
||||
|
||||
#include "ardour/route_group.h"
|
||||
|
||||
namespace ARDOUR {
|
||||
|
||||
class RouteGroup;
|
||||
//class RouteGroup;
|
||||
|
||||
class LIBARDOUR_API RouteGroupMember
|
||||
{
|
||||
|
|
@ -34,18 +37,18 @@ class LIBARDOUR_API RouteGroupMember
|
|||
RouteGroupMember () : _route_group (0) {}
|
||||
virtual ~RouteGroupMember() {}
|
||||
|
||||
RouteGroup* route_group () const { return _route_group; }
|
||||
std::shared_ptr<RouteGroup> route_group () const { return _route_group ? _route_group : nullptr; }
|
||||
|
||||
/** Emitted when this member joins or leaves a route group */
|
||||
PBD::Signal<void()> route_group_changed;
|
||||
|
||||
protected:
|
||||
RouteGroup* _route_group;
|
||||
std::shared_ptr<RouteGroup> _route_group;
|
||||
|
||||
private:
|
||||
friend class RouteGroup;
|
||||
|
||||
void set_route_group (RouteGroup *);
|
||||
void set_route_group (std::shared_ptr<RouteGroup>);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class LIBARDOUR_API CoreSelection : public PBD::Stateful {
|
|||
CoreSelection (Session& s);
|
||||
~CoreSelection ();
|
||||
|
||||
bool select_stripable_and_maybe_group (std::shared_ptr<Stripable> s, SelectionOperation op, bool with_group = true, bool routes_only = true, RouteGroup* = nullptr);
|
||||
bool select_stripable_and_maybe_group (std::shared_ptr<Stripable> s, SelectionOperation op, bool with_group = true, bool routes_only = true, std::shared_ptr<RouteGroup> = nullptr);
|
||||
void select_stripable_with_control (std::shared_ptr<Stripable> s, std::shared_ptr<AutomationControl>, SelectionOperation);
|
||||
|
||||
void select_next_stripable (bool mixer_order, bool routes_only);
|
||||
|
|
@ -125,7 +125,7 @@ class LIBARDOUR_API CoreSelection : public PBD::Stateful {
|
|||
bool remove (StripableList&, std::shared_ptr<AutomationControl>);
|
||||
bool set (StripableList&, std::shared_ptr<AutomationControl>, std::vector<std::shared_ptr<Stripable> > &);
|
||||
|
||||
bool do_select (std::shared_ptr<Stripable> s, std::shared_ptr<AutomationControl> c, SelectionOperation op, bool with_group, bool routes_only, RouteGroup* not_allowed_in_group);
|
||||
bool do_select (std::shared_ptr<Stripable> s, std::shared_ptr<AutomationControl> c, SelectionOperation op, bool with_group, bool routes_only, std::shared_ptr<RouteGroup> not_allowed_in_group);
|
||||
};
|
||||
|
||||
} // namespace ARDOUR
|
||||
|
|
|
|||
|
|
@ -467,15 +467,15 @@ public:
|
|||
/** Emitted when a property of one of our route groups changes.
|
||||
* The parameter is the RouteGroup that has changed.
|
||||
*/
|
||||
PBD::Signal<void(RouteGroup *)> RouteGroupPropertyChanged;
|
||||
PBD::Signal<void(std::shared_ptr<RouteGroup>)> RouteGroupPropertyChanged;
|
||||
/** Emitted when a route is added to one of our route groups.
|
||||
* First parameter is the RouteGroup, second is the route.
|
||||
*/
|
||||
PBD::Signal<void(RouteGroup *, std::weak_ptr<Route> )> RouteAddedToRouteGroup;
|
||||
PBD::Signal<void(std::shared_ptr<RouteGroup>, std::weak_ptr<Route> )> RouteAddedToRouteGroup;
|
||||
/** Emitted when a route is removed from one of our route groups.
|
||||
* First parameter is the RouteGroup, second is the route.
|
||||
*/
|
||||
PBD::Signal<void(RouteGroup *, std::weak_ptr<Route> )> RouteRemovedFromRouteGroup;
|
||||
PBD::Signal<void(std::shared_ptr<RouteGroup>, std::weak_ptr<Route> )> RouteRemovedFromRouteGroup;
|
||||
|
||||
/** Emitted when a foldback send is created or deleted
|
||||
*/
|
||||
|
|
@ -744,26 +744,24 @@ public:
|
|||
bool _reconfigure_on_delete;
|
||||
};
|
||||
|
||||
RouteGroup* new_route_group (const std::string&);
|
||||
void add_route_group (RouteGroup *);
|
||||
void remove_route_group (RouteGroup* rg) { if (rg) remove_route_group (*rg); }
|
||||
void remove_route_group (RouteGroup&);
|
||||
void reorder_route_groups (std::list<RouteGroup*>);
|
||||
std::shared_ptr<RouteGroup> new_route_group (const std::string&);
|
||||
void add_route_group (std::shared_ptr<RouteGroup>);
|
||||
void remove_route_group (std::shared_ptr<RouteGroup> rg);
|
||||
void reorder_route_groups (RouteGroupList);
|
||||
|
||||
RouteGroup* route_group_by_name (std::string);
|
||||
RouteGroup& all_route_group() const;
|
||||
std::shared_ptr<RouteGroup> route_group_by_name (std::string);
|
||||
|
||||
PBD::Signal<void(RouteGroup*)> route_group_added;
|
||||
PBD::Signal<void(std::shared_ptr<RouteGroup>)> route_group_added;
|
||||
PBD::Signal<void()> route_group_removed;
|
||||
PBD::Signal<void()> route_groups_reordered;
|
||||
|
||||
void foreach_route_group (std::function<void(RouteGroup*)> f) {
|
||||
for (std::list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
|
||||
f (*i);
|
||||
void foreach_route_group (std::function<void(std::shared_ptr<RouteGroup>)> f) {
|
||||
for (auto & rg : _route_groups) {
|
||||
f (rg);
|
||||
}
|
||||
}
|
||||
|
||||
std::list<RouteGroup*> const & route_groups () const {
|
||||
RouteGroupList const & route_groups () const {
|
||||
return _route_groups;
|
||||
}
|
||||
|
||||
|
|
@ -772,7 +770,7 @@ public:
|
|||
std::list<std::shared_ptr<AudioTrack> > new_audio_track (
|
||||
int input_channels,
|
||||
int output_channels,
|
||||
RouteGroup* route_group,
|
||||
std::shared_ptr<RouteGroup> route_group,
|
||||
uint32_t how_many,
|
||||
std::string name_template,
|
||||
PresentationInfo::order_t order,
|
||||
|
|
@ -785,15 +783,15 @@ public:
|
|||
const ChanCount& input, const ChanCount& output, bool strict_io,
|
||||
std::shared_ptr<PluginInfo> instrument,
|
||||
Plugin::PresetRecord* pset,
|
||||
RouteGroup* route_group, uint32_t how_many, std::string name_template,
|
||||
std::shared_ptr<RouteGroup> route_group, uint32_t how_many, std::string name_template,
|
||||
PresentationInfo::order_t,
|
||||
TrackMode mode,
|
||||
bool input_auto_connect,
|
||||
bool trigger_visibility = false
|
||||
);
|
||||
|
||||
RouteList new_audio_route (int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many, std::string name_template, PresentationInfo::Flag, PresentationInfo::order_t);
|
||||
RouteList new_midi_route (RouteGroup* route_group, uint32_t how_many, std::string name_template, bool strict_io, std::shared_ptr<PluginInfo> instrument, Plugin::PresetRecord*, PresentationInfo::Flag, PresentationInfo::order_t);
|
||||
RouteList new_audio_route (int input_channels, int output_channels, std::shared_ptr<RouteGroup> route_group, uint32_t how_many, std::string name_template, PresentationInfo::Flag, PresentationInfo::order_t);
|
||||
RouteList new_midi_route (std::shared_ptr<RouteGroup> route_group, uint32_t how_many, std::string name_template, bool strict_io, std::shared_ptr<PluginInfo> instrument, Plugin::PresetRecord*, PresentationInfo::Flag, PresentationInfo::order_t);
|
||||
|
||||
void remove_routes (std::shared_ptr<RouteList>);
|
||||
void remove_route (std::shared_ptr<Route>);
|
||||
|
|
@ -1947,8 +1945,7 @@ private:
|
|||
|
||||
int load_route_groups (const XMLNode&, int);
|
||||
|
||||
std::list<RouteGroup *> _route_groups;
|
||||
RouteGroup* _all_route_group;
|
||||
RouteGroupList _route_groups;
|
||||
|
||||
/* routes stuff */
|
||||
|
||||
|
|
@ -2003,9 +2000,9 @@ private:
|
|||
int load_regions (const XMLNode& node);
|
||||
int load_compounds (const XMLNode& node);
|
||||
|
||||
void route_added_to_route_group (RouteGroup *, std::weak_ptr<Route>);
|
||||
void route_removed_from_route_group (RouteGroup *, std::weak_ptr<Route>);
|
||||
void route_group_property_changed (RouteGroup *);
|
||||
void route_added_to_route_group (std::shared_ptr<RouteGroup>, std::weak_ptr<Route>);
|
||||
void route_removed_from_route_group (std::shared_ptr<RouteGroup>, std::weak_ptr<Route>);
|
||||
void route_group_property_changed (std::weak_ptr<RouteGroup>);
|
||||
|
||||
/* SOURCES */
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class Source;
|
|||
class AudioSource;
|
||||
class GraphNode;
|
||||
class Route;
|
||||
class RouteGroup;
|
||||
class Region;
|
||||
class Playlist;
|
||||
class Stripable;
|
||||
|
|
@ -103,6 +104,8 @@ typedef std::map<std::shared_ptr<ARDOUR::Region>,AudioIntervalResult> AudioInter
|
|||
|
||||
typedef std::list<std::shared_ptr<Region> > RegionList;
|
||||
typedef std::set<std::shared_ptr<Playlist> > PlaylistSet;
|
||||
typedef std::list<std::shared_ptr<RouteGroup>> RouteGroupList;
|
||||
|
||||
|
||||
struct IOChange {
|
||||
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ no_audio_tracks:
|
|||
ChanCount (DataType::MIDI, 1),
|
||||
true,
|
||||
instrument, (Plugin::PresetRecord*) 0,
|
||||
(RouteGroup*) 0,
|
||||
nullptr,
|
||||
1,
|
||||
a->trname,
|
||||
PresentationInfo::max_order,
|
||||
|
|
|
|||
|
|
@ -1376,7 +1376,8 @@ LuaBindings::common (lua_State* L)
|
|||
.addFunction ("set_bypassed", &PannerShell::set_bypassed)
|
||||
.endClass ()
|
||||
|
||||
.deriveClass <RouteGroup, SessionObject> ("RouteGroup")
|
||||
.deriveWSPtrClass <RouteGroup, SessionObject> ("RouteGroup")
|
||||
.addNilPtrConstructor ()
|
||||
.addFunction ("is_active", &RouteGroup::is_active)
|
||||
.addFunction ("is_relative", &RouteGroup::is_relative)
|
||||
.addFunction ("is_hidden", &RouteGroup::is_hidden)
|
||||
|
|
@ -2317,8 +2318,9 @@ LuaBindings::common (lua_State* L)
|
|||
.beginConstStdList <std::weak_ptr<Route> > ("WeakRouteList")
|
||||
.endClass ()
|
||||
|
||||
// RouteGroupList == std::list<RouteGroup*>
|
||||
.beginConstStdCPtrList <RouteGroup> ("RouteGroupList")
|
||||
// RouteGroupList == std::list<shared_ptr<RouteGroup>>
|
||||
.beginPtrStdList <std::shared_ptr<RouteGroup>> ("RouteGroupList")
|
||||
.addVoidPtrConstructor<std::list<std::shared_ptr <RouteGroup> > > ()
|
||||
.endClass ()
|
||||
|
||||
// typedef std::vector<std::shared_ptr<Source> > Region::SourceList
|
||||
|
|
@ -3189,7 +3191,7 @@ LuaBindings::common (lua_State* L)
|
|||
.addFunction ("maybe_update_session_range", &Session::maybe_update_session_range)
|
||||
.addFunction ("remove_route", &Session::remove_route)
|
||||
.addFunction ("remove_routes", &Session::remove_routes)
|
||||
.addFunction ("remove_route_group", (void (Session::*)(RouteGroup*))&Session::remove_route_group)
|
||||
.addFunction ("remove_route_group", &Session::remove_route_group)
|
||||
.addFunction ("cut_copy_section", &Session::cut_copy_section)
|
||||
.addFunction ("vca_manager", &Session::vca_manager_ptr)
|
||||
.addExtCFunction ("timecode_to_sample_lua", ARDOUR::LuaAPI::timecode_to_sample_lua)
|
||||
|
|
|
|||
|
|
@ -5121,8 +5121,8 @@ Route::set_active (bool yn, void* src)
|
|||
return;
|
||||
}
|
||||
|
||||
if (_route_group && src != _route_group && _route_group->is_active() && _route_group->is_route_active()) {
|
||||
_route_group->foreach_route (std::bind (&Route::set_active, _1, yn, _route_group));
|
||||
if (_route_group && src != _route_group.get() && _route_group->is_active() && _route_group->is_route_active()) {
|
||||
_route_group->foreach_route (std::bind (&Route::set_active, _1, yn, _route_group.get()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace ARDOUR {
|
|||
}
|
||||
}
|
||||
|
||||
PBD::Signal<void(RouteGroup *, std::weak_ptr<ARDOUR::Route> )> RouteGroup::RouteRemoved;
|
||||
PBD::Signal<void(std::shared_ptr<RouteGroup>, std::weak_ptr<ARDOUR::Route> )> RouteGroup::RouteRemoved;
|
||||
|
||||
void
|
||||
RouteGroup::make_property_quarks ()
|
||||
|
|
@ -200,7 +200,7 @@ RouteGroup::add (std::shared_ptr<Route> r)
|
|||
_sursend_enable_group->add_control (r->surround_send ()->send_enable_control ());
|
||||
}
|
||||
|
||||
r->set_route_group (this);
|
||||
r->set_route_group (shared_from_this());
|
||||
r->DropReferences.connect_same_thread (*this, std::bind (&RouteGroup::remove_when_going_away, this, std::weak_ptr<Route> (r)));
|
||||
|
||||
std::shared_ptr<VCA> vca (group_master.lock());
|
||||
|
|
@ -210,7 +210,7 @@ RouteGroup::add (std::shared_ptr<Route> r)
|
|||
}
|
||||
|
||||
_session.set_dirty ();
|
||||
RouteAdded (this, std::weak_ptr<Route> (r)); /* EMIT SIGNAL */
|
||||
RouteAdded (shared_from_this(), std::weak_ptr<Route> (r)); /* EMIT SIGNAL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ RouteGroup::remove (std::shared_ptr<Route> r)
|
|||
}
|
||||
routes->erase (i);
|
||||
_session.set_dirty ();
|
||||
RouteRemoved (this, std::weak_ptr<Route> (r)); /* EMIT SIGNAL */
|
||||
RouteRemoved (shared_from_this(), std::weak_ptr<Route> (r)); /* EMIT SIGNAL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace ARDOUR { class RouteGroup; }
|
|||
|
||||
/** Set the route group; it can be set to 0 for `none' */
|
||||
void
|
||||
RouteGroupMember::set_route_group (RouteGroup *rg)
|
||||
RouteGroupMember::set_route_group (std::shared_ptr<RouteGroup> rg)
|
||||
{
|
||||
if (rg == _route_group) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ using namespace ARDOUR;
|
|||
using namespace PBD;
|
||||
|
||||
bool
|
||||
CoreSelection::do_select (std::shared_ptr<Stripable> s, std::shared_ptr<AutomationControl> c, SelectionOperation op, bool with_group, bool routes_only, RouteGroup* not_allowed_in_group)
|
||||
CoreSelection::do_select (std::shared_ptr<Stripable> s, std::shared_ptr<AutomationControl> c, SelectionOperation op, bool with_group, bool routes_only, std::shared_ptr<RouteGroup> not_allowed_in_group)
|
||||
{
|
||||
std::shared_ptr<Route> r;
|
||||
StripableList sl;
|
||||
|
|
@ -68,7 +68,7 @@ CoreSelection::do_select (std::shared_ptr<Stripable> s, std::shared_ptr<Automati
|
|||
|
||||
if (!not_allowed_in_group || !r->route_group() || r->route_group() != not_allowed_in_group) {
|
||||
|
||||
RouteGroup* group = r->route_group();
|
||||
std::shared_ptr<RouteGroup> group = r->route_group();
|
||||
|
||||
if (group && group->is_select() && group->is_active()) {
|
||||
for (auto & ri : *(group->route_list())) {
|
||||
|
|
@ -129,7 +129,7 @@ CoreSelection::do_select (std::shared_ptr<Stripable> s, std::shared_ptr<Automati
|
|||
}
|
||||
|
||||
bool
|
||||
CoreSelection::select_stripable_and_maybe_group (std::shared_ptr<Stripable> s, SelectionOperation op, bool with_group, bool routes_only, RouteGroup* not_allowed_in_group)
|
||||
CoreSelection::select_stripable_and_maybe_group (std::shared_ptr<Stripable> s, SelectionOperation op, bool with_group, bool routes_only, std::shared_ptr<RouteGroup> not_allowed_in_group)
|
||||
{
|
||||
return do_select (s, nullptr, op, with_group, routes_only, not_allowed_in_group);
|
||||
}
|
||||
|
|
@ -196,7 +196,7 @@ CoreSelection::select_adjacent_stripable (bool mixer_order, bool routes_only,
|
|||
|
||||
/* Check for a possible selection-affecting route group */
|
||||
|
||||
RouteGroup* group = 0;
|
||||
std::shared_ptr<RouteGroup> group;
|
||||
std::shared_ptr<Route> r = std::dynamic_pointer_cast<Route> (last_selected);
|
||||
|
||||
if (r && r->route_group() && r->route_group()->is_select() && r->route_group()->is_active()) {
|
||||
|
|
@ -634,9 +634,9 @@ CoreSelection::get_stripables_for_op (StripableList& sl, std::shared_ptr<Stripab
|
|||
if (_stripables.empty()) {
|
||||
|
||||
if (r) {
|
||||
RouteGroup* rg = r->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = r->route_group();
|
||||
|
||||
if (rg && rg->is_active() && (rg->*group_predicate)()) {
|
||||
if (rg && rg->is_active() && ((rg.get())->*group_predicate)()) {
|
||||
for (auto & r : *rg->route_list()) {
|
||||
sl.push_back (r);
|
||||
}
|
||||
|
|
@ -671,9 +671,9 @@ CoreSelection::get_stripables_for_op (StripableList& sl, std::shared_ptr<Stripab
|
|||
/* target not selected but might be part of a group */
|
||||
|
||||
if (r) {
|
||||
RouteGroup* rg = r->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = r->route_group();
|
||||
|
||||
if (rg && rg->is_active() && (rg->*group_predicate)()) {
|
||||
if (rg && rg->is_active() && ((rg.get())->*group_predicate)()) {
|
||||
for (auto & r : *rg->route_list()) {
|
||||
sl.push_back (r);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -307,7 +307,6 @@ Session::Session (AudioEngine &eng,
|
|||
, ltc_timecode_negative_offset (false)
|
||||
, midi_control_ui (0)
|
||||
, _punch_or_loop (NoConstraint)
|
||||
, _all_route_group (new RouteGroup (*this, "all"))
|
||||
, routes (new RouteList)
|
||||
, _adding_routes_in_progress (false)
|
||||
, _reconnecting_routes_in_progress (false)
|
||||
|
|
@ -750,12 +749,8 @@ Session::destroy ()
|
|||
delete _butler;
|
||||
_butler = 0;
|
||||
|
||||
delete _all_route_group;
|
||||
|
||||
DEBUG_TRACE (DEBUG::Destruction, "delete route groups\n");
|
||||
for (list<RouteGroup *>::iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
|
||||
delete *i;
|
||||
}
|
||||
_route_groups.clear ();
|
||||
|
||||
if (click_data != default_click) {
|
||||
delete [] click_data;
|
||||
|
|
@ -2749,7 +2744,7 @@ Session::default_track_name_pattern (DataType t)
|
|||
list<std::shared_ptr<MidiTrack> >
|
||||
Session::new_midi_track (const ChanCount& input, const ChanCount& output, bool strict_io,
|
||||
std::shared_ptr<PluginInfo> instrument, Plugin::PresetRecord* pset,
|
||||
RouteGroup* route_group, uint32_t how_many,
|
||||
std::shared_ptr<RouteGroup> route_group, uint32_t how_many,
|
||||
string name_template, PresentationInfo::order_t order,
|
||||
TrackMode mode, bool input_auto_connect,
|
||||
bool trigger_visibility)
|
||||
|
|
@ -2838,7 +2833,7 @@ Session::new_midi_track (const ChanCount& input, const ChanCount& output, bool s
|
|||
}
|
||||
|
||||
RouteList
|
||||
Session::new_midi_route (RouteGroup* route_group, uint32_t how_many, string name_template, bool strict_io,
|
||||
Session::new_midi_route (std::shared_ptr<RouteGroup> route_group, uint32_t how_many, string name_template, bool strict_io,
|
||||
std::shared_ptr<PluginInfo> instrument, Plugin::PresetRecord* pset,
|
||||
PresentationInfo::Flag flag, PresentationInfo::order_t order)
|
||||
{
|
||||
|
|
@ -3010,7 +3005,7 @@ Session::ensure_route_presentation_info_gap (PresentationInfo::order_t first_new
|
|||
* @param name_template string to use for the start of the name, or "" to use "Audio".
|
||||
*/
|
||||
list< std::shared_ptr<AudioTrack> >
|
||||
Session::new_audio_track (int input_channels, int output_channels, RouteGroup* route_group,
|
||||
Session::new_audio_track (int input_channels, int output_channels, std::shared_ptr<RouteGroup> route_group,
|
||||
uint32_t how_many, string name_template, PresentationInfo::order_t order,
|
||||
TrackMode mode, bool input_auto_connect,
|
||||
bool trigger_visibility)
|
||||
|
|
@ -3102,7 +3097,7 @@ Session::new_audio_track (int input_channels, int output_channels, RouteGroup* r
|
|||
* @param name_template string to use for the start of the name, or "" to use "Bus".
|
||||
*/
|
||||
RouteList
|
||||
Session::new_audio_route (int input_channels, int output_channels, RouteGroup* route_group, uint32_t how_many, string name_template,
|
||||
Session::new_audio_route (int input_channels, int output_channels, std::shared_ptr<RouteGroup> route_group, uint32_t how_many, string name_template,
|
||||
PresentationInfo::Flag flags, PresentationInfo::order_t order)
|
||||
{
|
||||
string bus_name;
|
||||
|
|
@ -3964,7 +3959,7 @@ Session::route_listen_changed (Controllable::GroupControlDisposition group_overr
|
|||
|
||||
_engine.monitor_port().clear_ports (false);
|
||||
|
||||
RouteGroup* rg = route->route_group ();
|
||||
std::shared_ptr<RouteGroup> rg (route->route_group ());
|
||||
const bool group_already_accounted_for = (group_override == Controllable::ForGroup);
|
||||
|
||||
std::shared_ptr<RouteList const> r = routes.reader ();
|
||||
|
|
@ -4073,7 +4068,7 @@ Session::route_solo_changed (bool self_solo_changed, Controllable::GroupControlD
|
|||
* belongs to.
|
||||
*/
|
||||
|
||||
RouteGroup* rg = route->route_group ();
|
||||
std::shared_ptr<RouteGroup> rg = route->route_group ();
|
||||
const bool group_already_accounted_for = (group_override == Controllable::ForGroup);
|
||||
|
||||
DEBUG_TRACE (DEBUG::Solo, string_compose ("propagate to session, group accounted for ? %1\n", group_already_accounted_for));
|
||||
|
|
@ -6812,27 +6807,30 @@ Session::solo_control_mode_changed ()
|
|||
|
||||
/** Called when a property of one of our route groups changes */
|
||||
void
|
||||
Session::route_group_property_changed (RouteGroup* rg)
|
||||
Session::route_group_property_changed (std::weak_ptr<RouteGroup> wrg)
|
||||
{
|
||||
RouteGroupPropertyChanged (rg); /* EMIT SIGNAL */
|
||||
std::shared_ptr<RouteGroup> rg (wrg.lock());
|
||||
if (rg) {
|
||||
RouteGroupPropertyChanged (rg); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
||||
/** Called when a route is added to one of our route groups */
|
||||
void
|
||||
Session::route_added_to_route_group (RouteGroup* rg, std::weak_ptr<Route> r)
|
||||
Session::route_added_to_route_group (std::shared_ptr<RouteGroup> rg, std::weak_ptr<Route> r)
|
||||
{
|
||||
RouteAddedToRouteGroup (rg, r);
|
||||
}
|
||||
|
||||
/** Called when a route is removed from one of our route groups */
|
||||
void
|
||||
Session::route_removed_from_route_group (RouteGroup* rg, std::weak_ptr<Route> r)
|
||||
Session::route_removed_from_route_group (std::shared_ptr<RouteGroup> rg, std::weak_ptr<Route> r)
|
||||
{
|
||||
update_route_record_state ();
|
||||
RouteRemovedFromRouteGroup (rg, r); /* EMIT SIGNAL */
|
||||
|
||||
if (!rg->has_control_master () && !rg->has_subgroup () && rg->empty()) {
|
||||
remove_route_group (*rg);
|
||||
remove_route_group (rg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -815,7 +815,7 @@ Session::rewire_selected_midi (std::shared_ptr<MidiTrack> new_midi_target)
|
|||
/* connect it to the new target */
|
||||
new_midi_target->input()->connect (new_midi_target->input()->nth(0), (*p), this);
|
||||
/* and grouped tracks */
|
||||
RouteGroup* group = new_midi_target->route_group ();
|
||||
std::shared_ptr<RouteGroup> group = new_midi_target->route_group ();
|
||||
if (group && group->is_active () && group->is_select ()) {
|
||||
for (auto const& r : *group->route_list ()) {
|
||||
if (dynamic_pointer_cast<MidiTrack> (r)) {
|
||||
|
|
@ -859,7 +859,7 @@ Session::rewire_midi_selection_ports ()
|
|||
disconnect_port_for_rewire (*p);
|
||||
target->input()->connect (target->input()->nth (0), (*p), this);
|
||||
|
||||
RouteGroup* group = target->route_group ();
|
||||
std::shared_ptr<RouteGroup> group = target->route_group ();
|
||||
if (group && group->is_active () && group->is_select ()) {
|
||||
for (auto const& r : *group->route_list ()) {
|
||||
if (dynamic_pointer_cast<MidiTrack> (r)) {
|
||||
|
|
|
|||
|
|
@ -184,7 +184,6 @@ Session::pre_engine_init (string fullpath)
|
|||
_playback_load.store (100);
|
||||
_capture_load.store (100);
|
||||
set_next_event ();
|
||||
_all_route_group->set_active (true, this);
|
||||
|
||||
if (config.get_use_video_sync()) {
|
||||
waiting_for_sync_offset = true;
|
||||
|
|
@ -1399,16 +1398,16 @@ Session::import_route_state (const string& path, std::map<PBD::ID, PBD::ID> cons
|
|||
}
|
||||
/* set route-group */
|
||||
if (r && route_groupname.find (src) != route_groupname.end ()) {
|
||||
RouteGroup* rg;
|
||||
std::shared_ptr<RouteGroup> rg;
|
||||
switch (rgim) {
|
||||
case IgnoreRouteGroup:
|
||||
rg = nullptr;
|
||||
break;
|
||||
case UseRouteGroup:
|
||||
rg = route_group_by_name (route_groupname[src]);
|
||||
break;
|
||||
case CreateRouteGroup:
|
||||
rg = new_route_group (route_groupname[src]);
|
||||
add_route_group (rg);
|
||||
break;
|
||||
}
|
||||
if (rg) {
|
||||
|
|
@ -1800,8 +1799,8 @@ Session::state (bool save_template, snapshot_t snapshot_type, bool for_archive,
|
|||
_playlists->add_state (node, save_template, !only_used_assets);
|
||||
|
||||
child = node->add_child ("RouteGroups");
|
||||
for (list<RouteGroup *>::const_iterator i = _route_groups.begin(); i != _route_groups.end(); ++i) {
|
||||
child->add_child_nocopy ((*i)->get_state());
|
||||
for (auto const & rg : _route_groups) {
|
||||
child->add_child_nocopy (rg->get_state());
|
||||
}
|
||||
|
||||
if (_click_io) {
|
||||
|
|
@ -2052,7 +2051,7 @@ Session::set_state (const XMLNode& node, int version)
|
|||
if ((child = find_named_node (node, "ProgramVersion")) != 0) {
|
||||
child->get_property (X_("created-with"), created_with);
|
||||
|
||||
child->get_property (X_("modified-with"), modified_with);
|
||||
child->get_property (X_("modified-with"), modified_with);
|
||||
#if 0
|
||||
if (modified_with.rfind (PROGRAM_NAME, 0) != 0) {
|
||||
throw WrongProgram (modified_with);
|
||||
|
|
@ -3482,7 +3481,7 @@ Session::load_route_groups (const XMLNode& node, int version)
|
|||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
if ((*niter)->name() == "RouteGroup") {
|
||||
RouteGroup* rg = new RouteGroup (*this, "");
|
||||
std::shared_ptr<RouteGroup> rg (new RouteGroup (*this, ""));
|
||||
add_route_group (rg);
|
||||
rg->set_state (**niter, version);
|
||||
}
|
||||
|
|
@ -3492,7 +3491,7 @@ Session::load_route_groups (const XMLNode& node, int version)
|
|||
|
||||
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
|
||||
if ((*niter)->name() == "EditGroup" || (*niter)->name() == "MixGroup") {
|
||||
RouteGroup* rg = new RouteGroup (*this, "");
|
||||
std::shared_ptr<RouteGroup> rg (new RouteGroup (*this, ""));
|
||||
add_route_group (rg);
|
||||
rg->set_state (**niter, version);
|
||||
}
|
||||
|
|
@ -3547,46 +3546,49 @@ Session::possible_states () const
|
|||
return possible_states(_path);
|
||||
}
|
||||
|
||||
RouteGroup*
|
||||
std::shared_ptr<RouteGroup>
|
||||
Session::new_route_group (const std::string& name)
|
||||
{
|
||||
RouteGroup* rg = NULL;
|
||||
std::shared_ptr<RouteGroup> rg;
|
||||
|
||||
for (std::list<RouteGroup*>::const_iterator i = _route_groups.begin (); i != _route_groups.end (); ++i) {
|
||||
if ((*i)->name () == name) {
|
||||
rg = *i;
|
||||
for (auto const & grp : _route_groups) {
|
||||
if (grp->name () == name) {
|
||||
rg = grp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rg) {
|
||||
rg = new RouteGroup (*this, name);
|
||||
add_route_group (rg);
|
||||
rg.reset (new RouteGroup (*this, name));
|
||||
}
|
||||
return (rg);
|
||||
|
||||
return rg;
|
||||
}
|
||||
|
||||
void
|
||||
Session::add_route_group (RouteGroup* g)
|
||||
Session::add_route_group (std::shared_ptr<RouteGroup> g)
|
||||
{
|
||||
_route_groups.push_back (g);
|
||||
route_group_added (g); /* EMIT SIGNAL */
|
||||
|
||||
g->RouteAdded.connect_same_thread (*this, std::bind (&Session::route_added_to_route_group, this, _1, _2));
|
||||
g->PropertyChanged.connect_same_thread (*this, std::bind (&Session::route_group_property_changed, this, g));
|
||||
|
||||
|
||||
/* Cannot bind std::shared_ptr<> to a signal connection because of lifetime issues */
|
||||
std::weak_ptr<RouteGroup> wrg (g);
|
||||
g->PropertyChanged.connect_same_thread (*this, std::bind (&Session::route_group_property_changed, this, wrg));
|
||||
|
||||
set_dirty ();
|
||||
}
|
||||
|
||||
void
|
||||
Session::remove_route_group (RouteGroup& rg)
|
||||
Session::remove_route_group (std::shared_ptr<RouteGroup> rg)
|
||||
{
|
||||
list<RouteGroup*>::iterator i;
|
||||
list<std::shared_ptr<RouteGroup>>::iterator i;
|
||||
|
||||
if ((i = find (_route_groups.begin(), _route_groups.end(), &rg)) != _route_groups.end()) {
|
||||
if ((i = find (_route_groups.begin(), _route_groups.end(), rg)) != _route_groups.end()) {
|
||||
_route_groups.erase (i);
|
||||
delete &rg;
|
||||
|
||||
rg->drop_references ();
|
||||
route_group_removed (); /* EMIT SIGNAL */
|
||||
}
|
||||
}
|
||||
|
|
@ -3595,7 +3597,7 @@ Session::remove_route_group (RouteGroup& rg)
|
|||
* @param groups Route group list in the new order.
|
||||
*/
|
||||
void
|
||||
Session::reorder_route_groups (list<RouteGroup*> groups)
|
||||
Session::reorder_route_groups (RouteGroupList groups)
|
||||
{
|
||||
_route_groups = groups;
|
||||
|
||||
|
|
@ -3604,25 +3606,17 @@ Session::reorder_route_groups (list<RouteGroup*> groups)
|
|||
}
|
||||
|
||||
|
||||
RouteGroup *
|
||||
std::shared_ptr<RouteGroup>
|
||||
Session::route_group_by_name (string name)
|
||||
{
|
||||
list<RouteGroup *>::iterator i;
|
||||
|
||||
for (i = _route_groups.begin(); i != _route_groups.end(); ++i) {
|
||||
if ((*i)->name() == name) {
|
||||
return* i;
|
||||
for (auto & rg : _route_groups) {
|
||||
if (rg->name() == name) {
|
||||
return rg;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
RouteGroup&
|
||||
Session::all_route_group() const
|
||||
{
|
||||
return *_all_route_group;
|
||||
}
|
||||
|
||||
static bool
|
||||
accept_all_audio_files (const string& path, void* /*arg*/)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2478,7 +2478,7 @@ OSC::parse_sel_group (const char *path, const char* types, lo_arg **argv, int ar
|
|||
PBD::warning << "OSC: VCAs can not be part of a group." << endmsg;
|
||||
return ret;
|
||||
}
|
||||
RouteGroup *rg = rt->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = rt->route_group();
|
||||
if (!rg) {
|
||||
PBD::warning << "OSC: This strip is not part of a group." << endmsg;
|
||||
}
|
||||
|
|
@ -2621,7 +2621,7 @@ OSC::set_temp_mode (lo_address addr)
|
|||
if (sur->temp_mode == GroupOnly) {
|
||||
std::shared_ptr<Route> rt = std::dynamic_pointer_cast<Route> (s);
|
||||
if (rt) {
|
||||
RouteGroup *rg = rt->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = rt->route_group();
|
||||
if (rg) {
|
||||
sur->temp_strips.clear();
|
||||
std::shared_ptr<RouteList> rl = rg->route_list();
|
||||
|
|
@ -3257,9 +3257,8 @@ OSC::send_group_list (lo_address addr)
|
|||
|
||||
lo_message_add_string (reply, X_("none"));
|
||||
|
||||
std::list<RouteGroup*> groups = session->route_groups ();
|
||||
for (std::list<RouteGroup *>::iterator i = groups.begin(); i != groups.end(); ++i) {
|
||||
RouteGroup *rg = *i;
|
||||
RouteGroupList groups = session->route_groups ();
|
||||
for (auto const & rg : groups) {
|
||||
lo_message_add_string (reply, rg->name().c_str());
|
||||
}
|
||||
lo_send_message (addr, X_("/group/list"), reply);
|
||||
|
|
@ -3996,7 +3995,7 @@ OSC::_strip_parse (const char *path, const char *sub_path, const char* types, lo
|
|||
else if (!strncmp (sub_path, X_("group"), 5)) {
|
||||
if (!control_disabled) {
|
||||
if (rt) {
|
||||
RouteGroup *rg = rt->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = rt->route_group();
|
||||
if (argc > (param_1)) {
|
||||
if (types[param_1] == 's') {
|
||||
|
||||
|
|
@ -4005,12 +4004,12 @@ OSC::_strip_parse (const char *path, const char *sub_path, const char* types, lo
|
|||
strng = "none";
|
||||
}
|
||||
|
||||
RouteGroup* new_rg = session->route_group_by_name (strng);
|
||||
std::shared_ptr<RouteGroup> new_rg = session->route_group_by_name (strng);
|
||||
if (rg) {
|
||||
string old_group = rg->name();
|
||||
if (strng == "none") {
|
||||
if (rg->size () == 1) {
|
||||
session->remove_route_group (*rg);
|
||||
session->remove_route_group (rg);
|
||||
} else {
|
||||
rg->remove (rt);
|
||||
}
|
||||
|
|
@ -4040,8 +4039,7 @@ OSC::_strip_parse (const char *path, const char *sub_path, const char* types, lo
|
|||
ret = 0;
|
||||
} else {
|
||||
// create new group with this strip in it
|
||||
RouteGroup* new_rg = new RouteGroup (*session, strng);
|
||||
session->add_route_group (new_rg);
|
||||
std::shared_ptr<RouteGroup> new_rg (session->new_route_group (strng));
|
||||
new_rg->add (rt);
|
||||
ret = 0;
|
||||
}
|
||||
|
|
@ -4606,7 +4604,7 @@ OSC::spill (const char *path, const char* types, lo_arg **argv, int argc, lo_mes
|
|||
if (strstr (path, X_("/group"))) {
|
||||
//strp must be in a group
|
||||
if (rt) {
|
||||
RouteGroup *rg = rt->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = rt->route_group();
|
||||
if (rg) {
|
||||
new_mode = GroupOnly;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -137,9 +137,9 @@ OSCGlobalObserver::OSCGlobalObserver (OSC& o, Session& s, ArdourSurface::OSC::OS
|
|||
send_change_message (X_("/click/level"), click_controllable);
|
||||
}
|
||||
|
||||
session->route_group_added.connect (session_connections, MISSING_INVALIDATOR, std::bind (static_cast<void (OSCGlobalObserver::*)(ARDOUR::RouteGroup*)>(&OSCGlobalObserver::group_changed), this, _1), &_osc);
|
||||
session->route_group_removed.connect (session_connections, MISSING_INVALIDATOR, std::bind (static_cast<void (OSCGlobalObserver::*)(void)>(&OSCGlobalObserver::group_changed), this), &_osc);
|
||||
session->route_groups_reordered.connect (session_connections, MISSING_INVALIDATOR, std::bind (static_cast<void (OSCGlobalObserver::*)(void)>(&OSCGlobalObserver::group_changed), this), &_osc);
|
||||
session->route_group_added.connect (session_connections, MISSING_INVALIDATOR, std::bind (&OSCGlobalObserver::group_changed, this), &_osc);
|
||||
session->route_group_removed.connect (session_connections, MISSING_INVALIDATOR, std::bind (&OSCGlobalObserver::group_changed, this), &_osc);
|
||||
session->route_groups_reordered.connect (session_connections, MISSING_INVALIDATOR, std::bind (&OSCGlobalObserver::group_changed, this), &_osc);
|
||||
_osc.send_group_list (addr);
|
||||
|
||||
extra_check ();
|
||||
|
|
@ -588,12 +588,6 @@ OSCGlobalObserver::jog_mode (uint32_t jogmode)
|
|||
_osc.int_message (X_("/jog/mode"), jogmode, addr);
|
||||
}
|
||||
|
||||
void
|
||||
OSCGlobalObserver::group_changed (ARDOUR::RouteGroup *rg)
|
||||
{
|
||||
_osc.send_group_list (addr);
|
||||
}
|
||||
|
||||
void
|
||||
OSCGlobalObserver::group_changed ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ class OSCGlobalObserver
|
|||
void extra_check (void);
|
||||
void marks_changed (void);
|
||||
void mark_update (void);
|
||||
void group_changed (ARDOUR::RouteGroup*);
|
||||
void group_changed (void);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ OSCRouteObserver::group_name ()
|
|||
{
|
||||
std::shared_ptr<Route> rt = std::dynamic_pointer_cast<Route> (_strip);
|
||||
|
||||
RouteGroup *rg = rt->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = rt->route_group();
|
||||
if (rg) {
|
||||
_osc.text_message_with_id (X_("/strip/group"), ssid, rg->name(), in_line, addr);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -736,17 +736,17 @@ void
|
|||
OSCSelectObserver::group_name ()
|
||||
{
|
||||
std::shared_ptr<Route> rt = std::dynamic_pointer_cast<Route> (_strip);
|
||||
RouteGroup *rg = rt->route_group();
|
||||
std::shared_ptr<RouteGroup> rg = rt->route_group();
|
||||
group_sharing (rg);
|
||||
}
|
||||
|
||||
void
|
||||
OSCSelectObserver::group_sharing (RouteGroup *rgc)
|
||||
OSCSelectObserver::group_sharing (std::shared_ptr<RouteGroup> rgc)
|
||||
{
|
||||
_group_sharing[15] = 1;
|
||||
std::shared_ptr<Route> rt = std::dynamic_pointer_cast<Route> (_strip);
|
||||
string new_name = "none";
|
||||
RouteGroup* rg = NULL;
|
||||
std::shared_ptr<RouteGroup> rg = NULL;
|
||||
if (rt) {
|
||||
rg = rt->route_group();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class OSCSelectObserver
|
|||
void name_changed (const PBD::PropertyChange& what_changed);
|
||||
void panner_changed ();
|
||||
void group_name ();
|
||||
void group_sharing (ARDOUR::RouteGroup *rg_c);
|
||||
void group_sharing (std::shared_ptr<ARDOUR::RouteGroup> rg_c);
|
||||
void comment_changed ();
|
||||
void pi_changed (PBD::PropertyChange const&);
|
||||
void change_message (std::string path, std::shared_ptr<PBD::Controllable> controllable);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue