PluginInfo::type added to copy constructor. But why is the copy constructor defined...
[ardour.git] / libs / ardour / automation_event.cc
index 341fa82091902c0f4898320bf42d82cdeedf24b7..d5a7d50bb11942629d53b31e84962e2098f8f265 100644 (file)
@@ -14,7 +14,7 @@
     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.
-
 */
 
 #include <set>
@@ -185,7 +185,10 @@ AutomationList::operator= (const AutomationList& other)
                max_yval = other.max_yval;
                max_xval = other.max_xval;
                default_value = other.default_value;
-               
+
+               rt_insertion_point = events.end();
+               lookup_cache.range.first = events.end();
+       
                mark_dirty ();
                maybe_signal_changed ();
        }
@@ -364,6 +367,7 @@ AutomationList::rt_add (double when, double value)
                
                if (!done) {
                        last_rt_insertion_point = events.insert (where, point_factory (when, value));
+                       // cerr << "\tINSERTED\n";
                }
                
                _new_touch = false;
@@ -673,7 +677,7 @@ AutomationList::truncate_end (double last_coordinate)
        {
                Glib::Mutex::Lock lm (lock);
                ControlEvent cp (last_coordinate, 0);
-               list<ControlEvent*>::reverse_iterator i;
+               AutomationList::reverse_iterator i;
                double last_val;
 
                if (events.empty()) {
@@ -742,7 +746,7 @@ AutomationList::truncate_end (double last_coordinate)
                        uint32_t sz = events.size();
                        
                        while (i != events.rend() && sz > 2) {
-                               list<ControlEvent*>::reverse_iterator tmp;
+                               AutomationList::reverse_iterator tmp;
                                
                                tmp = i;
                                ++tmp;
@@ -839,7 +843,7 @@ AutomationList::truncate_start (double overall_length)
                        i = events.begin();
                        
                        while (i != events.end() && !events.empty()) {
-                               list<ControlEvent*>::iterator tmp;
+                               AutomationList::iterator tmp;
                                
                                tmp = i;
                                ++tmp;
@@ -939,6 +943,9 @@ AutomationList::shared_eval (double x)
                return multipoint_eval (x);
                break;
        }
+
+       /*NOTREACHED*/ /* stupid gcc */
+       return 0.0;
 }
 
 double
@@ -1243,6 +1250,8 @@ AutomationList::serialize_events ()
 {
        XMLNode* node = new XMLNode (X_("events"));
        stringstream str;
+       
+       str.precision(15);  //10 digits is enough digits for 24 hours at 96kHz
 
        for (iterator xx = events.begin(); xx != events.end(); ++xx) {
                str << (double) (*xx)->when;
@@ -1419,3 +1428,20 @@ AutomationList::set_state (const XMLNode& node)
        return 0;
 }
 
+void
+AutomationList::shift (nframes64_t pos, nframes64_t frames)
+{
+       {
+               Glib::Mutex::Lock lm (lock);
+
+               for (iterator i = begin (); i != end (); ++i) {
+                       if ((*i)->when >= pos) {
+                               (*i)->when += frames;
+                       }
+               }
+
+               mark_dirty ();
+       }
+
+       maybe_signal_changed ();
+}