From 0a865a7a141f52a71b1d27ffcc2c84de5eb2431d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 3 May 2009 17:55:54 +0000 Subject: Keep correct timers even when event write fails. Tidy. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1959 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/LV2EventBuffer.cpp | 18 ++++++++---------- src/engine/LV2EventBuffer.hpp | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/engine/LV2EventBuffer.cpp b/src/engine/LV2EventBuffer.cpp index 3de70216..bec92c0e 100644 --- a/src/engine/LV2EventBuffer.cpp +++ b/src/engine/LV2EventBuffer.cpp @@ -85,8 +85,7 @@ LV2EventBuffer::increment() const } -/** - * \return true iff the cursor is valid (ie get_event is safe) +/** \return true iff the cursor is valid (ie get_event is safe) */ bool LV2EventBuffer::is_valid() const @@ -143,15 +142,14 @@ LV2EventBuffer::append(uint32_t frames, /*cout << "Appending event type " << type << ", size " << size << " @ " << frames << "." << subframes << endl;*/ - const bool ret = lv2_event_write(&_iter, frames, subframes, type, size, data); - - if (!ret) + if (!lv2_event_write(&_iter, frames, subframes, type, size, data)) { cerr << "ERROR: Failed to write event." << endl; - - _latest_frames = frames; - _latest_subframes = subframes; - - return ret; + return false; + } else { + _latest_frames = frames; + _latest_subframes = subframes; + return true; + } } diff --git a/src/engine/LV2EventBuffer.hpp b/src/engine/LV2EventBuffer.hpp index 7e60dff0..30edc96c 100644 --- a/src/engine/LV2EventBuffer.hpp +++ b/src/engine/LV2EventBuffer.hpp @@ -67,7 +67,7 @@ public: bool append(const LV2_Event_Buffer* buf); private: - LV2_Event_Buffer* _data; ///< Contents + LV2_Event_Buffer* _data; ///< Contents mutable LV2_Event_Iterator _iter; ///< Iterator into _data uint32_t _latest_frames; ///< Latest time of all events (frames) uint32_t _latest_subframes; ///< Latest time of all events (subframes) -- cgit v1.2.1