2019-09-09 23:28:39 +00:00
|
|
|
import { expect } from "chai";
|
2024-05-03 18:31:14 +00:00
|
|
|
import { BasicTests, warns } from "../../../test/helper/Basic.js";
|
|
|
|
import { PassAudio } from "../../../test/helper/PassAudio.js";
|
|
|
|
import { Signal } from "../../signal/Signal.js";
|
|
|
|
import { DCMeter } from "./DCMeter.js";
|
2019-09-09 23:28:39 +00:00
|
|
|
|
|
|
|
describe("DCMeter", () => {
|
|
|
|
BasicTests(DCMeter);
|
|
|
|
|
|
|
|
context("DCMetering", () => {
|
|
|
|
it("passes the audio through", () => {
|
|
|
|
return PassAudio((input) => {
|
|
|
|
const meter = new DCMeter().toDestination();
|
|
|
|
input.connect(meter);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-05-03 18:31:14 +00:00
|
|
|
it("can get the rms level of the incoming signal", (done) => {
|
|
|
|
const meter = new DCMeter();
|
|
|
|
const osc = new Signal(2).connect(meter);
|
|
|
|
setTimeout(() => {
|
|
|
|
expect(meter.getValue()).to.be.closeTo(2, 0.1);
|
|
|
|
meter.dispose();
|
|
|
|
osc.dispose();
|
|
|
|
done();
|
|
|
|
}, 400);
|
|
|
|
});
|
2019-09-09 23:28:39 +00:00
|
|
|
});
|
|
|
|
});
|