Web demo: don't show scope on mobile browsers

This commit is contained in:
Geraint 2025-04-19 10:02:37 +01:00
parent 4d158cba47
commit 83f32d337b

View File

@ -156,12 +156,15 @@
}; };
let configValues = Object.assign({}, configValuesInitial); let configValues = Object.assign({}, configValuesInitial);
// add scope, for fun let scope;
let scope = await Scope(audioContext); if (!/Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile/.test(navigator.userAgent)) {
scope.connect(audioContext.destination); // add scope for fun, but only on desktop
let scopeFrame = scope.openInterface(); scope = await Scope(audioContext);
scopeFrame.id = 'scope'; scope.connect(audioContext.destination);
document.body.appendChild(scopeFrame); let scopeFrame = scope.openInterface();
scopeFrame.id = 'scope';
document.body.appendChild(scopeFrame);
}
// Drop zone // Drop zone
document.body.ondragover = event => { document.body.ondragover = event => {
@ -195,7 +198,7 @@
stretch.disconnect(); stretch.disconnect();
} }
stretch = await SignalsmithStretch(audioContext); stretch = await SignalsmithStretch(audioContext);
stretch.connect(scope); stretch.connect(scope || audioContext.destination);
await stretch.addBuffers(channelBuffers); await stretch.addBuffers(channelBuffers);
controlValues.loopEnd = audioDuration; controlValues.loopEnd = audioDuration;
configChanged(); configChanged();