Members
frame :Object
Current frame. This object and its data are updated at each incomming frame without reallocating memory.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
time |
Number | Time of the current frame. |
data |
Float32Array | Data of the current frame. |
metadata |
Object | Metadata associted to the current frame. |
- Source:
nextModules :Array.<BaseLfo>
List of nodes connected to the ouput of the node (lower in the graph).
At each frame, the node forward its frame
to to all its nextModules
.
Type:
- Array.<BaseLfo>
params :Object
Parameter bag containing parameter instances.
Type:
- Object
- Source:
prevModule :BaseLfo
The node from which the node receive the frames (upper in the graph).
Type:
- BaseLfo
streamParams :Object
Description of the stream output of the node.
Set to null
when the node is destroyed.
Type:
- Object
Properties:
Name | Type | Description |
---|---|---|
frameSize |
Number | Frame size at the output of the node. |
frameRate |
Number | Frame rate at the output of the node. |
frameType |
String | Frame type at the output of the node,
possible values are |
description |
Array | String | If type is |
sourceSampleRate |
Number | Sample rate of the source of the graph. The value should be defined by sources and never modified. |
sourceSampleCount |
Number | Number of consecutive discrete time values contained in the data frame output by the source. The value should be defined by sources and never modified. |
- Source:
Methods
connect(next)
Connect the current node (prevModule
) to another node (nextOp
).
A given node can be connected to several operators and propagate frames
to each of them.
Parameters:
Name | Type | Description |
---|---|---|
next |
BaseLfo | Next operator in the graph. |
- Source:
- See:
destroy()
Destroy all the nodes in the sub-graph starting from the current node.
When detroyed, the streamParams
of the node are set to null
, the
operator is then considered as dead
and cannot be reconnected.
- Source:
- See:
disconnect(nextopt)
Remove the given operator from its previous operators' nextModules
.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
next |
BaseLfo |
<optional> |
null | The operator to disconnect from the current
operator. If |
- Source:
finalizeStream(endTime)
Finalize the stream. A source node should call this method when stopped,
finalizeStream
is automatically propagated throught the graph.
Parameters:
Name | Type | Description |
---|---|---|
endTime |
Number | Logical time at which the graph is stopped. |
- Source:
getParamsDescription() → {Object}
Returns an object describing each available parameter of the node.
- Source:
Returns:
- Type
- Object
initModule()
Return a Promise
that resolve when the module is ready to be consumed.
Some modules relies on asynchronous APIs at initialization and thus could
be not ready to be consumed when the graph starts.
A module should be consider as initialized when all next modules (children)
are themselves initialized. The event bubbles up from sinks to sources.
When all its next operators are ready, a source can consider the whole graph
as ready and then start to produce frames.
The default implementation resolves when all next operators are resolved
themselves.
An operator relying on external async API must override this method to
resolve only when its dependecy is ready.
- Source:
- To Do:
-
- - Handle dynamic connections
Returns:
Promise
initStream(streamParamsopt)
Helper to initialize the stream in standalone mode.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
streamParams |
Object |
<optional> |
{} | Parameters of the stream. |
- Source:
- See:
onParamUpdate(name, value, metas)
Function called when a param is updated. By default set the _reinit
flag to true
if the param is static
one. This method should be
extended to handle particular logic bound to a specific parameter.
Parameters:
Name | Type | Description |
---|---|---|
name |
String | Name of the parameter. |
value |
Mixed | Value of the parameter. |
metas |
Object | Metadata associated to the parameter. |
- Source:
prepareFrame()
Common logic to perform at the beginning of the processFrame
.
- Source:
- See:
prepareStreamParams(prevStreamParams)
Common logic to do at the beginning of the processStreamParam
, must be
called at the beginning of any processStreamParam
implementation.
The method mainly check if the current node implement the interface to handle the type of frame propagated by it's parent:
- to handle a
vector
frame type, the class must implementprocessVector
- to handle a
signal
frame type, the class must implementprocessSignal
- in case of a 'scalar' frame type, the class can implement any of the
following by order of preference:
processScalar
,processVector
,processSignal
.
Parameters:
Name | Type | Description |
---|---|---|
prevStreamParams |
Object |
|
- Source:
- See:
processFrame(frame)
Define the particular logic the operator applies to the stream.
According to the frame type of the previous node, the method calls one
of the following method processVector
, processSignal
or processScalar
Parameters:
Name | Type | Description |
---|---|---|
frame |
Object | Frame (time, data, and metadata) as given by the previous operator. The incomming frame should never be modified by the operator. |
- Source:
- See:
processFunction()
Pointer to the method called in processFrame
according to the
frame type of the previous operator. Is dynamically assigned in
prepareStreamParams
.
- Source:
- See:
processStreamParams(prevStreamParams)
Initialize or update the operator's streamParams
according to the
previous operators streamParams
values.
When implementing a new operator this method should:
- call
this.prepareStreamParams
with the givenprevStreamParams
- optionnally change values to
this.streamParams
according to the logic performed by the operator. - optionnally allocate memory for ring buffers, etc.
- call
this.propagateStreamParams
to trigger the method on the next operators in the graph.
Parameters:
Name | Type | Description |
---|---|---|
prevStreamParams |
Object |
|
- Source:
- See:
propagateFrame()
Forward the current frame
to the next operators, is called at the end of
processFrame
.
- Source:
- See:
propagateStreamParams()
Create the this.frame.data
buffer and forward the operator's streamParam
to all its next operators, must be called at the end of any
processStreamParams
implementation.
- Source:
- See:
resetParams()
Reset all parameters to their initial value (as defined on instantication)
- Source:
- See:
resetStream()
Reset the frame.data
buffer by setting all its values to 0.
A source operator should call processStreamParams
and resetStream
when
started, each of these method propagate through the graph automaticaly.
- Source:
- See: