summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/QueuedEventSource.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-07-14 22:24:00 +0000
committerDavid Robillard <d@drobilla.net>2006-07-14 22:24:00 +0000
commit5dc6649496e938b32a5fe9f341de6cce962d3731 (patch)
treec4b1832581c32b867b653afd0a7bd4bb05883b36 /src/libs/engine/QueuedEventSource.cpp
parent7e013dc6986fa9d6dc8616d494d9de5d192c4c69 (diff)
downloadingen-5dc6649496e938b32a5fe9f341de6cce962d3731.tar.gz
ingen-5dc6649496e938b32a5fe9f341de6cce962d3731.tar.bz2
ingen-5dc6649496e938b32a5fe9f341de6cce962d3731.zip
Enforced OSC path restrictions on Path for spec conformance (since GraphObject
paths will soon be part of OSC paths) git-svn-id: http://svn.drobilla.net/lad/ingen@88 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/QueuedEventSource.cpp')
-rw-r--r--src/libs/engine/QueuedEventSource.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/libs/engine/QueuedEventSource.cpp b/src/libs/engine/QueuedEventSource.cpp
index 8254f3c8..ba05a0c1 100644
--- a/src/libs/engine/QueuedEventSource.cpp
+++ b/src/libs/engine/QueuedEventSource.cpp
@@ -24,12 +24,13 @@ using std::cout; using std::cerr; using std::endl;
namespace Om {
-QueuedEventSource::QueuedEventSource(size_t size)
+QueuedEventSource::QueuedEventSource(size_t queued_size, size_t stamped_size)
: _front(0),
_back(0),
_prepared_back(0),
- _size(size+1),
- _blocking_semaphore(0)
+ _size(queued_size+1),
+ _blocking_semaphore(0),
+ _stamped_queue(stamped_size)
{
_events = (QueuedEvent**)calloc(_size, sizeof(QueuedEvent*));
@@ -39,7 +40,7 @@ QueuedEventSource::QueuedEventSource(size_t size)
QueuedEventSource::~QueuedEventSource()
{
- stop();
+ Thread::stop();
free(_events);
}
@@ -48,7 +49,7 @@ QueuedEventSource::~QueuedEventSource()
/** Push an unprepared event onto the queue.
*/
void
-QueuedEventSource::push(QueuedEvent* const ev)
+QueuedEventSource::push_queued(QueuedEvent* const ev)
{
assert(!ev->is_prepared());
@@ -58,21 +59,30 @@ QueuedEventSource::push(QueuedEvent* const ev)
} else {
_events[_back] = ev;
_back = (_back + 1) % _size;
- signal();
+ whip();
}
}
-/** Pops the prepared event at the front of the queue, if it exists.
+void
+QueuedEventSource::push_stamped(Event* const ev)
+{
+ _stamped_queue.push(ev);
+}
+
+/** Pops the prepared event at the front of the prepare queue, if it exists.
*
* This method will only pop events that have been prepared, and are
* stamped before the time passed. In other words, it may return NULL
* even if there are events pending in the queue. The events returned are
* actually QueuedEvents, but after this they are "normal" events and the
- * engine deals with them just like a realtime in-band event.
+ * engine deals with them just like a realtime in-band event. The engine will
+ * not use the timestamps of the returned events in any way, since it is free
+ * to execute these non-time-stamped events whenever it wants (at whatever rate
+ * it wants).
*/
Event*
-QueuedEventSource::pop_earliest_before(const samplecount time)
+QueuedEventSource::pop_earliest_queued_before(const samplecount time)
{
QueuedEvent* const front_event = _events[_front];
@@ -102,18 +112,19 @@ QueuedEventSource::unblock()
}
+/** Pre-process a single event */
void
-QueuedEventSource::_signalled()
+QueuedEventSource::_whipped()
{
QueuedEvent* const ev = _events[_prepared_back];
- assert(ev != NULL);
-
+
+ assert(ev);
if (ev == NULL) {
cerr << "[QueuedEventSource] ERROR: Signalled, but event is NULL." << endl;
return;
}
- assert(ev != NULL);
+ assert(ev);
assert(!ev->is_prepared());
ev->pre_process();