mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-26 04:58:27 +00:00
tweaks + logs
This commit is contained in:
parent
c20e84773b
commit
7a4902862d
@ -52,22 +52,23 @@ function loadWorklets() {
|
|||||||
// this function should be called on first user interaction (to avoid console warning)
|
// this function should be called on first user interaction (to avoid console warning)
|
||||||
export async function initAudio(options = {}) {
|
export async function initAudio(options = {}) {
|
||||||
const { disableWorklets = false } = options;
|
const { disableWorklets = false } = options;
|
||||||
if (typeof window !== 'undefined') {
|
if (typeof window === 'undefined') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await getAudioContext().resume();
|
await getAudioContext().resume();
|
||||||
if (disableWorklets) {
|
if (disableWorklets) {
|
||||||
logger('disableWorklets: AudioWorklet effects skipped!');
|
logger('[superdough]: AudioWorklets disabled with disableWorklets');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await loadWorklets();
|
await loadWorklets();
|
||||||
logger('audio worklets loaded');
|
logger('[superdough] AudioWorklets loaded');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('could not load AudioWorklet effects', err);
|
console.warn('could not load AudioWorklet effects', err);
|
||||||
}
|
}
|
||||||
|
logger('[superdough] ready');
|
||||||
}
|
}
|
||||||
let audioReady = false;
|
let audioReady;
|
||||||
export async function initAudioOnFirstClick(options) {
|
export async function initAudioOnFirstClick(options) {
|
||||||
if (!audioReady) {
|
if (!audioReady) {
|
||||||
audioReady = new Promise((resolve) => {
|
audioReady = new Promise((resolve) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user