Ingen
0.5.1
|
Graph execution context. More...
#include <RunContext.hpp>
Public Member Functions | |
RunContext (Engine &engine, unsigned id, bool threaded) | |
Create a new run context. More... | |
RunContext (const RunContext &parent) | |
Create a sub-context of parent . More... | |
bool | must_notify (const PortImpl *port) const |
Return true iff the given port should broadcast its value. More... | |
bool | notify (LV2_URID key=0, FrameTime time=0, PortImpl *port=0, uint32_t size=0, LV2_URID type=0, const void *body=NULL) |
Send a notification from this run context. More... | |
void | emit_notifications (FrameTime end) |
Emit pending notifications in some other non-realtime thread. More... | |
bool | pending_notifications () const |
Return true iff any notifications are pending. More... | |
uint64_t | duration () const |
Return the duration of this cycle in microseconds. More... | |
void | locate (FrameTime s, SampleCount nframes) |
void | slice (SampleCount offset, SampleCount nframes) |
void | set_task (Task *task) |
void | set_priority (int priority) |
void | set_rate (SampleCount rate) |
Engine & | engine () const |
Task * | task () const |
unsigned | id () const |
FrameTime | start () const |
FrameTime | time () const |
FrameTime | end () const |
SampleCount | offset () const |
SampleCount | nframes () const |
SampleCount | rate () const |
bool | realtime () const |
Protected Member Functions | |
const RunContext & | operator= (const RunContext ©)=delete |
void | run () |
Protected Attributes | |
Engine & | _engine |
Engine we're running in. | |
Raul::RingBuffer * | _event_sink |
Port updates from process context. | |
Task * | _task |
Currently executing task. | |
std::thread * | _thread |
Thread (NULL for main run context) | |
unsigned | _id |
Context ID. | |
FrameTime | _start |
Start frame of this cycle, timeline relative. | |
FrameTime | _end |
End frame of this cycle, timeline relative. | |
SampleCount | _offset |
Offset into data buffers. | |
SampleCount | _nframes |
Number of frames past offset to process. | |
SampleCount | _rate |
Sample rate in Hz. | |
bool | _realtime |
True iff context is hard realtime. | |
bool | _copy |
True iff this is a copy (shared event_sink) | |
Graph execution context.
This is used to pass whatever information a Node 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).
Ingen::Server::RunContext::RunContext | ( | Engine & | engine, |
unsigned | id, | ||
bool | threaded | ||
) |
Create a new run context.
threaded | If true, then this context is a worker which will launch a thread and execute tasks as they become available. |
Ingen::Server::RunContext::RunContext | ( | const RunContext & | parent | ) |
Create a sub-context of parent
.
This is used to subdivide process cycles, the sub-context is lightweight and only serves to pass different time attributes.
References _copy, and _event_sink.
bool Ingen::Server::RunContext::must_notify | ( | const PortImpl * | port | ) | const |
Return true iff the given port should broadcast its value.
Whether or not broadcasting is actually done is a per-client property, this is for use in the audio thread to quickly determine if the necessary calculations need to be done at all.
References _engine, Ingen::Server::PortImpl::is_monitored(), and Ingen::Server::Broadcaster::must_broadcast().
Referenced by Ingen::Server::PortImpl::monitor().
bool Ingen::Server::RunContext::notify | ( | LV2_URID | key = 0 , |
FrameTime | time = 0 , |
||
PortImpl * | port = 0 , |
||
uint32_t | size = 0 , |
||
LV2_URID | type = 0 , |
||
const void * | body = NULL |
||
) |
Send a notification from this run context.
References _engine, and _event_sink.
Referenced by Ingen::Server::PortImpl::monitor().
void Ingen::Server::RunContext::emit_notifications | ( | FrameTime | end | ) |
Emit pending notifications in some other non-realtime thread.
References _engine, _event_sink, and _thread.
|
inline |
Return true iff any notifications are pending.
References _event_sink.
|
inline |
Return the duration of this cycle in microseconds.
This is the cycle length in frames (nframes) converted to microseconds, that is, the amount of real time that this cycle's audio represents. Note that this is unrelated to the amount of time available to execute a cycle (other than the fact that it must be processed in significantly less time to avoid a dropout when running in real time).
References _end, _engine, _id, _nframes, _offset, _rate, _realtime, _start, and _task.
Referenced by Ingen::Server::Engine::run().