From ca827960813c627aecff3ac424061da80c0958ef Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Thu, 22 Sep 2022 21:19:44 +0200 Subject: [PATCH] getDestination collides with tone -> do not export for now (not needed) -> can be refactored when tone is removed -> also prevent loading worklets in node --- packages/webaudio/webaudio.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/webaudio/webaudio.mjs b/packages/webaudio/webaudio.mjs index 78256af4..959e4ab8 100644 --- a/packages/webaudio/webaudio.mjs +++ b/packages/webaudio/webaudio.mjs @@ -23,7 +23,7 @@ export const getAudioContext = () => { }; let destination; -export const getDestination = () => { +const getDestination = () => { const ctx = getAudioContext(); if (!destination) { destination = ctx.createGain(); @@ -162,10 +162,12 @@ function getWorklet(ac, processor, params) { return node; } -try { - loadWorklets(); -} catch (err) { - console.warn('could not load AudioWorklet effects coarse, crush and shape', err); +if (typeof window !== 'undefined') { + try { + loadWorklets(); + } catch (err) { + console.warn('could not load AudioWorklet effects coarse, crush and shape', err); + } } const cutGroups = [];