fixing...
This commit is contained in:
parent
75b6f59212
commit
9416f317d4
2 changed files with 91 additions and 28 deletions
|
|
@ -343,41 +343,41 @@ function getDelay(orbit, delaytime, delayfeedback, t, channels) {
|
||||||
return delays[orbit];
|
return delays[orbit];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLfo(audioContext, begin, end, properties = {}) {
|
// export function getLfo(audioContext, begin, end, properties = {}) {
|
||||||
const { shape = 0, ...props } = properties;
|
// const { shape = 0, ...props } = properties;
|
||||||
const { dcoffset = -0.5, depth = 1 } = properties;
|
// const { dcoffset = -0.5, depth = 1 } = properties;
|
||||||
return getWorklet(audioContext, 'lfo-processor', {
|
|
||||||
frequency: 1,
|
|
||||||
depth,
|
|
||||||
skew: 0,
|
|
||||||
phaseoffset: 0,
|
|
||||||
time: begin,
|
|
||||||
begin,
|
|
||||||
end,
|
|
||||||
shape: getModulationShapeInput(shape),
|
|
||||||
dcoffset,
|
|
||||||
min: dcoffset - depth * 0.5,
|
|
||||||
max: dcoffset + depth * 0.5,
|
|
||||||
curve: 1,
|
|
||||||
...props,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// export function getLfo(audioContext, time, end, properties = {}) {
|
|
||||||
// return getWorklet(audioContext, 'lfo-processor', {
|
// return getWorklet(audioContext, 'lfo-processor', {
|
||||||
// frequency: 1,
|
// frequency: 1,
|
||||||
// depth: 1,
|
// depth,
|
||||||
// skew: 0,
|
// skew: 0,
|
||||||
// phaseoffset: 0,
|
// phaseoffset: 0,
|
||||||
// time,
|
// time: begin,
|
||||||
// begin: time,
|
// begin,
|
||||||
// end,
|
// end,
|
||||||
// shape: 1,
|
// shape: getModulationShapeInput(shape),
|
||||||
// dcoffset: -0.5,
|
// dcoffset,
|
||||||
// ...properties,
|
// min: dcoffset - depth * 0.5,
|
||||||
|
// max: dcoffset + depth * 0.5,
|
||||||
|
// curve: 1,
|
||||||
|
// ...props,
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
export function getLfo(audioContext, time, end, properties = {}) {
|
||||||
|
return getWorklet(audioContext, 'lfo-processor', {
|
||||||
|
frequency: 1,
|
||||||
|
depth: 1,
|
||||||
|
skew: 0,
|
||||||
|
phaseoffset: 0,
|
||||||
|
time,
|
||||||
|
begin: time,
|
||||||
|
end,
|
||||||
|
shape: 1,
|
||||||
|
dcoffset: -0.5,
|
||||||
|
...properties,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getSyncedLfo(audioContext, time, end, cps, cycle, properties = {}) {
|
export function getSyncedLfo(audioContext, time, end, cps, cycle, properties = {}) {
|
||||||
const frequency = cycle / cps;
|
const frequency = cycle / cps;
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,70 @@ function getParamValue(block, param) {
|
||||||
}
|
}
|
||||||
return param[0];
|
return param[0];
|
||||||
}
|
}
|
||||||
const waveShapeNames = Object.keys(waveshapes);
|
// const waveShapeNames = Object.keys(waveshapes);
|
||||||
|
// class LFOProcessor extends AudioWorkletProcessor {
|
||||||
|
// static get parameterDescriptors() {
|
||||||
|
// return [
|
||||||
|
// { name: 'time', defaultValue: 0 },
|
||||||
|
// { name: 'end', defaultValue: 0 },
|
||||||
|
// { name: 'frequency', defaultValue: 0.5 },
|
||||||
|
// { name: 'skew', defaultValue: 0.5 },
|
||||||
|
// { name: 'depth', defaultValue: 1 },
|
||||||
|
// { name: 'phaseoffset', defaultValue: 0 },
|
||||||
|
// { name: 'shape', defaultValue: 0 },
|
||||||
|
// { name: 'dcoffset', defaultValue: 0 },
|
||||||
|
// ];
|
||||||
|
// }
|
||||||
|
|
||||||
|
// constructor() {
|
||||||
|
// super();
|
||||||
|
// this.phase;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// incrementPhase(dt) {
|
||||||
|
// this.phase += dt;
|
||||||
|
// if (this.phase > 1.0) {
|
||||||
|
// this.phase = this.phase - 1;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// process(inputs, outputs, parameters) {
|
||||||
|
// // eslint-disable-next-line no-undef
|
||||||
|
// if (currentTime >= parameters.end[0]) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const output = outputs[0];
|
||||||
|
// const frequency = parameters['frequency'][0];
|
||||||
|
|
||||||
|
// const time = parameters['time'][0];
|
||||||
|
// const depth = parameters['depth'][0];
|
||||||
|
// const skew = parameters['skew'][0];
|
||||||
|
// const phaseoffset = parameters['phaseoffset'][0];
|
||||||
|
|
||||||
|
// const dcoffset = parameters['dcoffset'][0];
|
||||||
|
// const shape = waveShapeNames[parameters['shape'][0]];
|
||||||
|
|
||||||
|
// const blockSize = output[0].length ?? 0;
|
||||||
|
|
||||||
|
// if (this.phase == null) {
|
||||||
|
// this.phase = _mod(time * frequency + phaseoffset, 1);
|
||||||
|
// }
|
||||||
|
// // eslint-disable-next-line no-undef
|
||||||
|
// const dt = frequency / sampleRate;
|
||||||
|
// for (let n = 0; n < blockSize; n++) {
|
||||||
|
// for (let i = 0; i < output.length; i++) {
|
||||||
|
// const modval = (waveshapes[shape](this.phase, skew) + dcoffset) * depth;
|
||||||
|
// output[i][n] = modval;
|
||||||
|
// }
|
||||||
|
// this.incrementPhase(dt);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// registerProcessor('lfo-processor', LFOProcessor);
|
||||||
|
// const waveShapeNames = Object.keys(waveshapes);
|
||||||
class LFOProcessor extends AudioWorkletProcessor {
|
class LFOProcessor extends AudioWorkletProcessor {
|
||||||
static get parameterDescriptors() {
|
static get parameterDescriptors() {
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue