merge from trunk
[ardour.git] / libs / ardour / ardour / automation_event.h
index f26828a11478c2751f52f486841afd5a3d0f34a6..dad94161d06744df181c3a18a7663efec0d26a27 100644 (file)
@@ -26,7 +26,7 @@
 #include <cmath>
 
 #include <sigc++/signal.h>
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
 #include <pbd/undo.h>
 #include <pbd/xml++.h>
 #include <ardour/ardour.h>
@@ -51,7 +51,7 @@ struct ControlEvent {
 
 };
 
-class AutomationList : public StateManager
+class AutomationList : public StateManager, public Stateful
 {
   public:
        typedef std::list<ControlEvent*> AutomationEventList;
@@ -144,7 +144,7 @@ class AutomationList : public StateManager
        std::pair<AutomationList::iterator,AutomationList::iterator> control_points_adjacent (double when);
 
        template<class T> void apply_to_points (T& obj, void (T::*method)(const AutomationList&)) {
-               LockMonitor lm (lock, __LINE__, __FILE__);
+               Glib::Mutex::Lock lm (lock);
                (obj.*method)(*this);
        }
 
@@ -153,17 +153,22 @@ class AutomationList : public StateManager
        virtual void store_state (XMLNode& node) const;
        virtual void load_state (const XMLNode&);
 
+       XMLNode &get_state(void); 
+       int set_state (const XMLNode &s);
+
+        PBD::ID id() { return _id; }
+
        void set_max_xval (double);
        double get_max_xval() const { return max_xval; }
 
        double eval (double where) {
-               LockMonitor lm (lock, __LINE__, __FILE__);
+               Glib::Mutex::Lock lm (lock);
                return unlocked_eval (where);
        }
 
        double rt_safe_eval (double where, bool& ok) {
 
-               TentativeLockMonitor lm (lock, __LINE__, __FILE__);
+               Glib::Mutex::Lock lm (lock, Glib::TRY_LOCK);
 
                if ((ok = lm.locked())) {
                        return unlocked_eval (where);
@@ -178,7 +183,10 @@ class AutomationList : public StateManager
                }
        };
 
+        static sigc::signal<void, AutomationList*> AutomationListCreated;
+
   protected:
+        PBD::ID _id;
        struct State : public ARDOUR::StateManager::State {
            AutomationEventList events;
 
@@ -186,7 +194,7 @@ class AutomationList : public StateManager
        };
 
        AutomationEventList events;
-       mutable PBD::NonBlockingLock lock;
+       mutable Glib::Mutex lock;
        bool   _frozen;
        bool    changed_when_thawed;
        bool   _dirty;