properly handle integer steps in plugin controls
[ardour.git] / libs / evoral / src / Event.cpp
index b874c37de42679c7fd17bc86f39c3c7171484100..45935ccf8d255998cfa191f811bc30aea1574052 100644 (file)
@@ -63,6 +63,22 @@ Event<Timestamp>::Event(EventType type, Timestamp time, uint32_t size, uint8_t*
        }
 }
 
+template<typename Timestamp>
+Event<Timestamp>::Event(EventType      type,
+                        Timestamp      time,
+                        uint32_t       size,
+                        const uint8_t* buf)
+       : _type(type)
+       , _original_time(time)
+       , _nominal_time(time)
+       , _size(size)
+       , _buf((uint8_t*)malloc(size))
+       , _id(-1)
+       , _owns_buf(true)
+{
+       memcpy(_buf, buf, _size);
+}
+
 template<typename Timestamp>
 Event<Timestamp>::Event(const Event& copy, bool owns_buf)
        : _type(copy._type)
@@ -70,7 +86,7 @@ Event<Timestamp>::Event(const Event& copy, bool owns_buf)
        , _nominal_time(copy._nominal_time)
        , _size(copy._size)
        , _buf(copy._buf)
-       , _id(copy.id())
+       , _id (next_event_id ())
        , _owns_buf(owns_buf)
 {
        if (owns_buf) {
@@ -94,7 +110,7 @@ template<typename Timestamp>
 const Event<Timestamp>&
 Event<Timestamp>::operator=(const Event& copy)
 {
-       _id = copy.id(); // XXX is this right? do we want ID copy semantics?
+       _id = next_event_id ();
        _type = copy._type;
        _original_time = copy._original_time;
        _nominal_time = copy._nominal_time;
@@ -155,7 +171,7 @@ Event<Timestamp>::set_original_time (Timestamp t)
        
 #endif // EVORAL_EVENT_ALLOC
 
-template class Event<Evoral::MusicalTime>;
+template class Event<Evoral::Beats>;
 template class Event<double>;
 template class Event<int64_t>;