fill in remaining defaults

git push
This commit is contained in:
Jade (Rose) Rowland 2024-05-19 23:16:27 -04:00
parent eed4a83b71
commit a214b1b224

View File

@ -13,6 +13,7 @@ import { createFilter, gainNode, getCompressor } from './helpers.mjs';
import { map } from 'nanostores'; import { map } from 'nanostores';
import { logger } from './logger.mjs'; import { logger } from './logger.mjs';
import { loadBuffer } from './sampler.mjs'; import { loadBuffer } from './sampler.mjs';
import { velocity } from '../core/controls.mjs';
export const soundMap = map(); export const soundMap = map();
@ -24,12 +25,39 @@ export function getSound(s) {
return soundMap.get()[s]; return soundMap.get()[s];
} }
const defaults = new Map([['fanchor', 0]]); const defaults = new Map([
['s', 'triangle'],
['gain', 0.8],
['postgain', 1],
['density', '.03'],
['ftype', '12db'],
['fanchor', 0],
['resonance', 1],
['hresonance', 1],
['bandq', 1],
['channels', [1, 2]],
['phaserdepth', 0.75],
['shapevol', 1],
['distortvol', 1],
['delay', 0],
['delayfeedback', 0.5],
['delaytime', 0.25],
['orbit', 1],
['i', 1],
['velocity', 1],
['fft', 8],
]);
export function setDefault(key, value) { export function setDefault(key, value) {
defaults.set(key, value); defaults.set(key, value);
} }
export function setDefaults(defaultsobj) {
Object.keys(defaultsobj).forEach((key) => {
setDefault(key, defaultsobj[key]);
});
}
export const resetLoadedSounds = () => soundMap.set({}); export const resetLoadedSounds = () => soundMap.set({});
let audioContext; let audioContext;
@ -287,14 +315,14 @@ export const superdough = async (value, t, hapDuration) => {
} }
// destructure // destructure
let { let {
s = 'triangle', s = defaults.get('s'),
bank, bank,
source, source,
gain = 0.8, gain = defaults.get('gain'),
postgain = 1, postgain = defaults.get('postgain'),
density = 0.03, density = defaults.get('density'),
// filters // filters
ftype = '12db', ftype = defaults.get('ftype'),
fanchor = defaults.get('fanchor'), fanchor = defaults.get('fanchor'),
// low pass // low pass
cutoff, cutoff,
@ -303,7 +331,7 @@ export const superdough = async (value, t, hapDuration) => {
lpdecay, lpdecay,
lpsustain, lpsustain,
lprelease, lprelease,
resonance = 1, resonance = defaults.get('resonance'),
// high pass // high pass
hpenv, hpenv,
hcutoff, hcutoff,
@ -311,7 +339,7 @@ export const superdough = async (value, t, hapDuration) => {
hpdecay, hpdecay,
hpsustain, hpsustain,
hprelease, hprelease,
hresonance = 1, hresonance = defaults.get('hresonance'),
// band pass // band pass
bpenv, bpenv,
bandf, bandf,
@ -319,36 +347,36 @@ export const superdough = async (value, t, hapDuration) => {
bpdecay, bpdecay,
bpsustain, bpsustain,
bprelease, bprelease,
bandq = 1, bandq = defaults.get('bandq'),
channels = [1, 2], channels = defaults.get('channels'),
//phaser //phaser
phaser, phaser,
phaserdepth = 0.75, phaserdepth = defaults.get('phaserdepth'),
phasersweep, phasersweep,
phasercenter, phasercenter,
// //
coarse, coarse,
crush, crush,
shape, shape,
shapevol = 1, shapevol = defaults.get('shapevol'),
distort, distort,
distortvol = 1, distortvol = defaults.get('distortvol'),
pan, pan,
vowel, vowel,
delay = 0, delay = defaults.get('delay'),
delayfeedback = 0.5, delayfeedback = defaults.get('delayfeedback'),
delaytime = 0.25, delaytime = defaults.get('delaytime'),
orbit = 1, orbit = defaults.get('orbit'),
room, room,
roomfade, roomfade,
roomlp, roomlp,
roomdim, roomdim,
roomsize, roomsize,
ir, ir,
i = 0, i = defaults.get('i'),
velocity = 1, velocity = defaults.get('velocity'),
analyze, // analyser wet analyze, // analyser wet
fft = 8, // fftSize 0 - 10 fft = defaults.get('fft'), // fftSize 0 - 10
compressor: compressorThreshold, compressor: compressorThreshold,
compressorRatio, compressorRatio,
compressorKnee, compressorKnee,