mirror of
https://github.com/Tonejs/Tone.js
synced 2024-11-14 15:57:08 +00:00
parent
5a52c9f1bf
commit
ccf74922d4
2 changed files with 25 additions and 1 deletions
|
@ -196,5 +196,29 @@ describe("LFO", () => {
|
|||
expect(buffer.getValueAtTime(0.05)).to.be.closeTo(2, 0.1);
|
||||
});
|
||||
});
|
||||
|
||||
it("can adjust the amplitude", () => {
|
||||
return Offline(({ transport }) => {
|
||||
const lfo = new LFO(10, -10, 10);
|
||||
lfo.amplitude.value = 0.5;
|
||||
lfo.toDestination();
|
||||
lfo.start();
|
||||
}, 0.1).then((buffer) => {
|
||||
expect(buffer.min()).to.be.closeTo(-5, 0.1);
|
||||
expect(buffer.max()).to.be.closeTo(5, 0.1);
|
||||
});
|
||||
});
|
||||
|
||||
it("can adjust the amplitude not centered at 0", () => {
|
||||
return Offline(({ transport }) => {
|
||||
const lfo = new LFO(10, 400, 4000);
|
||||
lfo.amplitude.value = 0.5;
|
||||
lfo.toDestination();
|
||||
lfo.start();
|
||||
}, 0.1).then((buffer) => {
|
||||
expect(buffer.min()).to.be.closeTo(1300, 1);
|
||||
expect(buffer.max()).to.be.closeTo(3100, 1);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -150,7 +150,7 @@ export class LFO extends ToneAudioNode<LFOOptions> {
|
|||
this.max = options.max;
|
||||
|
||||
// connect it up
|
||||
this._oscillator.chain(this._a2g, this._amplitudeGain, this._scaler);
|
||||
this._oscillator.chain(this._amplitudeGain, this._a2g, this._scaler);
|
||||
this._zeros.connect(this._a2g);
|
||||
this._stoppedSignal.connect(this._a2g);
|
||||
readOnly(this, ["amplitude", "frequency"]);
|
||||
|
|
Loading…
Reference in a new issue