tone 15.3.0 → 15.3.2

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.
Files changed (58) hide show
  1. package/LICENSE.md +1 -1
  2. package/Tone/core/clock/Transport.test.ts +60 -60
  3. package/Tone/core/clock/Transport.ts +4 -4
  4. package/Tone/core/clock/TransportEvent.test.ts +4 -4
  5. package/Tone/core/clock/TransportEvent.ts +2 -2
  6. package/Tone/core/clock/TransportRepeatEvent.test.ts +4 -4
  7. package/Tone/core/clock/TransportRepeatEvent.ts +1 -1
  8. package/Tone/core/context/BaseContext.ts +4 -4
  9. package/Tone/core/context/Context.test.ts +8 -8
  10. package/Tone/core/context/Context.ts +14 -10
  11. package/Tone/core/context/Destination.test.ts +2 -2
  12. package/Tone/core/context/Destination.ts +3 -3
  13. package/Tone/core/context/DummyContext.ts +4 -4
  14. package/Tone/core/context/Listener.test.ts +2 -2
  15. package/Tone/core/context/Listener.ts +3 -2
  16. package/Tone/core/context/ToneWithContext.ts +1 -1
  17. package/Tone/core/index.ts +0 -3
  18. package/Tone/core/util/Draw.test.ts +4 -4
  19. package/Tone/core/util/Draw.ts +2 -2
  20. package/Tone/fromContext.ts +8 -8
  21. package/Tone/index.test.ts +9 -9
  22. package/Tone/index.ts +20 -16
  23. package/Tone/signal/SyncedSignal.ts +1 -1
  24. package/Tone/version.ts +1 -1
  25. package/build/Tone.js +1 -1
  26. package/build/Tone.js.map +1 -1
  27. package/build/esm/core/clock/Transport.d.ts +1 -1
  28. package/build/esm/core/clock/Transport.js +4 -4
  29. package/build/esm/core/clock/Transport.js.map +1 -1
  30. package/build/esm/core/clock/TransportEvent.d.ts +2 -2
  31. package/build/esm/core/clock/TransportEvent.js +1 -1
  32. package/build/esm/core/clock/TransportRepeatEvent.d.ts +1 -1
  33. package/build/esm/core/context/BaseContext.d.ts +4 -4
  34. package/build/esm/core/context/Context.d.ts +4 -4
  35. package/build/esm/core/context/Context.js +8 -6
  36. package/build/esm/core/context/Context.js.map +1 -1
  37. package/build/esm/core/context/Destination.d.ts +1 -1
  38. package/build/esm/core/context/Destination.js +3 -3
  39. package/build/esm/core/context/Destination.js.map +1 -1
  40. package/build/esm/core/context/DummyContext.d.ts +4 -4
  41. package/build/esm/core/context/Listener.d.ts +2 -1
  42. package/build/esm/core/context/Listener.js +3 -2
  43. package/build/esm/core/context/Listener.js.map +1 -1
  44. package/build/esm/core/context/ToneWithContext.d.ts +1 -1
  45. package/build/esm/core/context/ToneWithContext.js +1 -1
  46. package/build/esm/core/index.js +0 -2
  47. package/build/esm/core/index.js.map +1 -1
  48. package/build/esm/core/util/Draw.d.ts +1 -1
  49. package/build/esm/core/util/Draw.js +2 -2
  50. package/build/esm/core/util/Draw.js.map +1 -1
  51. package/build/esm/fromContext.d.ts +8 -8
  52. package/build/esm/index.d.ts +25 -21
  53. package/build/esm/index.js +8 -8
  54. package/build/esm/index.js.map +1 -1
  55. package/build/esm/signal/SyncedSignal.d.ts +1 -1
  56. package/build/esm/signal/SyncedSignal.js +1 -1
  57. package/build/esm/version.js +1 -1
  58. package/package.json +2 -2
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014-2020 Yotam Mann
3
+ Copyright (c) 2014-2025 Yotam Mann
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -10,13 +10,13 @@ import { Signal } from "../../signal/Signal.js";
10
10
  import { Time } from "../type/Time.js";
11
11
  import { TransportTime } from "../type/TransportTime.js";
12
12
  import { noOp } from "../util/Interface.js";
13
- import { TransportClass } from "./Transport.js";
13
+ import { TransportInstance } from "./Transport.js";
14
14
 
15
15
  describe("Transport", () => {
16
16
  context("BPM and timeSignature", () => {
17
17
  it("can get and set bpm", () => {
18
18
  return Offline((context) => {
19
- const transport = new TransportClass({ context });
19
+ const transport = new TransportInstance({ context });
20
20
  transport.bpm.value = 125;
21
21
  expect(transport.bpm.value).to.be.closeTo(125, 0.001);
22
22
  transport.bpm.value = 120;
@@ -26,7 +26,7 @@ describe("Transport", () => {
26
26
 
27
27
  it("can get and set timeSignature as both an array or number", () => {
28
28
  return Offline((context) => {
29
- const transport = new TransportClass({ context });
29
+ const transport = new TransportInstance({ context });
30
30
  transport.timeSignature = [6, 8];
31
31
  expect(transport.timeSignature).to.equal(3);
32
32
  transport.timeSignature = 5;
@@ -36,7 +36,7 @@ describe("Transport", () => {
36
36
 
37
37
  it("can get and set timeSignature as both an array or number", () => {
38
38
  return Offline((context) => {
39
- const transport = new TransportClass({ context });
39
+ const transport = new TransportInstance({ context });
40
40
  transport.timeSignature = [6, 8];
41
41
  expect(transport.timeSignature).to.equal(3);
42
42
  transport.timeSignature = 5;
@@ -48,7 +48,7 @@ describe("Transport", () => {
48
48
  context("looping", () => {
49
49
  it("can get and set loop points", () => {
50
50
  return Offline((context) => {
51
- const transport = new TransportClass({ context });
51
+ const transport = new TransportInstance({ context });
52
52
  transport.loopStart = 0.2;
53
53
  transport.loopEnd = 0.4;
54
54
  expect(transport.loopStart).to.be.closeTo(0.2, 0.01);
@@ -65,7 +65,7 @@ describe("Transport", () => {
65
65
  it("can loop events scheduled on the transport", async () => {
66
66
  let invocations = 0;
67
67
  await Offline((context) => {
68
- const transport = new TransportClass({ context });
68
+ const transport = new TransportInstance({ context });
69
69
  transport.schedule((time) => {
70
70
  invocations++;
71
71
  }, 0);
@@ -78,7 +78,7 @@ describe("Transport", () => {
78
78
  it("jumps to the loopStart after the loopEnd point", async () => {
79
79
  let looped = false;
80
80
  await Offline((context) => {
81
- const transport = new TransportClass({ context });
81
+ const transport = new TransportInstance({ context });
82
82
  transport.on("loop", () => {
83
83
  looped = true;
84
84
  });
@@ -94,14 +94,14 @@ describe("Transport", () => {
94
94
  context("nextSubdivision", () => {
95
95
  it("returns 0 if the transports not started", () => {
96
96
  return Offline((context) => {
97
- const transport = new TransportClass({ context });
97
+ const transport = new TransportInstance({ context });
98
98
  expect(transport.nextSubdivision()).to.equal(0);
99
99
  });
100
100
  });
101
101
 
102
102
  it("can get the next subdivision of the transport", async () => {
103
103
  await Offline((context) => {
104
- const transport = new TransportClass({ context });
104
+ const transport = new TransportInstance({ context });
105
105
  transport.start(0);
106
106
  return (time) => {
107
107
  whenBetween(time, 0.05, 0.07, () => {
@@ -136,7 +136,7 @@ describe("Transport", () => {
136
136
  context("PPQ", () => {
137
137
  it("can get and set pulses per quarter", () => {
138
138
  return Offline((context) => {
139
- const transport = new TransportClass({ context });
139
+ const transport = new TransportInstance({ context });
140
140
  transport.PPQ = 96;
141
141
  expect(transport.PPQ).to.equal(96);
142
142
  });
@@ -144,7 +144,7 @@ describe("Transport", () => {
144
144
 
145
145
  it("schedules a quarter note at the same time with a different PPQ", () => {
146
146
  return Offline((context) => {
147
- const transport = new TransportClass({ context });
147
+ const transport = new TransportInstance({ context });
148
148
  transport.PPQ = 1;
149
149
  const id = transport.schedule((time) => {
150
150
  expect(time).to.be.closeTo(transport.toSeconds("4n"), 0.1);
@@ -156,7 +156,7 @@ describe("Transport", () => {
156
156
 
157
157
  it("invokes the right number of ticks with a different PPQ", () => {
158
158
  return Offline((context) => {
159
- const transport = new TransportClass({ context });
159
+ const transport = new TransportInstance({ context });
160
160
  transport.bpm.value = 120;
161
161
  const ppq = 20;
162
162
  transport.PPQ = ppq;
@@ -174,7 +174,7 @@ describe("Transport", () => {
174
174
  context("position", () => {
175
175
  it("can jump to a specific tick number", () => {
176
176
  return Offline((context) => {
177
- const transport = new TransportClass({ context });
177
+ const transport = new TransportInstance({ context });
178
178
  transport.ticks = 200;
179
179
  expect(transport.ticks).to.equal(200);
180
180
  transport.start(0);
@@ -190,7 +190,7 @@ describe("Transport", () => {
190
190
 
191
191
  it("can get the current position in BarsBeatsSixteenths", () => {
192
192
  return Offline((context) => {
193
- const transport = new TransportClass({ context });
193
+ const transport = new TransportInstance({ context });
194
194
  expect(transport.position).to.equal("0:0:0");
195
195
  transport.start(0);
196
196
  return atTime(0.05, () => {
@@ -201,7 +201,7 @@ describe("Transport", () => {
201
201
 
202
202
  it("can get the current position in seconds", () => {
203
203
  return Offline((context) => {
204
- const transport = new TransportClass({ context });
204
+ const transport = new TransportInstance({ context });
205
205
  expect(transport.seconds).to.equal(0);
206
206
  transport.start(0.05);
207
207
  return (time) => {
@@ -217,7 +217,7 @@ describe("Transport", () => {
217
217
 
218
218
  it("can get the current position in seconds during a bpm ramp", () => {
219
219
  return Offline((context) => {
220
- const transport = new TransportClass({ context });
220
+ const transport = new TransportInstance({ context });
221
221
  expect(transport.seconds).to.equal(0);
222
222
  transport.start(0.05);
223
223
  transport.bpm.linearRampTo(60, 0.5, 0.5);
@@ -234,7 +234,7 @@ describe("Transport", () => {
234
234
 
235
235
  it("can set the current position in seconds", () => {
236
236
  return Offline((context) => {
237
- const transport = new TransportClass({ context });
237
+ const transport = new TransportInstance({ context });
238
238
  expect(transport.seconds).to.equal(0);
239
239
  transport.seconds = 3;
240
240
  expect(transport.seconds).to.be.closeTo(3, 0.01);
@@ -243,7 +243,7 @@ describe("Transport", () => {
243
243
 
244
244
  it("can set the current position in BarsBeatsSixteenths", () => {
245
245
  return Offline((context) => {
246
- const transport = new TransportClass({ context });
246
+ const transport = new TransportInstance({ context });
247
247
  expect(transport.position).to.equal("0:0:0");
248
248
  transport.position = "3:0";
249
249
  expect(transport.position).to.equal("3:0:0");
@@ -254,7 +254,7 @@ describe("Transport", () => {
254
254
 
255
255
  it("can get the progress of the loop", () => {
256
256
  return Offline((context) => {
257
- const transport = new TransportClass({ context });
257
+ const transport = new TransportInstance({ context });
258
258
  transport.setLoopPoints(0, "1m").start();
259
259
  transport.loop = true;
260
260
  expect(transport.progress).to.be.equal(0);
@@ -325,7 +325,7 @@ describe("Transport", () => {
325
325
  context("ticks", () => {
326
326
  it("resets ticks on stop but not on pause", () => {
327
327
  return Offline((context) => {
328
- const transport = new TransportClass({ context });
328
+ const transport = new TransportInstance({ context });
329
329
  transport.start(0).pause(0.1).stop(0.2);
330
330
  expect(transport.getTicksAtTime(0)).to.be.equal(
331
331
  Math.floor(transport.PPQ * 0)
@@ -345,7 +345,7 @@ describe("Transport", () => {
345
345
 
346
346
  it("tracks ticks after start", () => {
347
347
  return Offline((context) => {
348
- const transport = new TransportClass({ context });
348
+ const transport = new TransportInstance({ context });
349
349
  transport.bpm.value = 120;
350
350
  const ppq = transport.PPQ;
351
351
  transport.start();
@@ -360,7 +360,7 @@ describe("Transport", () => {
360
360
 
361
361
  it("can start with a tick offset", () => {
362
362
  return Offline((context) => {
363
- const transport = new TransportClass({ context });
363
+ const transport = new TransportInstance({ context });
364
364
  transport.start(0, "200i");
365
365
 
366
366
  return (time) => {
@@ -373,7 +373,7 @@ describe("Transport", () => {
373
373
 
374
374
  it("can toggle the state of the transport", async () => {
375
375
  await Offline((context) => {
376
- const transport = new TransportClass({ context });
376
+ const transport = new TransportInstance({ context });
377
377
  transport.toggle(0);
378
378
  transport.toggle(0.2);
379
379
 
@@ -391,7 +391,7 @@ describe("Transport", () => {
391
391
 
392
392
  it("tracks ticks correctly with a different PPQ and BPM", async () => {
393
393
  await Offline((context) => {
394
- const transport = new TransportClass({ context });
394
+ const transport = new TransportInstance({ context });
395
395
  transport.PPQ = 96;
396
396
  transport.bpm.value = 90;
397
397
  transport.start();
@@ -425,7 +425,7 @@ describe("Transport", () => {
425
425
  context("schedule", () => {
426
426
  it("can schedule an event on the timeline", () => {
427
427
  return Offline((context) => {
428
- const transport = new TransportClass({ context });
428
+ const transport = new TransportInstance({ context });
429
429
  const eventID = transport.schedule(() => {}, 0);
430
430
  expect(eventID).to.be.a("number");
431
431
  });
@@ -434,7 +434,7 @@ describe("Transport", () => {
434
434
  it("scheduled event gets invoked with the time of the event", async () => {
435
435
  let wasCalled = false;
436
436
  await Offline((context) => {
437
- const transport = new TransportClass({ context });
437
+ const transport = new TransportInstance({ context });
438
438
  const startTime = 0.1;
439
439
  transport.schedule((time) => {
440
440
  expect(time).to.be.closeTo(startTime, 0.01);
@@ -448,7 +448,7 @@ describe("Transport", () => {
448
448
  it("can schedule events with TransportTime", async () => {
449
449
  let wasCalled = false;
450
450
  await Offline((context) => {
451
- const transport = new TransportClass({ context });
451
+ const transport = new TransportInstance({ context });
452
452
  const startTime = 0.1;
453
453
  const eighth = transport.toSeconds("8n");
454
454
  transport.schedule((time) => {
@@ -462,7 +462,7 @@ describe("Transport", () => {
462
462
 
463
463
  it("can clear a scheduled event", () => {
464
464
  return Offline((context) => {
465
- const transport = new TransportClass({ context });
465
+ const transport = new TransportInstance({ context });
466
466
  const eventID = transport.schedule(() => {
467
467
  throw new Error("should not call this function");
468
468
  }, 0);
@@ -473,7 +473,7 @@ describe("Transport", () => {
473
473
 
474
474
  it("can cancel the timeline of scheduled object", () => {
475
475
  return Offline((context) => {
476
- const transport = new TransportClass({ context });
476
+ const transport = new TransportInstance({ context });
477
477
  transport.schedule(() => {
478
478
  throw new Error("should not call this");
479
479
  }, 0);
@@ -484,7 +484,7 @@ describe("Transport", () => {
484
484
 
485
485
  it("can cancel the timeline of scheduleOnce object", () => {
486
486
  return Offline((context) => {
487
- const transport = new TransportClass({ context });
487
+ const transport = new TransportInstance({ context });
488
488
  transport.scheduleOnce(() => {
489
489
  throw new Error("should not call this");
490
490
  }, 0);
@@ -496,7 +496,7 @@ describe("Transport", () => {
496
496
  it("scheduled event anywhere along the timeline", async () => {
497
497
  let wasCalled = false;
498
498
  await Offline((context) => {
499
- const transport = new TransportClass({ context });
499
+ const transport = new TransportInstance({ context });
500
500
  const startTime = transport.now();
501
501
  transport.schedule((time) => {
502
502
  expect(time).to.be.closeTo(startTime + 0.5, 0.001);
@@ -510,7 +510,7 @@ describe("Transport", () => {
510
510
  it("can schedule multiple events and invoke them in the right order", async () => {
511
511
  let wasCalled = false;
512
512
  await Offline((context) => {
513
- const transport = new TransportClass({ context });
513
+ const transport = new TransportInstance({ context });
514
514
  let first = false;
515
515
  transport.schedule(() => {
516
516
  first = true;
@@ -527,7 +527,7 @@ describe("Transport", () => {
527
527
  it("invokes the event again if the timeline is restarted", async () => {
528
528
  let iterations = 0;
529
529
  await Offline((context) => {
530
- const transport = new TransportClass({ context });
530
+ const transport = new TransportInstance({ context });
531
531
  transport.schedule(() => {
532
532
  iterations++;
533
533
  }, 0.05);
@@ -539,7 +539,7 @@ describe("Transport", () => {
539
539
  it("can add an event after the Transport is started", async () => {
540
540
  let wasCalled = false;
541
541
  await Offline((context) => {
542
- const transport = new TransportClass({ context });
542
+ const transport = new TransportInstance({ context });
543
543
  transport.start(0);
544
544
  let wasScheduled = false;
545
545
  return (time) => {
@@ -570,7 +570,7 @@ describe("Transport", () => {
570
570
  context("scheduleRepeat", () => {
571
571
  it("can schedule a repeated event", () => {
572
572
  return Offline((context) => {
573
- const transport = new TransportClass({ context });
573
+ const transport = new TransportInstance({ context });
574
574
  const eventID = transport.scheduleRepeat(noOp, 1);
575
575
  expect(eventID).to.be.a("number");
576
576
  });
@@ -579,7 +579,7 @@ describe("Transport", () => {
579
579
  it("scheduled event gets invoked with the time of the event", async () => {
580
580
  let invoked = false;
581
581
  await Offline((context) => {
582
- const transport = new TransportClass({ context });
582
+ const transport = new TransportInstance({ context });
583
583
  const startTime = 0.1;
584
584
  const eventID = transport.scheduleRepeat(
585
585
  (time) => {
@@ -597,7 +597,7 @@ describe("Transport", () => {
597
597
 
598
598
  it("can cancel the timeline of scheduleRepeat", () => {
599
599
  return Offline((context) => {
600
- const transport = new TransportClass({ context });
600
+ const transport = new TransportInstance({ context });
601
601
  transport.scheduleRepeat(
602
602
  () => {
603
603
  throw new Error("should not call this");
@@ -613,7 +613,7 @@ describe("Transport", () => {
613
613
  it("can schedule events with TransportTime", async () => {
614
614
  let invoked = false;
615
615
  await Offline((context) => {
616
- const transport = new TransportClass({ context });
616
+ const transport = new TransportInstance({ context });
617
617
  const startTime = 0.1;
618
618
  const eighth = transport.toSeconds("8n");
619
619
  transport.scheduleRepeat(
@@ -631,7 +631,7 @@ describe("Transport", () => {
631
631
 
632
632
  it("can clear a scheduled event", () => {
633
633
  return Offline((context) => {
634
- const transport = new TransportClass({ context });
634
+ const transport = new TransportInstance({ context });
635
635
  const eventID = transport.scheduleRepeat(
636
636
  () => {
637
637
  throw new Error("should not call this function");
@@ -647,7 +647,7 @@ describe("Transport", () => {
647
647
  it("can be scheduled in the future", async () => {
648
648
  let invoked = false;
649
649
  await Offline((context) => {
650
- const transport = new TransportClass({ context });
650
+ const transport = new TransportInstance({ context });
651
651
  const startTime = 0.1;
652
652
  const eventID = transport.scheduleRepeat(
653
653
  (time) => {
@@ -666,7 +666,7 @@ describe("Transport", () => {
666
666
  it("repeats a repeat event", async () => {
667
667
  let invocations = 0;
668
668
  await Offline((context) => {
669
- const transport = new TransportClass({ context });
669
+ const transport = new TransportInstance({ context });
670
670
  transport.scheduleRepeat(
671
671
  () => {
672
672
  invocations++;
@@ -682,7 +682,7 @@ describe("Transport", () => {
682
682
  it("repeats at the repeat interval", async () => {
683
683
  let wasCalled = false;
684
684
  await Offline((context) => {
685
- const transport = new TransportClass({ context });
685
+ const transport = new TransportInstance({ context });
686
686
  let repeatTime = -1;
687
687
  transport.scheduleRepeat(
688
688
  (time) => {
@@ -704,7 +704,7 @@ describe("Transport", () => {
704
704
  let first = false;
705
705
  let second = false;
706
706
  await Offline((context) => {
707
- const transport = new TransportClass({ context });
707
+ const transport = new TransportInstance({ context });
708
708
  const firstID = transport.scheduleRepeat(
709
709
  () => {
710
710
  first = true;
@@ -731,7 +731,7 @@ describe("Transport", () => {
731
731
  it("repeats for the given interval", async () => {
732
732
  let repeatCount = 0;
733
733
  await Offline((context) => {
734
- const transport = new TransportClass({ context });
734
+ const transport = new TransportInstance({ context });
735
735
  transport.scheduleRepeat(
736
736
  (time) => {
737
737
  repeatCount++;
@@ -748,7 +748,7 @@ describe("Transport", () => {
748
748
  it("can add an event after the Transport is started", async () => {
749
749
  let invocations = 0;
750
750
  await Offline((context) => {
751
- const transport = new TransportClass({ context });
751
+ const transport = new TransportInstance({ context });
752
752
  transport.start(0);
753
753
  let wasScheduled = false;
754
754
  const times = [0.15, 0.3];
@@ -775,7 +775,7 @@ describe("Transport", () => {
775
775
  it("can add an event to the past after the Transport is started", async () => {
776
776
  let invocations = 0;
777
777
  await Offline((context) => {
778
- const transport = new TransportClass({ context });
778
+ const transport = new TransportInstance({ context });
779
779
  transport.start(0);
780
780
  let wasScheduled = false;
781
781
  const times = [0.15, 0.25];
@@ -803,7 +803,7 @@ describe("Transport", () => {
803
803
  context("scheduleOnce", () => {
804
804
  it("can schedule a single event on the timeline", () => {
805
805
  return Offline((context) => {
806
- const transport = new TransportClass({ context });
806
+ const transport = new TransportInstance({ context });
807
807
  const eventID = transport.scheduleOnce(() => {}, 0);
808
808
  expect(eventID).to.be.a("number");
809
809
  });
@@ -812,7 +812,7 @@ describe("Transport", () => {
812
812
  it("scheduled event gets invoked with the time of the event", async () => {
813
813
  let invoked = false;
814
814
  await Offline((context) => {
815
- const transport = new TransportClass({ context });
815
+ const transport = new TransportInstance({ context });
816
816
  const startTime = 0.1;
817
817
  const eventID = transport.scheduleOnce((time) => {
818
818
  invoked = true;
@@ -827,7 +827,7 @@ describe("Transport", () => {
827
827
  it("can schedule events with TransportTime", async () => {
828
828
  let invoked = false;
829
829
  await Offline((context) => {
830
- const transport = new TransportClass({ context });
830
+ const transport = new TransportInstance({ context });
831
831
  const startTime = 0.1;
832
832
  const eighth = transport.toSeconds("8n");
833
833
  transport.scheduleOnce((time) => {
@@ -841,7 +841,7 @@ describe("Transport", () => {
841
841
 
842
842
  it("can clear a scheduled event", () => {
843
843
  return Offline((context) => {
844
- const transport = new TransportClass({ context });
844
+ const transport = new TransportInstance({ context });
845
845
  const eventID = transport.scheduleOnce(() => {
846
846
  throw new Error("should not call this function");
847
847
  }, 0);
@@ -853,7 +853,7 @@ describe("Transport", () => {
853
853
  it("can be scheduled in the future", async () => {
854
854
  let invoked = false;
855
855
  await Offline((context) => {
856
- const transport = new TransportClass({ context });
856
+ const transport = new TransportInstance({ context });
857
857
  const startTime = transport.now() + 0.1;
858
858
  const eventID = transport.scheduleOnce((time) => {
859
859
  transport.clear(eventID);
@@ -868,7 +868,7 @@ describe("Transport", () => {
868
868
  it("the event is removed after is is invoked", async () => {
869
869
  let iterations = 0;
870
870
  await Offline((context) => {
871
- const transport = new TransportClass({ context });
871
+ const transport = new TransportInstance({ context });
872
872
  transport.scheduleOnce(() => {
873
873
  iterations++;
874
874
  }, 0);
@@ -882,7 +882,7 @@ describe("Transport", () => {
882
882
  it("invokes start/stop/pause events", async () => {
883
883
  let invocations = 0;
884
884
  await Offline((context) => {
885
- const transport = new TransportClass({ context });
885
+ const transport = new TransportInstance({ context });
886
886
  transport.on("start", () => {
887
887
  invocations++;
888
888
  });
@@ -900,7 +900,7 @@ describe("Transport", () => {
900
900
  it("invokes start event with correct offset", async () => {
901
901
  let wasCalled = false;
902
902
  await Offline((context) => {
903
- const transport = new TransportClass({ context });
903
+ const transport = new TransportInstance({ context });
904
904
  transport.on("start", (time, offset) => {
905
905
  expect(time).to.be.closeTo(0.2, 0.01);
906
906
  expect(offset).to.be.closeTo(0.5, 0.001);
@@ -914,7 +914,7 @@ describe("Transport", () => {
914
914
  it("invokes the event just before the scheduled time", async () => {
915
915
  let invoked = false;
916
916
  await Offline((context) => {
917
- const transport = new TransportClass({ context });
917
+ const transport = new TransportInstance({ context });
918
918
  transport.on("start", (time, offset) => {
919
919
  expect(time - transport.context.currentTime).to.be.closeTo(
920
920
  0,
@@ -931,7 +931,7 @@ describe("Transport", () => {
931
931
  it("passes in the time argument to the events", async () => {
932
932
  let invocations = 0;
933
933
  await Offline((context) => {
934
- const transport = new TransportClass({ context });
934
+ const transport = new TransportInstance({ context });
935
935
  const now = transport.now();
936
936
  transport.on("start", (time) => {
937
937
  invocations++;
@@ -949,7 +949,7 @@ describe("Transport", () => {
949
949
  it("invokes the 'loop' method on loop", async () => {
950
950
  let loops = 0;
951
951
  await Offline((context) => {
952
- const transport = new TransportClass({ context });
952
+ const transport = new TransportInstance({ context });
953
953
  const sixteenth = transport.toSeconds("16n");
954
954
  transport.setLoopPoints(0, sixteenth);
955
955
  transport.loop = true;
@@ -970,7 +970,7 @@ describe("Transport", () => {
970
970
  context("swing", () => {
971
971
  it("can get/set the swing subdivision", () => {
972
972
  return Offline((context) => {
973
- const transport = new TransportClass({ context });
973
+ const transport = new TransportInstance({ context });
974
974
  transport.swingSubdivision = "8n";
975
975
  expect(transport.swingSubdivision).to.equal("8n");
976
976
  transport.swingSubdivision = "4n";
@@ -980,7 +980,7 @@ describe("Transport", () => {
980
980
 
981
981
  it("can get/set the swing amount", () => {
982
982
  return Offline((context) => {
983
- const transport = new TransportClass({ context });
983
+ const transport = new TransportInstance({ context });
984
984
  transport.swing = 0.5;
985
985
  expect(transport.swing).to.equal(0.5);
986
986
  transport.swing = 0;
@@ -991,7 +991,7 @@ describe("Transport", () => {
991
991
  it("can swing", async () => {
992
992
  let invocations = 0;
993
993
  await Offline((context) => {
994
- const transport = new TransportClass({ context });
994
+ const transport = new TransportInstance({ context });
995
995
  transport.swing = 1;
996
996
  transport.swingSubdivision = "8n";
997
997
  const eightNote = transport.toSeconds("8n");
@@ -87,7 +87,7 @@ type TransportCallback = (time: Seconds) => void;
87
87
  * Tone.getTransport().start();
88
88
  * @category Core
89
89
  */
90
- export class TransportClass
90
+ export class TransportInstance
91
91
  extends ToneWithContext<TransportOptions>
92
92
  implements Emitter<TransportEventNames>
93
93
  {
@@ -189,7 +189,7 @@ export class TransportClass
189
189
  constructor(options?: Partial<TransportOptions>);
190
190
  constructor() {
191
191
  const options = optionsFromArguments(
192
- TransportClass.getDefaults(),
192
+ TransportInstance.getDefaults(),
193
193
  arguments
194
194
  );
195
195
  super(options);
@@ -808,14 +808,14 @@ export class TransportClass
808
808
  emit!: (event: any, ...args: any[]) => this;
809
809
  }
810
810
 
811
- Emitter.mixin(TransportClass);
811
+ Emitter.mixin(TransportInstance);
812
812
 
813
813
  //-------------------------------------
814
814
  // INITIALIZATION
815
815
  //-------------------------------------
816
816
 
817
817
  onContextInit((context) => {
818
- context.transport = new TransportClass({ context });
818
+ context.transport = new TransportInstance({ context });
819
819
  });
820
820
 
821
821
  onContextClose((context) => {
@@ -1,13 +1,13 @@
1
1
  import { expect } from "chai";
2
2
 
3
3
  import { Offline } from "../../../test/helper/Offline.js";
4
- import { TransportClass } from "./Transport.js";
4
+ import { TransportInstance } from "./Transport.js";
5
5
  import { TransportEvent } from "./TransportEvent.js";
6
6
 
7
7
  describe("TransportEvent", () => {
8
8
  it("can be created and disposed", () => {
9
9
  return Offline((context) => {
10
- const transport = new TransportClass({ context });
10
+ const transport = new TransportInstance({ context });
11
11
  const event = new TransportEvent(transport, {
12
12
  time: 0,
13
13
  });
@@ -17,7 +17,7 @@ describe("TransportEvent", () => {
17
17
 
18
18
  it("has a unique id", () => {
19
19
  return Offline((context) => {
20
- const transport = new TransportClass({ context });
20
+ const transport = new TransportInstance({ context });
21
21
  const event = new TransportEvent(transport, {
22
22
  time: 0,
23
23
  });
@@ -29,7 +29,7 @@ describe("TransportEvent", () => {
29
29
  it("can invoke the callback", async () => {
30
30
  let wasInvoked = false;
31
31
  await Offline((context) => {
32
- const transport = new TransportClass({ context });
32
+ const transport = new TransportInstance({ context });
33
33
  const event = new TransportEvent(transport, {
34
34
  callback: (time) => {
35
35
  expect(time).to.equal(100);
@@ -1,6 +1,6 @@
1
1
  import { Seconds, Ticks } from "../type/Units.js";
2
2
  import { noOp } from "../util/Interface.js";
3
- import type { TransportClass as Transport } from "./Transport.js";
3
+ import type { TransportInstance as Transport } from "./Transport.js";
4
4
 
5
5
  export interface TransportEventOptions {
6
6
  callback: (time: number) => void;
@@ -9,7 +9,7 @@ export interface TransportEventOptions {
9
9
  }
10
10
 
11
11
  /**
12
- * TransportEvent is an internal class used by {@link TransportClass}
12
+ * TransportEvent is an internal class used by {@link TransportInstance}
13
13
  * to schedule events. Do no invoke this class directly, it is
14
14
  * handled from within Tone.Transport.
15
15
  */
@@ -1,13 +1,13 @@
1
1
  import { expect } from "chai";
2
2
 
3
3
  import { Offline } from "../../../test/helper/Offline.js";
4
- import { TransportClass } from "./Transport.js";
4
+ import { TransportInstance } from "./Transport.js";
5
5
  import { TransportRepeatEvent } from "./TransportRepeatEvent.js";
6
6
 
7
7
  describe("TransportRepeatEvent", () => {
8
8
  it("can be created and disposed", async () => {
9
9
  await Offline((context) => {
10
- const transport = new TransportClass({ context });
10
+ const transport = new TransportInstance({ context });
11
11
  const event = new TransportRepeatEvent(transport, {
12
12
  duration: 100,
13
13
  interval: 4,
@@ -19,7 +19,7 @@ describe("TransportRepeatEvent", () => {
19
19
 
20
20
  it("generates a unique event ID", async () => {
21
21
  await Offline((context) => {
22
- const transport = new TransportClass({ context });
22
+ const transport = new TransportInstance({ context });
23
23
  const event = new TransportRepeatEvent(transport, {
24
24
  time: 0,
25
25
  });
@@ -30,7 +30,7 @@ describe("TransportRepeatEvent", () => {
30
30
 
31
31
  it("is removed from the Transport when disposed", async () => {
32
32
  await Offline((context) => {
33
- const transport = new TransportClass({ context });
33
+ const transport = new TransportInstance({ context });
34
34
  const event = new TransportRepeatEvent(transport, {
35
35
  time: 0,
36
36
  });
@@ -2,7 +2,7 @@ import { BaseContext } from "../context/BaseContext.js";
2
2
  import { TicksClass } from "../type/Ticks.js";
3
3
  import { Seconds, Ticks, Time } from "../type/Units.js";
4
4
  import { GT, LT } from "../util/Math.js";
5
- import type { TransportClass as Transport } from "./Transport.js";
5
+ import type { TransportInstance as Transport } from "./Transport.js";
6
6
  import { TransportEvent, TransportEventOptions } from "./TransportEvent.js";
7
7
 
8
8
  interface TransportRepeatEventOptions extends TransportEventOptions {
@@ -1,10 +1,10 @@
1
- import type { TransportClass as Transport } from "../clock/Transport.js";
1
+ import type { TransportInstance as Transport } from "../clock/Transport.js";
2
2
  import { Seconds } from "../type/Units.js";
3
- import type { DrawClass as Draw } from "../util/Draw.js";
3
+ import type { DrawInstance as Draw } from "../util/Draw.js";
4
4
  import { Emitter } from "../util/Emitter.js";
5
5
  import { AnyAudioContext } from "./AudioContext.js";
6
- import type { DestinationClass as Destination } from "./Destination.js";
7
- import type { ListenerClass as Listener } from "./Listener.js";
6
+ import type { DestinationInstance as Destination } from "./Destination.js";
7
+ import type { ListenerInstance as Listener } from "./Listener.js";
8
8
 
9
9
  // these are either not used in Tone.js or deprecated and not implemented.
10
10
  export type ExcludedFromBaseAudioContext =