From 144ed389c0171c8a463f0aef13a18e6f72caf5ea Mon Sep 17 00:00:00 2001 From: kjw142857 <122250318+kjw142857@users.noreply.github.com> Date: Sun, 1 Oct 2023 17:29:13 +0800 Subject: [PATCH] Revert runtime-error regression in zero duration Revert regression that caused make_sound to reject durations of length 0, which affected the consecutively and simultaneously functions --- src/bundles/sound/functions.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bundles/sound/functions.ts b/src/bundles/sound/functions.ts index eb5a7abfae..be970090fc 100644 --- a/src/bundles/sound/functions.ts +++ b/src/bundles/sound/functions.ts @@ -277,8 +277,8 @@ export function record_for(duration: number, buffer: number): () => Sound { * @example const s = make_sound(t => Math_sin(2 * Math_PI * 440 * t), 5); */ export function make_sound(wave: Wave, duration: number): Sound { - if (duration <= 0) { - throw new Error('Sound duration must be greater than 0'); + if (duration < 0) { + throw new Error('Sound duration must be greater than or equal to 0'); } return pair((t: number) => (t >= duration ? 0 : wave(t)), duration);