tone 14.8.47 → 14.8.49

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.
@@ -13,6 +13,7 @@ export interface FFTOptions extends MeterBaseOptions {
13
13
 
14
14
  /**
15
15
  * Get the current frequency data of the connected audio source using a fast Fourier transform.
16
+ * Read more about FFT algorithms on [Wikipedia] (https://en.wikipedia.org/wiki/Fast_Fourier_transform).
16
17
  * @category Component
17
18
  */
18
19
  export class FFT extends MeterBase<FFTOptions> {
@@ -120,8 +120,7 @@ describe("Context", () => {
120
120
  await context.resume();
121
121
  await new Promise<void>((done) => setTimeout(() => done(), 10));
122
122
  expect(triggerChange).to.equal(true);
123
- context.dispose();
124
- return ac.close();
123
+ return context.dispose();
125
124
  });
126
125
  });
127
126
 
@@ -94,6 +94,11 @@ export class Context extends BaseContext {
94
94
  */
95
95
  private _initialized = false;
96
96
 
97
+ /**
98
+ * Private indicator if a close() has been called on the context, since close is async
99
+ */
100
+ private _closeStarted = false;
101
+
97
102
  /**
98
103
  * Indicates if the context is an OfflineAudioContext or an AudioContext
99
104
  */
@@ -485,7 +490,8 @@ export class Context extends BaseContext {
485
490
  * any AudioNodes created from the context will be silent.
486
491
  */
487
492
  async close(): Promise<void> {
488
- if (isAudioContext(this._context)) {
493
+ if (isAudioContext(this._context) && (this.state !== "closed") && !this._closeStarted) {
494
+ this._closeStarted = true;
489
495
  await this._context.close();
490
496
  }
491
497
  if (this._initialized) {
@@ -530,6 +536,7 @@ export class Context extends BaseContext {
530
536
  Object.keys(this._constants).map((val) =>
531
537
  this._constants[val].disconnect()
532
538
  );
539
+ this.close();
533
540
  return this;
534
541
  }
535
542
 
@@ -17,15 +17,15 @@ export interface ChorusOptions extends StereoFeedbackEffectOptions {
17
17
 
18
18
  /**
19
19
  * Chorus is a stereo chorus effect composed of a left and right delay with an [[LFO]] applied to the delayTime of each channel.
20
- * When [[feedback]] is set to a value larger than 0, you also get Flanger-type effects.
20
+ * When [[feedback]] is set to a value larger than 0, you also get Flanger-type effects.
21
21
  * Inspiration from [Tuna.js](https://github.com/Dinahmoe/tuna/blob/master/tuna.js).
22
- * Read more on the chorus effect on [SoundOnSound](http://www.soundonsound.com/sos/jun04/articles/synthsecrets.htm).
22
+ * Read more on the chorus effect on [Sound On Sound](http://www.soundonsound.com/sos/jun04/articles/synthsecrets.htm).
23
23
  *
24
24
  * @example
25
25
  * const chorus = new Tone.Chorus(4, 2.5, 0.5).toDestination().start();
26
26
  * const synth = new Tone.PolySynth().connect(chorus);
27
27
  * synth.triggerAttackRelease(["C3", "E3", "G3"], "8n");
28
- *
28
+ *
29
29
  * @category Effect
30
30
  */
31
31
  export class Chorus extends StereoFeedbackEffect<ChorusOptions> {
@@ -10,7 +10,7 @@ export interface DistortionOptions extends EffectOptions {
10
10
  /**
11
11
  * A simple distortion effect using Tone.WaveShaper.
12
12
  * Algorithm from [this stackoverflow answer](http://stackoverflow.com/a/22313408).
13
- *
13
+ * Read more about distortion on [Wikipedia] (https://en.wikipedia.org/wiki/Distortion_(music)).
14
14
  * @example
15
15
  * const dist = new Tone.Distortion(0.8).toDestination();
16
16
  * const fm = new Tone.FMSynth().connect(dist);
package/Tone/version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "14.8.47";
1
+ export const version: string = "14.8.49";