mirror of
https://github.com/eliasstepanik/strudel.git
synced 2026-01-11 13:48:40 +00:00
hackery
This commit is contained in:
parent
34ba762b42
commit
23be3e5ba3
@ -744,6 +744,11 @@ const generic_params = [
|
||||
['f', 'uid', ''],
|
||||
['f', 'val', ''],
|
||||
['f', 'cps', ''],
|
||||
['s', 'action', ''],
|
||||
['f', 'by', ''],
|
||||
['s', 'part', ''],
|
||||
['f', 'to', ''],
|
||||
['f', 'duration', ''],
|
||||
];
|
||||
|
||||
// TODO: slice / splice https://www.youtube.com/watch?v=hKhPdO0RKDQ&list=PL2lW1zNIIwj3bDkh-Y3LUGDuRcoUigoDs&index=13
|
||||
|
||||
@ -34,7 +34,6 @@ export async function getWriter(br=115200) {
|
||||
|
||||
const latency = 0.1;
|
||||
|
||||
// Pattern.prototype.midi = function (output: string | number, channel = 1) {
|
||||
Pattern.prototype.serial = async function (...args) {
|
||||
return this._withHap((hap) => {
|
||||
if (!serialWriter) {
|
||||
@ -43,11 +42,11 @@ Pattern.prototype.serial = async function (...args) {
|
||||
const onTrigger = (time, hap, currentTime) => {
|
||||
var message = "";
|
||||
if (typeof hap.value === 'object') {
|
||||
if ('what' in hap.value) {
|
||||
message += hap.value['what'] + '(';
|
||||
if ('action' in hap.value) {
|
||||
message += hap.value['action'] + '(';
|
||||
var first = true;
|
||||
for (const [key, val] of Object.entries(hap.value)) {
|
||||
if (key === 'what') {
|
||||
if (key === 'action') {
|
||||
continue;
|
||||
}
|
||||
if (first) {
|
||||
@ -69,6 +68,7 @@ Pattern.prototype.serial = async function (...args) {
|
||||
else {
|
||||
message = hap.value;
|
||||
}
|
||||
console.log("sending: " + message);
|
||||
const offset = (time - currentTime + latency) * 1000;
|
||||
window.setTimeout(serialWriter, offset, message);
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user