diff options
author | David Robillard <d@drobilla.net> | 2014-11-22 04:05:42 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-11-22 04:05:42 -0500 |
commit | c1cfa12d6e5136d2e3e5501e83ff74c5009a9e60 (patch) | |
tree | 56d2811bc8b9d6f2a5accfa8e497ddd5976c7c7a /libs/evoral/evoral/Event.hpp | |
parent | cae74309a583c29dd6cc2081425c2e7b673ea13e (diff) |
Wrap MusicalTime in a class.
This lets us get a more explicit handle on time conversions, and is the main
step towards using actual beat:tick time and getting away from floating point
precision problems.
Diffstat (limited to 'libs/evoral/evoral/Event.hpp')
-rw-r--r-- | libs/evoral/evoral/Event.hpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/libs/evoral/evoral/Event.hpp b/libs/evoral/evoral/Event.hpp index 59e5612e0e..059b64225b 100644 --- a/libs/evoral/evoral/Event.hpp +++ b/libs/evoral/evoral/Event.hpp @@ -48,7 +48,7 @@ template<typename Time> class LIBEVORAL_API Event { public: #ifdef EVORAL_EVENT_ALLOC - Event (EventType type=0, Time time=0, uint32_t size=0, uint8_t* buf=NULL, bool alloc=false); + Event (EventType type=0, Time time=Time(), uint32_t size=0, uint8_t* buf=NULL, bool alloc=false); /** Copy \a copy. * @@ -114,11 +114,11 @@ public: } inline void clear() { - _type = 0; - _original_time = 0; - _nominal_time = 0; - _size = 0; - _buf = NULL; + _type = 0; + _original_time = Time(); + _nominal_time = Time(); + _size = 0; + _buf = NULL; } #else @@ -154,9 +154,6 @@ protected: #endif }; -} // namespace Evoral - - template<typename Time> /*LIBEVORAL_API*/ std::ostream& operator<<(std::ostream& o, const Evoral::Event<Time>& ev) { o << "Event #" << ev.id() << " type = " << ev.event_type() << " @ " << ev.time(); @@ -168,6 +165,7 @@ template<typename Time> return o; } +} // namespace Evoral #endif // EVORAL_EVENT_HPP |