summaryrefslogtreecommitdiffstats
path: root/src/engine/QueuedEventSource.hpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-07 01:34:42 +0000
committerDavid Robillard <d@drobilla.net>2010-01-07 01:34:42 +0000
commit10a5b76a65fb7ca7bf8c1f5869aaf763854e05a3 (patch)
treef93824399e791f218545109304500fe71686f0a3 /src/engine/QueuedEventSource.hpp
parenta6045e5dc58f2dd2ab9e3d3d19fd3eaf6d84216f (diff)
downloadingen-10a5b76a65fb7ca7bf8c1f5869aaf763854e05a3.tar.gz
ingen-10a5b76a65fb7ca7bf8c1f5869aaf763854e05a3.tar.bz2
ingen-10a5b76a65fb7ca7bf8c1f5869aaf763854e05a3.zip
Merge QueuedEventSource and EventSource.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2352 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/QueuedEventSource.hpp')
-rw-r--r--src/engine/QueuedEventSource.hpp78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/engine/QueuedEventSource.hpp b/src/engine/QueuedEventSource.hpp
deleted file mode 100644
index 12b2300c..00000000
--- a/src/engine/QueuedEventSource.hpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2008-2009 Dave Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef INGEN_QUEUED_EVENT_SOURCE_HPP
-#define INGEN_QUEUED_EVENT_SOURCE_HPP
-
-#include <cstdlib>
-#include <pthread.h>
-#include "raul/Semaphore.hpp"
-#include "raul/Slave.hpp"
-#include "raul/List.hpp"
-#include "EventSource.hpp"
-
-namespace Ingen {
-
-class Event;
-class QueuedEvent;
-class PostProcessor;
-
-
-/** Queue of events that need processing before reaching the audio thread.
- *
- * Implemented as a deque (ringbuffer) in a circular array. Pushing and
- * popping are threadsafe, as long as a single thread pushes and a single
- * thread pops (ie this data structure is threadsafe, but the push and pop
- * methods themselves are not). Creating an instance of this class spawns
- * a pre-processing thread to prepare queued events.
- *
- * This class is it's own slave. :)
- */
-class QueuedEventSource : public EventSource, protected Raul::Slave
-{
-public:
- QueuedEventSource(size_t queue_size);
- ~QueuedEventSource();
-
- void activate_source() { Slave::start(); }
- void deactivate_source() { Slave::stop(); }
-
- void process(PostProcessor& dest, ProcessContext& context);
-
- /** Signal that the blocking event is finished.
- * When this is called preparing will resume. This MUST be called by
- * blocking events in their post_process() method. */
- inline void unblock() { _blocking_semaphore.post(); }
-
-protected:
- void push_queued(QueuedEvent* const ev);
-
- inline bool unprepared_events() { return (_prepared_back.get() != NULL); }
-
- virtual void _whipped(); ///< Prepare 1 event
-
-private:
- Raul::List<Event*> _events;
- Raul::AtomicPtr<Raul::List<Event*>::Node> _prepared_back;
- Raul::Semaphore _blocking_semaphore;
-};
-
-
-} // namespace Ingen
-
-#endif // INGEN_QUEUED_EVENT_SOURCE_HPP
-