@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.
Files changed (498) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/NOTICE +15 -14
  3. package/README.md +4 -4
  4. package/dist/assets/manager.d.ts.map +1 -1
  5. package/dist/assets/manager.js +7 -5
  6. package/dist/assets/manager.js.map +1 -1
  7. package/dist/attributes/audio/effects/chain.d.ts +73 -0
  8. package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
  9. package/dist/attributes/audio/effects/chain.js +67 -0
  10. package/dist/attributes/audio/effects/chain.js.map +1 -0
  11. package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
  12. package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
  13. package/dist/attributes/audio/effects/implementations/echo.js +11 -0
  14. package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
  15. package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
  16. package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
  17. package/dist/attributes/audio/effects/implementations/gain.js +6 -0
  18. package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
  19. package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
  20. package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
  21. package/dist/attributes/audio/effects/implementations/highpass.js +10 -0
  22. package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
  23. package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
  24. package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
  25. package/dist/attributes/audio/effects/implementations/lowpass.js +10 -0
  26. package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
  27. package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
  28. package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
  29. package/dist/attributes/audio/effects/implementations/tremolo.js +10 -0
  30. package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
  31. package/dist/attributes/audio/effects/index.d.ts +12 -0
  32. package/dist/attributes/audio/effects/index.d.ts.map +1 -0
  33. package/dist/attributes/audio/effects/index.js +4 -0
  34. package/dist/attributes/audio/effects/index.js.map +1 -0
  35. package/dist/attributes/audio/effects/registry.d.ts +36 -0
  36. package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
  37. package/dist/attributes/audio/effects/registry.js +80 -0
  38. package/dist/attributes/audio/effects/registry.js.map +1 -0
  39. package/dist/attributes/audio/effects/union.d.ts +14 -0
  40. package/dist/attributes/audio/effects/union.d.ts.map +1 -0
  41. package/dist/attributes/audio/effects/union.js +24 -0
  42. package/dist/attributes/audio/effects/union.js.map +1 -0
  43. package/dist/attributes/audio/ramp.d.ts +103 -0
  44. package/dist/attributes/audio/ramp.d.ts.map +1 -0
  45. package/dist/attributes/audio/ramp.js +246 -0
  46. package/dist/attributes/audio/ramp.js.map +1 -0
  47. package/dist/attributes/audio/request.d.ts +24 -13
  48. package/dist/attributes/audio/request.d.ts.map +1 -1
  49. package/dist/attributes/audio/request.js +4 -3
  50. package/dist/attributes/audio/request.js.map +1 -1
  51. package/dist/attributes/audio/schedule.d.ts +21 -13
  52. package/dist/attributes/audio/schedule.d.ts.map +1 -1
  53. package/dist/attributes/audio/schedule.js +42 -28
  54. package/dist/attributes/audio/schedule.js.map +1 -1
  55. package/dist/attributes/audio/sound.d.ts +15 -12
  56. package/dist/attributes/audio/sound.d.ts.map +1 -1
  57. package/dist/attributes/audio/sound.js +8 -10
  58. package/dist/attributes/audio/sound.js.map +1 -1
  59. package/dist/attributes/audio/transition.d.ts +33 -0
  60. package/dist/attributes/audio/transition.d.ts.map +1 -0
  61. package/dist/attributes/audio/transition.js +48 -0
  62. package/dist/attributes/audio/transition.js.map +1 -0
  63. package/dist/attributes/index.d.ts +4 -3
  64. package/dist/attributes/index.d.ts.map +1 -1
  65. package/dist/attributes/index.js +4 -7
  66. package/dist/attributes/index.js.map +1 -1
  67. package/dist/attributes/layout/matrix2d.d.ts +2 -2
  68. package/dist/attributes/layout/matrix2d.js.map +1 -1
  69. package/dist/attributes/layout/space3d.js +1 -1
  70. package/dist/attributes/layout/space3d.js.map +1 -1
  71. package/dist/attributes/properties/typed.d.ts +7 -7
  72. package/dist/attributes/properties/typed.d.ts.map +1 -1
  73. package/dist/attributes/properties/typed.js +6 -6
  74. package/dist/attributes/properties/typed.js.map +1 -1
  75. package/dist/attributes/shape/corners/corner-radius.d.ts +1 -2
  76. package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
  77. package/dist/attributes/shape/corners/corner-radius.js +1 -2
  78. package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
  79. package/dist/attributes/shape/effects/chain.d.ts +96 -409
  80. package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
  81. package/dist/attributes/shape/effects/chain.js +93 -283
  82. package/dist/attributes/shape/effects/chain.js.map +1 -1
  83. package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
  84. package/dist/attributes/shape/effects/effect-data.js.map +1 -1
  85. package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
  86. package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
  87. package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
  88. package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
  89. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
  90. package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
  91. package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
  92. package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
  93. package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
  94. package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
  95. package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
  96. package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
  97. package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
  98. package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
  99. package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
  100. package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
  101. package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
  102. package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
  103. package/dist/attributes/shape/effects/implementations/blur.js +13 -5
  104. package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
  105. package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
  106. package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
  107. package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
  108. package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
  109. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
  110. package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
  111. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
  112. package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
  113. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
  114. package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
  115. package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
  116. package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
  117. package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
  118. package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
  119. package/dist/attributes/shape/effects/implementations/curves.js +26 -23
  120. package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
  121. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
  122. package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
  123. package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
  124. package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
  125. package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
  126. package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
  127. package/dist/attributes/shape/effects/implementations/dither.js +26 -20
  128. package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
  129. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +46 -14
  130. package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
  131. package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
  132. package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
  133. package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
  134. package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
  135. package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
  136. package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
  137. package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
  138. package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
  139. package/dist/attributes/shape/effects/implementations/edges.js +17 -14
  140. package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
  141. package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
  142. package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
  143. package/dist/attributes/shape/effects/implementations/glass.js +28 -22
  144. package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
  145. package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
  146. package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
  147. package/dist/attributes/shape/effects/implementations/glow.js +74 -72
  148. package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
  149. package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
  150. package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
  151. package/dist/attributes/shape/effects/implementations/grain.js +21 -18
  152. package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
  153. package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
  154. package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
  155. package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
  156. package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
  157. package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
  158. package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
  159. package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
  160. package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
  161. package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
  162. package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
  163. package/dist/attributes/shape/effects/implementations/invert.js +15 -10
  164. package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
  165. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
  166. package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
  167. package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
  168. package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
  169. package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
  170. package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
  171. package/dist/attributes/shape/effects/implementations/lut.js +20 -16
  172. package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
  173. package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
  174. package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
  175. package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
  176. package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
  177. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
  178. package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
  179. package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
  180. package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
  181. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
  182. package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
  183. package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
  184. package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
  185. package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
  186. package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
  187. package/dist/attributes/shape/effects/implementations/outline.js +18 -17
  188. package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
  189. package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
  190. package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
  191. package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
  192. package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
  193. package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
  194. package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
  195. package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
  196. package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
  197. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
  198. package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
  199. package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
  200. package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
  201. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
  202. package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
  203. package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
  204. package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
  205. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
  206. package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
  207. package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
  208. package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
  209. package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
  210. package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
  211. package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
  212. package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
  213. package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
  214. package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
  215. package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
  216. package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
  217. package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
  218. package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
  219. package/dist/attributes/shape/effects/implementations/shader.js +42 -26
  220. package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
  221. package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
  222. package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
  223. package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
  224. package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
  225. package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
  226. package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
  227. package/dist/attributes/shape/effects/implementations/streak.js +19 -16
  228. package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
  229. package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
  230. package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
  231. package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
  232. package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
  233. package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
  234. package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
  235. package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
  236. package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
  237. package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
  238. package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
  239. package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
  240. package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
  241. package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
  242. package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
  243. package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
  244. package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
  245. package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
  246. package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
  247. package/dist/attributes/shape/effects/implementations/wave.js +26 -23
  248. package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
  249. package/dist/attributes/shape/effects/index.d.ts +4 -2
  250. package/dist/attributes/shape/effects/index.d.ts.map +1 -1
  251. package/dist/attributes/shape/effects/index.js +1 -1
  252. package/dist/attributes/shape/effects/index.js.map +1 -1
  253. package/dist/attributes/shape/effects/registry.d.ts +11 -0
  254. package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
  255. package/dist/attributes/shape/effects/registry.js +113 -102
  256. package/dist/attributes/shape/effects/registry.js.map +1 -1
  257. package/dist/attributes/shape/effects/spec.d.ts +229 -0
  258. package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
  259. package/dist/attributes/shape/effects/spec.js +178 -0
  260. package/dist/attributes/shape/effects/spec.js.map +1 -0
  261. package/dist/attributes/shape/fill/chain.d.ts +7 -9
  262. package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
  263. package/dist/attributes/shape/fill/chain.js +9 -11
  264. package/dist/attributes/shape/fill/chain.js.map +1 -1
  265. package/dist/attributes/shape/fill/implementations/shader.d.ts +27 -26
  266. package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
  267. package/dist/attributes/shape/fill/implementations/shader.js +20 -14
  268. package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
  269. package/dist/attributes/shape/fill/index.d.ts +1 -1
  270. package/dist/attributes/shape/fill/index.d.ts.map +1 -1
  271. package/dist/attributes/shape/fill/index.js.map +1 -1
  272. package/dist/attributes/shape/fill/registry.d.ts +1 -2
  273. package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
  274. package/dist/attributes/shape/fill/registry.js +1 -2
  275. package/dist/attributes/shape/fill/registry.js.map +1 -1
  276. package/dist/attributes/shape/filters/chain.d.ts +2 -6
  277. package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
  278. package/dist/attributes/shape/filters/chain.js +1 -5
  279. package/dist/attributes/shape/filters/chain.js.map +1 -1
  280. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
  281. package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
  282. package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
  283. package/dist/attributes/shape/filters/registry.d.ts +1 -1
  284. package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
  285. package/dist/attributes/shape/filters/registry.js +3 -3
  286. package/dist/attributes/shape/filters/registry.js.map +1 -1
  287. package/dist/attributes/shape/filters/union.d.ts +2 -3
  288. package/dist/attributes/shape/filters/union.d.ts.map +1 -1
  289. package/dist/attributes/shape/filters/union.js.map +1 -1
  290. package/dist/attributes/shape/shaders/index.d.ts +2 -0
  291. package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
  292. package/dist/attributes/shape/shaders/index.js +2 -0
  293. package/dist/attributes/shape/shaders/index.js.map +1 -1
  294. package/dist/attributes/shape/shaders/language.d.ts +26 -0
  295. package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
  296. package/dist/attributes/shape/shaders/language.js +20 -0
  297. package/dist/attributes/shape/shaders/language.js.map +1 -0
  298. package/dist/attributes/shape/shaders/pack.d.ts +25 -11
  299. package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
  300. package/dist/attributes/shape/shaders/pack.js +9 -4
  301. package/dist/attributes/shape/shaders/pack.js.map +1 -1
  302. package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
  303. package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
  304. package/dist/attributes/shape/shaders/resolve.js +3 -6
  305. package/dist/attributes/shape/shaders/resolve.js.map +1 -1
  306. package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
  307. package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
  308. package/dist/attributes/shape/shaders/uniforms.js +0 -0
  309. package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
  310. package/dist/browser/chunks/chunk-AOT33LMS.js +13 -0
  311. package/dist/browser/chunks/chunk-AOT33LMS.js.map +7 -0
  312. package/dist/browser/chunks/chunk-GKM6UZJR.js +6 -0
  313. package/dist/browser/chunks/chunk-GKM6UZJR.js.map +7 -0
  314. package/dist/browser/experimental.js +1 -1
  315. package/dist/browser/experimental.js.map +4 -4
  316. package/dist/browser/index.js +1 -1
  317. package/dist/browser/index.js.map +2 -2
  318. package/dist/browser/manifest.json +1 -1
  319. package/dist/browser/sdk.js +1 -1
  320. package/dist/components/builtins/audio/audio.d.ts +14 -5
  321. package/dist/components/builtins/audio/audio.d.ts.map +1 -1
  322. package/dist/components/builtins/audio/audio.js +10 -13
  323. package/dist/components/builtins/audio/audio.js.map +1 -1
  324. package/dist/components/builtins/geometry/composite.d.ts +3 -3
  325. package/dist/components/builtins/media/media.d.ts +7 -7
  326. package/dist/components/builtins/media/media.d.ts.map +1 -1
  327. package/dist/components/builtins/media/media.js +4 -10
  328. package/dist/components/builtins/media/media.js.map +1 -1
  329. package/dist/components/builtins/text/text.d.ts +12 -12
  330. package/dist/components/builtins/text/text.d.ts.map +1 -1
  331. package/dist/components/builtins/text/text.js +3 -0
  332. package/dist/components/builtins/text/text.js.map +1 -1
  333. package/dist/components/factory/api.d.ts +38 -11
  334. package/dist/components/factory/api.d.ts.map +1 -1
  335. package/dist/components/factory/api.js.map +1 -1
  336. package/dist/components/factory/component3d.d.ts.map +1 -1
  337. package/dist/components/factory/component3d.js +11 -3
  338. package/dist/components/factory/component3d.js.map +1 -1
  339. package/dist/components/factory/factory.d.ts +3 -0
  340. package/dist/components/factory/factory.d.ts.map +1 -1
  341. package/dist/components/factory/factory.js +39 -5
  342. package/dist/components/factory/factory.js.map +1 -1
  343. package/dist/components/modules/text-style.d.ts +1 -1
  344. package/dist/components/trees/2d/node-render.d.ts +1 -1
  345. package/dist/components/trees/2d/node-render.js +1 -1
  346. package/dist/components/trees/2d/node-render.js.map +1 -1
  347. package/dist/components/trees/2d/node2d.d.ts +1 -1
  348. package/dist/components/trees/2d/node2d.js +1 -1
  349. package/dist/components/trees/2d/node2d.js.map +1 -1
  350. package/dist/components/trees/audio/node-audio.d.ts +16 -9
  351. package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
  352. package/dist/components/trees/audio/node-audio.js +15 -11
  353. package/dist/components/trees/audio/node-audio.js.map +1 -1
  354. package/dist/document/command-traits.d.ts +12 -2
  355. package/dist/document/command-traits.d.ts.map +1 -1
  356. package/dist/document/command-traits.js +34 -6
  357. package/dist/document/command-traits.js.map +1 -1
  358. package/dist/document/index.d.ts +8 -0
  359. package/dist/document/index.d.ts.map +1 -1
  360. package/dist/document/index.js +4 -0
  361. package/dist/document/index.js.map +1 -1
  362. package/dist/document/migrate.d.ts +70 -0
  363. package/dist/document/migrate.d.ts.map +1 -0
  364. package/dist/document/migrate.js +202 -0
  365. package/dist/document/migrate.js.map +1 -0
  366. package/dist/document/missing-node.d.ts +27 -0
  367. package/dist/document/missing-node.d.ts.map +1 -0
  368. package/dist/document/missing-node.js +48 -0
  369. package/dist/document/missing-node.js.map +1 -0
  370. package/dist/document/node-descriptor.d.ts +4 -0
  371. package/dist/document/node-descriptor.d.ts.map +1 -1
  372. package/dist/document/node-descriptor.js.map +1 -1
  373. package/dist/document/placement.d.ts +2 -1
  374. package/dist/document/placement.d.ts.map +1 -1
  375. package/dist/document/placement.js.map +1 -1
  376. package/dist/document/project.d.ts +2 -0
  377. package/dist/document/project.d.ts.map +1 -1
  378. package/dist/document/project.js +1 -0
  379. package/dist/document/project.js.map +1 -1
  380. package/dist/document/prop-evolution.d.ts +51 -0
  381. package/dist/document/prop-evolution.d.ts.map +1 -0
  382. package/dist/document/prop-evolution.js +83 -0
  383. package/dist/document/prop-evolution.js.map +1 -0
  384. package/dist/document/registry.d.ts +16 -0
  385. package/dist/document/registry.d.ts.map +1 -1
  386. package/dist/document/registry.js +30 -4
  387. package/dist/document/registry.js.map +1 -1
  388. package/dist/document/settled-index.d.ts +2 -0
  389. package/dist/document/settled-index.d.ts.map +1 -1
  390. package/dist/document/settled-index.js +5 -5
  391. package/dist/document/settled-index.js.map +1 -1
  392. package/dist/document/timeline-patch.d.ts +4 -0
  393. package/dist/document/timeline-patch.d.ts.map +1 -1
  394. package/dist/document/timeline-patch.js +28 -3
  395. package/dist/document/timeline-patch.js.map +1 -1
  396. package/dist/document/timeline.d.ts +45 -1
  397. package/dist/document/timeline.d.ts.map +1 -1
  398. package/dist/document/timeline.js +172 -42
  399. package/dist/document/timeline.js.map +1 -1
  400. package/dist/document/types.d.ts +14 -28
  401. package/dist/document/types.d.ts.map +1 -1
  402. package/dist/document/types.js.map +1 -1
  403. package/dist/document/validate.d.ts +17 -5
  404. package/dist/document/validate.d.ts.map +1 -1
  405. package/dist/document/validate.js +158 -21
  406. package/dist/document/validate.js.map +1 -1
  407. package/dist/document/vocabulary.d.ts +28 -0
  408. package/dist/document/vocabulary.d.ts.map +1 -0
  409. package/dist/document/vocabulary.js +42 -0
  410. package/dist/document/vocabulary.js.map +1 -0
  411. package/dist/experimental.d.ts +68 -8
  412. package/dist/experimental.d.ts.map +1 -1
  413. package/dist/experimental.js +22 -8
  414. package/dist/experimental.js.map +1 -1
  415. package/dist/platform/exporter.d.ts +13 -0
  416. package/dist/platform/exporter.d.ts.map +1 -1
  417. package/dist/platform/exporter.js.map +1 -1
  418. package/dist/renamed-scene-names.d.ts +1 -1
  419. package/dist/renamed-scene-names.d.ts.map +1 -1
  420. package/dist/renamed-scene-names.js +1 -1
  421. package/dist/renamed-scene-names.js.map +1 -1
  422. package/dist/render/canvas-render-context2d.d.ts +9 -0
  423. package/dist/render/canvas-render-context2d.d.ts.map +1 -1
  424. package/dist/render/canvas-render-context2d.js +10 -0
  425. package/dist/render/canvas-render-context2d.js.map +1 -1
  426. package/dist/render/clip-contains.js +1 -1
  427. package/dist/render/clip-contains.js.map +1 -1
  428. package/dist/render/descriptors/text.d.ts +2 -2
  429. package/dist/render/descriptors/text.js +2 -2
  430. package/dist/render/descriptors/text.js.map +1 -1
  431. package/dist/render/index.d.ts +2 -0
  432. package/dist/render/index.d.ts.map +1 -1
  433. package/dist/render/index.js +1 -0
  434. package/dist/render/index.js.map +1 -1
  435. package/dist/render/render-context2d.d.ts +1 -1
  436. package/dist/render/render-context2d.js.map +1 -1
  437. package/dist/render/render-issue.d.ts +39 -0
  438. package/dist/render/render-issue.d.ts.map +1 -0
  439. package/dist/render/render-issue.js +29 -0
  440. package/dist/render/render-issue.js.map +1 -0
  441. package/dist/render/surface.d.ts +2 -2
  442. package/dist/render/surface.js.map +1 -1
  443. package/dist/render3d/graphics3d.d.ts.map +1 -1
  444. package/dist/render3d/graphics3d.js +54 -5
  445. package/dist/render3d/graphics3d.js.map +1 -1
  446. package/dist/runtime/asset-refine.js +2 -1
  447. package/dist/runtime/asset-refine.js.map +1 -1
  448. package/dist/runtime/asset-timeline.d.ts +10 -0
  449. package/dist/runtime/asset-timeline.d.ts.map +1 -1
  450. package/dist/runtime/asset-timeline.js.map +1 -1
  451. package/dist/runtime/asset-update.d.ts.map +1 -1
  452. package/dist/runtime/asset-update.js +7 -0
  453. package/dist/runtime/asset-update.js.map +1 -1
  454. package/dist/runtime/clip-instance.d.ts +3 -1
  455. package/dist/runtime/clip-instance.d.ts.map +1 -1
  456. package/dist/runtime/clip-instance.js +4 -0
  457. package/dist/runtime/clip-instance.js.map +1 -1
  458. package/dist/runtime/clip-store.d.ts.map +1 -1
  459. package/dist/runtime/clip-store.js +17 -2
  460. package/dist/runtime/clip-store.js.map +1 -1
  461. package/dist/runtime/engine.d.ts +5 -3
  462. package/dist/runtime/engine.d.ts.map +1 -1
  463. package/dist/runtime/engine.js +2 -1
  464. package/dist/runtime/engine.js.map +1 -1
  465. package/dist/runtime/playback-controller.d.ts.map +1 -1
  466. package/dist/runtime/playback-controller.js +14 -4
  467. package/dist/runtime/playback-controller.js.map +1 -1
  468. package/dist/runtime/session.d.ts +7 -3
  469. package/dist/runtime/session.d.ts.map +1 -1
  470. package/dist/runtime/session.js +11 -4
  471. package/dist/runtime/session.js.map +1 -1
  472. package/dist/runtime/text-geometry.d.ts +1 -1
  473. package/dist/runtime/text-geometry.js.map +1 -1
  474. package/dist/sdk/index.d.ts +8 -6
  475. package/dist/sdk/index.d.ts.map +1 -1
  476. package/dist/sdk/index.js +10 -3
  477. package/dist/sdk/index.js.map +1 -1
  478. package/dist/tween/command-decorator.d.ts +7 -0
  479. package/dist/tween/command-decorator.d.ts.map +1 -1
  480. package/dist/tween/command-decorator.js +1 -0
  481. package/dist/tween/command-decorator.js.map +1 -1
  482. package/dist/tween/ease/describe.d.ts +2 -0
  483. package/dist/tween/ease/describe.d.ts.map +1 -1
  484. package/dist/tween/ease/describe.js +4 -0
  485. package/dist/tween/ease/describe.js.map +1 -1
  486. package/dist/tween/ease/spec.d.ts +31 -0
  487. package/dist/tween/ease/spec.d.ts.map +1 -0
  488. package/dist/tween/ease/spec.js +51 -0
  489. package/dist/tween/ease/spec.js.map +1 -0
  490. package/dist/tween/index.d.ts +1 -0
  491. package/dist/tween/index.d.ts.map +1 -1
  492. package/dist/tween/index.js +1 -0
  493. package/dist/tween/index.js.map +1 -1
  494. package/package.json +2 -2
  495. package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
  496. package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
  497. package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
  498. package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @motionscript/core
2
2
 
3
+ ## 0.1.0-alpha.8
4
+
5
+ ### Minor Changes
6
+
7
+ - ba03011: WebGPU renderer replaces Skia, @motionscript/renderer is new, skia-render/canvaskit are gone, and it’s breaking
8
+
3
9
  ## 0.1.0-alpha.7
4
10
 
5
11
  ### Minor Changes
package/NOTICE CHANGED
@@ -4,24 +4,25 @@ Copyright 2026 Motionscript LLC
4
4
  This product includes the third-party code below, each part under the MIT
5
5
  License reproduced at the end of this file.
6
6
 
7
- - packages/skia-render/src/fills/fractal-noise.ts: `hash2` is "Hash without
8
- Sine" by David Hoskins (https://www.shadertoy.com/view/4djSRW).
7
+ - packages/renderer/crates/renderer/src/shaders/prim.wgsl (`fn_hash2`):
8
+ "Hash without Sine" by David Hoskins (https://www.shadertoy.com/view/4djSRW).
9
9
  Copyright (c) 2014 David Hoskins.
10
10
 
11
- - packages/skia-render/src/fills/fractal-noise.ts: `simplexNoise` follows
12
- "Noise - simplex - 2D" by Inigo Quilez (https://www.shadertoy.com/view/Msf3WH).
13
- Copyright (c) 2013 Inigo Quilez.
11
+ - packages/renderer/crates/renderer/src/shaders/prim.wgsl (`simplex_noise`): "Noise - simplex - 2D" by Inigo Quilez
12
+ (https://www.shadertoy.com/view/Msf3WH). Copyright (c) 2013 Inigo Quilez.
14
13
 
15
- The project website, which is in the source repository only and in no npm
16
- package, also includes MIT code: its landing-page background
17
- (packages/site/components/landing/GradientBackground.tsx) uses 3D simplex
18
- noise from webgl-noise by Ian McEwan, Ashima Arts
19
- (https://github.com/ashima/webgl-noise). Copyright (C) 2011 by Ashima Arts.
14
+ - packages/renderer/crates/render3d (in @motionscript/renderer's WebAssembly):
15
+ its shaders (src/shaders/mesh.wgsl) port three.js r185's mesh programs and
16
+ src/geometry.rs its primitive generators (https://threejs.org).
17
+ Copyright (c) 2010-2026 three.js authors.
20
18
 
21
- @motionscript/canvaskit is a build of Skia's CanvasKit (BSD-3-Clause,
22
- Copyright (c) 2011 Google Inc.) and carries FreeType, HarfBuzz, ICU, zlib,
23
- libpng, Brotli, WOFF2, Emscripten and musl; their notices are in
24
- packages/canvaskit/THIRD_PARTY_NOTICES.txt.
19
+ @motionscript/renderer's WebAssembly (dist/ms_renderer_bg.wasm) compiles in
20
+ Rust crates under MIT, Apache-2.0, Zlib and Unicode-3.0 terms (wgpu, naga,
21
+ harfrust, read-fonts, kurbo, wasm-bindgen and others); their notices are in
22
+ packages/renderer/THIRD_PARTY_NOTICES.txt.
23
+
24
+ MP3 export loads @mediabunny/mp3-encoder (MPL-2.0), a WebAssembly build of
25
+ the LAME MP3 encoder (LGPL, https://lame.sourceforge.io), on first use.
25
26
 
26
27
  The browser builds under dist/browser/ bundle each package's npm dependencies;
27
28
  dist/browser/THIRD_PARTY_LICENSES.txt in each package lists them with their
package/README.md CHANGED
@@ -37,19 +37,19 @@ function of its time, so a seek costs the same in either direction.
37
37
  play, seek and export it.
38
38
  - **Nodes**: the scene graph (`Rect`, `Ellipse`, `Text`, `RichText`, `Video`,
39
39
  paths, 3D, audio, and more) with attributes for fills, gradients, filters, and
40
- SkSL shader effects. A custom node is a component registered with the engine,
40
+ WGSL shader effects. A custom node is a component registered with the engine,
41
41
  and any document it opens can name it.
42
42
  - **Tweens**: interpolation and easing for animating attributes over time.
43
43
  - **Layout**: `flowOps`, the flow layout every 2D node runs on its children:
44
44
  freeform, runs (wrapped or not) and grid.
45
45
  - **Project / render / platform / assets**: the abstractions a renderer and a
46
46
  platform implement to turn a scene graph into pixels, audio, and exported
47
- video: `RenderContext2D`/`RenderContext3D` (implemented by
48
- [`@motionscript/skia-render`](https://github.com/motionscript-dev/motionscript/tree/main/packages/skia-render)) and the `platform` seams (filled
47
+ video: `RenderContext2D`/`RenderContext3D` (implemented by the WebGPU renderer
48
+ [`@motionscript/renderer`](https://github.com/motionscript-dev/motionscript/tree/main/packages/renderer)) and the `platform` seams (filled
49
49
  in by [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser)).
50
50
 
51
51
  This package has no rendering backend of its own. Pair it with
52
- [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser) (Skia/CanvasKit) or build your own backend
52
+ [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser) (WebGPU) or build your own backend
53
53
  against the `platform`/`render` abstractions.
54
54
 
55
55
  ## Docs
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAc,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE3E;;;GAGG;AACH,qBAAa,YAAY;IAuCjB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAtC5B,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAY;IAExC,sFAAsF;IACtF,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,aAAa,CAAoC;IACzD;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW,CAA8B;IACjD,8DAA8D;IAC9D,OAAO,CAAC,aAAa,CAAqB;IAC1C,4FAA4F;IAC5F,OAAO,CAAC,aAAa,CAAkC;IACvD,+EAA+E;IAC/E,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAS;IAEzB,0EAA0E;IAC1E,OAAO,CAAC,eAAe,CAA+B;IACtD,8EAA8E;IAC9E,OAAO,CAAC,cAAc,CAAoC;IAE1D;;;OAGG;gBAEC,OAAO,EAAE,mBAAmB,EAC5B,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,SAAS,EACL,OAAO,GAAE,CAAC,KAA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audio/filters/union.js";
2
+ import { effectsKey } from "../attributes/audio/effects/union.js";
3
+ import { paramKey } from "../attributes/audio/ramp.js";
4
+ import { transitionKey } from "../attributes/audio/transition.js";
3
5
  /**
4
6
  * Coordinates asset loading and audio synchronization during playback.
5
7
  * Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.
@@ -275,16 +277,16 @@ function layoutGatesOf(precomp) {
275
277
  const NO_DISPOSE = () => { };
276
278
  /**
277
279
  * Produce a deterministic string key that uniquely identifies an audio request's
278
- * playback identity. Includes the filter chain (via {@link filtersKey}) so editing a
279
- * filter/volume curve changes the id — the device then stops the stale source and
280
- * rebuilds the graph with the new filters instead of reusing the old one.
280
+ * playback identity. Includes the effect chain, the ramps and the transitions so
281
+ * editing any of them changes the id — the device then stops the stale source and
282
+ * rebuilds the graph instead of reusing the old one.
281
283
  *
282
284
  * The bus chain is in for the same reason: re-routing a clip to a different bus,
283
285
  * or changing a bus's level or its span, changes what it sounds like without
284
286
  * changing anything else here — so leaving it out would keep the stale graph.
285
287
  */
286
288
  function stableKey(req, clipOffsetSecs) {
287
- return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? "_"}|${req.loop ? 1 : 0}|${req.volume}|${filtersKey(req.filters)}|${busKey(req.bus)}`;
289
+ return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? "_"}|${req.loop ? 1 : 0}|${paramKey(req.volume)}|${paramKey(req.speed)}|${req.sourceLength ?? "_"}|${effectsKey(req.effects)}|${transitionKey(req.transitionIn)}|${transitionKey(req.transitionOut)}|${busKey(req.bus)}`;
288
290
  }
289
291
  /** The bus chain's contribution to {@link stableKey}. */
290
292
  function busKey(bus) {
@@ -1 +1 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAA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C,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { AudioRequest, busStopKey } from \"@/attributes/audio/request\";\r\nimport { filtersKey } from \"@/attributes/audio/filters/union\";\r\nimport { AssetRecord, Disposer, LoaderFn } from \"@/assets/record\";\r\nimport { AudioSink } from \"@/platform/audio-sink\";\r\nimport { StorageAdapter } from \"@/platform/storage-adapter\";\r\nimport { AssetTrack, AssetTimelineResult } from \"@/runtime/asset-timeline\";\r\n\r\n/**\r\n * Coordinates asset loading and audio synchronization during playback.\r\n * Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.\r\n */\r\nexport class AssetManager {\r\n private precomp: AssetTimelineResult;\r\n private readonly storageAdapter: StorageAdapter;\r\n private readonly audioDevice: AudioSink;\r\n\r\n /** `null` after a swap: whatever the device holds belongs to the previous precomp. */\r\n private lastAudioRequestKey: string | null = \"\";\r\n private lastAudioSrcs: ReadonlySet<string> | null = new Set();\r\n private audioFetching = new Map<string, Promise<void>>();\r\n /**\r\n * Sources whose fetch or decode failed, with why, so they are not fetched\r\n * again every sync. A source leaves when no request in the window names it\r\n * any more — and, once it has been reported, when a new precomp arrives —\r\n * so the next time it is wanted it is tried afresh. One that failed quietly\r\n * (see {@link AudioRequest.optional}) is kept across a precomp: a video with\r\n * no audio track would otherwise be fetched whole on every edit.\r\n */\r\n private audioFailed = new Map<string, unknown>();\r\n /** The failed sources already reported to {@link onError}. */\r\n private audioReported = new Set<string>();\r\n /** Sources a request in the last window asked for by name, not as a picture's own sound. */\r\n private audioRequired: ReadonlySet<string> = new Set();\r\n /** Keys of the loaders a track measures against, which no window may evict. */\r\n private layoutGateKeys: ReadonlySet<string>;\r\n private disposed = false;\r\n\r\n /** Disposers for loaders whose load has resolved, keyed by loader key. */\r\n private loaderDisposers = new Map<string, Disposer>();\r\n /** In-flight loader runs, keyed by loader key, to dedupe concurrent calls. */\r\n private loaderInFlight = new Map<string, Promise<void>>();\r\n\r\n /**\r\n * @param onError Told once per source when audio a request asked for cannot\r\n * be fetched or decoded. Defaults to `console.error`.\r\n */\r\n constructor(\r\n precomp: AssetTimelineResult,\r\n storageAdapter: StorageAdapter,\r\n audioDevice: AudioSink,\r\n private readonly onError: (error: Error) => void = (error) => console.error(`[AssetManager] ${error.message}`),\r\n ) {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n this.storageAdapter = storageAdapter;\r\n this.audioDevice = audioDevice;\r\n }\r\n\r\n // ─── Public surface ───────────────────────────────────────────────────────\r\n\r\n /**\r\n * Swap in a new precomp result (a document swap). The manager keeps its\r\n * warm loader disposers and in-flight audio fetches so a single-track edit\r\n * doesn't re-fetch unchanged assets; the next loadAt/syncAudio picks up the\r\n * new asset windows. Resetting the audio signature forces a reschedule so a\r\n * changed track's audio is re-evaluated against the new timeline — including\r\n * into an empty window, which is how removed audio stops.\r\n */\r\n setPrecomp(precomp: AssetTimelineResult): void {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n for (const src of this.audioReported) this.audioFailed.delete(src);\r\n this.audioReported.clear();\r\n this.lastAudioRequestKey = null;\r\n this.lastAudioSrcs = null;\r\n }\r\n\r\n /**\r\n * Blocking load for seek and initial render. Waits for every asset whose\r\n * cacheAt <= frame and endFrame >= frame to be ready, then schedules audio.\r\n */\r\n async loadAt(frame: number): Promise<void> {\r\n const jobs: Promise<void>[] = [];\r\n\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n const job = this.syncLoader(key, track, frame);\r\n if (job) jobs.push(job);\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n jobs.push(this.storageAdapter.loadAsset(key, track.record));\r\n }\r\n }\r\n\r\n await Promise.all(jobs);\r\n if (this.audioDevice.schedulesAudio) this.syncAudio(frame);\r\n }\r\n\r\n /** Whether `key` — a loader key or a stored asset's — is resident now. */\r\n isReady(key: string): boolean {\r\n return this.loaderDisposers.has(key) || this.storageAdapter.isLoaded(key);\r\n }\r\n\r\n /**\r\n * Load `records` whatever their windows say — for layout gates, which must be\r\n * resident before a track measures regardless of the frame being drawn.\r\n */\r\n async loadRecords(records: readonly AssetRecord[]): Promise<void> {\r\n await Promise.all(records.map((record) => record.type === 'loader'\r\n ? this.runLoader(record.src, record.load)\r\n : this.storageAdapter.loadAsset(record.src, record)));\r\n }\r\n\r\n /**\r\n * Non-blocking incremental prefetch called after each render tick. Fires\r\n * loads for assets whose cacheAt window has been reached without blocking.\r\n */\r\n prefetch(frame: number): void {\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n this.syncLoader(key, track, frame)?.catch(err => {\r\n console.error(`[AssetManager] loader failed for ${key}:`, err);\r\n });\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n this.storageAdapter.loadAsset(key, track.record).catch(err => {\r\n console.error(`[AssetManager] prefetch failed for ${key}:`, err);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Drive a single loader track toward the state `frame` requires. If `frame`\r\n * is inside the loader's `[cacheAt, discardAt]` window, run its callback\r\n * (deduped — at most one in-flight run, skipped once loaded) and return the\r\n * pending job, if any. If `frame` is outside the window and the loader was\r\n * loaded, dispose it. Returns the in-flight load promise so a blocking\r\n * caller can await it; `undefined` when there's nothing to wait for.\r\n */\r\n private syncLoader(key: string, track: AssetTrack, frame: number): Promise<void> | undefined {\r\n if (track.record.type !== 'loader') return undefined;\r\n const discardAt = track.discardAt ?? Infinity;\r\n const inWindow = track.cacheAt <= frame && frame <= discardAt;\r\n\r\n if (!inWindow) {\r\n // A layout gate is loaded by `loadRecords` whatever frame is drawn, so\r\n // its window says nothing about when it may go: disposing it here made\r\n // `isReady` false and the next frame load it again.\r\n if (this.layoutGateKeys.has(key)) return undefined;\r\n const dispose = this.loaderDisposers.get(key);\r\n if (dispose) {\r\n this.loaderDisposers.delete(key);\r\n dispose();\r\n }\r\n return undefined;\r\n }\r\n\r\n return this.runLoader(key, track.record.load);\r\n }\r\n\r\n /** Run a loader unless it is resident or already running. */\r\n private runLoader(key: string, load: LoaderFn): Promise<void> | undefined {\r\n // Already loaded for this window, or a run is already in flight.\r\n if (this.loaderDisposers.has(key)) return undefined;\r\n const existing = this.loaderInFlight.get(key);\r\n if (existing) return existing;\r\n\r\n const job = load()\r\n .then(disposer => {\r\n // A loader that resolves nothing is keeping its result resident on\r\n // purpose (see `LoaderFn`). Recording a no-op disposer rather than\r\n // skipping the entry is what keeps `loaderDisposers.has(key)` the\r\n // single \"already loaded\" test for both kinds.\r\n this.loaderDisposers.set(key, disposer ?? NO_DISPOSE);\r\n })\r\n .finally(() => {\r\n this.loaderInFlight.delete(key);\r\n });\r\n this.loaderInFlight.set(key, job);\r\n return job;\r\n }\r\n\r\n /** Run every outstanding loader disposer and clear loader state. */\r\n dispose(): void {\r\n for (const dispose of this.loaderDisposers.values()) dispose();\r\n this.loaderDisposers.clear();\r\n this.loaderInFlight.clear();\r\n this.disposed = true;\r\n }\r\n\r\n /**\r\n * Push the current audio working set to the AudioSink. Called after each\r\n * render tick so the device stays in sync with the tracks' audio requests.\r\n */\r\n syncAudio(frame: number): void {\r\n const currentTime = frame / this.precomp.fps;\r\n\r\n const inWindow: AudioRequest[] = [];\r\n const srcs = new Set<string>();\r\n const required = new Set<string>();\r\n const seen = new Set<string>();\r\n\r\n /** Admit `req` if it overlaps the scheduling window, shifted by its owner's offset. */\r\n const consider = (req: AudioRequest, offsetSecs: number): void => {\r\n const globalStart = offsetSecs + req.startAt;\r\n const globalEnd = offsetSecs + req.endAt;\r\n\r\n if (globalEnd < currentTime || globalStart > currentTime + 10) return;\r\n // Ahead of the dedupe: the flag is not part of a request's identity.\r\n if (!req.optional) required.add(req.src);\r\n\r\n const stableId = stableKey(req, offsetSecs);\r\n if (seen.has(stableId)) return;\r\n seen.add(stableId);\r\n\r\n inWindow.push({\r\n ...req,\r\n id: stableId,\r\n startAt: globalStart,\r\n endAt: globalEnd,\r\n // A bus's span is in its request's seconds, so it moves with it.\r\n ...(req.bus && {\r\n bus: req.bus.map((s) => ({ ...s, startAt: offsetSecs + s.startAt, endAt: offsetSecs + s.endAt })),\r\n }),\r\n });\r\n srcs.add(req.src);\r\n };\r\n\r\n for (const track of this.precomp.tracks) {\r\n const offsetSecs = track.startFrame / this.precomp.fps;\r\n for (const req of track.audioRequests) consider(req, offsetSecs);\r\n }\r\n\r\n this.audioRequired = required;\r\n for (const src of srcs) {\r\n if (!this.audioDevice.has(src) && !this.audioFetching.has(src) && !this.audioFailed.has(src)) {\r\n const job = this.storageAdapter.fetchAudioData(src)\r\n .then(data => this.audioDevice.append(src, data))\r\n .catch(cause => this.failAudio(src, cause))\r\n .finally(() => this.audioFetching.delete(src));\r\n this.audioFetching.set(src, job);\r\n }\r\n }\r\n // A failed source nothing asks for any more is forgotten, so wanting it\r\n // again later tries it afresh; one that failed quietly is reported when\r\n // a request that asks for its sound arrives.\r\n for (const [src, cause] of this.audioFailed) {\r\n if (!srcs.has(src)) {\r\n this.audioFailed.delete(src);\r\n this.audioReported.delete(src);\r\n } else if (required.has(src)) {\r\n this.reportAudio(src, cause);\r\n }\r\n }\r\n\r\n const requestKey = audioSignature(inWindow);\r\n if (requestKey !== this.lastAudioRequestKey) {\r\n this.audioDevice.schedule(inWindow);\r\n this.lastAudioRequestKey = requestKey;\r\n }\r\n if (this.lastAudioSrcs === null || !setsEqual(this.lastAudioSrcs, srcs)) {\r\n this.audioDevice.retain(srcs);\r\n this.lastAudioSrcs = srcs;\r\n }\r\n }\r\n\r\n /** Record that `src` could not be loaded, and say so if a request asked for its sound. */\r\n private failAudio(src: string, cause: unknown): void {\r\n if (this.disposed) return;\r\n this.audioFailed.set(src, cause);\r\n if (this.audioRequired.has(src)) this.reportAudio(src, cause);\r\n }\r\n\r\n /** Say that `src` could not be loaded, once, until it is wanted afresh. */\r\n private reportAudio(src: string, cause: unknown): void {\r\n if (this.audioReported.has(src)) return;\r\n this.audioReported.add(src);\r\n const message = cause instanceof Error ? cause.message : String(cause);\r\n this.onError(new Error(`audio \"${src}\" could not be loaded: ${message}`, { cause }));\r\n }\r\n}\r\n\r\n// ─── Helpers ──────────────────────────────────────────────────────────────────\r\n\r\n/** Every layout-gate key any track of `precomp` declares. */\r\nfunction layoutGatesOf(precomp: AssetTimelineResult): ReadonlySet<string> {\r\n const keys = new Set<string>();\r\n for (const track of precomp.tracks) for (const key of track.layoutGates ?? []) keys.add(key);\r\n return keys;\r\n}\r\n\r\n/** Stand-in for a loader that resolved nothing — see the note in {@link AssetManager.syncLoader}. */\r\nconst NO_DISPOSE: Disposer = () => { };\r\n\r\n/**\r\n * Produce a deterministic string key that uniquely identifies an audio request's\r\n * playback identity. Includes the filter chain (via {@link filtersKey}) so editing a\r\n * filter/volume curve changes the id — the device then stops the stale source and\r\n * rebuilds the graph with the new filters instead of reusing the old one.\r\n *\r\n * The bus chain is in for the same reason: re-routing a clip to a different bus,\r\n * or changing a bus's level or its span, changes what it sounds like without\r\n * changing anything else here — so leaving it out would keep the stale graph.\r\n */\r\nfunction stableKey(req: AudioRequest, clipOffsetSecs: number): string {\r\n return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? \"_\"}|${req.loop ? 1 : 0}|${req.volume}|${filtersKey(req.filters)}|${busKey(req.bus)}`;\r\n}\r\n\r\n/** The bus chain's contribution to {@link stableKey}. */\r\nfunction busKey(bus: AudioRequest[\"bus\"]): string {\r\n if (!bus || bus.length === 0) return \"\";\r\n return bus.map(busStopKey).join(\">\");\r\n}\r\n\r\n/** Produce a stable hash of the active audio request set to detect scheduling changes. */\r\nfunction audioSignature(reqs: readonly AudioRequest[]): string {\r\n if (reqs.length === 0) return \"\";\r\n return reqs.map(r => r.id).sort().join(\"\\n\");\r\n}\r\n\r\n/** Shallow equality check for two string sets (order-independent). */\r\nfunction setsEqual(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\r\n if (a.size !== b.size) return false;\r\n for (const v of a) if (!b.has(v)) return false;\r\n return true;\r\n}\r\n"]}
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAM9D;;;GAGG;AACH,MAAM,OAAO,YAAY;IAuCA;IAtCb,OAAO,CAAsB;IACpB,cAAc,CAAiB;IAC/B,WAAW,CAAY;IAExC,sFAAsF;IAC9E,mBAAmB,GAAkB,EAAE,CAAC;IACxC,aAAa,GAA+B,IAAI,GAAG,EAAE,CAAC;IACtD,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IACzD;;;;;;;OAOG;IACK,WAAW,GAAG,IAAI,GAAG,EAAmB,CAAC;IACjD,8DAA8D;IACtD,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAC1C,4FAA4F;IACpF,aAAa,GAAwB,IAAI,GAAG,EAAE,CAAC;IACvD,+EAA+E;IACvE,cAAc,CAAsB;IACpC,QAAQ,GAAG,KAAK,CAAC;IAEzB,0EAA0E;IAClE,eAAe,GAAG,IAAI,GAAG,EAAoB,CAAC;IACtD,8EAA8E;IACtE,cAAc,GAAG,IAAI,GAAG,EAAyB,CAAC;IAE1D;;;OAGG;IACH,YACI,OAA4B,EAC5B,cAA8B,EAC9B,WAAsB,EACL,UAAkC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,KAAK,CAAC,OAAO,EAAE,CAAC;QAA7F,YAAO,GAAP,OAAO,CAAsF;QAE9G,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,I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AAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,0FAA0F;AAC1F,SAAS,cAAc,CAAC,IAA6B;IACjD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,sEAAsE;AACtE,SAAS,SAAS,CAAC,CAAsB,EAAE,CAAsB;IAC7D,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { AudioRequest, busStopKey } from \"@/attributes/audio/request\";\r\nimport { effectsKey } from \"@/attributes/audio/effects/union\";\r\nimport { paramKey } from \"@/attributes/audio/ramp\";\r\nimport { transitionKey } from \"@/attributes/audio/transition\";\r\nimport { AssetRecord, Disposer, LoaderFn } from \"@/assets/record\";\r\nimport { AudioSink } from \"@/platform/audio-sink\";\r\nimport { StorageAdapter } from \"@/platform/storage-adapter\";\r\nimport { AssetTrack, AssetTimelineResult } from \"@/runtime/asset-timeline\";\r\n\r\n/**\r\n * Coordinates asset loading and audio synchronization during playback.\r\n * Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.\r\n */\r\nexport class AssetManager {\r\n private precomp: AssetTimelineResult;\r\n private readonly storageAdapter: StorageAdapter;\r\n private readonly audioDevice: AudioSink;\r\n\r\n /** `null` after a swap: whatever the device holds belongs to the previous precomp. */\r\n private lastAudioRequestKey: string | null = \"\";\r\n private lastAudioSrcs: ReadonlySet<string> | null = new Set();\r\n private audioFetching = new Map<string, Promise<void>>();\r\n /**\r\n * Sources whose fetch or decode failed, with why, so they are not fetched\r\n * again every sync. A source leaves when no request in the window names it\r\n * any more — and, once it has been reported, when a new precomp arrives —\r\n * so the next time it is wanted it is tried afresh. One that failed quietly\r\n * (see {@link AudioRequest.optional}) is kept across a precomp: a video with\r\n * no audio track would otherwise be fetched whole on every edit.\r\n */\r\n private audioFailed = new Map<string, unknown>();\r\n /** The failed sources already reported to {@link onError}. */\r\n private audioReported = new Set<string>();\r\n /** Sources a request in the last window asked for by name, not as a picture's own sound. */\r\n private audioRequired: ReadonlySet<string> = new Set();\r\n /** Keys of the loaders a track measures against, which no window may evict. */\r\n private layoutGateKeys: ReadonlySet<string>;\r\n private disposed = false;\r\n\r\n /** Disposers for loaders whose load has resolved, keyed by loader key. */\r\n private loaderDisposers = new Map<string, Disposer>();\r\n /** In-flight loader runs, keyed by loader key, to dedupe concurrent calls. */\r\n private loaderInFlight = new Map<string, Promise<void>>();\r\n\r\n /**\r\n * @param onError Told once per source when audio a request asked for cannot\r\n * be fetched or decoded. Defaults to `console.error`.\r\n */\r\n constructor(\r\n precomp: AssetTimelineResult,\r\n storageAdapter: StorageAdapter,\r\n audioDevice: AudioSink,\r\n private readonly onError: (error: Error) => void = (error) => console.error(`[AssetManager] ${error.message}`),\r\n ) {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n this.storageAdapter = storageAdapter;\r\n this.audioDevice = audioDevice;\r\n }\r\n\r\n // ─── Public surface ───────────────────────────────────────────────────────\r\n\r\n /**\r\n * Swap in a new precomp result (a document swap). The manager keeps its\r\n * warm loader disposers and in-flight audio fetches so a single-track edit\r\n * doesn't re-fetch unchanged assets; the next loadAt/syncAudio picks up the\r\n * new asset windows. Resetting the audio signature forces a reschedule so a\r\n * changed track's audio is re-evaluated against the new timeline — including\r\n * into an empty window, which is how removed audio stops.\r\n */\r\n setPrecomp(precomp: AssetTimelineResult): void {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n for (const src of this.audioReported) this.audioFailed.delete(src);\r\n this.audioReported.clear();\r\n this.lastAudioRequestKey = null;\r\n this.lastAudioSrcs = null;\r\n }\r\n\r\n /**\r\n * Blocking load for seek and initial render. Waits for every asset whose\r\n * cacheAt <= frame and endFrame >= frame to be ready, then schedules audio.\r\n */\r\n async loadAt(frame: number): Promise<void> {\r\n const jobs: Promise<void>[] = [];\r\n\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n const job = this.syncLoader(key, track, frame);\r\n if (job) jobs.push(job);\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n jobs.push(this.storageAdapter.loadAsset(key, track.record));\r\n }\r\n }\r\n\r\n await Promise.all(jobs);\r\n if (this.audioDevice.schedulesAudio) this.syncAudio(frame);\r\n }\r\n\r\n /** Whether `key` — a loader key or a stored asset's — is resident now. */\r\n isReady(key: string): boolean {\r\n return this.loaderDisposers.has(key) || this.storageAdapter.isLoaded(key);\r\n }\r\n\r\n /**\r\n * Load `records` whatever their windows say — for layout gates, which must be\r\n * resident before a track measures regardless of the frame being drawn.\r\n */\r\n async loadRecords(records: readonly AssetRecord[]): Promise<void> {\r\n await Promise.all(records.map((record) => record.type === 'loader'\r\n ? this.runLoader(record.src, record.load)\r\n : this.storageAdapter.loadAsset(record.src, record)));\r\n }\r\n\r\n /**\r\n * Non-blocking incremental prefetch called after each render tick. Fires\r\n * loads for assets whose cacheAt window has been reached without blocking.\r\n */\r\n prefetch(frame: number): void {\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n this.syncLoader(key, track, frame)?.catch(err => {\r\n console.error(`[AssetManager] loader failed for ${key}:`, err);\r\n });\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n this.storageAdapter.loadAsset(key, track.record).catch(err => {\r\n console.error(`[AssetManager] prefetch failed for ${key}:`, err);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Drive a single loader track toward the state `frame` requires. If `frame`\r\n * is inside the loader's `[cacheAt, discardAt]` window, run its callback\r\n * (deduped — at most one in-flight run, skipped once loaded) and return the\r\n * pending job, if any. If `frame` is outside the window and the loader was\r\n * loaded, dispose it. Returns the in-flight load promise so a blocking\r\n * caller can await it; `undefined` when there's nothing to wait for.\r\n */\r\n private syncLoader(key: string, track: AssetTrack, frame: number): Promise<void> | undefined {\r\n if (track.record.type !== 'loader') return undefined;\r\n const discardAt = track.discardAt ?? Infinity;\r\n const inWindow = track.cacheAt <= frame && frame <= discardAt;\r\n\r\n if (!inWindow) {\r\n // A layout gate is loaded by `loadRecords` whatever frame is drawn, so\r\n // its window says nothing about when it may go: disposing it here made\r\n // `isReady` false and the next frame load it again.\r\n if (this.layoutGateKeys.has(key)) return undefined;\r\n const dispose = this.loaderDisposers.get(key);\r\n if (dispose) {\r\n this.loaderDisposers.delete(key);\r\n dispose();\r\n }\r\n return undefined;\r\n }\r\n\r\n return this.runLoader(key, track.record.load);\r\n }\r\n\r\n /** Run a loader unless it is resident or already running. */\r\n private runLoader(key: string, load: LoaderFn): Promise<void> | undefined {\r\n // Already loaded for this window, or a run is already in flight.\r\n if (this.loaderDisposers.has(key)) return undefined;\r\n const existing = this.loaderInFlight.get(key);\r\n if (existing) return existing;\r\n\r\n const job = load()\r\n .then(disposer => {\r\n // A loader that resolves nothing is keeping its result resident on\r\n // purpose (see `LoaderFn`). Recording a no-op disposer rather than\r\n // skipping the entry is what keeps `loaderDisposers.has(key)` the\r\n // single \"already loaded\" test for both kinds.\r\n this.loaderDisposers.set(key, disposer ?? NO_DISPOSE);\r\n })\r\n .finally(() => {\r\n this.loaderInFlight.delete(key);\r\n });\r\n this.loaderInFlight.set(key, job);\r\n return job;\r\n }\r\n\r\n /** Run every outstanding loader disposer and clear loader state. */\r\n dispose(): void {\r\n for (const dispose of this.loaderDisposers.values()) dispose();\r\n this.loaderDisposers.clear();\r\n this.loaderInFlight.clear();\r\n this.disposed = true;\r\n }\r\n\r\n /**\r\n * Push the current audio working set to the AudioSink. Called after each\r\n * render tick so the device stays in sync with the tracks' audio requests.\r\n */\r\n syncAudio(frame: number): void {\r\n const currentTime = frame / this.precomp.fps;\r\n\r\n const inWindow: AudioRequest[] = [];\r\n const srcs = new Set<string>();\r\n const required = new Set<string>();\r\n const seen = new Set<string>();\r\n\r\n /** Admit `req` if it overlaps the scheduling window, shifted by its owner's offset. */\r\n const consider = (req: AudioRequest, offsetSecs: number): void => {\r\n const globalStart = offsetSecs + req.startAt;\r\n const globalEnd = offsetSecs + req.endAt;\r\n\r\n if (globalEnd < currentTime || globalStart > currentTime + 10) return;\r\n // Ahead of the dedupe: the flag is not part of a request's identity.\r\n if (!req.optional) required.add(req.src);\r\n\r\n const stableId = stableKey(req, offsetSecs);\r\n if (seen.has(stableId)) return;\r\n seen.add(stableId);\r\n\r\n inWindow.push({\r\n ...req,\r\n id: stableId,\r\n startAt: globalStart,\r\n endAt: globalEnd,\r\n // A bus's span is in its request's seconds, so it moves with it.\r\n ...(req.bus && {\r\n bus: req.bus.map((s) => ({ ...s, startAt: offsetSecs + s.startAt, endAt: offsetSecs + s.endAt })),\r\n }),\r\n });\r\n srcs.add(req.src);\r\n };\r\n\r\n for (const track of this.precomp.tracks) {\r\n const offsetSecs = track.startFrame / this.precomp.fps;\r\n for (const req of track.audioRequests) consider(req, offsetSecs);\r\n }\r\n\r\n this.audioRequired = required;\r\n for (const src of srcs) {\r\n if (!this.audioDevice.has(src) && !this.audioFetching.has(src) && !this.audioFailed.has(src)) {\r\n const job = this.storageAdapter.fetchAudioData(src)\r\n .then(data => this.audioDevice.append(src, data))\r\n .catch(cause => this.failAudio(src, cause))\r\n .finally(() => this.audioFetching.delete(src));\r\n this.audioFetching.set(src, job);\r\n }\r\n }\r\n // A failed source nothing asks for any more is forgotten, so wanting it\r\n // again later tries it afresh; one that failed quietly is reported when\r\n // a request that asks for its sound arrives.\r\n for (const [src, cause] of this.audioFailed) {\r\n if (!srcs.has(src)) {\r\n this.audioFailed.delete(src);\r\n this.audioReported.delete(src);\r\n } else if (required.has(src)) {\r\n this.reportAudio(src, cause);\r\n }\r\n }\r\n\r\n const requestKey = audioSignature(inWindow);\r\n if (requestKey !== this.lastAudioRequestKey) {\r\n this.audioDevice.schedule(inWindow);\r\n this.lastAudioRequestKey = requestKey;\r\n }\r\n if (this.lastAudioSrcs === null || !setsEqual(this.lastAudioSrcs, srcs)) {\r\n this.audioDevice.retain(srcs);\r\n this.lastAudioSrcs = srcs;\r\n }\r\n }\r\n\r\n /** Record that `src` could not be loaded, and say so if a request asked for its sound. */\r\n private failAudio(src: string, cause: unknown): void {\r\n if (this.disposed) return;\r\n this.audioFailed.set(src, cause);\r\n if (this.audioRequired.has(src)) this.reportAudio(src, cause);\r\n }\r\n\r\n /** Say that `src` could not be loaded, once, until it is wanted afresh. */\r\n private reportAudio(src: string, cause: unknown): void {\r\n if (this.audioReported.has(src)) return;\r\n this.audioReported.add(src);\r\n const message = cause instanceof Error ? cause.message : String(cause);\r\n this.onError(new Error(`audio \"${src}\" could not be loaded: ${message}`, { cause }));\r\n }\r\n}\r\n\r\n// ─── Helpers ──────────────────────────────────────────────────────────────────\r\n\r\n/** Every layout-gate key any track of `precomp` declares. */\r\nfunction layoutGatesOf(precomp: AssetTimelineResult): ReadonlySet<string> {\r\n const keys = new Set<string>();\r\n for (const track of precomp.tracks) for (const key of track.layoutGates ?? []) keys.add(key);\r\n return keys;\r\n}\r\n\r\n/** Stand-in for a loader that resolved nothing — see the note in {@link AssetManager.syncLoader}. */\r\nconst NO_DISPOSE: Disposer = () => { };\r\n\r\n/**\r\n * Produce a deterministic string key that uniquely identifies an audio request's\r\n * playback identity. Includes the effect chain, the ramps and the transitions so\r\n * editing any of them changes the id — the device then stops the stale source and\r\n * rebuilds the graph instead of reusing the old one.\r\n *\r\n * The bus chain is in for the same reason: re-routing a clip to a different bus,\r\n * or changing a bus's level or its span, changes what it sounds like without\r\n * changing anything else here — so leaving it out would keep the stale graph.\r\n */\r\nfunction stableKey(req: AudioRequest, clipOffsetSecs: number): string {\r\n return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? \"_\"}|${req.loop ? 1 : 0}|${paramKey(req.volume)}|${paramKey(req.speed)}|${req.sourceLength ?? \"_\"}|${effectsKey(req.effects)}|${transitionKey(req.transitionIn)}|${transitionKey(req.transitionOut)}|${busKey(req.bus)}`;\r\n}\r\n\r\n/** The bus chain's contribution to {@link stableKey}. */\r\nfunction busKey(bus: AudioRequest[\"bus\"]): string {\r\n if (!bus || bus.length === 0) return \"\";\r\n return bus.map(busStopKey).join(\">\");\r\n}\r\n\r\n/** Produce a stable hash of the active audio request set to detect scheduling changes. */\r\nfunction audioSignature(reqs: readonly AudioRequest[]): string {\r\n if (reqs.length === 0) return \"\";\r\n return reqs.map(r => r.id).sort().join(\"\\n\");\r\n}\r\n\r\n/** Shallow equality check for two string sets (order-independent). */\r\nfunction setsEqual(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\r\n if (a.size !== b.size) return false;\r\n for (const v of a) if (!b.has(v)) return false;\r\n return true;\r\n}\r\n"]}
@@ -0,0 +1,73 @@
1
+ import { AudioEffect } from "./union.js";
2
+ import { Param } from "../ramp.js";
3
+ /**
4
+ * Every builder takes one options object, and those with one dominant param
5
+ * also take that param directly — a number or a {@link Ramp}, so
6
+ * `AudioEffects.lowpass(ramp(8000, 400, 2))` works.
7
+ */
8
+ /** Gain. Param shorthand sets `value`. */
9
+ export interface GainEffectOptions {
10
+ /** 1 = unchanged, 0 = silent, >1 = louder. */
11
+ value: Param;
12
+ }
13
+ /** High-pass filter. Param shorthand sets `frequency`. */
14
+ export interface HighPassEffectOptions {
15
+ /** Rolls off content below this frequency, in Hz. */
16
+ frequency: Param;
17
+ /** Resonance at the cutoff (default 1). */
18
+ q?: Param;
19
+ }
20
+ /** Low-pass filter. Param shorthand sets `frequency`. */
21
+ export interface LowPassEffectOptions {
22
+ /** Rolls off content above this frequency, in Hz. */
23
+ frequency: Param;
24
+ /** Resonance at the cutoff (default 1). */
25
+ q?: Param;
26
+ }
27
+ /** Amplitude wobble. Param shorthand sets `rate`. */
28
+ export interface TremoloEffectOptions {
29
+ /** Wobble rate in Hz. */
30
+ rate: Param;
31
+ /** Modulation depth, 0–1 (default 0.5). */
32
+ depth?: Param;
33
+ }
34
+ /** Delay line with feedback. Param shorthand sets `delay`. */
35
+ export interface EchoEffectOptions {
36
+ /** Delay time in seconds. */
37
+ delay: Param;
38
+ /** Feedback amount, 0–<1 (default 0.4). */
39
+ feedback?: Param;
40
+ /** Wet mix, 0–1 (default 0.5). */
41
+ mix?: Param;
42
+ }
43
+ /**
44
+ * Immutable, chainable list of audio effects, applied in order (index 0
45
+ * closest to the source).
46
+ *
47
+ * @example
48
+ * const chain = AudioEffects.gain(1.5).lowpass(800).echo(0.3);
49
+ */
50
+ export declare class AudioEffectChain {
51
+ list: AudioEffect[];
52
+ constructor(list?: AudioEffect[]);
53
+ private append;
54
+ gain(options: Param | GainEffectOptions): AudioEffectChain;
55
+ /** Alias for {@link gain}. */
56
+ volume(options: Param | GainEffectOptions): AudioEffectChain;
57
+ /** Rolls off content below `frequency` Hz. */
58
+ highpass(options: Param | HighPassEffectOptions): AudioEffectChain;
59
+ /** Rolls off content above `frequency` Hz. */
60
+ lowpass(options: Param | LowPassEffectOptions): AudioEffectChain;
61
+ /** A `rate` Hz wobble at `depth` (0–1). */
62
+ tremolo(options: Param | TremoloEffectOptions): AudioEffectChain;
63
+ /** `delay` seconds, `feedback` 0–<1, optional wet `mix` 0–1. */
64
+ echo(options: Param | EchoEffectOptions): AudioEffectChain;
65
+ [Symbol.iterator](): Generator<AudioEffect, void, unknown>;
66
+ toJSON(): AudioEffect[];
67
+ }
68
+ /** What an `effects` prop accepts: one effect, a plain array, or a chain. */
69
+ export type AudioEffectsInput = AudioEffect[] | AudioEffectChain | AudioEffect;
70
+ /** An empty {@link AudioEffectChain}: `AudioEffects.gain(1.5)` is `new AudioEffectChain().gain(1.5)`. */
71
+ export declare const AudioEffects: AudioEffectChain;
72
+ export declare function resolveAudioEffects(effects: AudioEffectsInput | undefined): AudioEffect[];
73
+ //# sourceMappingURL=chain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/attributes/audio/effects/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,KAAK,EAAU,MAAM,SAAS,CAAC;AAExC;;;;GAIG;AAEH,0CAA0C;AAC1C,MAAM,WAAW,iBAAiB;IAC9B,8CAA8C;IAC9C,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,0DAA0D;AAC1D,MAAM,WAAW,qBAAqB;IAClC,qDAAqD;IACrD,SAAS,EAAE,KAAK,CAAC;IACjB,2CAA2C;IAC3C,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAED,yDAAyD;AACzD,MAAM,WAAW,oBAAoB;IACjC,qDAAqD;IACrD,SAAS,EAAE,KAAK,CAAC;IACjB,2CAA2C;IAC3C,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAED,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACjC,yBAAyB;IACzB,IAAI,EAAE,KAAK,CAAC;IACZ,2CAA2C;IAC3C,KAAK,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAC9B,6BAA6B;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,kCAAkC;IAClC,GAAG,CAAC,EAAE,KAAK,CAAC;CACf;AAOD;;;;;;GAMG;AACH,qBAAa,gBAAgB;IACN,IAAI,EAAE,WAAW,EAAE;gBAAnB,IAAI,GAAE,WAAW,EAAO;IAE3C,OAAO,CAAC,MAAM;IAId,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,iBAAiB;IAKvC,8BAA8B;IAC9B,MAAM,CAAC,OAAO,EAAE,KAAK,GAAG,iBAAiB;IAIzC,8CAA8C;IAC9C,QAAQ,CAAC,OAAO,EAAE,KAAK,GAAG,qBAAqB;IAK/C,8CAA8C;IAC9C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,oBAAoB;IAK7C,2CAA2C;IAC3C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,oBAAoB;IAK7C,gEAAgE;IAChE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,iBAAiB;IAKtC,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIlB,MAAM;CAGT;AAED,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,GAAG,WAAW,EAAE,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAE/E,yGAAyG;AACzG,eAAO,MAAM,YAAY,kBAAyB,CAAC;AAEnD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,WAAW,EAAE,CAKzF"}
@@ -0,0 +1,67 @@
1
+ import { isRamp } from "../ramp.js";
2
+ /** A ramp is an object too, so the shorthand test has to ask {@link isRamp}, or it reads as an options bag. */
3
+ function scalarParam(arg, key) {
4
+ return typeof arg === "number" || isRamp(arg) ? { [key]: arg } : arg;
5
+ }
6
+ /**
7
+ * Immutable, chainable list of audio effects, applied in order (index 0
8
+ * closest to the source).
9
+ *
10
+ * @example
11
+ * const chain = AudioEffects.gain(1.5).lowpass(800).echo(0.3);
12
+ */
13
+ export class AudioEffectChain {
14
+ list;
15
+ constructor(list = []) {
16
+ this.list = list;
17
+ }
18
+ append(effect) {
19
+ return new AudioEffectChain([...this.list, effect]);
20
+ }
21
+ gain(options) {
22
+ const { value } = scalarParam(options, "value");
23
+ return this.append({ type: 'gain', value });
24
+ }
25
+ /** Alias for {@link gain}. */
26
+ volume(options) {
27
+ return this.gain(options);
28
+ }
29
+ /** Rolls off content below `frequency` Hz. */
30
+ highpass(options) {
31
+ const { frequency, q } = scalarParam(options, "frequency");
32
+ return this.append({ type: 'highpass', frequency, q });
33
+ }
34
+ /** Rolls off content above `frequency` Hz. */
35
+ lowpass(options) {
36
+ const { frequency, q } = scalarParam(options, "frequency");
37
+ return this.append({ type: 'lowpass', frequency, q });
38
+ }
39
+ /** A `rate` Hz wobble at `depth` (0–1). */
40
+ tremolo(options) {
41
+ const { rate, depth } = scalarParam(options, "rate");
42
+ return this.append({ type: 'tremolo', rate, depth: depth ?? 0.5 });
43
+ }
44
+ /** `delay` seconds, `feedback` 0–<1, optional wet `mix` 0–1. */
45
+ echo(options) {
46
+ const { delay, feedback, mix } = scalarParam(options, "delay");
47
+ return this.append({ type: 'echo', delay, feedback: feedback ?? 0.4, mix });
48
+ }
49
+ *[Symbol.iterator]() {
50
+ yield* this.list;
51
+ }
52
+ toJSON() {
53
+ return this.list;
54
+ }
55
+ }
56
+ /** An empty {@link AudioEffectChain}: `AudioEffects.gain(1.5)` is `new AudioEffectChain().gain(1.5)`. */
57
+ export const AudioEffects = new AudioEffectChain();
58
+ export function resolveAudioEffects(effects) {
59
+ if (effects === undefined)
60
+ return [];
61
+ if (effects instanceof AudioEffectChain)
62
+ return effects.list;
63
+ if (Array.isArray(effects))
64
+ return effects;
65
+ return [effects];
66
+ }
67
+ //# sourceMappingURL=chain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/audio/effects/chain.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,MAAM,SAAS,CAAC;AAgDxC,+GAA+G;AAC/G,SAAS,WAAW,CAAmB,GAAc,EAAE,GAAY;IAC/D,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAQ,CAAC,CAAC,CAAE,GAAS,CAAC;AACvF,CAAC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IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,gEAAgE;IAChE,IAAI,CAAC,OAAkC;QACnC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/D,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IAChF,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACd,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AAKD,yGAAyG;AACzG,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEnD,MAAM,UAAU,mBAAmB,CAAC,OAAsC;IACtE,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrC,IAAI,OAAO,YAAY,gBAAgB;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC7D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC","sourcesContent":["import { AudioEffect } from \"./union\";\r\nimport { Param, isRamp } from \"../ramp\";\r\n\r\n/**\r\n * Every builder takes one options object, and those with one dominant param\r\n * also take that param directly — a number or a {@link Ramp}, so\r\n * `AudioEffects.lowpass(ramp(8000, 400, 2))` works.\r\n */\r\n\r\n/** Gain. Param shorthand sets `value`. */\r\nexport interface GainEffectOptions {\r\n /** 1 = unchanged, 0 = silent, >1 = louder. */\r\n value: Param;\r\n}\r\n\r\n/** High-pass filter. Param shorthand sets `frequency`. */\r\nexport interface HighPassEffectOptions {\r\n /** Rolls off content below this frequency, in Hz. */\r\n frequency: Param;\r\n /** Resonance at the cutoff (default 1). */\r\n q?: Param;\r\n}\r\n\r\n/** Low-pass filter. Param shorthand sets `frequency`. */\r\nexport interface LowPassEffectOptions {\r\n /** Rolls off content above this frequency, in Hz. */\r\n frequency: Param;\r\n /** Resonance at the cutoff (default 1). */\r\n q?: Param;\r\n}\r\n\r\n/** Amplitude wobble. Param shorthand sets `rate`. */\r\nexport interface TremoloEffectOptions {\r\n /** Wobble rate in Hz. */\r\n rate: Param;\r\n /** Modulation depth, 0–1 (default 0.5). */\r\n depth?: Param;\r\n}\r\n\r\n/** Delay line with feedback. Param shorthand sets `delay`. */\r\nexport interface EchoEffectOptions {\r\n /** Delay time in seconds. */\r\n delay: Param;\r\n /** Feedback amount, 0–<1 (default 0.4). */\r\n feedback?: Param;\r\n /** Wet mix, 0–1 (default 0.5). */\r\n mix?: Param;\r\n}\r\n\r\n/** A ramp is an object too, so the shorthand test has to ask {@link isRamp}, or it reads as an options bag. */\r\nfunction scalarParam<O extends object>(arg: Param | O, key: keyof O): O {\r\n return typeof arg === \"number\" || isRamp(arg) ? ({ [key]: arg } as O) : (arg as O);\r\n}\r\n\r\n/**\r\n * Immutable, chainable list of audio effects, applied in order (index 0\r\n * closest to the source).\r\n *\r\n * @example\r\n * const chain = AudioEffects.gain(1.5).lowpass(800).echo(0.3);\r\n */\r\nexport class AudioEffectChain {\r\n constructor(public list: AudioEffect[] = []) { }\r\n\r\n private append(effect: AudioEffect): AudioEffectChain {\r\n return new AudioEffectChain([...this.list, effect]);\r\n }\r\n\r\n gain(options: Param | GainEffectOptions) {\r\n const { value } = scalarParam(options, \"value\");\r\n return this.append({ type: 'gain', value });\r\n }\r\n\r\n /** Alias for {@link gain}. */\r\n volume(options: Param | GainEffectOptions) {\r\n return this.gain(options);\r\n }\r\n\r\n /** Rolls off content below `frequency` Hz. */\r\n highpass(options: Param | HighPassEffectOptions) {\r\n const { frequency, q } = scalarParam(options, \"frequency\");\r\n return this.append({ type: 'highpass', frequency, q });\r\n }\r\n\r\n /** Rolls off content above `frequency` Hz. */\r\n lowpass(options: Param | LowPassEffectOptions) {\r\n const { frequency, q } = scalarParam(options, \"frequency\");\r\n return this.append({ type: 'lowpass', frequency, q });\r\n }\r\n\r\n /** A `rate` Hz wobble at `depth` (0–1). */\r\n tremolo(options: Param | TremoloEffectOptions) {\r\n const { rate, depth } = scalarParam(options, \"rate\");\r\n return this.append({ type: 'tremolo', rate, depth: depth ?? 0.5 });\r\n }\r\n\r\n /** `delay` seconds, `feedback` 0–<1, optional wet `mix` 0–1. */\r\n echo(options: Param | EchoEffectOptions) {\r\n const { delay, feedback, mix } = scalarParam(options, \"delay\");\r\n return this.append({ type: 'echo', delay, feedback: feedback ?? 0.4, mix });\r\n }\r\n\r\n *[Symbol.iterator]() {\r\n yield* this.list;\r\n }\r\n\r\n toJSON() {\r\n return this.list;\r\n }\r\n}\r\n\r\n/** What an `effects` prop accepts: one effect, a plain array, or a chain. */\r\nexport type AudioEffectsInput = AudioEffect[] | AudioEffectChain | AudioEffect;\r\n\r\n/** An empty {@link AudioEffectChain}: `AudioEffects.gain(1.5)` is `new AudioEffectChain().gain(1.5)`. */\r\nexport const AudioEffects = new AudioEffectChain();\r\n\r\nexport function resolveAudioEffects(effects: AudioEffectsInput | undefined): AudioEffect[] {\r\n if (effects === undefined) return [];\r\n if (effects instanceof AudioEffectChain) return effects.list;\r\n if (Array.isArray(effects)) return effects;\r\n return [effects];\r\n}\r\n"]}
@@ -0,0 +1,14 @@
1
+ import type { AudioEffectData } from "../registry.js";
2
+ import { Param } from "../../ramp.js";
3
+ /** Adds a delayed, fading repeat of the signal (a feedback echo / simple delay). */
4
+ export interface EchoEffect {
5
+ type: 'echo';
6
+ /** Delay before the first repeat, in seconds. May be a ramp. */
7
+ delay: Param;
8
+ /** Feedback amount, 0–<1. Each repeat is scaled by this; higher = more repeats. May be a ramp. */
9
+ feedback: Param;
10
+ /** Wet/dry mix, 0–1. 0 = dry only, 1 = full wet. Default 0.5. May be a ramp. */
11
+ mix?: Param;
12
+ }
13
+ export declare const echoEffect: AudioEffectData<EchoEffect>;
14
+ //# sourceMappingURL=echo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/echo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,EAA0B,MAAM,YAAY,CAAC;AAE3D,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,KAAK,EAAE,KAAK,CAAC;IACb,kGAAkG;IAClG,QAAQ,EAAE,KAAK,CAAC;IAChB,gFAAgF;IAChF,GAAG,CAAC,EAAE,KAAK,CAAC;CACf;AAED,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,UAAU,CASlD,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { lerpParam, equalsParam } from "../../ramp.js";
2
+ export const echoEffect = {
3
+ lerp: (from, to, t) => ({
4
+ type: "echo",
5
+ delay: lerpParam(from.delay, to.delay, t),
6
+ feedback: lerpParam(from.feedback, to.feedback, t),
7
+ mix: lerpParam(from.mix ?? 0.5, to.mix ?? 0.5, t),
8
+ }),
9
+ equals: (a, b) => equalsParam(a.delay, b.delay) && equalsParam(a.feedback, b.feedback) && equalsParam(a.mix ?? 0.5, b.mix ?? 0.5),
10
+ };
11
+ //# sourceMappingURL=echo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"echo.js","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/echo.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAa3D,MAAM,CAAC,MAAM,UAAU,GAAgC;IACnD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QACzC,QAAQ,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAClD,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;KACpD,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACb,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC;CACtH,CAAC","sourcesContent":["import type { AudioEffectData } from \"../registry\";\r\nimport { Param, lerpParam, equalsParam } from \"../../ramp\";\r\n\r\n/** Adds a delayed, fading repeat of the signal (a feedback echo / simple delay). */\r\nexport interface EchoEffect {\r\n type: 'echo';\r\n /** Delay before the first repeat, in seconds. May be a ramp. */\r\n delay: Param;\r\n /** Feedback amount, 0–<1. Each repeat is scaled by this; higher = more repeats. May be a ramp. */\r\n feedback: Param;\r\n /** Wet/dry mix, 0–1. 0 = dry only, 1 = full wet. Default 0.5. May be a ramp. */\r\n mix?: Param;\r\n}\r\n\r\nexport const echoEffect: AudioEffectData<EchoEffect> = {\r\n lerp: (from, to, t) => ({\r\n type: \"echo\",\r\n delay: lerpParam(from.delay, to.delay, t),\r\n feedback: lerpParam(from.feedback, to.feedback, t),\r\n mix: lerpParam(from.mix ?? 0.5, to.mix ?? 0.5, t),\r\n }),\r\n equals: (a, b) =>\r\n equalsParam(a.delay, b.delay) && equalsParam(a.feedback, b.feedback) && equalsParam(a.mix ?? 0.5, b.mix ?? 0.5),\r\n};\r\n"]}
@@ -0,0 +1,10 @@
1
+ import type { AudioEffectData } from "../registry.js";
2
+ import { Param } from "../../ramp.js";
3
+ /** Scales the clip's amplitude by a linear factor. */
4
+ export interface GainEffect {
5
+ type: 'gain';
6
+ /** Linear gain multiplier. 1 = unchanged, 0 = silent, >1 = louder. May be a ramp. */
7
+ value: Param;
8
+ }
9
+ export declare const gainEffect: AudioEffectData<GainEffect>;
10
+ //# sourceMappingURL=gain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gain.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/gain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,EAA0B,MAAM,YAAY,CAAC;AAE3D,sDAAsD;AACtD,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,UAAU,CAGlD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { lerpParam, equalsParam } from "../../ramp.js";
2
+ export const gainEffect = {
3
+ lerp: (from, to, t) => ({ type: "gain", value: lerpParam(from.value, to.value, t) }),
4
+ equals: (a, b) => equalsParam(a.value, b.value),
5
+ };
6
+ //# sourceMappingURL=gain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gain.js","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/gain.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAS3D,MAAM,CAAC,MAAM,UAAU,GAAgC;IACnD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC;IACpF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;CAClD,CAAC","sourcesContent":["import type { AudioEffectData } from \"../registry\";\r\nimport { Param, lerpParam, equalsParam } from \"../../ramp\";\r\n\r\n/** Scales the clip's amplitude by a linear factor. */\r\nexport interface GainEffect {\r\n type: 'gain';\r\n /** Linear gain multiplier. 1 = unchanged, 0 = silent, >1 = louder. May be a ramp. */\r\n value: Param;\r\n}\r\n\r\nexport const gainEffect: AudioEffectData<GainEffect> = {\r\n lerp: (from, to, t) => ({ type: \"gain\", value: lerpParam(from.value, to.value, t) }),\r\n equals: (a, b) => equalsParam(a.value, b.value),\r\n};\r\n"]}
@@ -0,0 +1,12 @@
1
+ import type { AudioEffectData } from "../registry.js";
2
+ import { Param } from "../../ramp.js";
3
+ /** Attenuates frequencies below `frequency`, passing the highs through. */
4
+ export interface HighPassEffect {
5
+ type: 'highpass';
6
+ /** Cutoff frequency in Hz. Content below this is rolled off. May be a ramp. */
7
+ frequency: Param;
8
+ /** Resonance (Q) at the cutoff. Default 1. May be a ramp. */
9
+ q?: Param;
10
+ }
11
+ export declare const highPassEffect: AudioEffectData<HighPassEffect>;
12
+ //# sourceMappingURL=highpass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highpass.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/highpass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,EAA0B,MAAM,YAAY,CAAC;AAE3D,2EAA2E;AAC3E,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,+EAA+E;IAC/E,SAAS,EAAE,KAAK,CAAC;IACjB,6DAA6D;IAC7D,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAED,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,cAAc,CAO1D,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { lerpParam, equalsParam } from "../../ramp.js";
2
+ export const highPassEffect = {
3
+ lerp: (from, to, t) => ({
4
+ type: "highpass",
5
+ frequency: lerpParam(from.frequency, to.frequency, t),
6
+ q: lerpParam(from.q ?? 1, to.q ?? 1, t),
7
+ }),
8
+ equals: (a, b) => equalsParam(a.frequency, b.frequency) && equalsParam(a.q ?? 1, b.q ?? 1),
9
+ };
10
+ //# sourceMappingURL=highpass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"highpass.js","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/highpass.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAW3D,MAAM,CAAC,MAAM,cAAc,GAAoC;IAC3D,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QACrD,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAC1C,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;CAC7F,CAAC","sourcesContent":["import type { AudioEffectData } from \"../registry\";\r\nimport { Param, lerpParam, equalsParam } from \"../../ramp\";\r\n\r\n/** Attenuates frequencies below `frequency`, passing the highs through. */\r\nexport interface HighPassEffect {\r\n type: 'highpass';\r\n /** Cutoff frequency in Hz. Content below this is rolled off. May be a ramp. */\r\n frequency: Param;\r\n /** Resonance (Q) at the cutoff. Default 1. May be a ramp. */\r\n q?: Param;\r\n}\r\n\r\nexport const highPassEffect: AudioEffectData<HighPassEffect> = {\r\n lerp: (from, to, t) => ({\r\n type: \"highpass\",\r\n frequency: lerpParam(from.frequency, to.frequency, t),\r\n q: lerpParam(from.q ?? 1, to.q ?? 1, t),\r\n }),\r\n equals: (a, b) => equalsParam(a.frequency, b.frequency) && equalsParam(a.q ?? 1, b.q ?? 1),\r\n};\r\n"]}
@@ -0,0 +1,12 @@
1
+ import type { AudioEffectData } from "../registry.js";
2
+ import { Param } from "../../ramp.js";
3
+ /** Attenuates frequencies above `frequency`, passing the lows through. */
4
+ export interface LowPassEffect {
5
+ type: 'lowpass';
6
+ /** Cutoff frequency in Hz. Content above this is rolled off. May be a ramp. */
7
+ frequency: Param;
8
+ /** Resonance (Q) at the cutoff. Default 1. May be a ramp. */
9
+ q?: Param;
10
+ }
11
+ export declare const lowPassEffect: AudioEffectData<LowPassEffect>;
12
+ //# sourceMappingURL=lowpass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lowpass.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/lowpass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,EAA0B,MAAM,YAAY,CAAC;AAE3D,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,+EAA+E;IAC/E,SAAS,EAAE,KAAK,CAAC;IACjB,6DAA6D;IAC7D,CAAC,CAAC,EAAE,KAAK,CAAC;CACb;AAED,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,aAAa,CAOxD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { lerpParam, equalsParam } from "../../ramp.js";
2
+ export const lowPassEffect = {
3
+ lerp: (from, to, t) => ({
4
+ type: "lowpass",
5
+ frequency: lerpParam(from.frequency, to.frequency, t),
6
+ q: lerpParam(from.q ?? 1, to.q ?? 1, t),
7
+ }),
8
+ equals: (a, b) => equalsParam(a.frequency, b.frequency) && equalsParam(a.q ?? 1, b.q ?? 1),
9
+ };
10
+ //# sourceMappingURL=lowpass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lowpass.js","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/lowpass.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAW3D,MAAM,CAAC,MAAM,aAAa,GAAmC;IACzD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,SAAS;QACf,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QACrD,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;KAC1C,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;CAC7F,CAAC","sourcesContent":["import type { AudioEffectData } from \"../registry\";\r\nimport { Param, lerpParam, equalsParam } from \"../../ramp\";\r\n\r\n/** Attenuates frequencies above `frequency`, passing the lows through. */\r\nexport interface LowPassEffect {\r\n type: 'lowpass';\r\n /** Cutoff frequency in Hz. Content above this is rolled off. May be a ramp. */\r\n frequency: Param;\r\n /** Resonance (Q) at the cutoff. Default 1. May be a ramp. */\r\n q?: Param;\r\n}\r\n\r\nexport const lowPassEffect: AudioEffectData<LowPassEffect> = {\r\n lerp: (from, to, t) => ({\r\n type: \"lowpass\",\r\n frequency: lerpParam(from.frequency, to.frequency, t),\r\n q: lerpParam(from.q ?? 1, to.q ?? 1, t),\r\n }),\r\n equals: (a, b) => equalsParam(a.frequency, b.frequency) && equalsParam(a.q ?? 1, b.q ?? 1),\r\n};\r\n"]}
@@ -0,0 +1,12 @@
1
+ import type { AudioEffectData } from "../registry.js";
2
+ import { Param } from "../../ramp.js";
3
+ /** Modulates the clip's amplitude with a low-frequency oscillator for a wobble effect. */
4
+ export interface TremoloEffect {
5
+ type: 'tremolo';
6
+ /** Modulation rate in Hz (how fast the volume pulses). May be a ramp. */
7
+ rate: Param;
8
+ /** Modulation depth, 0–1. 0 = no effect, 1 = full dips to silence. May be a ramp. */
9
+ depth: Param;
10
+ }
11
+ export declare const tremoloEffect: AudioEffectData<TremoloEffect>;
12
+ //# sourceMappingURL=tremolo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tremolo.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/tremolo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,EAA0B,MAAM,YAAY,CAAC;AAE3D,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,yEAAyE;IACzE,IAAI,EAAE,KAAK,CAAC;IACZ,qFAAqF;IACrF,KAAK,EAAE,KAAK,CAAC;CAChB;AAED,eAAO,MAAM,aAAa,EAAE,eAAe,CAAC,aAAa,CAOxD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { lerpParam, equalsParam } from "../../ramp.js";
2
+ export const tremoloEffect = {
3
+ lerp: (from, to, t) => ({
4
+ type: "tremolo",
5
+ rate: lerpParam(from.rate, to.rate, t),
6
+ depth: lerpParam(from.depth, to.depth, t),
7
+ }),
8
+ equals: (a, b) => equalsParam(a.rate, b.rate) && equalsParam(a.depth, b.depth),
9
+ };
10
+ //# sourceMappingURL=tremolo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tremolo.js","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/tremolo.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAW3D,MAAM,CAAC,MAAM,aAAa,GAAmC;IACzD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;QACtC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;KAC5C,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;CACjF,CAAC","sourcesContent":["import type { AudioEffectData } from \"../registry\";\r\nimport { Param, lerpParam, equalsParam } from \"../../ramp\";\r\n\r\n/** Modulates the clip's amplitude with a low-frequency oscillator for a wobble effect. */\r\nexport interface TremoloEffect {\r\n type: 'tremolo';\r\n /** Modulation rate in Hz (how fast the volume pulses). May be a ramp. */\r\n rate: Param;\r\n /** Modulation depth, 0–1. 0 = no effect, 1 = full dips to silence. May be a ramp. */\r\n depth: Param;\r\n}\r\n\r\nexport const tremoloEffect: AudioEffectData<TremoloEffect> = {\r\n lerp: (from, to, t) => ({\r\n type: \"tremolo\",\r\n rate: lerpParam(from.rate, to.rate, t),\r\n depth: lerpParam(from.depth, to.depth, t),\r\n }),\r\n equals: (a, b) => equalsParam(a.rate, b.rate) && equalsParam(a.depth, b.depth),\r\n};\r\n"]}
@@ -0,0 +1,12 @@
1
+ export type { GainEffect } from './implementations/gain.js';
2
+ export type { HighPassEffect } from './implementations/highpass.js';
3
+ export type { LowPassEffect } from './implementations/lowpass.js';
4
+ export type { TremoloEffect } from './implementations/tremolo.js';
5
+ export type { EchoEffect } from './implementations/echo.js';
6
+ export { AudioEffects, AudioEffectChain, resolveAudioEffects } from './chain.js';
7
+ export type { AudioEffectsInput, GainEffectOptions, HighPassEffectOptions, LowPassEffectOptions, TremoloEffectOptions, EchoEffectOptions, } from './chain.js';
8
+ export type { AudioEffect } from './union.js';
9
+ export { effectsKey } from './union.js';
10
+ export { AudioEffectRegistry, audioEffectsOps } from './registry.js';
11
+ export type { AudioEffectData } from './registry.js';
12
+ //# sourceMappingURL=index.d.ts.map