2015-08-28 22:42:44 +00:00
|
|
|
define(["Tone/component/Merge", "helper/Basic", "helper/PassAudio", "helper/PassAudioStereo",
|
2018-05-18 16:07:20 +00:00
|
|
|
"helper/Test", "helper/Offline", "Tone/signal/Signal"],
|
|
|
|
function(Merge, Basic, PassAudio, PassAudioStereo, Test, Offline, Signal){
|
2015-08-28 22:42:44 +00:00
|
|
|
describe("Merge", function(){
|
|
|
|
|
|
|
|
Basic(Merge);
|
|
|
|
|
|
|
|
context("Merging", function(){
|
|
|
|
|
|
|
|
it("handles input and output connections", function(){
|
|
|
|
var merge = new Merge();
|
|
|
|
Test.connect(merge);
|
|
|
|
merge.connect(Test);
|
|
|
|
merge.dispose();
|
|
|
|
});
|
|
|
|
|
2017-02-20 04:55:55 +00:00
|
|
|
it("passes the incoming signal through", function(){
|
|
|
|
return PassAudio(function(input){
|
|
|
|
var merge = new Merge().toMaster();
|
2015-08-28 22:42:44 +00:00
|
|
|
input.connect(merge);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-02-20 04:55:55 +00:00
|
|
|
it("merge two signal into one stereo signal", function(){
|
|
|
|
return Offline(function(){
|
|
|
|
var sigL = new Signal(1);
|
|
|
|
var sigR = new Signal(2);
|
|
|
|
var merger = new Merge();
|
2015-08-28 22:42:44 +00:00
|
|
|
sigL.connect(merger.left);
|
|
|
|
sigR.connect(merger.right);
|
2017-02-20 04:55:55 +00:00
|
|
|
merger.toMaster();
|
|
|
|
}, 0.1, 2).then(function(buffer){
|
|
|
|
buffer.forEach(function(l, r){
|
|
|
|
expect(l).to.be.closeTo(1, 0.001);
|
|
|
|
expect(r).to.be.closeTo(2, 0.001);
|
|
|
|
});
|
2015-08-28 22:42:44 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2017-12-30 16:26:29 +00:00
|
|
|
});
|