|
1 | | -/*! p5.sound.js v0.2.16 2015-12-06 */ |
| 1 | +/*! p5.sound.js v0.2.16 2015-12-19 */ |
2 | 2 | (function (root, factory) { |
3 | 3 | if (typeof define === 'function' && define.amd) |
4 | 4 | define('p5.sound', ['p5'], function (p5) { (factory(p5));}); |
@@ -4040,11 +4040,6 @@ env = function () { |
4040 | 4040 | var Scale = Tone_signal_Scale; |
4041 | 4041 | var Tone = Tone_core_Tone; |
4042 | 4042 | Tone.setContext(p5sound.audiocontext); |
4043 | | - // oscillator or buffer source to clear on env complete |
4044 | | - // to save resources if/when it is retriggered |
4045 | | - var sourceToClear = null; |
4046 | | - // set to true if attack is set, then false on release |
4047 | | - var wasTriggered = false; |
4048 | 4043 | /** |
4049 | 4044 | * <p>Envelopes are pre-defined amplitude distribution over time. |
4050 | 4045 | * The p5.Env accepts up to four time/level pairs, where time |
@@ -4144,6 +4139,11 @@ env = function () { |
4144 | 4139 | // store connection |
4145 | 4140 | //array of math operation signal chaining |
4146 | 4141 | this.mathOps = [this.control]; |
| 4142 | + // oscillator or buffer source to clear on env complete |
| 4143 | + // to save resources if/when it is retriggered |
| 4144 | + this.sourceToClear = null; |
| 4145 | + // set to true if attack is set, then false on release |
| 4146 | + this.wasTriggered = false; |
4147 | 4147 | // add to the soundArray so we can dispose of the env later |
4148 | 4148 | p5sound.soundArray.push(this); |
4149 | 4149 | }; |
@@ -4243,7 +4243,7 @@ env = function () { |
4243 | 4243 | var tFromNow = secondsFromNow || 0; |
4244 | 4244 | var t = now + tFromNow; |
4245 | 4245 | this.lastAttack = t; |
4246 | | - wasTriggered = true; |
| 4246 | + this.wasTriggered = true; |
4247 | 4247 | // we should set current value, but this is not working on Firefox |
4248 | 4248 | var currentVal = this.control.getValue(); |
4249 | 4249 | console.log(currentVal); |
@@ -4272,7 +4272,7 @@ env = function () { |
4272 | 4272 | */ |
4273 | 4273 | p5.Env.prototype.triggerRelease = function (unit, secondsFromNow) { |
4274 | 4274 | // only trigger a release if an attack was triggered |
4275 | | - if (!wasTriggered) { |
| 4275 | + if (!this.wasTriggered) { |
4276 | 4276 | return; |
4277 | 4277 | } |
4278 | 4278 | var now = p5sound.audiocontext.currentTime; |
@@ -4316,13 +4316,13 @@ env = function () { |
4316 | 4316 | var clearTime = t + this.aTime + this.dTime + this.sTime + this.rTime; |
4317 | 4317 | // * 1000; |
4318 | 4318 | if (this.connection && this.connection.hasOwnProperty('oscillator')) { |
4319 | | - sourceToClear = this.connection.oscillator; |
4320 | | - sourceToClear.stop(clearTime + 0.01); |
| 4319 | + this.sourceToClear = this.connection.oscillator; |
| 4320 | + this.sourceToClear.stop(clearTime + 0.01); |
4321 | 4321 | } else if (this.connect && this.connection.hasOwnProperty('source')) { |
4322 | | - sourceToClear = this.connection.source; |
4323 | | - sourceToClear.stop(clearTime + 0.01); |
| 4322 | + this.sourceToClear = this.connection.source; |
| 4323 | + this.sourceToClear.stop(clearTime + 0.01); |
4324 | 4324 | } |
4325 | | - wasTriggered = false; |
| 4325 | + this.wasTriggered = false; |
4326 | 4326 | }; |
4327 | 4327 | p5.Env.prototype.connect = function (unit) { |
4328 | 4328 | this.connection = unit; |
@@ -5018,8 +5018,6 @@ audioin = function () { |
5018 | 5018 | * audioGrab.setSource(0); |
5019 | 5019 | * }); |
5020 | 5020 | * } |
5021 | | - * function draw(){ |
5022 | | - * } |
5023 | 5021 | * </code></div> |
5024 | 5022 | */ |
5025 | 5023 | p5.AudioIn.prototype.getSources = function (callback) { |
|
0 commit comments