Better sample loading

This commit is contained in:
Nikita 2025-10-21 22:42:01 +03:00
parent 92d3fe496d
commit daea207aff
5 changed files with 33 additions and 15 deletions

View file

@ -289,7 +289,7 @@ export async function onTriggerSample(t, value, onended, bank, resolveUrl) {
const { bufferSource, sliceDuration, offset } = await getSampleBufferSource(value, bank, resolveUrl);
// asny stuff above took too long?
if (ac.currentTime > t) {
if (ac.currentTime > t && !(ac instanceof OfflineAudioContext)) {
logger(`[sampler] still loading sound "${s}:${n}"`, 'highlight');
// console.warn('sample still loading:', s, n);
return;

View file

@ -562,7 +562,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5)
return;
}
if (ac.currentTime > t) {
if (ac.currentTime > t && !(ac instanceof OfflineAudioContext)) {
logger('[webaudio] skip hap: still loading', ac.currentTime - t);
return;
}