mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 16:48:00 +00:00
clip the incoming signal
This commit is contained in:
parent
69294ce410
commit
fca7b0eba3
1 changed files with 33 additions and 0 deletions
33
Tone/signal/Clip.js
Normal file
33
Tone/signal/Clip.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
define(["Tone/core/Tone", "Tone/signal/Max", "Tone/signal/Min"], function(Tone){
|
||||
|
||||
/**
|
||||
* @class Clip the incoming signal so that the output is always between min and max
|
||||
*
|
||||
* @constructor
|
||||
* @extends {Tone}
|
||||
* @param {number} min the minimum value of the outgoing signal
|
||||
* @param {number} max the maximum value of the outgoing signal
|
||||
*/
|
||||
Tone.Clip = function(min, max){
|
||||
Tone.call(this);
|
||||
|
||||
/**
|
||||
* the min clipper
|
||||
* @private
|
||||
*/
|
||||
this._min = new Tone.Min(max);
|
||||
|
||||
/**
|
||||
* the max clipper
|
||||
* @private
|
||||
*/
|
||||
this._max = new Tone.Max(min);
|
||||
|
||||
//connect it up
|
||||
this.chain(this.input, this._min, this._max, this.output);
|
||||
};
|
||||
|
||||
Tone.extend(Tone.Clip);
|
||||
|
||||
return Tone.Clip;
|
||||
});
|
Loading…
Reference in a new issue