mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-16 08:38:00 +00:00
added 'spread' to Chorus
This commit is contained in:
parent
23dd869b30
commit
298799dee9
2 changed files with 22 additions and 1 deletions
|
@ -101,6 +101,7 @@ function(Tone){
|
||||||
this.frequency.value = options.frequency;
|
this.frequency.value = options.frequency;
|
||||||
this.type = options.type;
|
this.type = options.type;
|
||||||
this._readOnly(["frequency"]);
|
this._readOnly(["frequency"]);
|
||||||
|
this.spread = options.spread;
|
||||||
};
|
};
|
||||||
|
|
||||||
Tone.extend(Tone.Chorus, Tone.StereoXFeedbackEffect);
|
Tone.extend(Tone.Chorus, Tone.StereoXFeedbackEffect);
|
||||||
|
@ -114,7 +115,8 @@ function(Tone){
|
||||||
"delayTime" : 3.5,
|
"delayTime" : 3.5,
|
||||||
"depth" : 0.7,
|
"depth" : 0.7,
|
||||||
"feedback" : 0.1,
|
"feedback" : 0.1,
|
||||||
"type" : "sine"
|
"type" : "sine",
|
||||||
|
"spread" : 180
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,6 +174,23 @@ function(Tone){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Amount of stereo spread. When set to 0, both LFO's will be panned centrally.
|
||||||
|
* When set to 180, LFO's will be panned hard left and right respectively.
|
||||||
|
* @memberOf Tone.Chorus#
|
||||||
|
* @type {Degrees}
|
||||||
|
* @name spread
|
||||||
|
*/
|
||||||
|
Object.defineProperty(Tone.Chorus.prototype, "spread", {
|
||||||
|
get : function(){
|
||||||
|
return this._lfoR.phase - this._lfoL.phase; //180
|
||||||
|
},
|
||||||
|
set : function(spread){
|
||||||
|
this._lfoL.phase = 90 - (spread/2);
|
||||||
|
this._lfoR.phase = (spread/2) + 90;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean up.
|
* Clean up.
|
||||||
* @returns {Tone.Chorus} this
|
* @returns {Tone.Chorus} this
|
||||||
|
|
|
@ -12,10 +12,12 @@ define(["Tone/effect/Chorus", "helper/Basic", "helper/EffectTests"], function (C
|
||||||
"frequency" : 2,
|
"frequency" : 2,
|
||||||
"delayTime" : 1,
|
"delayTime" : 1,
|
||||||
"depth" : 0.4,
|
"depth" : 0.4,
|
||||||
|
"spread" : 90
|
||||||
});
|
});
|
||||||
expect(chorus.frequency.value).to.be.closeTo(2, 0.01);
|
expect(chorus.frequency.value).to.be.closeTo(2, 0.01);
|
||||||
expect(chorus.delayTime).to.be.closeTo(1, 0.01);
|
expect(chorus.delayTime).to.be.closeTo(1, 0.01);
|
||||||
expect(chorus.depth).to.be.closeTo(0.4, 0.01);
|
expect(chorus.depth).to.be.closeTo(0.4, 0.01);
|
||||||
|
expect(chorus.spread).to.be.equal(90);
|
||||||
chorus.dispose();
|
chorus.dispose();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue