Format
This commit is contained in:
parent
428a4b3dd7
commit
4bdaf577c0
9 changed files with 360 additions and 318 deletions
|
|
@ -1,15 +1,15 @@
|
|||
import { analysers, resetGlobalEffects } from "./superdough.mjs";
|
||||
import { analysers, resetGlobalEffects } from './superdough.mjs';
|
||||
|
||||
let audioContext;
|
||||
|
||||
export const setDefaultAudioContext = () => {
|
||||
audioContext = new AudioContext();
|
||||
resetGlobalEffects()
|
||||
resetGlobalEffects();
|
||||
return audioContext;
|
||||
};
|
||||
|
||||
export const setAudioContext = (context) => {
|
||||
audioContext = context
|
||||
audioContext = context;
|
||||
return audioContext;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ export function applyFM(param, value, begin) {
|
|||
duration,
|
||||
} = value;
|
||||
let modulator;
|
||||
let stop = () => { };
|
||||
let stop = () => {};
|
||||
|
||||
if (fmModulationIndex) {
|
||||
const ac = getAudioContext();
|
||||
|
|
|
|||
|
|
@ -212,7 +212,9 @@ export function loadWorklets() {
|
|||
if (!workletsLoading) {
|
||||
const audioCtx = getAudioContext();
|
||||
const allWorkletURLs = externalWorklets.concat([workletsUrl]);
|
||||
workletsLoading = Promise.all(allWorkletURLs.map((workletURL) => audioCtx.audioWorklet.addModule(workletURL))).then(() => workletsLoading = undefined);
|
||||
workletsLoading = Promise.all(allWorkletURLs.map((workletURL) => audioCtx.audioWorklet.addModule(workletURL))).then(
|
||||
() => (workletsLoading = undefined),
|
||||
);
|
||||
}
|
||||
|
||||
return workletsLoading;
|
||||
|
|
@ -250,7 +252,7 @@ export async function initAudio(options = {}) {
|
|||
logger('[superdough] failed to set audio interface', 'warning');
|
||||
}
|
||||
}
|
||||
if (!audioCtx instanceof OfflineAudioContext) {
|
||||
if ((!audioCtx) instanceof OfflineAudioContext) {
|
||||
await audioCtx.resume();
|
||||
}
|
||||
if (disableWorklets) {
|
||||
|
|
@ -288,7 +290,7 @@ function getSuperdoughAudioController() {
|
|||
}
|
||||
|
||||
export function setSuperdoughAudioController(newController) {
|
||||
controller = newController
|
||||
controller = newController;
|
||||
return controller;
|
||||
}
|
||||
|
||||
|
|
@ -401,7 +403,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||
);
|
||||
return;
|
||||
} // FIXME: fix
|
||||
// destructure
|
||||
// destructure
|
||||
let {
|
||||
tremolo,
|
||||
tremolosync,
|
||||
|
|
@ -743,4 +745,4 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
|
|||
|
||||
export const superdoughTrigger = (t, hap, ct, cps) => {
|
||||
superdough(hap, t - ct, hap.duration / cps, cps);
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue