summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/QueuedEventSource.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-09-30 21:12:16 +0000
committerDavid Robillard <d@drobilla.net>2007-09-30 21:12:16 +0000
commit399ddfc5b1d4f1f131362d0439821778c6681b23 (patch)
treee8ca2536fa251f474817d0575bc3b4747c494954 /src/libs/engine/QueuedEventSource.cpp
parentc40ddfc0eebbcb3333d6cc9e3df7fb62ecb45941 (diff)
downloadingen-399ddfc5b1d4f1f131362d0439821778c6681b23.tar.gz
ingen-399ddfc5b1d4f1f131362d0439821778c6681b23.tar.bz2
ingen-399ddfc5b1d4f1f131362d0439821778c6681b23.zip
Better design for process() signature (pass everything needed in a single object parameter).
Working port "monitoring" (connect an output to a control input, GUI will animate controller). git-svn-id: http://svn.drobilla.net/lad/ingen@788 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/QueuedEventSource.cpp')
-rw-r--r--src/libs/engine/QueuedEventSource.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp
index 634b94da..5dcaf255 100644
--- a/src/libs/engine/QueuedEventSource.cpp
+++ b/src/libs/engine/QueuedEventSource.cpp
@@ -15,14 +15,15 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <sys/mman.h>
+#include <iostream>
#include "QueuedEventSource.hpp"
#include "QueuedEvent.hpp"
#include "PostProcessor.hpp"
#include "ThreadManager.hpp"
-#include <sys/mman.h>
-#include <iostream>
-using std::cout; using std::cerr; using std::endl;
+#include "ProcessContext.hpp"
+using namespace std;
namespace Ingen {
@@ -77,7 +78,7 @@ QueuedEventSource::push_queued(QueuedEvent* const ev)
* Executed events will be pushed to @a dest.
*/
void
-QueuedEventSource::process(PostProcessor& dest, SampleCount nframes, FrameTime cycle_start, FrameTime cycle_end)
+QueuedEventSource::process(PostProcessor& dest, ProcessContext& context)
{
assert(ThreadManager::current_thread_id() == THREAD_PROCESS);
@@ -87,21 +88,21 @@ QueuedEventSource::process(PostProcessor& dest, SampleCount nframes, FrameTime c
* 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 = nframes / 100;
+ const unsigned int MAX_QUEUED_EVENTS = context.nframes() / 100;
unsigned int num_events_processed = 0;
/* FIXME: Merge these next two loops into one */
- while ((ev = pop_earliest_queued_before(cycle_end))) {
- ev->execute(nframes, cycle_start, cycle_end);
+ while ((ev = pop_earliest_queued_before(context.end()))) {
+ ev->execute(context);
dest.push(ev);
if (++num_events_processed > MAX_QUEUED_EVENTS)
break;
}
- while ((ev = pop_earliest_stamped_before(cycle_end))) {
- ev->execute(nframes, cycle_start, cycle_end);
+ while ((ev = pop_earliest_stamped_before(context.end()))) {
+ ev->execute(context);
dest.push(ev);
++num_events_processed;
}