Ingen
0.5.1
|
The engine which executes the process graph. More...
#include <Engine.hpp>
Public Member Functions | |
Engine (Ingen::World *world) | |
virtual void | init (double sample_rate, uint32_t block_length, size_t seq_size) |
Initialise the engine for local use (e.g. More... | |
virtual bool | activate () |
Activate the engine. | |
virtual void | deactivate () |
Deactivate the engine. | |
virtual bool | pending_events () |
Return true iff events are waiting to be processed. | |
virtual unsigned | run (uint32_t sample_count) |
Process audio for sample_count frames. More... | |
virtual void | quit () |
Indicate that a quit is desired. More... | |
virtual bool | main_iteration () |
Run a single iteration of the main context. More... | |
virtual void | register_client (SPtr< Interface > client) |
Register a client to receive updates about engine changes. | |
virtual bool | unregister_client (SPtr< Interface > client) |
Unregister a client. | |
void | listen () |
Begin listening on network sockets. | |
float | frand () |
Return a random [0..1] float with uniform distribution. | |
void | set_driver (SPtr< Driver > driver) |
SampleCount | event_time () |
Return the frame time to execute an event that arrived now. More... | |
uint64_t | cycle_start_time (const RunContext &context) const |
Return the time this cycle began processing in microseconds. More... | |
uint64_t | current_time (const RunContext &context) const |
Return the current time in microseconds. More... | |
void | reset_load () |
Reset the load statistics (when the expected DSP load changes). More... | |
void | enqueue_event (Event *ev, Event::Mode mode=Event::Mode::NORMAL) |
Enqueue an event to be processed (non-realtime threads only). More... | |
unsigned | process_events () |
Process events (process thread only). More... | |
Ingen::World * | world () const |
Interface * | interface () const |
EventWriter * | event_writer () const |
AtomReader * | atom_interface () const |
BlockFactory * | block_factory () const |
Broadcaster * | broadcaster () const |
BufferFactory * | buffer_factory () const |
ControlBindings * | control_bindings () const |
Driver * | driver () const |
Log & | log () const |
GraphImpl * | root_graph () const |
PostProcessor * | post_processor () const |
Raul::Maid * | maid () const |
UndoStack * | undo_stack () const |
UndoStack * | redo_stack () const |
Worker * | worker () const |
Worker * | sync_worker () const |
RunContext & | run_context () |
void | locate (FrameTime s, SampleCount nframes) |
Locate to a given cycle. | |
void | emit_notifications (FrameTime end) |
bool | pending_notifications () |
bool | wait_for_tasks () |
void | signal_tasks () |
Task * | steal_task (unsigned start_thread) |
SPtr< Store > | store () const |
size_t | event_queue_size () const |
size_t | n_threads () const |
bool | atomic_bundles () const |
The engine which executes the process graph.
This is a simple class that provides pointers to the various components that make up the engine implementation. In processes with a local engine, it can be accessed via the Ingen::World.
|
virtual |
Initialise the engine for local use (e.g.
without a Jack driver).
sample_rate | Audio sampling rate in Hz. |
block_length | Audio block length (i.e. buffer size) in frames. |
seq_size | Sequence buffer size in bytes. |
Implements Ingen::EngineBase.
|
virtual |
Process audio for sample_count
frames.
If the return value is non-zero, events have been processed and are awaiting to be finalised (including responding and announcing any changes to clients) via a call to main_iteration().
Implements Ingen::EngineBase.
References Ingen::Server::RunContext::duration().
|
virtual |
Indicate that a quit is desired.
This function simply sets a flag which affects the return value of main_iteration, it does not actually force the engine to stop running or block. The code driving the engine is responsible for stopping and cleaning up when main_iteration returns false.
Implements Ingen::EngineBase.
|
virtual |
Run a single iteration of the main context.
The main context post-processes events and performs housekeeping duties like collecting garbage. This should be called regularly, e.g. a few times per second. The return value indicates whether execution should continue; i.e. if false is returned, a quit has been requested and the caller should cease calling main_iteration() and stop the engine.
Implements Ingen::EngineBase.
SampleCount Ingen::Server::Engine::event_time | ( | ) |
Return the frame time to execute an event that arrived now.
This aims to return a time one cycle from "now", so that events ideally have 1 cycle of latency with no jitter.
References Ingen::Server::ThreadManager::single_threaded.
|
inline |
Return the time this cycle began processing in microseconds.
This value is comparable to the value returned by current_time().
Referenced by Ingen::Server::PreProcessor::process().
uint64_t Ingen::Server::Engine::current_time | ( | const RunContext & | context | ) | const |
Return the current time in microseconds.
Referenced by Ingen::Server::PreProcessor::process().
void Ingen::Server::Engine::reset_load | ( | ) |
Reset the load statistics (when the expected DSP load changes).
void Ingen::Server::Engine::enqueue_event | ( | Event * | ev, |
Event::Mode | mode = Event::Mode::NORMAL |
||
) |
Enqueue an event to be processed (non-realtime threads only).
Referenced by Ingen::Server::EventWriter::bundle_begin(), and Ingen::Server::EventWriter::bundle_end().
unsigned Ingen::Server::Engine::process_events | ( | ) |
Process events (process thread only).