From 8a614ae060308637dd0ade55383ea54199531198 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Nov 2008 08:12:23 +0000 Subject: Better handling of large patch loading. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1766 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/QueuedEventSource.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/engine') diff --git a/src/engine/QueuedEventSource.cpp b/src/engine/QueuedEventSource.cpp index e9817c4b..7dd12049 100644 --- a/src/engine/QueuedEventSource.cpp +++ b/src/engine/QueuedEventSource.cpp @@ -95,7 +95,7 @@ QueuedEventSource::process(PostProcessor& dest, ProcessContext& context) * makes the process callback (more) realtime-safe by preventing being * choked by events coming in faster than they can be processed. * FIXME: test this and figure out a good value */ - const unsigned int MAX_QUEUED_EVENTS = context.nframes() / 100; + const unsigned int MAX_QUEUED_EVENTS = context.nframes() / 64; unsigned int num_events_processed = 0; @@ -114,9 +114,11 @@ QueuedEventSource::process(PostProcessor& dest, ProcessContext& context) ++num_events_processed; } - if (num_events_processed > 0) - while (_full_semaphore.has_waiter()) + if (_full_semaphore.has_waiter()) { + const bool full = (((_front.get() - _back.get() + _size) % _size) == 1); + if (!full) _full_semaphore.post(); + } } -- cgit v1.2.1