2018-05-18 16:07:20 +00:00
|
|
|
define(["helper/Test", "helper/Offline", "Tone/signal/Signal", "Tone/core/Master", "Tone/component/Merge"],
|
|
|
|
function(Test, Offline, Signal, Master, Merge){
|
2015-08-26 14:01:51 +00:00
|
|
|
|
2017-12-30 16:26:29 +00:00
|
|
|
var PassAudioStereo = function(before){
|
2017-02-20 01:49:47 +00:00
|
|
|
|
2017-12-30 16:26:29 +00:00
|
|
|
var duration = 0.2;
|
|
|
|
return Offline(function(){
|
2018-02-05 21:25:43 +00:00
|
|
|
var merge = new Merge();
|
|
|
|
var sigL = new Signal(0);
|
|
|
|
sigL.connect(merge, 0, 0);
|
|
|
|
var sigR = new Signal(0);
|
|
|
|
sigR.connect(merge, 0, 1);
|
|
|
|
before(merge);
|
|
|
|
sigL.setValueAtTime(1, duration / 2);
|
|
|
|
sigR.setValueAtTime(1, duration / 2);
|
2017-12-30 16:26:29 +00:00
|
|
|
}, duration, 2).then(function(buffer){
|
|
|
|
var silent = true;
|
|
|
|
buffer.forEach(function(l, r, time){
|
|
|
|
if (time >= duration / 2 && l !== 0 && r !== 0){
|
|
|
|
silent = false;
|
|
|
|
return;
|
2018-05-18 16:07:20 +00:00
|
|
|
} else if (time < duration / 2){
|
2017-12-30 16:26:29 +00:00
|
|
|
expect(l).to.be.closeTo(0, 0.001);
|
|
|
|
expect(r).to.be.closeTo(0, 0.001);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (silent){
|
|
|
|
throw new Error("node outputs silence");
|
2015-08-26 14:01:51 +00:00
|
|
|
}
|
2017-02-20 01:49:47 +00:00
|
|
|
});
|
2017-12-30 16:26:29 +00:00
|
|
|
};
|
2015-08-26 14:01:51 +00:00
|
|
|
|
2017-12-30 16:26:29 +00:00
|
|
|
return PassAudioStereo;
|
|
|
|
});
|