This commit is contained in:
tboie 2019-04-04 15:10:03 -04:00 committed by Yotam Mann
parent 2c2c45ff29
commit 8f08316b41
2 changed files with 21 additions and 2 deletions

View file

@ -19,8 +19,9 @@ import "../core/AudioNode";
* //pan the input signal hard right.
* var panner = new Tone.Panner(1);
*/
Tone.Panner = function(initialPan){
Tone.Panner = function(){
var options = Tone.defaults(arguments, ["pan"], Tone.Panner);
Tone.AudioNode.call(this);
/**
* the panner node
@ -37,12 +38,22 @@ Tone.Panner = function(initialPan){
this.pan = this._panner.pan;
//initial value
this.pan.value = Tone.defaultArg(initialPan, 0);
this.pan.value = options.pan;
this._readOnly("pan");
};
Tone.extend(Tone.Panner, Tone.AudioNode);
/**
* Defaults
* @type {Object}
* @const
* @static
*/
Tone.Panner.defaults = {
"pan" : 0
};
/**
* Clean up.
* @returns {Tone.Panner} this

View file

@ -29,6 +29,14 @@ describe("Panner", function(){
panner.dispose();
});
it("can be constructed with an options object", function(){
var panner = new Panner({
"pan" : 0.5
});
expect(panner.pan.value).to.be.closeTo(0.5, 0.001);
panner.dispose();
});
it("passes the incoming signal through", function(){
return PassAudio(function(input){
var panner = new Panner().toMaster();