Merge pull request 'Make kabelsalat stereo out' (#1927) from glossing/ks-stereo-out into main

Reviewed-on: https://codeberg.org/uzu/strudel/pulls/1927
This commit is contained in:
Aria
2026-01-17 21:00:42 +01:00
2 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -613,7 +613,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
// Kabelsalat
if (fx.workletSrc !== undefined) {
const workletNode = getWorklet(ac, 'generic-processor', {});
const workletNode = getWorklet(ac, 'generic-processor', {}, { outputChannelCount: [2] });
chain.connect(workletNode);
const workletSrc = fx.workletSrc
.replace(/\bpat\[(\d+)\]/g, (_, i) => fx.workletInputs[i])
+12 -4
View File
@@ -1540,12 +1540,20 @@ class GenericProcessor extends AudioWorkletProcessor {
this.gateNode?.setValue(0);
this.gateEnded = true;
}
const outL = outputs[0][0];
const outR = outputs[0][1] ?? outputs[0][0];
const output = outputs[0];
const outL = output[0];
const outR = output[1];
for (let n = 0; n < blockSize; n++) {
this.genSample(this.playPos, this.nodes, input ? input[n] : 0, this.registers, this.outputs, this.sources);
outL[n] = this.outputs[0];
outR[n] = this.outputs[1];
const left = this.outputs[0];
const right = this.outputs[1];
// Spread to stereo if possible; else mixdown to mono
if (outR) {
outL[n] = left;
outR[n] = right;
} else {
outL[n] = 0.5 * (left + right);
}
this.playPos += 1 / sampleRate;
}
return true;