diff options
author | David Robillard <d@drobilla.net> | 2012-07-17 22:36:55 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-07-17 22:36:55 +0000 |
commit | 5dcac50655a6635352e4542888e091bef515f865 (patch) | |
tree | 915b19f606b4221768287f9ca5903d5f35d19317 /src/server/Context.hpp | |
parent | c94231abbc601652e73423ec6e43a1e241024a17 (diff) | |
download | ingen-5dcac50655a6635352e4542888e091bef515f865.tar.gz ingen-5dcac50655a6635352e4542888e091bef515f865.tar.bz2 ingen-5dcac50655a6635352e4542888e091bef515f865.zip |
Wrap notification stuff behind simple API and hide details in Context.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4545 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server/Context.hpp')
-rw-r--r-- | src/server/Context.hpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/server/Context.hpp b/src/server/Context.hpp index fa2a2c7e..8afe1caa 100644 --- a/src/server/Context.hpp +++ b/src/server/Context.hpp @@ -22,6 +22,7 @@ #include "ingen/shared/World.hpp" #include "types.hpp" +#include "Notification.hpp" namespace Ingen { namespace Server { @@ -61,20 +62,31 @@ public: virtual ~Context() {} - ID id() const { return _id; } + /** Send a notification from this run context. */ + void notify( + Notification::Type type = Notification::NIL, + FrameTime time = 0, + PortImpl* port = 0, + const Raul::Atom& value = Raul::Atom(), + const ControlBindings::Type btype = ControlBindings::NULL_CONTROL); - void locate(FrameTime s, SampleCount nframes, SampleCount offset) { - _start = s; - _end = s + nframes; + /** Emit pending notifications in some other non-realtime thread. */ + void emit_notifications(); + + inline ID id() const { return _id; } + + inline void locate(FrameTime s, SampleCount nframes, SampleCount offset) { + _start = s; + _end = s + nframes; _nframes = nframes; - _offset = offset; + _offset = offset; } - void locate(const Context& other) { - _start = other._start; - _end = other._end; + inline void locate(const Context& other) { + _start = other._start; + _end = other._end; _nframes = other._nframes; - _offset = other._offset; + _offset = other._offset; } inline Engine& engine() const { return _engine; } @@ -84,9 +96,6 @@ public: inline SampleCount offset() const { return _offset; } inline bool realtime() const { return _realtime; } - inline const Raul::RingBuffer & event_sink() const { return _event_sink; } - inline Raul::RingBuffer& event_sink() { return _event_sink; } - protected: Engine& _engine; ///< Engine we're running in ID _id; ///< Fast ID for this context |