Merge branch 'main' into glossing/distortion-modes

This commit is contained in:
Aria 2025-09-13 14:23:17 -05:00
commit 5f7e10733a
60 changed files with 2002 additions and 159 deletions

View file

@ -194,11 +194,17 @@ export function setVersionDefaults(version) {
export const resetLoadedSounds = () => soundMap.set({});
let externalWorklets = [];
export function registerWorklet(url) {
externalWorklets.push(url);
}
let workletsLoading;
function loadWorklets() {
if (!workletsLoading) {
const audioCtx = getAudioContext();
workletsLoading = audioCtx.audioWorklet.addModule(workletsUrl);
const allWorkletURLs = externalWorklets.concat([workletsUrl]);
workletsLoading = Promise.all(allWorkletURLs.map((workletURL) => audioCtx.audioWorklet.addModule(workletURL)));
}
return workletsLoading;
@ -395,7 +401,7 @@ function connectToOrbit(node, orbit) {
function setOrbit(audioContext, orbit, channels) {
if (orbits[orbit] == null) {
orbits[orbit] = {
gain: new GainNode(audioContext, { gain: 1 }),
gain: new GainNode(audioContext, { gain: 1, channelCount: 2, channelCountMode: 'explicit' }),
};
connectToDestination(orbits[orbit].gain, channels);
}