Tone.js/test/signal/Multiply.js

41 lines
1 KiB
JavaScript
Raw Normal View History

2017-02-20 21:40:41 +00:00
define(["helper/ConstantOutput", "Tone/signal/Multiply", "helper/Basic",
2015-08-24 15:17:21 +00:00
"Test", "Tone/source/Oscillator", "Tone/signal/Signal"],
2017-12-30 16:26:29 +00:00
function (ConstantOutput, Multiply, Basic, Test, Oscillator, Signal) {
2015-08-24 15:17:21 +00:00
describe("Multiply", function(){
Basic(Multiply);
describe("Multiplication", function(){
it("handles input and output connections", function(){
var mult = new Multiply();
Test.connect(mult, 0);
Test.connect(mult, 1);
mult.connect(Test);
mult.dispose();
});
2017-02-20 21:40:41 +00:00
it("correctly multiplys a signal and a scalar", function(){
return ConstantOutput(function(){
var signal = new Signal(2);
var mult = new Multiply(10);
2015-08-24 15:17:21 +00:00
signal.connect(mult);
2017-02-20 21:40:41 +00:00
mult.toMaster();
}, 20);
2015-08-24 15:17:21 +00:00
});
2017-02-20 21:40:41 +00:00
it("can multiply two signals", function(){
return ConstantOutput(function(){
var sigA = new Signal(3);
var sigB = new Signal(5);
var mult = new Multiply();
2015-08-24 15:17:21 +00:00
sigA.connect(mult, 0, 0);
sigB.connect(mult, 0, 1);
2017-02-20 21:40:41 +00:00
mult.toMaster();
}, 15);
2015-08-24 15:17:21 +00:00
});
});
});
2017-12-30 16:26:29 +00:00
});