Tone.js/test/component/Split.js

75 lines
2.1 KiB
JavaScript
Raw Normal View History

import Merge from "Tone/component/Merge";
import Basic from "helper/Basic";
import PassAudio from "helper/PassAudio";
import PassAudioStereo from "helper/PassAudioStereo";
import Test from "helper/Test";
import Offline from "helper/Offline";
import Signal from "Tone/signal/Signal";
import Split from "Tone/component/Split";
import Tone from "Tone/core/Tone";
import ConstantOutput from "helper/ConstantOutput";
import StereoSignal from "helper/StereoSignal";
describe("Split", function(){
2015-08-28 22:42:44 +00:00
Basic(Split);
2015-08-28 22:42:44 +00:00
context("Splitting", function(){
2015-08-28 22:42:44 +00:00
it("handles input and output connections", function(){
var split = new Split();
Test.connect(split);
split.connect(Test);
split.dispose();
});
2015-08-28 22:42:44 +00:00
it("defaults to two channels", function(){
var split = new Split();
expect(split.numberOfOutputs).to.equal(2);
split.dispose();
});
it("can pass in more channels", function(){
var split = new Split(4);
expect(split.numberOfOutputs).to.equal(4);
split.connect(Test, 0, 0);
split.connect(Test, 1, 0);
split.connect(Test, 2, 0);
split.connect(Test, 3, 0);
split.dispose();
});
it("passes the incoming signal through on the left side", function(){
return ConstantOutput(function(){
var split = new Split();
var signal = StereoSignal(1, 2).connect(split);
split.left.toMaster();
}, 1);
});
2015-08-28 22:42:44 +00:00
it("passes the incoming signal through on the right side", function(){
return ConstantOutput(function(){
var split = new Split();
var signal = StereoSignal(1, 2).connect(split);
split.right.toMaster();
}, 2);
});
2015-08-28 22:42:44 +00:00
it("merges two signal into one stereo signal and then split them back into two signals on left side", function(){
return ConstantOutput(function(){
var split = new Split();
var signal = StereoSignal(1, 2).connect(split);
split.connect(Tone.Master, 0, 0);
}, 1);
});
2015-08-28 22:42:44 +00:00
it("merges two signal into one stereo signal and then split them back into two signals on right side", function(){
return ConstantOutput(function(){
var split = new Split();
var signal = StereoSignal(1, 2).connect(split);
split.connect(Tone.Master, 1, 0);
}, 2);
2015-08-28 22:42:44 +00:00
});
});
2017-12-30 16:26:29 +00:00
});