Vuo  2.3.2
Functions

Description

Setup, event handler, and teardown methods to be implemented by stateful node classes.

These functions are always called sequentially (not concurrently), so you don't need to make them mutually thread-safe.

Functions

struct nodeInstanceData * nodeInstanceInit (...)
 This function is called once for the node, either when the composition starts or when the node is added to a running composition. More...
 
void nodeInstanceTriggerStart (...)
 This function is called just after nodeInstanceInit() and each time the running composition is updated (e.g. More...
 
void nodeInstanceEvent (...)
 This function is called each time this node receives an event. More...
 
void nodeInstanceTriggerUpdate (...)
 This function is called each time an input port constant on this node is updated while the composition is running. More...
 
void nodeInstanceTriggerStop (...)
 This function is called each time the running composition is updated (e.g. More...
 
void nodeInstanceFini (...)
 This function is called once for the node, either when node is removed from the running composition or the composition stops. More...
 

Function Documentation

◆ nodeInstanceEvent()

void nodeInstanceEvent (   ...)

This function is called each time this node receives an event.

Typically, it's responsible for performing whatever task the node does; it takes any input data and events, processes them, and sets or fires any output data and events. For node classes whose primary task is firing events through trigger ports, this function may not be as important.

This function is called once per event received by the node (even if the event is received through multiple input ports).

Parameter decorations must include:

Parameter decorations may include:

This function should not modify heap data provided via VuoInputData. The node may retain references to heap data sent via VuoOutputData, but it should not modify the heap data once it has been sent via VuoOutputData.

See Developing Node Classes for more information.

Note
This function may be called even after nodeInstanceTriggerStop has been called. For example, when a composition is stopping, the runtime may call this node's nodeInstanceTriggerStop, then another node (whose triggers haven't yet been stopped) may fire an event, which may call this node's nodeInstanceEvent.

◆ nodeInstanceFini()

void nodeInstanceFini (   ...)

This function is called once for the node, either when node is removed from the running composition or the composition stops.

It's responsible for closing any services opened in nodeInstanceInit() or elsewhere.

Parameter decorations must include:

◆ nodeInstanceInit()

struct nodeInstanceData* nodeInstanceInit (   ...)

This function is called once for the node, either when the composition starts or when the node is added to a running composition.

It's responsible for creating the instance data, and may open services (file, network port, ...).

If this function allocates memory on the heap for the instance data, it should register that memory. See Managing Memory.

Parameter decorations may include:

  • VuoInputData — This argument has the initial (constant or default) value of the input port, before it has received any events.

◆ nodeInstanceTriggerStart()

void nodeInstanceTriggerStart (   ...)

This function is called just after nodeInstanceInit() and each time the running composition is updated (e.g.

when a node is added). It's responsible for starting any threads, dispatch sources, or event loops that call VuoOutputTrigger functions.

This function is optional.

Parameter decorations must include:

Parameter decorations may include:

  • VuoInputData — This argument has the current value of the input port.
  • VuoOutputTrigger — Stateful nodes may store references to trigger functions in their instance data, in order to fire events at any time.

◆ nodeInstanceTriggerStop()

void nodeInstanceTriggerStop (   ...)

This function is called each time the running composition is updated (e.g.

when a node is added) and just before nodeInstanceFini(). It's responsible for stopping all threads, dispatch sources, and event loops started in nodeInstanceTriggerStart() or elsewhere.

Any VuoOutputTrigger functions stored in instance data become invalid after this function returns. No VuoOutputTrigger functions should fire from the time this function returns to the next time that nodeInstanceTriggerStart() is called.

This function is optional.

Parameter decorations must include:

Parameter decorations may include:

  • VuoOutputTrigger — Stateful nodes may store references to trigger functions in their instance data, in order to fire events at any time.

◆ nodeInstanceTriggerUpdate()

void nodeInstanceTriggerUpdate (   ...)

This function is called each time an input port constant on this node is updated while the composition is running.

It's responsible for adjusting all VuoOutputTrigger callbacks to use the new input port values.

This function is optional.

Parameter decorations must include:

Parameter decorations may include:

  • VuoInputData — This argument has the current value of the input port.
  • VuoOutputTrigger — Stateful nodes may store references to trigger functions in their instance data, in order to fire events at any time.