Compare commits

..

1 Commits

Author SHA1 Message Date
alex e60541260c draft agents text 2026-11-22 10:43:56 +00:00
3 changed files with 52 additions and 58 deletions
+23
View File
@@ -0,0 +1,23 @@
In line with [our humane policy](POLICY.md), code and documentation
should not be written by LLM agents. To this end, agents should not
edit the codebase or make any commits that are intended to be
contributed upstream. Likewise, LLM output should not be pasted into
issues, comments, pull requests and so on.
A contributor's personal use of LLMs and related technology is their
own business, whether for research, analysis, bug discovery or other
assistive technology, so long as the output is not included in any
contributions to our projects.
Strudel is AGPL licensed, and so any code integrated with it also
comes under that license. This should be carefully considered before
distributing software integrated with strudel, including making it
available over a network.
Strudel has purposefully moved away from github.com, as a closed
source platform with ethical issues. Please do not fork strudel back
to that platform, or similar corporate platforms.
Projects using strudel must not use "strudel" in their name, unless
they are 'official' projects, or have the blessing of the strudel
community.
+25 -56
View File
@@ -57,8 +57,9 @@ export function parseControlsFromHap(hap, cps) {
}
let timeOrigin = performance.timeOrigin;
export async function oscOutput(hap, targetTime, cps = 1) {
const ws = await connect();
function getOscTimestamp(targetTime) {
const timeMs = getClockBridge().getPerformanceTime(targetTime);
if (!timeMs) {
logger('[osc] clockbridge not ready');
@@ -72,73 +73,44 @@ function getOscTimestamp(targetTime) {
// shift time after microsleep
timeOrigin -= deprivation;
}
return timeOrigin + timeMs;
}
export async function oscOutput(hap, targetTime, cps = 1) {
const ws = await connect();
const ts = getOscTimestamp(targetTime);
if (!ts) {
return;
}
const ts = timeOrigin + timeMs;
const controls = parseControlsFromHap(hap, cps);
const keyvals = Object.entries(controls).flat();
const msg = { address: '/dirt/play', args: keyvals, timestamp: ts };
if ('oschost' in hap.value) {
msg.oschost = hap.value.oschost;
}
if ('oscport' in hap.value) {
msg.oscport = hap.value.oscport;
}
ws.send(JSON.stringify(msg));
}
export async function superdirtOutput(hap, targetTime, cps = 1) {
export async function superdirtTrigger(hap, currentTime, cps = 1, targetTime) {
const ws = await connect();
const ts = getOscTimestamp(targetTime);
if (!ts) {
return;
}
const controls = parseControlsFromHap(hap, cps);
const ts = collator.calculateTimestamp(currentTime, targetTime) * 1000;
const oschost = hap.value.oschost ?? '127.0.0.1';
const oscport = hap.value.oscport ?? 57120;
const bushost = oschost;
const busport = 57110;
let oschost = '127.0.0.1';
let oscport = 57120;
let bushost = oschost;
let busport = 57110;
// send SuperDirt bus/control messages first
for (const [key, busIdVal] of Object.entries(controls)) {
if (key.startsWith('^')) {
ws.send(
JSON.stringify({
oschost: bushost,
oscport: busport,
address: '/c_set',
args: busIdVal,
timestamp: ts,
}),
);
// so they aren't sent with trigger messages
delete controls[key];
for (const [k, v] of Object.entries(controls)) {
if (k.startsWith('^')) {
const bus_idval = v;
const msg = JSON.stringify({
oschost: bushost,
oscport: busport,
address: '/c_set',
args: bus_idval,
timestamp: ts,
});
// console.log('bus message', msg);
ws.send(msg);
// So they aren't sent with trigger messages
delete controls[k];
}
}
// only trigger samples on haps that actually begin here
if (hap.hasOnset()) {
const keyvals = Object.entries(controls).flat();
ws.send(
JSON.stringify({
oschost,
oscport,
address: '/dirt/play',
args: keyvals,
timestamp: ts,
}),
);
ws.send(JSON.stringify({ oschost, oscport, address: '/dirt/play', args: keyvals, timestamp: ts }));
}
}
@@ -156,7 +128,4 @@ export const osc = register('osc', (pat) => {
ensureMinimalOutput();
return pat.onSchedule(oscOutput);
});
export const superdirt = register('superdirt', (pat) => {
ensureMinimalOutput();
return pat._processParts().onSchedule(superdirtOutput);
});
export const superdirt = register('superdirt', (pat) => pat._processParts().onTrigger(superdirtTrigger));
+4 -2
View File
@@ -1,5 +1,7 @@
/* import { tauriOscOutput } from '../desktopbridge/oscbridge.mjs';
import { isTauri } from '../desktopbridge/utils.mjs'; */
// const output = /* isTauri() ? tauriOscOutput : */ oscOutput;
import { oscOutput } from './osc.mjs';
export { superdirtOutput } from './osc.mjs';
const output = /* isTauri() ? tauriOscOutput : */ oscOutput;
export const superdirtOutput = (hap, targetTime, cps) => output(hap, targetTime, cps);