.out error handling
This commit is contained in:
parent
4f460eeb32
commit
712a2ae018
1 changed files with 138 additions and 134 deletions
|
|
@ -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);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue