Skip to content

Commit 8f7317e

Browse files
committed
schedule p5.Env triggerRelease fix
1 parent eb22e94 commit 8f7317e

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/p5.sound.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4288,21 +4288,21 @@ env = function () {
42884288
// ideally would get & set currentValue here,
42894289
// but this.control._scalar.gain.value not working in firefox
42904290
// release based on how much time has passed since this.lastAttack
4291-
if (now - this.lastAttack < this.aTime) {
4291+
if (t - this.lastAttack < this.aTime) {
42924292
var a = this.aTime - (t - this.lastAttack);
42934293
this.control.linearRampToValueAtTime(this.aLevel, t + a);
42944294
this.control.linearRampToValueAtTime(this.dLevel, t + a + this.dTime);
42954295
this.control.linearRampToValueAtTime(this.sLevel, t + a + this.dTime + this.sTime);
42964296
this.control.linearRampToValueAtTime(this.rLevel, t + a + this.dTime + this.sTime + this.rTime);
42974297
relTime = t + this.dTime + this.sTime + this.rTime;
4298-
} else if (now - this.lastAttack < this.aTime + this.dTime) {
4298+
} else if (t - this.lastAttack < this.aTime + this.dTime) {
42994299
var d = this.aTime + this.dTime - (now - this.lastAttack);
43004300
this.control.linearRampToValueAtTime(this.dLevel, t + d);
43014301
// this.control.linearRampToValueAtTime(this.sLevel, t + d + this.sTime);
43024302
this.control.linearRampToValueAtTime(this.sLevel, t + d + 0.01);
43034303
this.control.linearRampToValueAtTime(this.rLevel, t + d + 0.01 + this.rTime);
43044304
relTime = t + this.sTime + this.rTime;
4305-
} else if (now - this.lastAttack < this.aTime + this.dTime + this.sTime) {
4305+
} else if (t - this.lastAttack < this.aTime + this.dTime + this.sTime) {
43064306
var s = this.aTime + this.dTime + this.sTime - (now - this.lastAttack);
43074307
this.control.linearRampToValueAtTime(this.sLevel, t + s);
43084308
this.control.linearRampToValueAtTime(this.rLevel, t + s + this.rTime);

0 commit comments

Comments
 (0)