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