2017-02-20 21:40:41 +00:00
|
|
|
define(["helper/ConstantOutput", "Tone/signal/GainToAudio", "helper/Basic",
|
2018-05-18 16:07:20 +00:00
|
|
|
"helper/Test", "Tone/signal/Signal", "Tone/signal/Zero"],
|
|
|
|
function(ConstantOutput, GainToAudio, Basic, Test, Signal, Zero){
|
2015-08-24 21:29:19 +00:00
|
|
|
|
|
|
|
describe("GainToAudio", function(){
|
|
|
|
|
|
|
|
Basic(GainToAudio);
|
|
|
|
|
|
|
|
context("Gain To Audio", function(){
|
|
|
|
|
|
|
|
it("handles input and output connections", function(){
|
|
|
|
var g2a = new GainToAudio();
|
|
|
|
Test.connect(g2a);
|
|
|
|
g2a.connect(Test);
|
|
|
|
g2a.dispose();
|
|
|
|
});
|
|
|
|
|
2017-02-20 21:40:41 +00:00
|
|
|
it("outputs 0 for an input value of 0.5", function(){
|
|
|
|
return ConstantOutput(function(){
|
|
|
|
var sig = new Signal(0.5);
|
|
|
|
var g2a = new GainToAudio();
|
2015-08-24 21:29:19 +00:00
|
|
|
sig.connect(g2a);
|
2017-02-20 21:40:41 +00:00
|
|
|
g2a.toMaster();
|
|
|
|
}, 0);
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
|
|
|
|
2017-02-20 21:40:41 +00:00
|
|
|
it("outputs 1 for an input value of 1", function(){
|
|
|
|
return ConstantOutput(function(){
|
|
|
|
var sig = new Signal(1);
|
|
|
|
var g2a = new GainToAudio();
|
2015-08-24 21:29:19 +00:00
|
|
|
sig.connect(g2a);
|
2017-02-20 21:40:41 +00:00
|
|
|
g2a.toMaster();
|
|
|
|
}, 1);
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
|
|
|
|
2017-02-20 21:40:41 +00:00
|
|
|
it("outputs -1 for an input value of 0", function(){
|
|
|
|
return ConstantOutput(function(){
|
|
|
|
var sig = new Zero();
|
|
|
|
var g2a = new GainToAudio();
|
2015-08-24 21:29:19 +00:00
|
|
|
sig.connect(g2a);
|
2017-02-20 21:40:41 +00:00
|
|
|
g2a.toMaster();
|
|
|
|
}, -1);
|
2015-08-24 21:29:19 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-12-30 16:26:29 +00:00
|
|
|
});
|