initial support for osc (buggy)

This commit is contained in:
2023-11-22 12:12:36 +01:00
parent bbd7ccdeaa
commit fa67fdc2e5
8 changed files with 610 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import { type Editor } from "../main";
import { AudibleEvent } from "./AbstractEvents";
import { sendToServer, type OSCMessage } from "../IO/OSC";
import {
filterObject,
arrayOfObjectsToObjectWithArrays,
@ -46,6 +47,7 @@ export class SoundEvent extends AudibleEvent {
pitchJumpTime: ["pitchJumpTime", "pjt"],
lfo: ["lfo"],
znoise: ["znoise"],
address: ["address", "add"],
noise: ["noise"],
zmod: ["zmod"],
zcrush: ["zcrush"],
@ -452,4 +454,24 @@ export class SoundEvent extends AudibleEvent {
superdough(filteredEvent, this.nudge - this.app.clock.deviation, filteredEvent.dur);
}
};
osc = (orbit?: number | number[]): void => {
if (orbit) this.values["orbit"] = orbit;
const events = objectWithArraysToArrayOfObjects(this.values, [
"parsedScale",
]);
for (const event of events) {
const filteredEvent = event;
let oscAddress = this.values["address"]?.startsWith('/') ? this.values["address"] : `/${this.values["address"]}` || "/topos";
if (filteredEvent.freq) { delete filteredEvent.note; }
sendToServer({
address: oscAddress,
message: event,
timetag: Math.round(Date.now() + this.nudge - this.app.clock.deviation)
} as OSCMessage)
}
}
}