Tone.js/test/helper/PassAudioStereo.js

29 lines
771 B
JavaScript
Raw Normal View History

2017-02-20 01:49:47 +00:00
define(["Test", "Tone/core/Offline", "Tone/signal/Signal", "Tone/core/Master", "helper/BufferTest"],
function (Test, Offline, Signal, Master, BufferTest) {
2015-08-26 14:01:51 +00:00
2017-02-20 01:49:47 +00:00
var PassAudioStereo = function(before){
var duration = 0.2;
return Offline(function(){
var sig = new Signal(0);
before(sig);
sig.setValueAtTime(1, duration / 2);
}, duration).then(function(buffer){
var silent = true;
BufferTest.forEach(buffer, function(l, r, time){
if (time >= duration / 2 && l !== 0 && r !== 0){
silent = false;
return;
} else if (time < duration / 2) {
expect(l).to.be.closeTo(0, 0.001);
expect(r).to.be.closeTo(0, 0.001);
2015-08-26 14:01:51 +00:00
}
2017-02-20 01:49:47 +00:00
});
if (silent){
throw new Error("node outputs silence");
2015-08-26 14:01:51 +00:00
}
});
};
return PassAudioStereo;
});