From 099d321dbd1489b885e2e1f8b639b41b39863d34 Mon Sep 17 00:00:00 2001 From: "Jade (Rose) Rowland" Date: Wed, 7 May 2025 11:25:34 -0400 Subject: [PATCH] format --- packages/superdough/superdough.mjs | 17 +++++++++-------- .../src/repl/components/panel/SettingsTab.jsx | 9 +++++++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 90f0d369..f774ca60 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -441,6 +441,11 @@ export function resetGlobalEffects() { } let activeSoundSources = new Map(); +//music programs/audio gear usually increments inputs/outputs from 1, we need to subtract 1 from the input because the webaudio API channels start at 0 + +function mapChannelNumbers(channels) { + return (Array.isArray(channels) ? channels : [value.channels]).map((ch) => ch - 1); +} export const superdough = async (value, t, hapDuration) => { const ac = getAudioContext(); @@ -539,14 +544,10 @@ export const superdough = async (value, t, hapDuration) => { compressorRelease, } = value; - //music programs/audio gear usually increments inputs/outputs from 1, we need to subtract 1 from the input because the webaudio API channels start at 0 - const orbitChannels = ( - multiChannelOrbits && orbit > 0 ? [orbit * 2 - 1, orbit * 2] : getDefaultValue('channels') - ).map((ch) => ch - 1); - const channels = - value.channels != null - ? (Array.isArray(value.channels) ? value.channels : [value.channels]).map((ch) => ch - 1) - : orbitChannels; + const orbitChannels = mapChannelNumbers( + multiChannelOrbits && orbit > 0 ? [orbit * 2 - 1, orbit * 2] : getDefaultValue('channels'), + ); + const channels = value.channels != null ? mapChannelNumbers(value.channels) : orbitChannels; gain = applyGainCurve(nanFallback(gain, 1)); postgain = applyGainCurve(postgain); diff --git a/website/src/repl/components/panel/SettingsTab.jsx b/website/src/repl/components/panel/SettingsTab.jsx index dd372555..5be9b602 100644 --- a/website/src/repl/components/panel/SettingsTab.jsx +++ b/website/src/repl/components/panel/SettingsTab.jsx @@ -168,8 +168,13 @@ export function SettingsTab({ started }) { label="Multi Channel Orbits" onChange={(cbEvent) => { const val = cbEvent.target.checked; - settingsMap.setKey('multiChannelOrbits', val); - setMultiChannelOrbits(val); + confirmDialog(RELOAD_MSG).then((r) => { + if (r == true) { + settingsMap.setKey('multiChannelOrbits', val); + setMultiChannelOrbits(val); + return window.location.reload(); + } + }); }} value={multiChannelOrbits} />