Add param guesses
This commit is contained in:
parent
442f487973
commit
f8796d039f
1 changed files with 33 additions and 3 deletions
|
|
@ -408,7 +408,38 @@ function _getNodeParams(node) {
|
||||||
return Array.from(params);
|
return Array.from(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const targetToParamGuess = {
|
||||||
|
source: 'detune',
|
||||||
|
lpf: 'frequency',
|
||||||
|
bpf: 'frequency',
|
||||||
|
hpf: 'frequency',
|
||||||
|
distort: 'distort',
|
||||||
|
gain: 'gain',
|
||||||
|
vowel: 'frequency',
|
||||||
|
coarse: 'coarse',
|
||||||
|
crush: 'crush',
|
||||||
|
shape: 'shape',
|
||||||
|
compressor: 'threshold',
|
||||||
|
pan: 'pan',
|
||||||
|
phaser: 'rate',
|
||||||
|
post: 'gain',
|
||||||
|
delay: 'time',
|
||||||
|
room: 'size',
|
||||||
|
djf: 'value',
|
||||||
|
lfo: 'frequency',
|
||||||
|
env: 'depth',
|
||||||
|
send: 'depth',
|
||||||
|
}
|
||||||
|
|
||||||
function _getTargetParams(nodes, target) {
|
function _getTargetParams(nodes, target) {
|
||||||
|
let param;
|
||||||
|
if (target.includes('.')) {
|
||||||
|
const split = target.split('.');
|
||||||
|
target = split[0];
|
||||||
|
param = split[1];
|
||||||
|
} else {
|
||||||
|
param = targetToParamGuess[target];
|
||||||
|
}
|
||||||
const targetNodes = nodes[target];
|
const targetNodes = nodes[target];
|
||||||
if (!targetNodes) {
|
if (!targetNodes) {
|
||||||
const keys = Object.keys(nodes);
|
const keys = Object.keys(nodes);
|
||||||
|
|
@ -422,13 +453,12 @@ function _getTargetParams(nodes, target) {
|
||||||
}
|
}
|
||||||
const audioParams = [];
|
const audioParams = [];
|
||||||
targetNodes.forEach((targetNode) => {
|
targetNodes.forEach((targetNode) => {
|
||||||
const paramName = guessParamName(blah);
|
const targetParam = _getNodeParam(targetNode, param);
|
||||||
const targetParam = _getNodeParam(targetNode, paramName);
|
|
||||||
if (!targetParam) {
|
if (!targetParam) {
|
||||||
const available = _getNodeParams(targetNode);
|
const available = _getNodeParams(targetNode);
|
||||||
errorLogger(
|
errorLogger(
|
||||||
new Error(
|
new Error(
|
||||||
`Could not connect to parameter '${paramName}' on '${targetName}'. Available parameters: ${available.join(', ')}`,
|
`Could not connect to parameter '${param}' on '${targetName}'. Available parameters: ${available.join(', ')}`,
|
||||||
),
|
),
|
||||||
'superdough',
|
'superdough',
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue