Constructor
new Bridge(options)
Parameters:
Name |
Type |
Description |
options |
Object
|
Override default parameters.
Properties
Name |
Type |
Attributes |
Default |
Description |
processFrame |
function
|
<optional>
|
null
|
Callback executed on each
processFrame call. |
finalizeStream |
function
|
<optional>
|
null
|
Callback executed on each
finalizeStream call. |
|
- Source:
- See:
-
Example
import * as lfo from 'waves-lfo/common';
const frames = [
{ time: 0, data: [0, 1] },
{ time: 1, data: [1, 2] },
];
const eventIn = new EventIn({
frameType: 'vector',
frameSize: 2,
frameRate: 1,
});
const bridge = new Bridge({
processFrame: (frame) => console.log(frame),
});
eventIn.connect(bridge);
eventIn.start();
// callback executed on each frame
eventIn.processFrame(frame[0]);
> { time: 0, data: [0, 1] }
eventIn.processFrame(frame[1]);
> { time: 1, data: [1, 2] }
// pull current frame when needed
console.log(bridge.frame);
> { time: 1, data: [1, 2] }