diff options
author | David Robillard <d@drobilla.net> | 2010-02-24 23:54:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-24 23:54:37 +0000 |
commit | c35f3f773e68c0e787a8436393475d3269c421c9 (patch) | |
tree | fb3847a90d94394f7ff22b3fad1ccb5c0f0da546 /src/engine/Context.hpp | |
parent | 313af960a340f8539214d53252e3186fe3dc8f40 (diff) | |
download | ingen-c35f3f773e68c0e787a8436393475d3269c421c9.tar.gz ingen-c35f3f773e68c0e787a8436393475d3269c421c9.tar.bz2 ingen-c35f3f773e68c0e787a8436393475d3269c421c9.zip |
Tidy up Context and ProcessContext interfaces (ProcessContext only lives on as a useful type).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2487 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine/Context.hpp')
-rw-r--r-- | src/engine/Context.hpp | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/src/engine/Context.hpp b/src/engine/Context.hpp index a30706da..2a3bd7ca 100644 --- a/src/engine/Context.hpp +++ b/src/engine/Context.hpp @@ -25,6 +25,19 @@ namespace Ingen { class Engine; + +/** Graph execution context. + * + * This is used to pass whatever information a GraphObject might need to + * process; such as the current time, a sink for generated events, etc. + * + * Note the logical distinction between nframes (jack relative) and start/end + * (timeline relative). If transport speed != 1.0, then end-start != nframes + * (though currently this is never the case, it may be if ingen incorporates + * tempo and varispeed). + * + * \ingroup engine + */ class Context { public: @@ -34,12 +47,12 @@ public: }; Context(Engine& engine, ID id) - : _id(id) - , _engine(engine) + : _engine(engine) + , _id(id) , _event_sink(engine, event_queue_size) , _start(0) - , _nframes(0) , _end(0) + , _nframes(0) , _offset(0) , _realtime(true) {} @@ -48,12 +61,24 @@ public: ID id() const { return _id; } - void locate(FrameTime s, SampleCount o=0) { _start = s; _offset=o; } + void locate(FrameTime s, SampleCount nframes, SampleCount offset) { + _start = s; + _end = s + nframes; + _nframes = nframes; + _offset = offset; + } + + void locate(const Context& other) { + _start = other._start; + _end = other._end; + _nframes = other._nframes; + _offset = other._offset; + } inline Engine& engine() const { return _engine; } inline FrameTime start() const { return _start; } - inline SampleCount nframes() const { return _nframes; } inline FrameTime end() const { return _end; } + inline SampleCount nframes() const { return _nframes; } inline SampleCount offset() const { return _offset; } inline bool realtime() const { return _realtime; } @@ -61,13 +86,13 @@ public: inline EventSink& event_sink() { return _event_sink; } protected: - ID _id; ///< Fast ID for this context Engine& _engine; ///< Engine we're running in + ID _id; ///< Fast ID for this context EventSink _event_sink; ///< Sink for events generated in a realtime context FrameTime _start; ///< Start frame of this cycle, timeline relative - SampleCount _nframes; ///< Length of this cycle in frames FrameTime _end; ///< End frame of this cycle, timeline relative + SampleCount _nframes; ///< Length of this cycle in frames SampleCount _offset; ///< Start offset relative to start of driver buffers bool _realtime; ///< True iff context is hard realtime }; |