mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-24 12:08:28 +00:00
hackery
This commit is contained in:
parent
34ba762b42
commit
23be3e5ba3
@ -744,6 +744,11 @@ const generic_params = [
|
|||||||
['f', 'uid', ''],
|
['f', 'uid', ''],
|
||||||
['f', 'val', ''],
|
['f', 'val', ''],
|
||||||
['f', 'cps', ''],
|
['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
|
// 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;
|
const latency = 0.1;
|
||||||
|
|
||||||
// Pattern.prototype.midi = function (output: string | number, channel = 1) {
|
|
||||||
Pattern.prototype.serial = async function (...args) {
|
Pattern.prototype.serial = async function (...args) {
|
||||||
return this._withHap((hap) => {
|
return this._withHap((hap) => {
|
||||||
if (!serialWriter) {
|
if (!serialWriter) {
|
||||||
@ -43,11 +42,11 @@ Pattern.prototype.serial = async function (...args) {
|
|||||||
const onTrigger = (time, hap, currentTime) => {
|
const onTrigger = (time, hap, currentTime) => {
|
||||||
var message = "";
|
var message = "";
|
||||||
if (typeof hap.value === 'object') {
|
if (typeof hap.value === 'object') {
|
||||||
if ('what' in hap.value) {
|
if ('action' in hap.value) {
|
||||||
message += hap.value['what'] + '(';
|
message += hap.value['action'] + '(';
|
||||||
var first = true;
|
var first = true;
|
||||||
for (const [key, val] of Object.entries(hap.value)) {
|
for (const [key, val] of Object.entries(hap.value)) {
|
||||||
if (key === 'what') {
|
if (key === 'action') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (first) {
|
if (first) {
|
||||||
@ -69,6 +68,7 @@ Pattern.prototype.serial = async function (...args) {
|
|||||||
else {
|
else {
|
||||||
message = hap.value;
|
message = hap.value;
|
||||||
}
|
}
|
||||||
|
console.log("sending: " + message);
|
||||||
const offset = (time - currentTime + latency) * 1000;
|
const offset = (time - currentTime + latency) * 1000;
|
||||||
window.setTimeout(serialWriter, offset, message);
|
window.setTimeout(serialWriter, offset, message);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user