mirror of
https://github.com/Tonejs/Tone.js
synced 2025-01-03 23:48:43 +00:00
aaf880c925
* WIP moving tests to web-test-runner * updating thresholds * Adding file extensions * Testing integrations * linting * fixing dep * moving back to root dir * prettier all of the files * updating eslint rules to use with prettier * remove import package * moving tsignore around * removing unneeded ignores * all tests run on puppeteer, no need for testing guards * linting * import type syntax * cleaning up * Update package.json
67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import { BasicTests } from "../../../test/helper/Basic.js";
|
|
import { connectFrom, connectTo } from "../../../test/helper/Connect.js";
|
|
import { ConstantOutput } from "../../../test/helper/ConstantOutput.js";
|
|
import { Signal } from "../../signal/Signal.js";
|
|
import { CrossFade } from "./CrossFade.js";
|
|
|
|
describe("CrossFade", () => {
|
|
BasicTests(CrossFade);
|
|
|
|
context("Fading", () => {
|
|
it("handles input and output connections", () => {
|
|
const comp = new CrossFade();
|
|
connectFrom().connect(comp.a);
|
|
connectFrom().connect(comp.b);
|
|
comp.connect(connectTo());
|
|
comp.dispose();
|
|
});
|
|
|
|
it("pass 100% of input 0", () => {
|
|
return ConstantOutput(
|
|
() => {
|
|
const crossFade = new CrossFade();
|
|
const drySignal = new Signal(10);
|
|
const wetSignal = new Signal(20);
|
|
drySignal.connect(crossFade.a);
|
|
wetSignal.connect(crossFade.b);
|
|
crossFade.fade.value = 0;
|
|
crossFade.toDestination();
|
|
},
|
|
10,
|
|
0.05
|
|
);
|
|
});
|
|
|
|
it("pass 100% of input 1", () => {
|
|
return ConstantOutput(
|
|
() => {
|
|
const crossFade = new CrossFade();
|
|
const drySignal = new Signal(10);
|
|
const wetSignal = new Signal(20);
|
|
drySignal.connect(crossFade.a);
|
|
wetSignal.connect(crossFade.b);
|
|
crossFade.fade.value = 1;
|
|
crossFade.toDestination();
|
|
},
|
|
20,
|
|
0.01
|
|
);
|
|
});
|
|
|
|
it("can mix two signals", () => {
|
|
return ConstantOutput(
|
|
() => {
|
|
const crossFade = new CrossFade();
|
|
const drySignal = new Signal(2);
|
|
const wetSignal = new Signal(1);
|
|
drySignal.connect(crossFade.a);
|
|
wetSignal.connect(crossFade.b);
|
|
crossFade.fade.value = 0.5;
|
|
crossFade.toDestination();
|
|
},
|
|
2.12,
|
|
0.01
|
|
);
|
|
});
|
|
});
|
|
});
|