@motionscript/core 0.1.0-alpha.7 → 0.1.0-alpha.8
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/CHANGELOG.md +6 -0
- package/NOTICE +15 -14
- package/README.md +4 -4
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +7 -5
- package/dist/assets/manager.js.map +1 -1
- package/dist/attributes/audio/effects/chain.d.ts +73 -0
- package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
- package/dist/attributes/audio/effects/chain.js +67 -0
- package/dist/attributes/audio/effects/chain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/echo.js +11 -0
- package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
- package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/gain.js +6 -0
- package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/highpass.js +10 -0
- package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/lowpass.js +10 -0
- package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/tremolo.js +10 -0
- package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
- package/dist/attributes/audio/effects/index.d.ts +12 -0
- package/dist/attributes/audio/effects/index.d.ts.map +1 -0
- package/dist/attributes/audio/effects/index.js +4 -0
- package/dist/attributes/audio/effects/index.js.map +1 -0
- package/dist/attributes/audio/effects/registry.d.ts +36 -0
- package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
- package/dist/attributes/audio/effects/registry.js +80 -0
- package/dist/attributes/audio/effects/registry.js.map +1 -0
- package/dist/attributes/audio/effects/union.d.ts +14 -0
- package/dist/attributes/audio/effects/union.d.ts.map +1 -0
- package/dist/attributes/audio/effects/union.js +24 -0
- package/dist/attributes/audio/effects/union.js.map +1 -0
- package/dist/attributes/audio/ramp.d.ts +103 -0
- package/dist/attributes/audio/ramp.d.ts.map +1 -0
- package/dist/attributes/audio/ramp.js +246 -0
- package/dist/attributes/audio/ramp.js.map +1 -0
- package/dist/attributes/audio/request.d.ts +24 -13
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +4 -3
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +21 -13
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +42 -28
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +15 -12
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -10
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/audio/transition.d.ts +33 -0
- package/dist/attributes/audio/transition.d.ts.map +1 -0
- package/dist/attributes/audio/transition.js +48 -0
- package/dist/attributes/audio/transition.js.map +1 -0
- package/dist/attributes/index.d.ts +4 -3
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +4 -7
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/matrix2d.d.ts +2 -2
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/space3d.js +1 -1
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +7 -7
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +6 -6
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +1 -2
- package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js +1 -2
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +96 -409
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +93 -283
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
- package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
- package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
- package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js +13 -5
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
- package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
- package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js +26 -23
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
- package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js +26 -20
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +46 -14
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
- package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
- package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js +17 -14
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js +28 -22
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
- package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js +74 -72
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
- package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js +21 -18
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
- package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
- package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js +15 -10
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
- package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js +20 -16
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
- package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
- package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js +18 -17
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
- package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
- package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +42 -26
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
- package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js +19 -16
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
- package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
- package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
- package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
- package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
- package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js +26 -23
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +4 -2
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +11 -0
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +113 -102
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/spec.d.ts +229 -0
- package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
- package/dist/attributes/shape/effects/spec.js +178 -0
- package/dist/attributes/shape/effects/spec.js.map +1 -0
- package/dist/attributes/shape/fill/chain.d.ts +7 -9
- package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
- package/dist/attributes/shape/fill/chain.js +9 -11
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +27 -26
- package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js +20 -14
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/index.d.ts +1 -1
- package/dist/attributes/shape/fill/index.d.ts.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/registry.d.ts +1 -2
- package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
- package/dist/attributes/shape/fill/registry.js +1 -2
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +2 -6
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -5
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +1 -1
- package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +2 -3
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/shaders/index.d.ts +2 -0
- package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/index.js +2 -0
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/language.d.ts +26 -0
- package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/language.js +20 -0
- package/dist/attributes/shape/shaders/language.js.map +1 -0
- package/dist/attributes/shape/shaders/pack.d.ts +25 -11
- package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/pack.js +9 -4
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
- package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js +3 -6
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
- package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/uniforms.js +0 -0
- package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
- package/dist/browser/chunks/chunk-AOT33LMS.js +13 -0
- package/dist/browser/chunks/chunk-AOT33LMS.js.map +7 -0
- package/dist/browser/chunks/chunk-GKM6UZJR.js +6 -0
- package/dist/browser/chunks/chunk-GKM6UZJR.js.map +7 -0
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/experimental.js.map +4 -4
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +2 -2
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/components/builtins/audio/audio.d.ts +14 -5
- package/dist/components/builtins/audio/audio.d.ts.map +1 -1
- package/dist/components/builtins/audio/audio.js +10 -13
- package/dist/components/builtins/audio/audio.js.map +1 -1
- package/dist/components/builtins/geometry/composite.d.ts +3 -3
- package/dist/components/builtins/media/media.d.ts +7 -7
- package/dist/components/builtins/media/media.d.ts.map +1 -1
- package/dist/components/builtins/media/media.js +4 -10
- package/dist/components/builtins/media/media.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +12 -12
- package/dist/components/builtins/text/text.d.ts.map +1 -1
- package/dist/components/builtins/text/text.js +3 -0
- package/dist/components/builtins/text/text.js.map +1 -1
- package/dist/components/factory/api.d.ts +38 -11
- package/dist/components/factory/api.d.ts.map +1 -1
- package/dist/components/factory/api.js.map +1 -1
- package/dist/components/factory/component3d.d.ts.map +1 -1
- package/dist/components/factory/component3d.js +11 -3
- package/dist/components/factory/component3d.js.map +1 -1
- package/dist/components/factory/factory.d.ts +3 -0
- package/dist/components/factory/factory.d.ts.map +1 -1
- package/dist/components/factory/factory.js +39 -5
- package/dist/components/factory/factory.js.map +1 -1
- package/dist/components/modules/text-style.d.ts +1 -1
- package/dist/components/trees/2d/node-render.d.ts +1 -1
- package/dist/components/trees/2d/node-render.js +1 -1
- package/dist/components/trees/2d/node-render.js.map +1 -1
- package/dist/components/trees/2d/node2d.d.ts +1 -1
- package/dist/components/trees/2d/node2d.js +1 -1
- package/dist/components/trees/2d/node2d.js.map +1 -1
- package/dist/components/trees/audio/node-audio.d.ts +16 -9
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
- package/dist/components/trees/audio/node-audio.js +15 -11
- package/dist/components/trees/audio/node-audio.js.map +1 -1
- package/dist/document/command-traits.d.ts +12 -2
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +34 -6
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/index.d.ts +8 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +4 -0
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.d.ts +70 -0
- package/dist/document/migrate.d.ts.map +1 -0
- package/dist/document/migrate.js +202 -0
- package/dist/document/migrate.js.map +1 -0
- package/dist/document/missing-node.d.ts +27 -0
- package/dist/document/missing-node.d.ts.map +1 -0
- package/dist/document/missing-node.js +48 -0
- package/dist/document/missing-node.js.map +1 -0
- package/dist/document/node-descriptor.d.ts +4 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +2 -1
- package/dist/document/placement.d.ts.map +1 -1
- package/dist/document/placement.js.map +1 -1
- package/dist/document/project.d.ts +2 -0
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js +1 -0
- package/dist/document/project.js.map +1 -1
- package/dist/document/prop-evolution.d.ts +51 -0
- package/dist/document/prop-evolution.d.ts.map +1 -0
- package/dist/document/prop-evolution.js +83 -0
- package/dist/document/prop-evolution.js.map +1 -0
- package/dist/document/registry.d.ts +16 -0
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +30 -4
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +2 -0
- package/dist/document/settled-index.d.ts.map +1 -1
- package/dist/document/settled-index.js +5 -5
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline-patch.d.ts +4 -0
- package/dist/document/timeline-patch.d.ts.map +1 -1
- package/dist/document/timeline-patch.js +28 -3
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +45 -1
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +172 -42
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +14 -28
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +17 -5
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +158 -21
- package/dist/document/validate.js.map +1 -1
- package/dist/document/vocabulary.d.ts +28 -0
- package/dist/document/vocabulary.d.ts.map +1 -0
- package/dist/document/vocabulary.js +42 -0
- package/dist/document/vocabulary.js.map +1 -0
- package/dist/experimental.d.ts +68 -8
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +22 -8
- package/dist/experimental.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -0
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +1 -1
- package/dist/renamed-scene-names.d.ts.map +1 -1
- package/dist/renamed-scene-names.js +1 -1
- package/dist/renamed-scene-names.js.map +1 -1
- package/dist/render/canvas-render-context2d.d.ts +9 -0
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +10 -0
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/index.d.ts +2 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +1 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/render-context2d.d.ts +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/render-issue.d.ts +39 -0
- package/dist/render/render-issue.d.ts.map +1 -0
- package/dist/render/render-issue.js +29 -0
- package/dist/render/render-issue.js.map +1 -0
- package/dist/render/surface.d.ts +2 -2
- package/dist/render/surface.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +54 -5
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/runtime/asset-refine.js +2 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.d.ts +10 -0
- package/dist/runtime/asset-timeline.d.ts.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.d.ts.map +1 -1
- package/dist/runtime/asset-update.js +7 -0
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +3 -1
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +4 -0
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +17 -2
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -3
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +14 -4
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/session.d.ts +7 -3
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +11 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +1 -1
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +8 -6
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +10 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +7 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +1 -0
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +2 -0
- package/dist/tween/ease/describe.d.ts.map +1 -1
- package/dist/tween/ease/describe.js +4 -0
- package/dist/tween/ease/describe.js.map +1 -1
- package/dist/tween/ease/spec.d.ts +31 -0
- package/dist/tween/ease/spec.d.ts.map +1 -0
- package/dist/tween/ease/spec.js +51 -0
- package/dist/tween/ease/spec.js.map +1 -0
- package/dist/tween/index.d.ts +1 -0
- package/dist/tween/index.d.ts.map +1 -1
- package/dist/tween/index.js +1 -0
- package/dist/tween/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
- package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
- package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
- package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type Param } from "../../attributes/audio/
|
|
1
|
+
import { type AudioEffect } from "../../attributes/audio/effects/union.js";
|
|
2
|
+
import { type Param } from "../../attributes/audio/ramp.js";
|
|
3
|
+
import { type AudioTransition } from "../../attributes/audio/transition.js";
|
|
3
4
|
/**
|
|
4
5
|
* One bus a clip's signal passes through on its way to the master.
|
|
5
6
|
*
|
|
@@ -14,17 +15,19 @@ import { type Param } from "../../attributes/audio/filters/curve.js";
|
|
|
14
15
|
*/
|
|
15
16
|
export interface AudioBusStop {
|
|
16
17
|
id: string;
|
|
17
|
-
/** Linear gain. A {@link Param}, so a bus fade is a
|
|
18
|
+
/** Linear gain. A {@link Param}, so a bus fade is a ramp rather than a per-frame write. */
|
|
18
19
|
volume: Param;
|
|
19
20
|
/** -1 hard left … +1 hard right. */
|
|
20
21
|
pan: Param;
|
|
21
22
|
mute: boolean;
|
|
22
23
|
/** Applied in array order, index 0 closest to the source. */
|
|
23
|
-
|
|
24
|
+
effects?: AudioEffect[];
|
|
25
|
+
transitionIn?: AudioTransition;
|
|
26
|
+
transitionOut?: AudioTransition;
|
|
24
27
|
/**
|
|
25
28
|
* When the bus is present, in the same seconds as the request carrying the
|
|
26
|
-
* stop: what a
|
|
27
|
-
* clip's
|
|
29
|
+
* stop: what a ramp in {@link volume} or {@link effects}, and its
|
|
30
|
+
* transitions, run over, as a clip's run over the clip. Not the clip's span, because one bus
|
|
28
31
|
* feeds many clips and its fade has to mean one thing to all of them.
|
|
29
32
|
*/
|
|
30
33
|
startAt: number;
|
|
@@ -37,11 +40,11 @@ export interface AudioBusStop {
|
|
|
37
40
|
export declare function busStopKey(stop: AudioBusStop): string;
|
|
38
41
|
export interface AudioParams {
|
|
39
42
|
src: string;
|
|
40
|
-
volume?:
|
|
43
|
+
volume?: Param;
|
|
41
44
|
loop?: boolean;
|
|
42
45
|
trimStart?: number;
|
|
43
46
|
trimEnd?: number;
|
|
44
|
-
|
|
47
|
+
effects?: AudioEffect[];
|
|
45
48
|
}
|
|
46
49
|
export interface AudioRequest {
|
|
47
50
|
id: string;
|
|
@@ -85,14 +88,22 @@ export interface AudioRequest {
|
|
|
85
88
|
* out-point and this is absent.
|
|
86
89
|
*/
|
|
87
90
|
trimEnd?: number;
|
|
88
|
-
|
|
91
|
+
/** Linear gain over the clip's own seconds. Default 1. */
|
|
92
|
+
volume: Param;
|
|
93
|
+
/** Playback rate, default 1. A ramp runs over the first {@link sourceLength} source seconds after `trimStart`. */
|
|
94
|
+
speed?: Param;
|
|
95
|
+
/** The source seconds a speed ramp is placed on; carried only with one, so the device and the timeline place it alike. */
|
|
96
|
+
sourceLength?: number;
|
|
89
97
|
loop: boolean;
|
|
90
|
-
/** Audio
|
|
91
|
-
|
|
98
|
+
/** Audio effects applied in array order (index 0 closest to the source). */
|
|
99
|
+
effects?: AudioEffect[];
|
|
100
|
+
/** A gain over the clip's first and last seconds, on top of {@link volume}. */
|
|
101
|
+
transitionIn?: AudioTransition;
|
|
102
|
+
transitionOut?: AudioTransition;
|
|
92
103
|
/**
|
|
93
104
|
* The buses this clip feeds, **source-adjacent first** — the same ordering
|
|
94
|
-
* convention {@link
|
|
95
|
-
* the clip's own
|
|
105
|
+
* convention {@link effects} uses, so the whole chain reads in signal order:
|
|
106
|
+
* the clip's own effects, then each stop in turn, then the master.
|
|
96
107
|
*
|
|
97
108
|
* Absent means the clip goes straight to the master, which is what every
|
|
98
109
|
* request did before buses existed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,
|
|
1
|
+
{"version":3,"file":"request.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAY,KAAK,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAiB,KAAK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AC,EAAE,KAAK,CAAC;IACd,0HAA0H;IAC1H,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IAId,4EAA4E;IAC5E,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,aAAa,CAAC,EAAE,eAAe,CAAC;IAEhC;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;IAI9B;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { paramKey } from "../../attributes/audio/
|
|
1
|
+
import { effectsKey } from "../../attributes/audio/effects/union.js";
|
|
2
|
+
import { paramKey } from "../../attributes/audio/ramp.js";
|
|
3
|
+
import { transitionKey } from "../../attributes/audio/transition.js";
|
|
3
4
|
/**
|
|
4
5
|
* Everything about a stop that changes what passes through it, as a string — so
|
|
5
6
|
* a device can tell an edited bus from the one it already built.
|
|
6
7
|
*/
|
|
7
8
|
export function busStopKey(stop) {
|
|
8
|
-
return `${stop.id}:${paramKey(stop.volume)}:${paramKey(stop.pan)}:${stop.mute ? 1 : 0}:${
|
|
9
|
+
return `${stop.id}:${paramKey(stop.volume)}:${paramKey(stop.pan)}:${stop.mute ? 1 : 0}:${effectsKey(stop.effects)}:${transitionKey(stop.transitionIn)}:${transitionKey(stop.transitionOut)}:${stop.startAt}:${stop.endAt}`;
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/attributes/audio/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/attributes/audio/request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,kCAAkC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAc,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAwB,MAAM,+BAA+B,CAAC;AAmCpF;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,IAAkB;IACzC,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;AAC/N,CAAC","sourcesContent":["import { effectsKey, type AudioEffect } from \"@/attributes/audio/effects/union\";\r\nimport { paramKey, type Param } from \"@/attributes/audio/ramp\";\r\nimport { transitionKey, type AudioTransition } from \"@/attributes/audio/transition\";\r\n\r\n/**\r\n * One bus a clip's signal passes through on its way to the master.\r\n *\r\n * A flattened snapshot of an {@link AudioBus} node, not a reference to it: core\r\n * describes what the graph should be and a platform builds it, so what crosses\r\n * that seam has to be plain data.\r\n *\r\n * {@link id} is what makes it a *bus* rather than per-clip processing — two\r\n * clips naming the same id share one live chain, so a reverb on a bus is a\r\n * single tail fed by both, which is not the same sound as that reverb applied\r\n * to each clip separately.\r\n */\r\nexport interface AudioBusStop {\r\n id: string;\r\n /** Linear gain. A {@link Param}, so a bus fade is a ramp rather than a per-frame write. */\r\n volume: Param;\r\n /** -1 hard left … +1 hard right. */\r\n pan: Param;\r\n mute: boolean;\r\n /** Applied in array order, index 0 closest to the source. */\r\n effects?: AudioEffect[];\r\n transitionIn?: AudioTransition;\r\n transitionOut?: AudioTransition;\r\n /**\r\n * When the bus is present, in the same seconds as the request carrying the\r\n * stop: what a ramp in {@link volume} or {@link effects}, and its\r\n * transitions, run over, as a clip's run over the clip. Not the clip's span, because one bus\r\n * feeds many clips and its fade has to mean one thing to all of them.\r\n */\r\n startAt: number;\r\n endAt: number;\r\n}\r\n\r\n/**\r\n * Everything about a stop that changes what passes through it, as a string — so\r\n * a device can tell an edited bus from the one it already built.\r\n */\r\nexport function busStopKey(stop: AudioBusStop): string {\r\n return `${stop.id}:${paramKey(stop.volume)}:${paramKey(stop.pan)}:${stop.mute ? 1 : 0}:${effectsKey(stop.effects)}:${transitionKey(stop.transitionIn)}:${transitionKey(stop.transitionOut)}:${stop.startAt}:${stop.endAt}`;\r\n}\r\n\r\nexport interface AudioParams {\r\n src: string;\r\n volume?: Param;\r\n loop?: boolean;\r\n trimStart?: number; // in seconds\r\n trimEnd?: number; // in seconds\r\n effects?: AudioEffect[];\r\n}\r\n\r\nexport interface AudioRequest {\r\n id: string;\r\n /** The asset path or URL. ('src' is standard for media) */\r\n src: string;\r\n\r\n // --- Timeline Synchronization (Clip Time) ---\r\n\r\n /** The clip timestamp when the audio should START playing. */\r\n startAt: number; // in seconds\r\n\r\n /**\r\n * The clip timestamp when the audio should STOP playing.\r\n *\r\n * Always a number, and **`Infinity` is the open/unbounded sentinel** — never\r\n * `null` or `undefined`. An unstopped clip carries `Infinity` until\r\n * {@link open} resolution pins it to the project end.\r\n *\r\n * So test it with `Number.isFinite(endAt)`. A `?? Infinity` or `!== null`\r\n * guard is dead code that reads as if the field were nullable.\r\n */\r\n endAt: number; // in seconds\r\n\r\n /**\r\n * True when this request was started and left running at its scene's end —\r\n * neither explicitly stopped nor finite-trimmed. Open requests\r\n * are exempt from the per-scene audio clamp and instead **continue across scene\r\n * boundaries**: `assembleTimeline` shifts them to absolute time and resolves\r\n * `endAt = min(startAt + mediaDuration, projectTotalDuration)` (a looped open\r\n * request runs to the project end). Bounded requests are unaffected.\r\n */\r\n open?: boolean;\r\n\r\n /**\r\n * Source media length in seconds, carried on **open** requests so the\r\n * cross-scene end can be resolved at assembly time without re-reading the\r\n * asset catalog. Ignored for bounded requests.\r\n */\r\n mediaDuration?: number;\r\n\r\n // --- Media Trimming (Local Audio Time) ---\r\n\r\n /** Offset in seconds to skip ahead in the audio file. Default: 0 */\r\n trimStart: number;\r\n\r\n /**\r\n * Out-point inside the source, in seconds, carried **only by a looping\r\n * request that has one** (`trimEnd` greater than {@link trimStart}). A device\r\n * loops the region `[trimStart, trimEnd)` rather than the whole buffer; for a\r\n * request that does not loop, {@link endAt} already ends playback at the\r\n * out-point and this is absent.\r\n */\r\n trimEnd?: number;\r\n\r\n // --- Playback Settings ---\r\n\r\n /** Linear gain over the clip's own seconds. Default 1. */\r\n volume: Param;\r\n /** Playback rate, default 1. A ramp runs over the first {@link sourceLength} source seconds after `trimStart`. */\r\n speed?: Param;\r\n /** The source seconds a speed ramp is placed on; carried only with one, so the device and the timeline place it alike. */\r\n sourceLength?: number;\r\n loop: boolean; // Default: false\r\n\r\n // --- Processing ---\r\n\r\n /** Audio effects applied in array order (index 0 closest to the source). */\r\n effects?: AudioEffect[];\r\n /** A gain over the clip's first and last seconds, on top of {@link volume}. */\r\n transitionIn?: AudioTransition;\r\n transitionOut?: AudioTransition;\r\n\r\n /**\r\n * The buses this clip feeds, **source-adjacent first** — the same ordering\r\n * convention {@link effects} uses, so the whole chain reads in signal order:\r\n * the clip's own effects, then each stop in turn, then the master.\r\n *\r\n * Absent means the clip goes straight to the master, which is what every\r\n * request did before buses existed.\r\n */\r\n bus?: readonly AudioBusStop[];\r\n\r\n // --- Timeline attribution (display only) ---\r\n\r\n /**\r\n * The owner key of the node that declared this request: its document row's\r\n * id, plus the path below that row for a node a composite built. Lets a\r\n * timeline draw the waveform on that node's bar. Never affects playback.\r\n */\r\n ownerId?: string;\r\n\r\n /**\r\n * The sound of something that is also a picture — a video's own track. A\r\n * source only such requests want is silence when it holds no audio, where\r\n * for a request without this it is a failure to report. Never part of the\r\n * request's identity: it changes nothing a device plays.\r\n */\r\n optional?: boolean;\r\n}"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AssetCatalog } from "../../assets/catalog.js";
|
|
2
|
-
import { type
|
|
3
|
-
import type
|
|
2
|
+
import { type AudioEffectsInput } from "./effects/chain.js";
|
|
3
|
+
import { type Param } from "./ramp.js";
|
|
4
|
+
import type { AudioTransition } from "./transition.js";
|
|
4
5
|
import type { AudioBusStop, AudioRequest } from "./request.js";
|
|
5
6
|
/** One clip a command's sound plays, in its clip's seconds. */
|
|
6
7
|
export interface AudioClip {
|
|
@@ -14,24 +15,31 @@ export interface AudioClip {
|
|
|
14
15
|
/** Out-point inside the source. Absent plays to the source's end. */
|
|
15
16
|
trimEnd?: number;
|
|
16
17
|
loop?: boolean;
|
|
17
|
-
volume?:
|
|
18
|
-
|
|
18
|
+
volume?: Param;
|
|
19
|
+
/** Playback rate; a ramp runs over source seconds after `trimStart`. */
|
|
20
|
+
speed?: Param;
|
|
21
|
+
effects?: AudioEffectsInput;
|
|
22
|
+
transitionIn?: AudioTransition;
|
|
23
|
+
transitionOut?: AudioTransition;
|
|
19
24
|
/** Source-adjacent first — see {@link AudioRequest.bus}. */
|
|
20
25
|
bus?: readonly AudioBusStop[];
|
|
21
26
|
/** Sound nobody asked for by name — see {@link AudioRequest.optional}. */
|
|
22
27
|
optional?: boolean;
|
|
23
28
|
}
|
|
24
29
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
30
|
+
* Clip seconds spent playing the first `sourceElapsed` of `sourceLength` source
|
|
31
|
+
* seconds at `speed`. Must match the device's `playbackRate` schedule, or a
|
|
32
|
+
* request ends before or after its sound does.
|
|
27
33
|
*/
|
|
28
|
-
export declare function
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
export declare function clipTimeAtSource(speed: Param, sourceLength: number, sourceElapsed?: number): number;
|
|
35
|
+
/** Inverse of {@link clipTimeAtSource}: the source seconds reached `clipElapsed` clip seconds in. */
|
|
36
|
+
export declare function sourceTimeAtClip(speed: Param, sourceLength: number, clipElapsed: number): number;
|
|
37
|
+
/** How long a clip lasts on the timeline: its trimmed source at its speed. `trimEnd` absent plays to `mediaDuration`. */
|
|
38
|
+
export declare function clipDurationOf(clip: {
|
|
39
|
+
readonly trimStart?: number;
|
|
40
|
+
readonly trimEnd?: number;
|
|
41
|
+
readonly speed?: Param;
|
|
42
|
+
}, mediaDuration: number): number;
|
|
35
43
|
/**
|
|
36
44
|
* The request `clip` schedules.
|
|
37
45
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAuB,KAAK,
|
|
1
|
+
{"version":3,"file":"schedule.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/schedule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAA0E,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAq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veSpeed(filters) {
|
|
8
|
-
let speed = 1;
|
|
9
|
-
for (const f of filters) {
|
|
10
|
-
if (f.type === "speed" && !isCurve(f.value) && f.value > 0)
|
|
11
|
-
speed *= f.value;
|
|
12
|
-
}
|
|
13
|
-
return speed;
|
|
1
|
+
import { resolveAudioEffects } from "./effects/chain.js";
|
|
2
|
+
import { integrateSpeedToClipTime, isRamp, sourceTimeAtClipElapsed, staticValue } from "./ramp.js";
|
|
3
|
+
function scalarSpeed(speed) {
|
|
4
|
+
return Number.isFinite(speed) && speed > 0 ? speed : 1;
|
|
14
5
|
}
|
|
15
6
|
/**
|
|
16
|
-
* Clip seconds
|
|
17
|
-
* Must match the
|
|
18
|
-
* or after
|
|
7
|
+
* Clip seconds spent playing the first `sourceElapsed` of `sourceLength` source
|
|
8
|
+
* seconds at `speed`. Must match the device's `playbackRate` schedule, or a
|
|
9
|
+
* request ends before or after its sound does.
|
|
19
10
|
*/
|
|
20
|
-
export function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
export function clipTimeAtSource(speed, sourceLength, sourceElapsed = sourceLength) {
|
|
12
|
+
if (isRamp(speed))
|
|
13
|
+
return integrateSpeedToClipTime(speed, sourceLength, sourceElapsed);
|
|
14
|
+
return Math.max(0, Math.min(sourceElapsed, sourceLength)) / scalarSpeed(speed);
|
|
15
|
+
}
|
|
16
|
+
/** Inverse of {@link clipTimeAtSource}: the source seconds reached `clipElapsed` clip seconds in. */
|
|
17
|
+
export function sourceTimeAtClip(speed, sourceLength, clipElapsed) {
|
|
18
|
+
if (isRamp(speed))
|
|
19
|
+
return sourceTimeAtClipElapsed(speed, sourceLength, clipElapsed);
|
|
20
|
+
return Math.max(0, Math.min(sourceLength, clipElapsed * scalarSpeed(speed)));
|
|
21
|
+
}
|
|
22
|
+
/** How long a clip lasts on the timeline: its trimmed source at its speed. `trimEnd` absent plays to `mediaDuration`. */
|
|
23
|
+
export function clipDurationOf(clip, mediaDuration) {
|
|
24
|
+
const length = Math.max(0, (clip.trimEnd ?? mediaDuration) - (clip.trimStart ?? 0));
|
|
25
|
+
return clipTimeAtSource(clip.speed ?? 1, length);
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
29
28
|
* The request `clip` schedules.
|
|
@@ -37,10 +36,18 @@ export function requestOf(clip, catalog, ownerKey, n) {
|
|
|
37
36
|
const trimStart = clip.trimStart ?? 0;
|
|
38
37
|
const trimEnd = clip.trimEnd ?? Infinity;
|
|
39
38
|
const loop = clip.loop ?? false;
|
|
40
|
-
const
|
|
39
|
+
const effects = resolveAudioEffects(clip.effects);
|
|
41
40
|
// Read even when the length goes unused: a missing file throws here, as a
|
|
42
41
|
// build error, rather than playing silence.
|
|
43
42
|
const mediaDuration = catalog.getMediaDuration(clip.src);
|
|
43
|
+
let speed = clip.speed ?? 1;
|
|
44
|
+
if (loop && isRamp(speed)) {
|
|
45
|
+
if (process.env.NODE_ENV !== "production") {
|
|
46
|
+
console.warn(`[motionscript] A speed ramp on a looping clip (${clip.src}) has no one source axis to run over; it plays at its start value.`);
|
|
47
|
+
}
|
|
48
|
+
speed = staticValue(speed, 1);
|
|
49
|
+
}
|
|
50
|
+
const sourceLength = Math.max(0, (Number.isFinite(trimEnd) ? trimEnd : mediaDuration) - trimStart);
|
|
44
51
|
const request = {
|
|
45
52
|
id: `${ownerKey}|${clip.src}|${at}|${n}`,
|
|
46
53
|
src: clip.src,
|
|
@@ -48,11 +55,18 @@ export function requestOf(clip, catalog, ownerKey, n) {
|
|
|
48
55
|
endAt: Infinity,
|
|
49
56
|
trimStart,
|
|
50
57
|
volume: clip.volume ?? 1,
|
|
58
|
+
speed,
|
|
51
59
|
loop,
|
|
52
60
|
ownerId: ownerKey,
|
|
53
61
|
};
|
|
54
|
-
if (
|
|
55
|
-
request.
|
|
62
|
+
if (isRamp(speed))
|
|
63
|
+
request.sourceLength = sourceLength;
|
|
64
|
+
if (effects.length > 0)
|
|
65
|
+
request.effects = effects;
|
|
66
|
+
if (clip.transitionIn)
|
|
67
|
+
request.transitionIn = clip.transitionIn;
|
|
68
|
+
if (clip.transitionOut)
|
|
69
|
+
request.transitionOut = clip.transitionOut;
|
|
56
70
|
if (clip.bus)
|
|
57
71
|
request.bus = clip.bus;
|
|
58
72
|
if (clip.optional)
|
|
@@ -69,10 +83,10 @@ export function requestOf(clip, catalog, ownerKey, n) {
|
|
|
69
83
|
request.open = true;
|
|
70
84
|
}
|
|
71
85
|
else if (Number.isFinite(trimEnd)) {
|
|
72
|
-
request.endAt = Math.min(until, at +
|
|
86
|
+
request.endAt = Math.min(until, at + clipTimeAtSource(speed, sourceLength));
|
|
73
87
|
}
|
|
74
88
|
else {
|
|
75
|
-
const natural =
|
|
89
|
+
const natural = clipTimeAtSource(speed, sourceLength);
|
|
76
90
|
if (Number.isFinite(until)) {
|
|
77
91
|
request.endAt = Math.min(until, at + natural);
|
|
78
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../src/attributes/audio/schedule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"schedule.js","sourceRoot":"","sources":["../../../src/attributes/audio/schedule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAA0B,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,EAAE,uBAAuB,EAAE,WAAW,EAAc,MAAM,QAAQ,CAAC;AA4B5G,SAAS,WAAW,CAAC,KAAa;IAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY,EAAE,YAAoB,EAAE,gBAAwB,YAAY;IACrG,IAAI,MAAM,CAAC,KAAK,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C,aAAa,GAAG,OAAO,CAAC;QACpC,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC","sourcesContent":["import type { AssetCatalog } from \"@/assets/catalog\";\r\nimport { resolveAudioEffects, type AudioEffectsInput } from \"./effects/chain\";\r\nimport { integrateSpeedToClipTime, isRamp, sourceTimeAtClipElapsed, staticValue, type Param } from \"./ramp\";\r\nimport type { AudioTransition } from \"./transition\";\r\nimport type { AudioBusStop, AudioRequest } from \"./request\";\r\n\r\n/** One clip a command's sound plays, in its clip's seconds. */\r\nexport interface AudioClip {\r\n src: string;\r\n /** When it starts. */\r\n at?: number;\r\n /** When it is cut, however much of it is left. */\r\n until?: number;\r\n /** In-point inside the source, in seconds. */\r\n trimStart?: number;\r\n /** Out-point inside the source. Absent plays to the source's end. */\r\n trimEnd?: number;\r\n loop?: boolean;\r\n volume?: Param;\r\n /** Playback rate; a ramp runs over source seconds after `trimStart`. */\r\n speed?: Param;\r\n effects?: AudioEffectsInput;\r\n transitionIn?: AudioTransition;\r\n transitionOut?: AudioTransition;\r\n /** Source-adjacent first — see {@link AudioRequest.bus}. */\r\n bus?: readonly AudioBusStop[];\r\n /** Sound nobody asked for by name — see {@link AudioRequest.optional}. */\r\n optional?: boolean;\r\n}\r\n\r\nfunction scalarSpeed(speed: number): number {\r\n return Number.isFinite(speed) && speed > 0 ? speed : 1;\r\n}\r\n\r\n/**\r\n * Clip seconds spent playing the first `sourceElapsed` of `sourceLength` source\r\n * seconds at `speed`. Must match the device's `playbackRate` schedule, or a\r\n * request ends before or after its sound does.\r\n */\r\nexport function clipTimeAtSource(speed: Param, sourceLength: number, sourceElapsed: number = sourceLength): number {\r\n if (isRamp(speed)) return integrateSpeedToClipTime(speed, sourceLength, sourceElapsed);\r\n return Math.max(0, Math.min(sourceElapsed, sourceLength)) / scalarSpeed(speed);\r\n}\r\n\r\n/** Inverse of {@link clipTimeAtSource}: the source seconds reached `clipElapsed` clip seconds in. */\r\nexport function sourceTimeAtClip(speed: Param, sourceLength: number, clipElapsed: number): number {\r\n if (isRamp(speed)) return sourceTimeAtClipElapsed(speed, sourceLength, clipElapsed);\r\n return Math.max(0, Math.min(sourceLength, clipElapsed * scalarSpeed(speed)));\r\n}\r\n\r\n/** How long a clip lasts on the timeline: its trimmed source at its speed. `trimEnd` absent plays to `mediaDuration`. */\r\nexport function clipDurationOf(clip: { readonly trimStart?: number; readonly trimEnd?: number; readonly speed?: Param }, mediaDuration: number): number {\r\n const length = Math.max(0, (clip.trimEnd ?? mediaDuration) - (clip.trimStart ?? 0));\r\n return clipTimeAtSource(clip.speed ?? 1, length);\r\n}\r\n\r\n/**\r\n * The request `clip` schedules.\r\n *\r\n * Bounded when it has an end — a trim, or an `until` — and **open** otherwise, so\r\n * a bed nothing cuts continues across later tracks; see `AudioRequest.open`.\r\n */\r\nexport function requestOf(clip: AudioClip, catalog: AssetCatalog, ownerKey: string, n: number): AudioRequest {\r\n const at = clip.at ?? 0;\r\n const until = clip.until ?? Infinity;\r\n const trimStart = clip.trimStart ?? 0;\r\n const trimEnd = clip.trimEnd ?? Infinity;\r\n const loop = clip.loop ?? false;\r\n const effects = resolveAudioEffects(clip.effects);\r\n // Read even when the length goes unused: a missing file throws here, as a\r\n // build error, rather than playing silence.\r\n const mediaDuration = catalog.getMediaDuration(clip.src);\r\n\r\n let speed = clip.speed ?? 1;\r\n if (loop && isRamp(speed)) {\r\n if (process.env.NODE_ENV !== \"production\") {\r\n console.warn(`[motionscript] A speed ramp on a looping clip (${clip.src}) has no one source axis to run over; it plays at its start value.`);\r\n }\r\n speed = staticValue(speed, 1);\r\n }\r\n const sourceLength = Math.max(0, (Number.isFinite(trimEnd) ? trimEnd : mediaDuration) - trimStart);\r\n\r\n const request: AudioRequest = {\r\n id: `${ownerKey}|${clip.src}|${at}|${n}`,\r\n src: clip.src,\r\n startAt: at,\r\n endAt: Infinity,\r\n trimStart,\r\n volume: clip.volume ?? 1,\r\n speed,\r\n loop,\r\n ownerId: ownerKey,\r\n };\r\n if (isRamp(speed)) request.sourceLength = sourceLength;\r\n if (effects.length > 0) request.effects = effects;\r\n if (clip.transitionIn) request.transitionIn = clip.transitionIn;\r\n if (clip.transitionOut) request.transitionOut = clip.transitionOut;\r\n if (clip.bus) request.bus = clip.bus;\r\n if (clip.optional) request.optional = true;\r\n\r\n // A loop repeats the trimmed region, so a `trimEnd` bounds one pass and says\r\n // nothing about when the clip stops: only a cut (`until`) ends it, and with\r\n // none it runs open to the project end like any other bed.\r\n if (loop && trimEnd > trimStart && Number.isFinite(trimEnd)) request.trimEnd = trimEnd;\r\n\r\n if (loop && Number.isFinite(until)) {\r\n request.endAt = until;\r\n } else if (loop) {\r\n request.open = true;\r\n } else if (Number.isFinite(trimEnd)) {\r\n request.endAt = Math.min(until, at + clipTimeAtSource(speed, sourceLength));\r\n } else {\r\n const natural = clipTimeAtSource(speed, sourceLength);\r\n if (Number.isFinite(until)) {\r\n request.endAt = Math.min(until, at + natural);\r\n } else {\r\n request.open = true;\r\n request.mediaDuration = natural;\r\n }\r\n }\r\n return request;\r\n}\r\n"]}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { AudioEffect } from "../../attributes/audio/effects/union.js";
|
|
2
|
+
import { type AudioEffectsInput } from "../../attributes/audio/effects/chain.js";
|
|
3
|
+
import type { Param } from "../../attributes/audio/ramp.js";
|
|
3
4
|
interface SoundPropsBase {
|
|
4
5
|
src: string;
|
|
5
|
-
volume?:
|
|
6
|
+
volume?: Param;
|
|
7
|
+
/** Playback rate; a ramp runs over source seconds after `trimStart`. */
|
|
8
|
+
speed?: Param;
|
|
6
9
|
loop?: boolean;
|
|
7
|
-
/** Audio
|
|
8
|
-
|
|
10
|
+
/** Audio effects applied to the clip (gain, eq, tremolo, echo). */
|
|
11
|
+
effects?: AudioEffectsInput;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
11
14
|
* Author-facing sound props. Two mutually-exclusive ways to bound the clip:
|
|
@@ -29,11 +32,12 @@ export type SoundProps = (SoundPropsBase & {
|
|
|
29
32
|
/** Canonical, fully-resolved sound props. `trimEnd` is resolved against the catalog. */
|
|
30
33
|
export interface ResolvedSoundProps {
|
|
31
34
|
src: string;
|
|
32
|
-
volume?:
|
|
35
|
+
volume?: Param;
|
|
36
|
+
speed?: Param;
|
|
33
37
|
loop?: boolean;
|
|
34
38
|
trimStart?: number;
|
|
35
39
|
trimEnd?: number;
|
|
36
|
-
|
|
40
|
+
effects?: AudioEffect[];
|
|
37
41
|
}
|
|
38
42
|
/**
|
|
39
43
|
* A clip's resolved props, and how long it runs. What a node plays is declared
|
|
@@ -41,15 +45,14 @@ export interface ResolvedSoundProps {
|
|
|
41
45
|
*/
|
|
42
46
|
export declare class Sound {
|
|
43
47
|
readonly src: string;
|
|
44
|
-
volume:
|
|
48
|
+
volume: Param;
|
|
49
|
+
speed: Param;
|
|
45
50
|
loop: boolean;
|
|
46
51
|
trimStart: number;
|
|
47
52
|
trimEnd: number;
|
|
48
|
-
|
|
53
|
+
effects: AudioEffect[];
|
|
49
54
|
constructor(props: SoundProps);
|
|
50
|
-
/**
|
|
51
|
-
effectiveSpeed(): number;
|
|
52
|
-
/** See `schedule.clipDurationFor`. */
|
|
55
|
+
/** Clip seconds `trimmedSourceLength` source seconds take at this clip's speed. */
|
|
53
56
|
clipDurationFor(trimmedSourceLength: number): number;
|
|
54
57
|
/** @deprecated Renamed to {@link clipDurationFor}; kept until 1.0. */
|
|
55
58
|
sceneDurationFor(trimmedSourceLength: number): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/sound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/sound.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OA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;gBAEX,KAAK,EAAE,UAAU;IAW7B,mFAAmF;IACnF,eAAe,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM;IAIpD,sEAAsE;IACtE,gBAAgB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM;IAIrD,qFAAqF;IACrF,IAAI,YAAY,IAAI,MAAM,GAAG,SAAS,CAIrC;CACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { resolveAudioEffects } from "../../attributes/audio/effects/chain.js";
|
|
2
|
+
import { clipTimeAtSource } from "../../attributes/audio/schedule.js";
|
|
3
3
|
/**
|
|
4
4
|
* A clip's resolved props, and how long it runs. What a node plays is declared
|
|
5
5
|
* through `declareAudio`; this is only the arithmetic over one clip.
|
|
@@ -7,26 +7,24 @@ import * as schedule from "../../attributes/audio/schedule.js";
|
|
|
7
7
|
export class Sound {
|
|
8
8
|
src;
|
|
9
9
|
volume;
|
|
10
|
+
speed;
|
|
10
11
|
loop;
|
|
11
12
|
trimStart;
|
|
12
13
|
trimEnd;
|
|
13
|
-
|
|
14
|
+
effects;
|
|
14
15
|
constructor(props) {
|
|
15
16
|
this.src = props.src;
|
|
16
17
|
this.volume = props.volume ?? 1;
|
|
18
|
+
this.speed = props.speed ?? 1;
|
|
17
19
|
this.loop = props.loop ?? false;
|
|
18
20
|
// `duration` is sugar for `trimStart: 0, trimEnd: duration`.
|
|
19
21
|
this.trimStart = props.trimStart ?? 0;
|
|
20
22
|
this.trimEnd = props.trimEnd ?? props.duration ?? Infinity;
|
|
21
|
-
this.
|
|
23
|
+
this.effects = resolveAudioEffects(props.effects);
|
|
22
24
|
}
|
|
23
|
-
/**
|
|
24
|
-
effectiveSpeed() {
|
|
25
|
-
return schedule.effectiveSpeed(this.filters);
|
|
26
|
-
}
|
|
27
|
-
/** See `schedule.clipDurationFor`. */
|
|
25
|
+
/** Clip seconds `trimmedSourceLength` source seconds take at this clip's speed. */
|
|
28
26
|
clipDurationFor(trimmedSourceLength) {
|
|
29
|
-
return
|
|
27
|
+
return clipTimeAtSource(this.speed, trimmedSourceLength);
|
|
30
28
|
}
|
|
31
29
|
/** @deprecated Renamed to {@link clipDurationFor}; kept until 1.0. */
|
|
32
30
|
sceneDurationFor(trimmedSourceLength) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sound.js","sourceRoot":"","sources":["../../../src/attributes/audio/sound.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"sound.js","sourceRoot":"","sources":["../../../src/attributes/audio/sound.ts"],"names":[],"mappings":"AACA,OAAO,EAA0B,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE/F,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAqC/D;;;GAGG;AACH,MAAM,OAAO,KAAK;IACL,GAAG,CAAS;IACrB,MAAM,CAAQ;IACd,KAAK,CAAQ;IACb,IAAI,CAAU;IACd,SAAS,CAAS;IAClB,OAAO,CAAS;IAChB,OAAO,CAAgB;IAEvB,YAAY,KAAiB;QACzB,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC;QAChC,6DAA6D;QAC7D,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,QAAQ,IAAI,QAAQ,CAAC;QAC3D,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtD,CAAC;IAED,mFAAmF;IACnF,eAAe,CAAC,mBAA2B;QACvC,OAAO,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,mBAAmB,CAAC,CAAC;IAC7D,CAAC;IAED,sEAAsE;IACtE,gBAAgB,CAAC,mBAA2B;QACxC,OAAO,IAAI,CAAC,eAAe,CAAC,mBAAmB,CAAC,CAAC;IACrD,CAAC;IAED,qFAAqF;IACrF,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;YAC5B,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC;YACrD,CAAC,CAAC,SAAS,CAAC;IACpB,CAAC;CACJ","sourcesContent":["import type { AudioEffect } from \"@/attributes/audio/effects/union\";\r\nimport { type AudioEffectsInput, resolveAudioEffects } from \"@/attributes/audio/effects/chain\";\r\nimport type { Param } from \"@/attributes/audio/ramp\";\r\nimport { clipTimeAtSource } from \"@/attributes/audio/schedule\";\r\n\r\ninterface SoundPropsBase {\r\n src: string;\r\n volume?: Param;\r\n /** Playback rate; a ramp runs over source seconds after `trimStart`. */\r\n speed?: Param;\r\n loop?: boolean;\r\n /** Audio effects applied to the clip (gain, eq, tremolo, echo). */\r\n effects?: AudioEffectsInput;\r\n}\r\n\r\n/**\r\n * Author-facing sound props. Two mutually-exclusive ways to bound the clip:\r\n *\r\n * - `{ trimStart?, trimEnd? }` — explicit in/out points into the source file.\r\n * - `{ duration? }` — syntax sugar for a clip that runs `duration` seconds from\r\n * the start (equivalent to `trimStart: 0, trimEnd: duration`).\r\n *\r\n * When neither `trimEnd` nor `duration` is given, the clip runs to the source's\r\n * full length (resolved from the asset catalog). `trimStart` defaults to 0.\r\n */\r\nexport type SoundProps =\r\n | (SoundPropsBase & { trimStart?: number; trimEnd?: number; duration?: undefined })\r\n | (SoundPropsBase & { duration?: number; trimStart?: undefined; trimEnd?: undefined });\r\n\r\n/** Canonical, fully-resolved sound props. `trimEnd` is resolved against the catalog. */\r\nexport interface ResolvedSoundProps {\r\n src: string;\r\n volume?: Param;\r\n speed?: Param;\r\n loop?: boolean;\r\n trimStart?: number;\r\n trimEnd?: number;\r\n effects?: AudioEffect[];\r\n}\r\n\r\n/**\r\n * A clip's resolved props, and how long it runs. What a node plays is declared\r\n * through `declareAudio`; this is only the arithmetic over one clip.\r\n */\r\nexport class Sound {\r\n readonly src: string;\r\n volume: Param;\r\n speed: Param;\r\n loop: boolean;\r\n trimStart: number;\r\n trimEnd: number;\r\n effects: AudioEffect[];\r\n\r\n constructor(props: SoundProps) {\r\n this.src = props.src;\r\n this.volume = props.volume ?? 1;\r\n this.speed = props.speed ?? 1;\r\n this.loop = props.loop ?? false;\r\n // `duration` is sugar for `trimStart: 0, trimEnd: duration`.\r\n this.trimStart = props.trimStart ?? 0;\r\n this.trimEnd = props.trimEnd ?? props.duration ?? Infinity;\r\n this.effects = resolveAudioEffects(props.effects);\r\n }\r\n\r\n /** Clip seconds `trimmedSourceLength` source seconds take at this clip's speed. */\r\n clipDurationFor(trimmedSourceLength: number): number {\r\n return clipTimeAtSource(this.speed, trimmedSourceLength);\r\n }\r\n\r\n /** @deprecated Renamed to {@link clipDurationFor}; kept until 1.0. */\r\n sceneDurationFor(trimmedSourceLength: number): number {\r\n return this.clipDurationFor(trimmedSourceLength);\r\n }\r\n\r\n /** Clip seconds, speed profile applied; `undefined` when nothing bounds the clip. */\r\n get clipDuration(): number | undefined {\r\n return this.trimEnd !== Infinity\r\n ? this.clipDurationFor(this.trimEnd - this.trimStart)\r\n : undefined;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type EaseSpec } from "../../tween/ease/spec.js";
|
|
2
|
+
/**
|
|
3
|
+
* What happens as a clip enters (`transitionIn`) or leaves (`transitionOut`):
|
|
4
|
+
* today, a fade over its first or last `duration` clip seconds.
|
|
5
|
+
*
|
|
6
|
+
* A cross-fade is two clips that overlap, the first carrying a `transitionOut`
|
|
7
|
+
* and the second a `transitionIn` as long as the overlap; equal-power shapes
|
|
8
|
+
* are complementary, so the pair needs no link between them.
|
|
9
|
+
*/
|
|
10
|
+
export interface AudioTransition {
|
|
11
|
+
readonly duration: number;
|
|
12
|
+
/**
|
|
13
|
+
* Progress through the transition (x, 0→1) to how far it has come (y, the
|
|
14
|
+
* gain for a fade), read as entering; a `transitionOut` plays it backwards.
|
|
15
|
+
* Default `"equalPower"`, sin(πx/2).
|
|
16
|
+
*/
|
|
17
|
+
readonly curve?: "equalPower" | EaseSpec;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The two transitions' durations on a clip `length` seconds long: shrunk in
|
|
21
|
+
* proportion when together they would overrun it.
|
|
22
|
+
*/
|
|
23
|
+
export declare function transitionSpans(length: number, transitionIn?: AudioTransition, transitionOut?: AudioTransition): {
|
|
24
|
+
readonly in: number;
|
|
25
|
+
readonly out: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The gain the transitions put on a clip at `t` of its `length` seconds: 1
|
|
29
|
+
* outside both. An open clip (`length` not finite) has no end to leave from.
|
|
30
|
+
*/
|
|
31
|
+
export declare function transitionGainAt(t: number, length: number, transitionIn?: AudioTransition, transitionOut?: AudioTransition): number;
|
|
32
|
+
export declare function transitionKey(transition: AudioTransition | undefined): string;
|
|
33
|
+
//# sourceMappingURL=transition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/attributes/audio/transition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG9D;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAC;CAC5C;AAaD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,eAAe,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAU9J;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,eAAe,EAAE,aAAa,CAAC,EAAE,eAAe,GAAG,MAAM,CAMnI;AAED,wBAAgB,aAAa,CAAC,UAAU,EAAE,eAAe,GAAG,SAAS,GAAG,MAAM,CAG7E"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { easeOfSpec } from "../../tween/ease/spec.js";
|
|
2
|
+
const EQUAL_POWER = (x) => Math.sin((Math.max(0, Math.min(1, x)) * Math.PI) / 2);
|
|
3
|
+
const shapes = new WeakMap();
|
|
4
|
+
function shapeOf(transition) {
|
|
5
|
+
const curve = transition.curve;
|
|
6
|
+
if (curve === undefined || curve === "equalPower")
|
|
7
|
+
return EQUAL_POWER;
|
|
8
|
+
let shape = shapes.get(curve);
|
|
9
|
+
if (!shape)
|
|
10
|
+
shapes.set(curve, (shape = easeOfSpec(curve)));
|
|
11
|
+
return shape;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The two transitions' durations on a clip `length` seconds long: shrunk in
|
|
15
|
+
* proportion when together they would overrun it.
|
|
16
|
+
*/
|
|
17
|
+
export function transitionSpans(length, transitionIn, transitionOut) {
|
|
18
|
+
const wanted = { in: Math.max(0, transitionIn?.duration ?? 0), out: Math.max(0, transitionOut?.duration ?? 0) };
|
|
19
|
+
if (!Number.isFinite(length))
|
|
20
|
+
return { in: wanted.in, out: 0 };
|
|
21
|
+
const total = wanted.in + wanted.out;
|
|
22
|
+
if (total <= length || total === 0)
|
|
23
|
+
return wanted;
|
|
24
|
+
if (process.env.NODE_ENV !== "production") {
|
|
25
|
+
console.warn(`[motionscript] Transitions of ${total.toFixed(3)}s overrun a ${length.toFixed(3)}s clip; both are shortened to fit.`);
|
|
26
|
+
}
|
|
27
|
+
const scale = Math.max(0, length) / total;
|
|
28
|
+
return { in: wanted.in * scale, out: wanted.out * scale };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The gain the transitions put on a clip at `t` of its `length` seconds: 1
|
|
32
|
+
* outside both. An open clip (`length` not finite) has no end to leave from.
|
|
33
|
+
*/
|
|
34
|
+
export function transitionGainAt(t, length, transitionIn, transitionOut) {
|
|
35
|
+
const spans = transitionSpans(length, transitionIn, transitionOut);
|
|
36
|
+
let gain = 1;
|
|
37
|
+
if (transitionIn && spans.in > 0 && t < spans.in)
|
|
38
|
+
gain *= Math.max(0, shapeOf(transitionIn)(Math.max(0, t) / spans.in));
|
|
39
|
+
if (transitionOut && spans.out > 0 && t > length - spans.out)
|
|
40
|
+
gain *= Math.max(0, shapeOf(transitionOut)(Math.max(0, length - t) / spans.out));
|
|
41
|
+
return gain;
|
|
42
|
+
}
|
|
43
|
+
export function transitionKey(transition) {
|
|
44
|
+
if (!transition)
|
|
45
|
+
return "_";
|
|
46
|
+
return `${transition.duration}:${typeof transition.curve === "object" ? JSON.stringify(transition.curve) : transition.curve ?? "equalPower"}`;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=transition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transition.js","sourceRoot":"","sources":["../../../src/attributes/audio/transition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAiB,MAAM,mBAAmB,CAAC;AAqB9D,MAAM,WAAW,GAAmB,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AACjG,MAAM,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AC,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,IAAI,YAAY,EAAE,CAAC;AAClJ,CAAC","sourcesContent":["import { easeOfSpec, type EaseSpec } from \"@/tween/ease/spec\";\r\nimport type { EasingFunction } from \"@/tween/ease/type\";\r\n\r\n/**\r\n * What happens as a clip enters (`transitionIn`) or leaves (`transitionOut`):\r\n * today, a fade over its first or last `duration` clip seconds.\r\n *\r\n * A cross-fade is two clips that overlap, the first carrying a `transitionOut`\r\n * and the second a `transitionIn` as long as the overlap; equal-power shapes\r\n * are complementary, so the pair needs no link between them.\r\n */\r\nexport interface AudioTransition {\r\n readonly duration: number;\r\n /**\r\n * Progress through the transition (x, 0→1) to how far it has come (y, the\r\n * gain for a fade), read as entering; a `transitionOut` plays it backwards.\r\n * Default `\"equalPower\"`, sin(πx/2).\r\n */\r\n readonly curve?: \"equalPower\" | EaseSpec;\r\n}\r\n\r\nconst EQUAL_POWER: EasingFunction = (x) => Math.sin((Math.max(0, Math.min(1, x)) * Math.PI) / 2);\r\nconst shapes = new WeakMap<EaseSpec, EasingFunction>();\r\n\r\nfunction shapeOf(transition: AudioTransition): EasingFunction {\r\n const curve = transition.curve;\r\n if (curve === undefined || curve === \"equalPower\") return EQUAL_POWER;\r\n let shape = shapes.get(curve);\r\n if (!shape) shapes.set(curve, (shape = easeOfSpec(curve)));\r\n return shape;\r\n}\r\n\r\n/**\r\n * The two transitions' durations on a clip `length` seconds long: shrunk in\r\n * proportion when together they would overrun it.\r\n */\r\nexport function transitionSpans(length: number, transitionIn?: AudioTransition, transitionOut?: AudioTransition): { readonly in: number; readonly out: number } {\r\n const wanted = { in: Math.max(0, transitionIn?.duration ?? 0), out: Math.max(0, transitionOut?.duration ?? 0) };\r\n if (!Number.isFinite(length)) return { in: wanted.in, out: 0 };\r\n const total = wanted.in + wanted.out;\r\n if (total <= length || total === 0) return wanted;\r\n if (process.env.NODE_ENV !== \"production\") {\r\n console.warn(`[motionscript] Transitions of ${total.toFixed(3)}s overrun a ${length.toFixed(3)}s clip; both are shortened to fit.`);\r\n }\r\n const scale = Math.max(0, length) / total;\r\n return { in: wanted.in * scale, out: wanted.out * scale };\r\n}\r\n\r\n/**\r\n * The gain the transitions put on a clip at `t` of its `length` seconds: 1\r\n * outside both. An open clip (`length` not finite) has no end to leave from.\r\n */\r\nexport function transitionGainAt(t: number, length: number, transitionIn?: AudioTransition, transitionOut?: AudioTransition): number {\r\n const spans = transitionSpans(length, transitionIn, transitionOut);\r\n let gain = 1;\r\n if (transitionIn && spans.in > 0 && t < spans.in) gain *= Math.max(0, shapeOf(transitionIn)(Math.max(0, t) / spans.in));\r\n if (transitionOut && spans.out > 0 && t > length - spans.out) gain *= Math.max(0, shapeOf(transitionOut)(Math.max(0, length - t) / spans.out));\r\n return gain;\r\n}\r\n\r\nexport function transitionKey(transition: AudioTransition | undefined): string {\r\n if (!transition) return \"_\";\r\n return `${transition.duration}:${typeof transition.curve === \"object\" ? JSON.stringify(transition.curve) : transition.curve ?? \"equalPower\"}`;\r\n}\r\n"]}
|