mirror of
https://codeberg.org/uzu/strudel
synced 2026-07-13 14:26:58 -04:00
Restore old lfo to avoid unifying right now
This commit is contained in:
@@ -109,7 +109,29 @@ export function getEnvelope(audioContext, properties = {}) {
|
||||
return getWorklet(audioContext, 'envelope-processor', properties);
|
||||
}
|
||||
|
||||
export function getLfo(audioContext, properties = {}) {
|
||||
export function getLfo(audioContext, begin, end, properties = {}) {
|
||||
const { shape = 0, ...props } = properties;
|
||||
const { dcoffset = -0.5, depth = 1 } = properties;
|
||||
const lfoprops = {
|
||||
frequency: 1,
|
||||
depth,
|
||||
skew: 0.5,
|
||||
phaseoffset: 0,
|
||||
time: begin,
|
||||
begin,
|
||||
end,
|
||||
shape: getModulationShapeInput(shape),
|
||||
dcoffset,
|
||||
min: dcoffset * depth,
|
||||
max: dcoffset * depth + depth,
|
||||
curve: 1,
|
||||
...props,
|
||||
};
|
||||
|
||||
return getWorklet(audioContext, 'lfo-processor', lfoprops);
|
||||
}
|
||||
|
||||
export function getCustomLfo(audioContext, properties = {}) {
|
||||
// Extract some params we need for deriving other params
|
||||
const { shape = 0, ...props } = properties;
|
||||
const lfoprops = {
|
||||
|
||||
@@ -443,7 +443,7 @@ function _getTargetParamsForControl(control, nodes, subControl) {
|
||||
return { targetParams: audioParams, paramName };
|
||||
}
|
||||
|
||||
function connectLFO(idx, params, nodeTracker, value) {
|
||||
function connectLFO(idx, params, nodeTracker) {
|
||||
const { rate = 1, sync, cps, cycle, control = 'lfo', subControl, depth = 1, depthabs, ...filteredParams } = params;
|
||||
const { targetParams, paramName } = _getTargetParamsForControl(control, nodeTracker, subControl);
|
||||
const currentValue = targetParams[0].value;
|
||||
@@ -457,13 +457,13 @@ function connectLFO(idx, params, nodeTracker, value) {
|
||||
min,
|
||||
max,
|
||||
};
|
||||
const lfoNode = getLfo(getAudioContext(), modParams);
|
||||
const lfoNode = getCustomLfo(getAudioContext(), modParams);
|
||||
nodeTracker[`lfo${idx}`] = [lfoNode];
|
||||
targetParams.forEach((t) => lfoNode.connect(t));
|
||||
return lfoNode;
|
||||
}
|
||||
|
||||
function connectEnvelope(idx, params, nodeTracker, value) {
|
||||
function connectEnvelope(idx, params, nodeTracker) {
|
||||
const { control, subControl, acurve, dcurve, rcurve, depth = 1, depthabs, ...filteredParams } = params;
|
||||
const { targetParams, paramName } = _getTargetParamsForControl(control, nodeTracker, subControl);
|
||||
const currentValue = targetParams[0].value;
|
||||
@@ -997,7 +997,6 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
||||
end: endWithRelease,
|
||||
},
|
||||
nodes,
|
||||
value,
|
||||
);
|
||||
audioNodes.push(lfo);
|
||||
}
|
||||
@@ -1012,14 +1011,13 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
||||
end: endWithRelease,
|
||||
},
|
||||
nodes,
|
||||
value,
|
||||
);
|
||||
audioNodes.push(env);
|
||||
}
|
||||
}
|
||||
if (value.bmod) {
|
||||
for (const p of value.bmod) {
|
||||
const { toCleanup } = connectBusModulator({ ...p, begin: t, end: endWithRelease }, nodes, value);
|
||||
const { toCleanup } = connectBusModulator({ ...p, begin: t, end: endWithRelease }, nodes);
|
||||
audioNodes.push(...toCleanup);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user