Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const {createStore} = require('redux');
const {isEmpty} = require('lodash')
const {default: createVirtualAudioGraph} = require('virtual-audio-graph');
const {makeDistortionCurve, getGuitarSoundBuffer, stateToGraph} = require('./utils');
const reducer = require('./reducer')
const ui = require('./ui')
const audioContext = new AudioContext();
const virtualAudioGraph = createVirtualAudioGraph({
audioContext,
output: audioContext.destination,
});
// update using virtualAudioGraph
const updateAudioNodes = state => virtualAudioGraph.update(stateToGraph(state));
// update using plain Web Audio API
const nodes = {};
const updateAudioNodes2 = state => {
if (isEmpty(nodes)) {
// creating nodes
nodes.volume = audioContext.createGain();
nodes.distortion = audioContext.createWaveShaper();
nodes.distortion.oversample = state.distortion[2].oversample;
nodes.guitar = audioContext.createBufferSource();