/* Copyright (C) 2016 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __ardour_slavable_h__ #define __ardour_slavable_h__ #include #include #include #include #include "pbd/signals.h" #include "evoral/Parameter.hpp" #include "ardour/types.h" #include "ardour/libardour_visibility.h" class XMLNode; namespace ARDOUR { class VCA; class VCAManager; class AutomationControl; class SlavableAutomationControl; class LIBARDOUR_API Slavable { public: Slavable (); virtual ~Slavable() {} XMLNode& get_state () const; int set_state (XMLNode const&, int); virtual void assign (boost::shared_ptr); void unassign (boost::shared_ptr); PBD::Signal2,bool> AssignmentChange; virtual boost::shared_ptr automation_control (const Evoral::Parameter&) = 0; static std::string xml_node_name; /* signal sent VCAManager once assignment is possible */ static PBD::Signal1 Assign; std::vector > masters (VCAManager*) const; /** recursively test for master assignment to given VCA */ bool assigned_to (VCAManager*, boost::shared_ptr) const; protected: virtual SlavableControlList slavables () const = 0; private: bool assign_controls (boost::shared_ptr); void unassign_controls (boost::shared_ptr); bool assign_control (boost::shared_ptr, boost::shared_ptr); void unassign_control (boost::shared_ptr, boost::shared_ptr); mutable Glib::Threads::RWLock master_lock; std::set _masters; PBD::ScopedConnection assign_connection; PBD::ScopedConnectionList unassign_connections; int do_assign (VCAManager* s); void weak_unassign (boost::weak_ptr); }; } // namespace ARDOUR #endif /* __ardour_slavable_h__ */