Ingen  0.5.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Ingen::Server::RunContext Class Reference

Graph execution context. More...

#include <RunContext.hpp>

+ Collaboration diagram for Ingen::Server::RunContext:

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)
 
Engineengine () const
 
Tasktask () 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 RunContextoperator= (const RunContext &copy)=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)
 

Detailed Description

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).

Constructor & Destructor Documentation

§ RunContext() [1/2]

Ingen::Server::RunContext::RunContext ( Engine engine,
unsigned  id,
bool  threaded 
)

Create a new run context.

Parameters
threadedIf true, then this context is a worker which will launch a thread and execute tasks as they become available.

§ RunContext() [2/2]

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.

Member Function Documentation

§ must_notify()

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().

§ notify()

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.

Returns
false on failure (ring is full)

References _engine, and _event_sink.

Referenced by Ingen::Server::PortImpl::monitor().

§ emit_notifications()

void Ingen::Server::RunContext::emit_notifications ( FrameTime  end)

Emit pending notifications in some other non-realtime thread.

References _engine, _event_sink, and _thread.

§ pending_notifications()

bool Ingen::Server::RunContext::pending_notifications ( ) const
inline

Return true iff any notifications are pending.

References _event_sink.

§ duration()

uint64_t Ingen::Server::RunContext::duration ( ) const
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().


The documentation for this class was generated from the following files: