tone 15.5.64 → 15.5.65

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.
@@ -1,6 +1,9 @@
1
+ import { expect } from "chai";
2
+
1
3
  import { BasicTests } from "../../../test/helper/Basic.js";
2
4
  import { connectFrom, connectTo } from "../../../test/helper/Connect.js";
3
5
  import { ConstantOutput } from "../../../test/helper/ConstantOutput.js";
6
+ import { wait } from "../../../test/helper/Wait.js";
4
7
  import { Signal } from "../../signal/Signal.js";
5
8
  import { CrossFade } from "./CrossFade.js";
6
9
 
@@ -64,4 +67,18 @@ describe("CrossFade", () => {
64
67
  );
65
68
  });
66
69
  });
70
+
71
+ it("passes input a before the context's lookAhead has passed", async () => {
72
+ const crossFade = new CrossFade(0);
73
+ const signal = new Signal(1).connect(crossFade.a);
74
+ const analyser = crossFade.context.createAnalyser();
75
+ crossFade.connect(analyser);
76
+ // a start which waited for the lookAhead would still be silent here
77
+ await wait((crossFade.context.lookAhead / 2) * 1000);
78
+ const samples = new Float32Array(analyser.fftSize);
79
+ analyser.getFloatTimeDomainData(samples);
80
+ expect(Math.max(...samples)).to.be.closeTo(1, 0.01);
81
+ signal.dispose();
82
+ crossFade.dispose();
83
+ });
67
84
  });
@@ -123,7 +123,7 @@ export class CrossFade extends ToneAudioNode<CrossFadeOptions> {
123
123
  this._constant = new ToneConstantSource({
124
124
  context: this.context,
125
125
  offset: 1,
126
- }).start();
126
+ }).start(0);
127
127
  this._constant.connect(this._panner);
128
128
  this._panner.connect(this._split);
129
129
  // this is necessary for standardized-audio-context
@@ -1,6 +1,7 @@
1
1
  import { expect } from "chai";
2
2
 
3
3
  import { connectFrom } from "../../../test/helper/Connect.js";
4
+ import { wait } from "../../../test/helper/Wait.js";
4
5
  import { Context } from "../../core/context/Context.js";
5
6
  import { ToneWithContext } from "../../core/context/ToneWithContext.js";
6
7
  import { Synth } from "../../instrument/Synth.js";
@@ -47,10 +48,6 @@ describe("Recorder", () => {
47
48
  });
48
49
  });
49
50
 
50
- function wait(time) {
51
- return new Promise((done) => setTimeout(done, time));
52
- }
53
-
54
51
  context("start/stop/pause", () => {
55
52
  it("can be started", () => {
56
53
  const rec = new Recorder();
@@ -98,7 +98,7 @@ export class StereoWidener extends MidSideEffect<StereoWidenerOptions> {
98
98
  this._constant = new ToneConstantSource({
99
99
  context: this.context,
100
100
  offset: 1,
101
- }).start();
101
+ }).start(0);
102
102
  this._constant.connect(this._oneMinusWidth);
103
103
  this.width.connect(this._oneMinusWidth.subtrahend);
104
104
 
@@ -36,7 +36,7 @@ export class Zero extends SignalOperator<ToneAudioNodeOptions> {
36
36
  this._constant = this.output = new ToneConstantSource({
37
37
  context: this.context,
38
38
  offset: 0,
39
- }).start();
39
+ }).start(0);
40
40
  }
41
41
 
42
42
  /**
package/Tone/version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "15.5.64";
1
+ export const version: string = "15.5.65";