diff options
author | David Robillard <d@drobilla.net> | 2009-05-03 17:55:54 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2009-05-03 17:55:54 +0000 |
commit | 0a865a7a141f52a71b1d27ffcc2c84de5eb2431d (patch) | |
tree | fb1a1d518d0a4cadcda7677d99a48c93cd43f371 | |
parent | 6012222c80c37be78db3f38a37f7d9a609a213a8 (diff) | |
download | ingen-0a865a7a141f52a71b1d27ffcc2c84de5eb2431d.tar.gz ingen-0a865a7a141f52a71b1d27ffcc2c84de5eb2431d.tar.bz2 ingen-0a865a7a141f52a71b1d27ffcc2c84de5eb2431d.zip |
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
-rw-r--r-- | src/engine/LV2EventBuffer.cpp | 18 | ||||
-rw-r--r-- | 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) |