tone 15.1.4 → 15.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -69,5 +69,22 @@ describe("Reverb", () => {
69
69
  expect(buffer.getRmsAtTime(0.2)).to.be.greaterThan(0);
70
70
  });
71
71
  });
72
+
73
+ it("parses number from string in input", () => {
74
+ // @ts-ignore
75
+ const reverb = new Reverb("1");
76
+ expect(reverb.decay).to.equal(1);
77
+ reverb.dispose();
78
+ });
79
+
80
+ it("throws an error with invalid input", () => {
81
+ expect(
82
+ () =>
83
+ new Reverb({
84
+ decay: 0,
85
+ preDelay: -1,
86
+ })
87
+ ).to.throw(Error);
88
+ });
72
89
  });
73
90
  });
@@ -61,8 +61,14 @@ export class Reverb extends Effect<ReverbOptions> {
61
61
  ]);
62
62
  super(options);
63
63
 
64
- this._decay = options.decay;
65
- this._preDelay = options.preDelay;
64
+ const decayTime = this.toSeconds(options.decay);
65
+ assertRange(decayTime, 0.001);
66
+ this._decay = decayTime;
67
+
68
+ const preDelayTime = this.toSeconds(options.preDelay);
69
+ assertRange(preDelayTime, 0);
70
+ this._preDelay = preDelayTime;
71
+
66
72
  this.generate();
67
73
 
68
74
  this.connectEffect(this._convolver);
package/Tone/version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "15.1.4";
1
+ export const version: string = "15.1.5";