mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
ramp exponential won't go below some small value
This commit is contained in:
parent
bf325680a6
commit
908ae686f2
1 changed files with 3 additions and 9 deletions
|
@ -109,21 +109,15 @@ define(["Tone/core/Tone", "Tone/signal/WaveShaper"], function(Tone){
|
|||
/**
|
||||
* Schedules an exponential continuous change in parameter value from
|
||||
* the previous scheduled parameter value to the given value.
|
||||
*
|
||||
* NOTE: Chrome will throw an error if you try to exponentially ramp to a
|
||||
* value 0 or less.
|
||||
*
|
||||
* @param {number} value
|
||||
* @param {Tone.Time} endTime
|
||||
*/
|
||||
Tone.Signal.prototype.exponentialRampToValueAtTime = function(value, endTime){
|
||||
value *= this._syncRatio;
|
||||
try {
|
||||
this._scalar.gain.exponentialRampToValueAtTime(value, this.toSeconds(endTime));
|
||||
} catch(e){
|
||||
//firefox won't let the signal ramp past 1, in these cases, revert to linear ramp
|
||||
this._scalar.gain.linearRampToValueAtTime(value, this.toSeconds(endTime));
|
||||
}
|
||||
//can't go below a certain value
|
||||
value = Math.max(0.00001, value);
|
||||
this._scalar.gain.exponentialRampToValueAtTime(value, this.toSeconds(endTime));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue