Constructor
new EventIn(options)
Parameters:
Name | Type | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object | Override parameters' default values. Properties
|
- Source:
- To Do:
-
- - Add a `logicalTime` parameter to tag frame according to frame rate.
Example
import * as lfo from 'waves-lfo/client';
const eventIn = new lfo.source.EventIn({
frameType: 'vector',
frameSize: 3,
frameRate: 1 / 50,
description: ['alpha', 'beta', 'gamma'],
});
// connect source to operators and sink(s)
// initialize and start the graph
eventIn.start();
// feed `deviceorientation` data into the graph
window.addEventListener('deviceorientation', (e) => {
const frame = {
time: window.performace.now() / 1000,
data: [e.alpha, e.beta, e.gamma],
};
eventIn.processFrame(frame);
}, false);
Methods
process(time, data, metadata)
Alternative interface to propagate a frame in the graph. Pack time
,
data
and metadata
in a frame object.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
time |
Number | Frame time. |
|
data |
Float32Array | Array | Frame data. |
|
metadata |
Object | null | Optionnal frame metadata. |
- Source:
Example
eventIn.process(1, [0, 1, 2]);
// is equivalent to
eventIn.processFrame({ time: 1, data: [0, 1, 2] });
processFrame(frame)
Propagate a frame object in the graph.
Parameters:
Name | Type | Description | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
frame |
Object | Input frame. Properties
|
- Source:
Example
eventIn.processFrame({ time: 1, data: [0, 1, 2] });
start()
Propagate the streamParams
in the graph and allow to push frames into
the graph. Any call to process
or processFrame
before start
will be
ignored.
- Source:
- See:
stop()
Finalize the stream and stop the whole graph. Any call to process
or
processFrame
after stop
will be ignored.