Ingen  0.5.1
Classes | Public Member Functions | List of all members
Ingen::Server::Engine Class Reference

The engine which executes the process graph. More...

#include <Engine.hpp>

+ Inheritance diagram for Ingen::Server::Engine:
+ Collaboration diagram for Ingen::Server::Engine:

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::Worldworld () const
 
Interfaceinterface () const
 
EventWriterevent_writer () const
 
AtomReaderatom_interface () const
 
BlockFactoryblock_factory () const
 
Broadcasterbroadcaster () const
 
BufferFactorybuffer_factory () const
 
ControlBindingscontrol_bindings () const
 
Driverdriver () const
 
Loglog () const
 
GraphImplroot_graph () const
 
PostProcessorpost_processor () const
 
Raul::Maid * maid () const
 
UndoStackundo_stack () const
 
UndoStackredo_stack () const
 
Workerworker () const
 
Workersync_worker () const
 
RunContextrun_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 ()
 
Tasksteal_task (unsigned start_thread)
 
SPtr< Storestore () const
 
size_t event_queue_size () const
 
size_t n_threads () const
 
bool atomic_bundles () const
 

Detailed Description

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.

Member Function Documentation

§ init()

void Ingen::Server::Engine::init ( double  sample_rate,
uint32_t  block_length,
size_t  seq_size 
)
virtual

Initialise the engine for local use (e.g.

without a Jack driver).

Parameters
sample_rateAudio sampling rate in Hz.
block_lengthAudio block length (i.e. buffer size) in frames.
seq_sizeSequence buffer size in bytes.

Implements Ingen::EngineBase.

§ run()

unsigned Ingen::Server::Engine::run ( uint32_t  sample_count)
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().

Returns
The number of events processed.

Implements Ingen::EngineBase.

References Ingen::Server::RunContext::duration().

§ quit()

void Ingen::Server::Engine::quit ( )
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.

§ main_iteration()

bool Ingen::Server::Engine::main_iteration ( )
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.

§ event_time()

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.

§ cycle_start_time()

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

§ current_time()

uint64_t Ingen::Server::Engine::current_time ( const RunContext context) const

Return the current time in microseconds.

Referenced by Ingen::Server::PreProcessor::process().

§ reset_load()

void Ingen::Server::Engine::reset_load ( )

Reset the load statistics (when the expected DSP load changes).

§ enqueue_event()

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

§ process_events()

unsigned Ingen::Server::Engine::process_events ( )

Process events (process thread only).


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