try to send osc as timestamped bundle
This commit is contained in:
parent
ba095d8e7f
commit
0bfbd87bbf
2 changed files with 11 additions and 5 deletions
|
|
@ -1,15 +1,18 @@
|
|||
import OSC from './node_modules/osc-js/lib/osc.js';
|
||||
import { Pattern, isPattern } from '@strudel.cycles/core/strudel.mjs';
|
||||
//import {OSC} from 'osc-js';
|
||||
|
||||
const comm = new OSC();
|
||||
comm.open();
|
||||
const startTime = Date.now();
|
||||
const latency = 0.1 * 1000;
|
||||
|
||||
Pattern.prototype.osc = function () {
|
||||
return this._withEvent((event) => {
|
||||
const onTrigger = (time, event) => {
|
||||
console.log(time);
|
||||
const keyvals = Object.entries(event.value).flat();
|
||||
const message = new OSC.Message('/dirt/play', ...keyvals);
|
||||
const ts = startTime + (time*1000);
|
||||
const message = new OSC.Message('/dirt/play', ts, ...keyvals);
|
||||
comm.send(message);
|
||||
};
|
||||
return event.setContext({ ...event.context, onTrigger });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue