.out error handling

This commit is contained in:
Felix Roos 2022-07-29 00:05:20 +02:00
parent 4f460eeb32
commit 712a2ae018

View file

@ -126,6 +126,7 @@ const splitSN = (s, n) => {
Pattern.prototype.out = function () { Pattern.prototype.out = function () {
return this.onTrigger(async (t, hap, ct) => { return this.onTrigger(async (t, hap, ct) => {
try {
const ac = getAudioContext(); const ac = getAudioContext();
// calculate correct time (tone.js workaround) // calculate correct time (tone.js workaround)
t = ac.currentTime + t - ct; t = ac.currentTime + t - ct;
@ -267,5 +268,8 @@ Pattern.prototype.out = function () {
chain.push(ac.destination); chain.push(ac.destination);
// connect chain elements together // connect chain elements together
chain.slice(1).reduce((last, current) => last.connect(current), chain[0]); chain.slice(1).reduce((last, current) => last.connect(current), chain[0]);
} catch (e) {
console.warn('.out error:', e);
}
}); });
}; };