add new sigc++2 directory
[ardour.git] / libs / ardour / ardour / automation_event.h
index e2a98e50b086f36eac7378e950f0ff5543d26efb..18190aa9b6e08f4f6e4034c835eeb17419031a0b 100644 (file)
@@ -27,6 +27,9 @@
 #include <sigc++/signal.h>
 #include <glibmm/thread.h>
 
+#include <boost/pool/pool.hpp>
+#include <boost/pool/pool_alloc.hpp>
+
 #include <pbd/undo.h>
 #include <pbd/xml++.h>
 #include <pbd/statefuldestructible.h> 
@@ -67,12 +70,21 @@ struct ControlEvent {
     double* coeff; ///< double[4] allocated by Curve as needed
 };
 
+/* automation lists use a pool allocator that does not use a lock and 
+   allocates 8k of new pointers at a time
+*/
+
+typedef boost::fast_pool_allocator<ControlEvent*,
+       boost::default_user_allocator_new_delete,
+       boost::details::pool::null_mutex,
+       8192> ControlEventAllocator;
 
 class AutomationList : public PBD::StatefulDestructible
 {
   public:
-       typedef std::list<ControlEvent*> EventList;
+       typedef std::list<ControlEvent*,ControlEventAllocator> EventList;
        typedef EventList::iterator iterator;
+       typedef EventList::reverse_iterator reverse_iterator;
        typedef EventList::const_iterator const_iterator;
 
        AutomationList (Parameter id, double min_val, double max_val, double default_val);
@@ -226,7 +238,7 @@ class AutomationList : public PBD::StatefulDestructible
        Glib::Mutex& lock() const { return _lock; }
        LookupCache& lookup_cache() const { return _lookup_cache; }
        SearchCache& search_cache() const { return _search_cache; }
-       
+
        /** Called by locked entry point and various private
         * locations where we already hold the lock.
         * 
@@ -234,7 +246,8 @@ class AutomationList : public PBD::StatefulDestructible
         */
        double unlocked_eval (double x) const;
        
-       bool rt_safe_earliest_event (double start, double end, double& x, double& y) const;
+       bool rt_safe_earliest_event (double start, double end, double& x, double& y, bool start_inclusive=false) const;
+       bool rt_safe_earliest_event_unlocked (double start, double end, double& x, double& y, bool start_inclusive=false) const;
 
        Curve&       curve()       { return *_curve; }
        const Curve& curve() const { return *_curve; }
@@ -256,8 +269,8 @@ class AutomationList : public PBD::StatefulDestructible
 
        void build_search_cache_if_necessary(double start, double end) const;
        
-       bool rt_safe_earliest_event_discrete (double start, double end, double& x, double& y) const;
-       bool rt_safe_earliest_event_linear (double start, double end, double& x, double& y) const;
+       bool rt_safe_earliest_event_discrete_unlocked (double start, double end, double& x, double& y, bool inclusive) const;
+       bool rt_safe_earliest_event_linear_unlocked (double start, double end, double& x, double& y, bool inclusive) const;
 
        AutomationList* cut_copy_clear (double, double, int op);