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