summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/server/Context.hpp3
-rw-r--r--src/server/PostProcessor.cpp8
-rw-r--r--src/server/PostProcessor.hpp3
-rw-r--r--src/server/ingen_lv2.cpp3
4 files changed, 15 insertions, 2 deletions
diff --git a/src/server/Context.hpp b/src/server/Context.hpp
index 62bcfba9..b5941dfc 100644
--- a/src/server/Context.hpp
+++ b/src/server/Context.hpp
@@ -64,6 +64,9 @@ public:
/** Emit pending notifications in some other non-realtime thread. */
void emit_notifications(FrameTime end);
+ /** Return true iff any notifications are pending. */
+ bool pending_notifications() const { return _event_sink.read_space(); }
+
inline ID id() const { return _id; }
inline void locate(FrameTime s, SampleCount nframes) {
diff --git a/src/server/PostProcessor.cpp b/src/server/PostProcessor.cpp
index 92d49d43..74493b51 100644
--- a/src/server/PostProcessor.cpp
+++ b/src/server/PostProcessor.cpp
@@ -51,10 +51,16 @@ PostProcessor::append(ProcessContext& context, Event* first, Event* last)
}
}
+bool
+PostProcessor::pending() const
+{
+ return _head.get() || _engine.process_context().pending_notifications();
+}
+
void
PostProcessor::process()
{
- const FrameTime end_time = _max_time.get() + 1;
+ const FrameTime end_time = _max_time.get();
// To avoid a race, we only process up to tail and never write to _tail
Event* const tail = _tail.get();
diff --git a/src/server/PostProcessor.hpp b/src/server/PostProcessor.hpp
index 31f49ad4..2bd6036f 100644
--- a/src/server/PostProcessor.hpp
+++ b/src/server/PostProcessor.hpp
@@ -54,6 +54,9 @@ public:
/** Post-process and delete all pending events */
void process();
+ /** Return true iff any events are pending */
+ bool pending() const;
+
/** Set the latest event time that should be post-processed */
void set_end_time(FrameTime time) { _max_time = time; }
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index 43b8503d..2f845dd2 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -187,7 +187,8 @@ public:
for (Ports::iterator i = _ports.begin(); i != _ports.end(); ++i)
(*i)->pre_process(_engine.process_context());
- if (_engine.run(nframes) > 0) {
+ _engine.run(nframes);
+ if (_engine.post_processor()->pending()) {
_main_sem.post();
}