|
| 1 | +const expect = chai.expect; |
| 2 | +let gain; |
| 3 | + |
| 4 | +describe('p5.Gain', function () { |
| 5 | + beforeEach(function () { |
| 6 | + gain = new p5.Gain(); |
| 7 | + }); |
| 8 | + |
| 9 | + it('can be created', function () { |
| 10 | + expect(gain.input).to.have.property('gain'); |
| 11 | + expect(gain.output).to.have.property('gain'); |
| 12 | + let audioContext = gain.ac; |
| 13 | + expect(audioContext).to.have.property('baseLatency').to.be.an('number'); |
| 14 | + expect(audioContext).to.have.property('destination'); |
| 15 | + expect(audioContext).to.have.property('state').to.be.an('string'); |
| 16 | + }); |
| 17 | + it('can be created and disposed', function () { |
| 18 | + gain.dispose(); |
| 19 | + expect(gain).to.not.have.property('input'); |
| 20 | + expect(gain).to.not.have.property('output'); |
| 21 | + }); |
| 22 | + |
| 23 | + describe('methods', function () { |
| 24 | + describe('setInput', function () { |
| 25 | + it('can set Input', function () { |
| 26 | + let soundFile = p5.prototype.loadSound('./testAudio/drum.mp3'); |
| 27 | + gain.setInput(soundFile); |
| 28 | + }); |
| 29 | + }); |
| 30 | + describe('connect, disconnect', function () { |
| 31 | + it('can connect to empty node', function () { |
| 32 | + gain.connect(); |
| 33 | + }); |
| 34 | + it('can connect with or without input property', function () { |
| 35 | + let filter = new p5.Filter(); |
| 36 | + gain.connect(filter); |
| 37 | + gain.connect(filter.input); |
| 38 | + }); |
| 39 | + it('can disconnect', function () { |
| 40 | + let filter = new p5.Filter(); |
| 41 | + gain.connect(filter); |
| 42 | + gain.disconnect(); |
| 43 | + }); |
| 44 | + }); |
| 45 | + describe('amp', function () { |
| 46 | + it('can take only volume as input', function () { |
| 47 | + //TODO |
| 48 | + }); |
| 49 | + }); |
| 50 | + }); |
| 51 | +}); |
0 commit comments