summaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-12 03:52:29 +0000
committerDavid Robillard <d@drobilla.net>2012-08-12 03:52:29 +0000
commit7f24f7c5f62eb03e99b2ce812022f2fa3cdf05e6 (patch)
treec1efe17c3b3e281b8021a347569a46d266c8d77f /src/server
parent5fae80a1340441467ec03ad34f39cfd3273f7099 (diff)
downloadingen-7f24f7c5f62eb03e99b2ce812022f2fa3cdf05e6.tar.gz
ingen-7f24f7c5f62eb03e99b2ce812022f2fa3cdf05e6.tar.bz2
ingen-7f24f7c5f62eb03e99b2ce812022f2fa3cdf05e6.zip
Fix notifications when running as LV2.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4665 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-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();
}