tone 15.2.7 → 15.2.9
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.
- package/Tone/component/analysis/DCMeter.test.ts +1 -1
- package/Tone/component/analysis/Meter.test.ts +0 -2
- package/Tone/component/envelope/AmplitudeEnvelope.test.ts +0 -1
- package/Tone/component/filter/EQ3.test.ts +0 -1
- package/Tone/core/clock/Ticker.ts +1 -0
- package/Tone/core/clock/TransportRepeatEvent.ts +2 -4
- package/Tone/core/context/Param.test.ts +1 -8
- package/Tone/core/context/ToneWithContext.ts +0 -1
- package/Tone/core/util/Draw.test.ts +12 -1
- package/Tone/event/PatternGenerator.ts +10 -12
- package/Tone/index.ts +1 -2
- package/Tone/signal/Abs.test.ts +0 -1
- package/Tone/signal/AudioToGain.test.ts +0 -1
- package/Tone/signal/GainToAudio.test.ts +0 -1
- package/Tone/signal/Signal.test.ts +0 -2
- package/Tone/signal/SyncedSignal.ts +2 -1
- package/Tone/version.ts +1 -1
- package/build/Tone.js +1 -1
- package/build/Tone.js.map +1 -1
- package/build/esm/core/clock/Ticker.js +1 -0
- package/build/esm/core/clock/Ticker.js.map +1 -1
- package/build/esm/core/clock/TransportRepeatEvent.js +2 -4
- package/build/esm/core/clock/TransportRepeatEvent.js.map +1 -1
- package/build/esm/core/context/ToneWithContext.js.map +1 -1
- package/build/esm/event/PatternGenerator.d.ts +1 -2
- package/build/esm/event/PatternGenerator.js +1 -2
- package/build/esm/event/PatternGenerator.js.map +1 -1
- package/build/esm/index.d.ts +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/signal/SyncedSignal.d.ts +1 -0
- package/build/esm/signal/SyncedSignal.js +1 -0
- package/build/esm/signal/SyncedSignal.js.map +1 -1
- package/build/esm/version.js +1 -1
- package/package.json +12 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
|
|
3
|
-
import { BasicTests
|
|
3
|
+
import { BasicTests } from "../../../test/helper/Basic.js";
|
|
4
4
|
import { PassAudio } from "../../../test/helper/PassAudio.js";
|
|
5
5
|
import { Signal } from "../../signal/Signal.js";
|
|
6
6
|
import { DCMeter } from "./DCMeter.js";
|
|
@@ -2,10 +2,8 @@ import { expect } from "chai";
|
|
|
2
2
|
|
|
3
3
|
import { BasicTests, warns } from "../../../test/helper/Basic.js";
|
|
4
4
|
import { PassAudio } from "../../../test/helper/PassAudio.js";
|
|
5
|
-
import { Signal } from "../../signal/Signal.js";
|
|
6
5
|
import { Oscillator } from "../../source/oscillator/Oscillator.js";
|
|
7
6
|
import { Merge } from "../channel/Merge.js";
|
|
8
|
-
import { Panner } from "../channel/Panner.js";
|
|
9
7
|
import { Meter } from "./Meter.js";
|
|
10
8
|
|
|
11
9
|
describe("Meter", () => {
|
|
@@ -2,7 +2,6 @@ import { expect } from "chai";
|
|
|
2
2
|
|
|
3
3
|
import { BasicTests } from "../../../test/helper/Basic.js";
|
|
4
4
|
import { CompareToFile } from "../../../test/helper/CompareToFile.js";
|
|
5
|
-
import { connectFrom, connectTo } from "../../../test/helper/Connect.js";
|
|
6
5
|
import { Offline } from "../../../test/helper/Offline.js";
|
|
7
6
|
import { Signal } from "../../signal/Signal.js";
|
|
8
7
|
import { Oscillator } from "../../source/oscillator/Oscillator.js";
|
|
@@ -86,7 +86,7 @@ export class TransportRepeatEvent extends TransportEvent {
|
|
|
86
86
|
*/
|
|
87
87
|
invoke(time: Seconds): void {
|
|
88
88
|
// create more events if necessary
|
|
89
|
-
this._createEvents(
|
|
89
|
+
this._createEvents();
|
|
90
90
|
// call the super class
|
|
91
91
|
super.invoke(time);
|
|
92
92
|
}
|
|
@@ -107,9 +107,7 @@ export class TransportRepeatEvent extends TransportEvent {
|
|
|
107
107
|
/**
|
|
108
108
|
* Push more events onto the timeline to keep up with the position of the timeline
|
|
109
109
|
*/
|
|
110
|
-
private _createEvents(
|
|
111
|
-
// schedule the next event
|
|
112
|
-
// const ticks = this.transport.getTicksAtTime(time);
|
|
110
|
+
private _createEvents(): void {
|
|
113
111
|
// if the next tick is within the bounds set by "duration"
|
|
114
112
|
if (
|
|
115
113
|
LT(this._nextTick + this._interval, this.floatTime + this.duration)
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
|
|
3
3
|
import { BasicTests, testAudioContext } from "../../../test/helper/Basic.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Plot } from "../../../test/helper/compare/index.js";
|
|
5
5
|
import { atTime, Offline } from "../../../test/helper/Offline.js";
|
|
6
6
|
import { Signal } from "../../signal/Signal.js";
|
|
7
7
|
import { getContext } from "../Global.js";
|
|
8
8
|
import {
|
|
9
|
-
BPM,
|
|
10
|
-
Decibels,
|
|
11
|
-
Frequency,
|
|
12
|
-
Positive,
|
|
13
|
-
Seconds,
|
|
14
|
-
Time,
|
|
15
|
-
Unit,
|
|
16
9
|
UnitName,
|
|
17
10
|
} from "../type/Units.js";
|
|
18
11
|
import { Param } from "./Param.js";
|
|
@@ -3,13 +3,24 @@ import { expect } from "chai";
|
|
|
3
3
|
import { DrawClass } from "./Draw.js";
|
|
4
4
|
|
|
5
5
|
describe("Draw", () => {
|
|
6
|
+
const originalRAF = window.requestAnimationFrame;
|
|
7
|
+
before(async () => {
|
|
8
|
+
window.requestAnimationFrame = (callback) => {
|
|
9
|
+
return setTimeout(callback, 10);
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
after(() => {
|
|
14
|
+
window.requestAnimationFrame = originalRAF;
|
|
15
|
+
});
|
|
16
|
+
|
|
6
17
|
it("can schedule a callback at a AudioContext time", (done) => {
|
|
7
18
|
const draw = new DrawClass();
|
|
8
19
|
const scheduledTime = draw.now() + 0.2;
|
|
9
20
|
draw.schedule(() => {
|
|
10
|
-
done();
|
|
11
21
|
expect(draw.context.currentTime).to.be.closeTo(scheduledTime, 0.05);
|
|
12
22
|
draw.dispose();
|
|
23
|
+
done();
|
|
13
24
|
}, scheduledTime);
|
|
14
25
|
});
|
|
15
26
|
|
|
@@ -18,7 +18,7 @@ export type PatternName =
|
|
|
18
18
|
/**
|
|
19
19
|
* Start at the first value and go up to the last
|
|
20
20
|
*/
|
|
21
|
-
function* upPatternGen
|
|
21
|
+
function* upPatternGen(numValues: number): IterableIterator<number> {
|
|
22
22
|
let index = 0;
|
|
23
23
|
while (index < numValues) {
|
|
24
24
|
index = clamp(index, 0, numValues - 1);
|
|
@@ -30,7 +30,7 @@ function* upPatternGen<T>(numValues: number): IterableIterator<number> {
|
|
|
30
30
|
/**
|
|
31
31
|
* Start at the last value and go down to 0
|
|
32
32
|
*/
|
|
33
|
-
function* downPatternGen
|
|
33
|
+
function* downPatternGen(numValues: number): IterableIterator<number> {
|
|
34
34
|
let index = numValues - 1;
|
|
35
35
|
while (index >= 0) {
|
|
36
36
|
index = clamp(index, 0, numValues - 1);
|
|
@@ -42,7 +42,7 @@ function* downPatternGen<T>(numValues: number): IterableIterator<number> {
|
|
|
42
42
|
/**
|
|
43
43
|
* Infinitely yield the generator
|
|
44
44
|
*/
|
|
45
|
-
function* infiniteGen
|
|
45
|
+
function* infiniteGen(
|
|
46
46
|
numValues: number,
|
|
47
47
|
gen: typeof upPatternGen
|
|
48
48
|
): IterableIterator<number> {
|
|
@@ -54,7 +54,7 @@ function* infiniteGen<T>(
|
|
|
54
54
|
/**
|
|
55
55
|
* Alternate between two generators
|
|
56
56
|
*/
|
|
57
|
-
function* alternatingGenerator
|
|
57
|
+
function* alternatingGenerator(
|
|
58
58
|
numValues: number,
|
|
59
59
|
directionUp: boolean
|
|
60
60
|
): IterableIterator<number> {
|
|
@@ -79,7 +79,7 @@ function* alternatingGenerator<T>(
|
|
|
79
79
|
/**
|
|
80
80
|
* Starting from the bottom move up 2, down 1
|
|
81
81
|
*/
|
|
82
|
-
function* jumpUp
|
|
82
|
+
function* jumpUp(numValues: number): IterableIterator<number> {
|
|
83
83
|
let index = 0;
|
|
84
84
|
let stepIndex = 0;
|
|
85
85
|
while (index < numValues) {
|
|
@@ -93,7 +93,7 @@ function* jumpUp<T>(numValues: number): IterableIterator<number> {
|
|
|
93
93
|
/**
|
|
94
94
|
* Starting from the top move down 2, up 1
|
|
95
95
|
*/
|
|
96
|
-
function* jumpDown
|
|
96
|
+
function* jumpDown(numValues: number): IterableIterator<number> {
|
|
97
97
|
let index = numValues - 1;
|
|
98
98
|
let stepIndex = 0;
|
|
99
99
|
while (index >= 0) {
|
|
@@ -107,7 +107,7 @@ function* jumpDown<T>(numValues: number): IterableIterator<number> {
|
|
|
107
107
|
/**
|
|
108
108
|
* Choose a random index each time
|
|
109
109
|
*/
|
|
110
|
-
function* randomGen
|
|
110
|
+
function* randomGen(numValues: number): IterableIterator<number> {
|
|
111
111
|
while (true) {
|
|
112
112
|
const randomIndex = Math.floor(Math.random() * numValues);
|
|
113
113
|
yield randomIndex;
|
|
@@ -117,7 +117,7 @@ function* randomGen<T>(numValues: number): IterableIterator<number> {
|
|
|
117
117
|
/**
|
|
118
118
|
* Randomly go through all of the values once before choosing a new random order
|
|
119
119
|
*/
|
|
120
|
-
function* randomOnce
|
|
120
|
+
function* randomOnce(numValues: number): IterableIterator<number> {
|
|
121
121
|
// create an array of indices
|
|
122
122
|
const copy: number[] = [];
|
|
123
123
|
for (let i = 0; i < numValues; i++) {
|
|
@@ -134,7 +134,7 @@ function* randomOnce<T>(numValues: number): IterableIterator<number> {
|
|
|
134
134
|
/**
|
|
135
135
|
* Randomly choose to walk up or down 1 index
|
|
136
136
|
*/
|
|
137
|
-
function* randomWalk
|
|
137
|
+
function* randomWalk(numValues: number): IterableIterator<number> {
|
|
138
138
|
// randomly choose a starting index
|
|
139
139
|
let index = Math.floor(Math.random() * numValues);
|
|
140
140
|
while (true) {
|
|
@@ -157,12 +157,10 @@ function* randomWalk<T>(numValues: number): IterableIterator<number> {
|
|
|
157
157
|
* according to the passed in pattern that can be used as indexes into an array of size numValues.
|
|
158
158
|
* @param numValues The size of the array to emit indexes for
|
|
159
159
|
* @param pattern The name of the pattern use when iterating over
|
|
160
|
-
* @param index Where to start in the offset of the values array
|
|
161
160
|
*/
|
|
162
161
|
export function* PatternGenerator(
|
|
163
162
|
numValues: number,
|
|
164
|
-
pattern: PatternName = "up"
|
|
165
|
-
index = 0
|
|
163
|
+
pattern: PatternName = "up"
|
|
166
164
|
): Iterator<number> {
|
|
167
165
|
// safeguards
|
|
168
166
|
assert(numValues >= 1, "The number of values must be at least one");
|
package/Tone/index.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { getContext, setContext } from "./core/Global.js";
|
|
2
|
-
import { Context } from "./core/context/Context.js";
|
|
3
1
|
export * from "./classes.js";
|
|
2
|
+
export { getContext, setContext } from "./core/Global.js";
|
|
4
3
|
export * from "./version.js";
|
|
5
4
|
import { ToneAudioBuffer } from "./core/context/ToneAudioBuffer.js";
|
|
6
5
|
import { getContext } from "./core/Global.js";
|
package/Tone/signal/Abs.test.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BasicTests } from "../../test/helper/Basic.js";
|
|
2
|
-
import { connectFrom, connectTo } from "../../test/helper/Connect.js";
|
|
3
2
|
import { ConstantOutput } from "../../test/helper/ConstantOutput.js";
|
|
4
3
|
import { Abs } from "./Abs.js";
|
|
5
4
|
import { Signal } from "./Signal.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
|
|
3
3
|
import { BasicTests } from "../../test/helper/Basic.js";
|
|
4
|
-
import { connectFrom, connectTo } from "../../test/helper/Connect.js";
|
|
5
4
|
import { ConstantOutput } from "../../test/helper/ConstantOutput.js";
|
|
6
5
|
import { Offline } from "../../test/helper/Offline.js";
|
|
7
6
|
import { Oscillator } from "../source/oscillator/Oscillator.js";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BasicTests } from "../../test/helper/Basic.js";
|
|
2
|
-
import { connectFrom, connectTo } from "../../test/helper/Connect.js";
|
|
3
2
|
import { ConstantOutput } from "../../test/helper/ConstantOutput.js";
|
|
4
3
|
import { GainToAudio } from "./GainToAudio.js";
|
|
5
4
|
import { Signal } from "./Signal.js";
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { expect } from "chai";
|
|
2
2
|
|
|
3
3
|
import { BasicTests } from "../../test/helper/Basic.js";
|
|
4
|
-
import { connectFrom, connectTo } from "../../test/helper/Connect.js";
|
|
5
4
|
import { ConstantOutput } from "../../test/helper/ConstantOutput.js";
|
|
6
5
|
import { Offline } from "../../test/helper/Offline.js";
|
|
7
6
|
import { Gain } from "../core/context/Gain.js";
|
|
8
|
-
import { Decibels, Frequency, Time } from "../core/type/Units.js";
|
|
9
7
|
import { Signal } from "./Signal.js";
|
|
10
8
|
|
|
11
9
|
describe("Signal", () => {
|
package/Tone/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version: string = "15.2.
|
|
1
|
+
export const version: string = "15.2.9";
|