change name of a Session method to makes its intended function clear
[ardour.git] / libs / ardour / ardour / automatable.h
index 6e0f7a97b58a55e04dafef39f4fd87cef63ae6bf..ae2c8dd41f669e282af5f19d70dfe3b570bd2768 100644 (file)
 #include <map>
 #include <set>
 #include <string>
+
 #include <boost/shared_ptr.hpp>
+
 #include "pbd/signals.h"
+
 #include "evoral/ControlSet.hpp"
+
+#include "ardour/libardour_visibility.h"
+#include "ardour/slavable.h"
 #include "ardour/types.h"
 
 class XMLNode;
@@ -35,11 +41,10 @@ namespace ARDOUR {
 class Session;
 class AutomationControl;
 
-
-/** Note this class is abstract, actual objects must either be
- * an AutomatableControls or an AutomatableSequence
+/* The inherited ControlSet is virtual because AutomatableSequence inherits
+ * from this AND EvoralSequence, which is also a ControlSet
  */
-class Automatable : virtual public Evoral::ControlSet
+class LIBARDOUR_API Automatable : virtual public Evoral::ControlSet, public Slavable
 {
 public:
        Automatable(Session&);
@@ -47,23 +52,24 @@ public:
 
         virtual ~Automatable();
 
-       boost::shared_ptr<Evoral::Control>
-       control_factory(const Evoral::Parameter& id);
+       boost::shared_ptr<Evoral::Control> control_factory(const Evoral::Parameter& id);
 
-       boost::shared_ptr<AutomationControl>
-       automation_control (const Evoral::Parameter& id, bool create_if_missing=false);
+       boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id) {
+               return automation_control (id, false);
+       }
 
-       boost::shared_ptr<const AutomationControl>
-       automation_control (const Evoral::Parameter& id) const;
+       boost::shared_ptr<AutomationControl> automation_control (const Evoral::Parameter& id, bool create_if_missing);
+       boost::shared_ptr<const AutomationControl> automation_control (const Evoral::Parameter& id) const;
 
        virtual void add_control(boost::shared_ptr<Evoral::Control>);
+       virtual bool find_next_event (double start, double end, Evoral::ControlEvent& ev, bool only_active = true) const;
        void clear_controls ();
 
         virtual void transport_located (framepos_t now);
        virtual void transport_stopped (framepos_t now);
 
        virtual std::string describe_parameter(Evoral::Parameter param);
-       virtual std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
+       virtual std::string value_as_string (boost::shared_ptr<const AutomationControl>) const;
 
        AutoState get_parameter_automation_state (Evoral::Parameter param);
        virtual void set_parameter_automation_state (Evoral::Parameter param, AutoState);
@@ -76,24 +82,13 @@ public:
        const std::set<Evoral::Parameter>& what_can_be_automated() const { return _can_automate_list; }
        void what_has_existing_automation (std::set<Evoral::Parameter>&) const;
 
-       inline bool should_snapshot (framepos_t now) {
-               return (_last_automation_snapshot > now
-                               || (now - _last_automation_snapshot) > _automation_interval);
-       }
-
-       static void set_automation_interval (framecnt_t frames) {
-               _automation_interval = frames;
-       }
-
-       static framecnt_t automation_interval() {
-               return _automation_interval;
-       }
-
        static const std::string xml_node_name;
 
        int set_automation_xml_state (const XMLNode&, Evoral::Parameter default_param);
        XMLNode& get_automation_xml_state();
 
+       PBD::Signal0<void> AutomationStateChanged;
+
   protected:
        Session& _a_session;
 
@@ -107,7 +102,6 @@ public:
        std::set<Evoral::Parameter> _can_automate_list;
 
        framepos_t _last_automation_snapshot;
-       static framecnt_t _automation_interval;
 
 private:
        PBD::ScopedConnectionList _control_connections; ///< connections to our controls' signals