Restore old lfo to avoid unifying right now
This commit is contained in:
parent
12f9af227c
commit
ef2ee0969a
2 changed files with 27 additions and 7 deletions
|
|
@ -109,7 +109,29 @@ export function getEnvelope(audioContext, properties = {}) {
|
||||||
return getWorklet(audioContext, 'envelope-processor', 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
|
// Extract some params we need for deriving other params
|
||||||
const { shape = 0, ...props } = properties;
|
const { shape = 0, ...props } = properties;
|
||||||
const lfoprops = {
|
const lfoprops = {
|
||||||
|
|
|
||||||
|
|
@ -443,7 +443,7 @@ function _getTargetParamsForControl(control, nodes, subControl) {
|
||||||
return { targetParams: audioParams, paramName };
|
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 { rate = 1, sync, cps, cycle, control = 'lfo', subControl, depth = 1, depthabs, ...filteredParams } = params;
|
||||||
const { targetParams, paramName } = _getTargetParamsForControl(control, nodeTracker, subControl);
|
const { targetParams, paramName } = _getTargetParamsForControl(control, nodeTracker, subControl);
|
||||||
const currentValue = targetParams[0].value;
|
const currentValue = targetParams[0].value;
|
||||||
|
|
@ -457,13 +457,13 @@ function connectLFO(idx, params, nodeTracker, value) {
|
||||||
min,
|
min,
|
||||||
max,
|
max,
|
||||||
};
|
};
|
||||||
const lfoNode = getLfo(getAudioContext(), modParams);
|
const lfoNode = getCustomLfo(getAudioContext(), modParams);
|
||||||
nodeTracker[`lfo${idx}`] = [lfoNode];
|
nodeTracker[`lfo${idx}`] = [lfoNode];
|
||||||
targetParams.forEach((t) => lfoNode.connect(t));
|
targetParams.forEach((t) => lfoNode.connect(t));
|
||||||
return lfoNode;
|
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 { control, subControl, acurve, dcurve, rcurve, depth = 1, depthabs, ...filteredParams } = params;
|
||||||
const { targetParams, paramName } = _getTargetParamsForControl(control, nodeTracker, subControl);
|
const { targetParams, paramName } = _getTargetParamsForControl(control, nodeTracker, subControl);
|
||||||
const currentValue = targetParams[0].value;
|
const currentValue = targetParams[0].value;
|
||||||
|
|
@ -997,7 +997,6 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
||||||
end: endWithRelease,
|
end: endWithRelease,
|
||||||
},
|
},
|
||||||
nodes,
|
nodes,
|
||||||
value,
|
|
||||||
);
|
);
|
||||||
audioNodes.push(lfo);
|
audioNodes.push(lfo);
|
||||||
}
|
}
|
||||||
|
|
@ -1012,14 +1011,13 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
||||||
end: endWithRelease,
|
end: endWithRelease,
|
||||||
},
|
},
|
||||||
nodes,
|
nodes,
|
||||||
value,
|
|
||||||
);
|
);
|
||||||
audioNodes.push(env);
|
audioNodes.push(env);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (value.bmod) {
|
if (value.bmod) {
|
||||||
for (const p of 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);
|
audioNodes.push(...toCleanup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue