2024-05-03 18:31:14 +00:00
|
|
|
import { JCReverb } from "./JCReverb.js";
|
|
|
|
import { BasicTests } from "../../test/helper/Basic.js";
|
|
|
|
import { EffectTests } from "../../test/helper/EffectTests.js";
|
2019-11-04 01:33:46 +00:00
|
|
|
import { expect } from "chai";
|
2024-05-03 18:31:14 +00:00
|
|
|
import { CompareToFile } from "../../test/helper/CompareToFile.js";
|
|
|
|
import { Noise } from "../source/Noise.js";
|
2019-11-04 01:33:46 +00:00
|
|
|
|
|
|
|
describe("JCReverb", () => {
|
|
|
|
BasicTests(JCReverb);
|
|
|
|
EffectTests(JCReverb);
|
|
|
|
|
|
|
|
it("matches a file", () => {
|
2024-05-03 18:31:14 +00:00
|
|
|
return CompareToFile(
|
|
|
|
() => {
|
|
|
|
const reverb = new JCReverb().toDestination();
|
|
|
|
const noise = new Noise().connect(reverb);
|
|
|
|
noise.start(0).stop(0.1);
|
|
|
|
},
|
|
|
|
"jcReverb.wav",
|
|
|
|
0.2
|
|
|
|
);
|
2019-11-04 01:33:46 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
context("API", () => {
|
|
|
|
it("can pass in options in the constructor", () => {
|
|
|
|
const reverb = new JCReverb({
|
|
|
|
roomSize: 0.2,
|
|
|
|
});
|
|
|
|
expect(reverb.roomSize.value).to.be.closeTo(0.2, 0.01);
|
|
|
|
reverb.dispose();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("can get/set the options", () => {
|
|
|
|
const reverb = new JCReverb();
|
|
|
|
reverb.set({
|
|
|
|
roomSize: 0.23,
|
|
|
|
});
|
|
|
|
expect(reverb.get().roomSize).to.be.closeTo(0.23, 0.01);
|
|
|
|
reverb.dispose();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|