Skip to content

Commit 344968e

Browse files
committed
(Chore) : added test to set the output level of gain Node
Signed-off-by: Abhijay Jain <[email protected]>
1 parent c17425a commit 344968e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/tests/p5.Gain.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,23 @@ describe('p5.Gain', function () {
3636
gain.connect(filter);
3737
gain.connect(filter.input);
3838
});
39+
it('can set the output level of gain Node', () => {
40+
let osc = new p5.Oscillator('sine');
41+
let mainGainNode = new p5.Gain();
42+
let amplitude = new p5.Amplitude();
43+
44+
osc.amp(1);
45+
osc.start();
46+
osc.disconnect();
47+
48+
mainGainNode.setInput(osc);
49+
amplitude.setInput(mainGainNode);
50+
51+
mainGainNode.amp(0.5);
52+
setTimeout(function () {
53+
expect(amplitude.getLevel()).to.be.closeTo(0.25, 0.125);
54+
}, 100);
55+
});
3956
it('can disconnect', function () {
4057
let filter = new p5.Filter();
4158
gain.connect(filter);

0 commit comments

Comments
 (0)