hotfix: disconnect chain after use

This commit is contained in:
Felix Roos 2022-09-16 00:53:43 +02:00
parent a11d23ba62
commit 3fdfd12448

View File

@ -304,6 +304,10 @@ Pattern.prototype.out = function () {
chain.push(ac.destination);
// connect chain elements together
chain.slice(1).reduce((last, current) => last.connect(current), chain[0]);
// disconnect all nodes when hap is over to make sure they are garbage collected
setTimeout(() => {
chain.forEach((n) => n.disconnect());
}, (hapDuration + release + 0.1) * 1000);
} catch (e) {
console.warn('.out error:', e);
}