Fully working version with multiple LFOs
This commit is contained in:
parent
4a70ac5a99
commit
efb337677c
5 changed files with 103 additions and 48 deletions
|
|
@ -108,6 +108,7 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||
{ name: 'dcoffset', defaultValue: 0 },
|
||||
{ name: 'min', defaultValue: 0 },
|
||||
{ name: 'max', defaultValue: 1 },
|
||||
{ name: 'persistent', defaultValue: 0, min: 0, max: 1 }, // whether to ignore end
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -123,9 +124,11 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
process(inputs, outputs, parameters) {
|
||||
process(_inputs, outputs, parameters) {
|
||||
const begin = parameters['begin'][0];
|
||||
if (currentTime >= parameters.end[0]) {
|
||||
const end = parameters['end'][0];
|
||||
const persistent = parameters['persistent'][0];
|
||||
if ((persistent < 0.5) && currentTime >= end) {
|
||||
return false;
|
||||
}
|
||||
if (currentTime <= begin) {
|
||||
|
|
@ -143,8 +146,9 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||
const curve = parameters['curve'][0];
|
||||
|
||||
const dcoffset = parameters['dcoffset'][0];
|
||||
const min = parameters['min'][0];
|
||||
const max = parameters['max'][0];
|
||||
|
||||
const min = dcoffset * depth;
|
||||
const max = dcoffset * depth + depth;
|
||||
const shape = waveShapeNames[parameters['shape'][0]];
|
||||
|
||||
const blockSize = output[0].length ?? 0;
|
||||
|
|
@ -161,7 +165,7 @@ class LFOProcessor extends AudioWorkletProcessor {
|
|||
}
|
||||
this.incrementPhase(dt);
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue