LV2 Toolkit  1.2.0
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Worker< Required >::I< Derived > Struct Template Reference
Collaboration diagram for Worker< Required >::I< Derived >:
Collaboration graph
[legend]

Public Member Functions

bool check_ok ()
 
WorkerStatus schedule_work (uint32_t size, const void *data)
 
WorkerStatus work (WorkerRespond &respond, uint32_t size, const void *data)
 
WorkerStatus work_response (uint32_t size, const void *body)
 
WorkerStatus end_run ()
 

Static Public Member Functions

static void map_feature_handlers (FeatureHandlerMap &hmap)
 
static void handle_feature (void *instance, FeatureData data)
 
static const void * extension_data (const char *uri)
 

Static Protected Member Functions

static LV2_Worker_Status _work (LV2_Handle instance, LV2_Worker_Respond_Function respond, LV2_Worker_Respond_Handle handle, uint32_t size, const void *data)
 
static LV2_Worker_Status _work_response (LV2_Handle instance, uint32_t size, const void *body)
 
static LV2_Worker_Status _end_run (LV2_Handle instance)
 

Protected Attributes

LV2_Worker_Schedule_Handle m_work_schedule_handle
 
LV2_Worker_Status(* m_schedule_work_func )(LV2_Worker_Schedule_Handle handle, uint32_t size, const void *data)
 

Member Function Documentation

bool check_ok ( )
inline

Sanity check the mixin

WorkerStatus end_run ( )
inline

Called when all responses for this cycle have been delivered.

Since work_response() may be called after run() finished, this provides a hook for code that must run after the cycle is completed.

This field may be NULL if the plugin has no use for it. Otherwise, the host MUST call it after every run(), regardless of whether or not any responses were sent that cycle.

static const void* extension_data ( const char *  uri)
inlinestatic
static void handle_feature ( void *  instance,
FeatureData  data 
)
inlinestatic
static void map_feature_handlers ( FeatureHandlerMap hmap)
inlinestatic
WorkerStatus schedule_work ( uint32_t  size,
const void *  data 
)
inline

Request from run() that the host call the worker.

This function is in the audio threading class. It should be called from run() to request that the host call the work() method in a non-realtime context with the given arguments.

This function is always safe to call from run(), but it is not guaranteed that the worker is actually called from a different thread. In particular, when free-wheeling (e.g. for offline rendering), the worker may be executed immediately. This allows single-threaded processing with sample accuracy and avoids timing problems when run() is executing much faster or slower than real-time.

Plugins SHOULD be written in such a way that if the worker runs immediately, and responses from the worker are delivered immediately, the effect of the work takes place immediately with sample accuracy.

The data MUST be safe for the host to copy and later pass to work(), and the host MUST guarantee that it will be eventually passed to work() if this function returns WORKER_SUCCESS.

Parameters
sizeThe size of data.
dataMessage to pass to work(), or NULL.
WorkerStatus work ( WorkerRespond respond,
uint32_t  size,
const void *  data 
)
inline

This is called by the host in a non-realtime context as requested, possibly with an arbitrary message to handle. A response can be sent to run() using respond. The plugin MUST NOT make any assumptions about which thread calls this method, other than the fact that there are no real-time requirements.

Parameters
respondA functor for sending a response to run().
sizeThe size of data.
dataData from run(), or NULL.
WorkerStatus work_response ( uint32_t  size,
const void *  body 
)
inline

Handle a response from the worker. This is called by the host in the run() context when a response from the worker is ready.

Parameters
sizeThe size of body.
bodyMessage body, or NULL.

The documentation for this struct was generated from the following file: