tone 15.5.44 → 15.5.46

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.
@@ -395,5 +395,31 @@ describe("Source", () => {
395
395
  expect(output.getValueAtTime(0.25)).to.be.closeTo(0.05, 0.01);
396
396
  expect(output.getValueAtTime(0.3)).to.be.closeTo(0.1, 0.01);
397
397
  });
398
+
399
+ it("does not replay a clip synced at time 0 after stopping and restarting at a later offset (#1417)", async () => {
400
+ let onStopCount = 0;
401
+ await Offline(({ transport }) => {
402
+ const source = new Player(rampBuffer).toDestination();
403
+ source.onstop = () => {
404
+ onStopCount++;
405
+ };
406
+ // rampBuffer duration is 1s. Sync at time 0 with duration 0.2s.
407
+ // This clip only spans [0, 0.2]. At transport time 0.4, it is over.
408
+ source.sync().start(0, 0, 0.2);
409
+ transport.start(0, 0);
410
+
411
+ return [
412
+ atTime(0.25, () => {
413
+ transport.stop();
414
+ }),
415
+ atTime(0.3, () => {
416
+ // restart past the clip duration at offset 0.4
417
+ transport.start(0.3, 0.4);
418
+ }),
419
+ ];
420
+ }, 0.5);
421
+
422
+ expect(onStopCount).to.equal(1);
423
+ });
398
424
  });
399
425
  });
@@ -348,6 +348,9 @@ export abstract class Source<
348
348
  duration =
349
349
  this.toSeconds(stateEvent.duration) -
350
350
  startOffset;
351
+ if (duration <= 0) {
352
+ return;
353
+ }
351
354
  }
352
355
  this._start(
353
356
  time,
package/Tone/version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "15.5.44";
1
+ export const version: string = "15.5.46";