@woosh/meep-engine 3.45.0 → 3.47.0

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 (435) hide show
  1. package/build/bundle-worker-terrain.js +1 -1
  2. package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
  3. package/editor/actions/concrete/TransformModifyAction.js +10 -2
  4. package/editor/ecs/component/FieldDescriptor.js +15 -0
  5. package/editor/ecs/component/createObjectEditor.js +41 -12
  6. package/editor/ecs/component/editors/ecs/Transform64Editor.d.ts.map +1 -1
  7. package/editor/ecs/component/editors/ecs/Transform64Editor.js +77 -70
  8. package/editor/tools/TransformToolV2.d.ts.map +1 -1
  9. package/editor/tools/TransformToolV2.js +4 -0
  10. package/editor/tools/v2/TransformControls.d.ts.map +1 -1
  11. package/editor/tools/v2/TransformControls.js +7 -0
  12. package/editor/view/ecs/EntityEditor.d.ts.map +1 -1
  13. package/editor/view/ecs/EntityEditor.js +4 -2
  14. package/package.json +1 -1
  15. package/src/core/assert.d.ts.map +1 -1
  16. package/src/core/assert.js +5 -1
  17. package/src/core/binary/hash/XXH128Hash.d.ts +1 -37
  18. package/src/core/binary/hash/XXH128Hash.d.ts.map +1 -1
  19. package/src/core/binary/hash/XXH128Hash.js +4 -55
  20. package/src/core/binary/hash/XXH3_SECRET.d.ts +1 -12
  21. package/src/core/binary/hash/XXH3_SECRET.d.ts.map +1 -1
  22. package/src/core/binary/hash/XXH3_SECRET.js +4 -25
  23. package/src/core/binary/hash/crc32.d.ts +1 -15
  24. package/src/core/binary/hash/crc32.d.ts.map +1 -1
  25. package/src/core/binary/hash/crc32.js +4 -96
  26. package/src/core/binary/hash/xxh3_128.d.ts +1 -9
  27. package/src/core/binary/hash/xxh3_128.d.ts.map +1 -1
  28. package/src/core/binary/hash/xxh3_128.js +4 -341
  29. package/src/core/binary/hash/xxh3_64.d.ts +1 -8
  30. package/src/core/binary/hash/xxh3_64.d.ts.map +1 -1
  31. package/src/core/binary/hash/xxh3_64.js +4 -241
  32. package/src/core/binary/hash/xxh3_common.d.ts +1 -223
  33. package/src/core/binary/hash/xxh3_common.d.ts.map +1 -1
  34. package/src/core/binary/hash/xxh3_common.js +90 -476
  35. package/src/core/collection/array/array_insert_at.d.ts +16 -0
  36. package/src/core/collection/array/array_insert_at.d.ts.map +1 -0
  37. package/src/core/collection/array/array_insert_at.js +32 -0
  38. package/src/core/collection/array/array_remove_at.d.ts +15 -0
  39. package/src/core/collection/array/array_remove_at.d.ts.map +1 -0
  40. package/src/core/collection/array/array_remove_at.js +30 -0
  41. package/src/core/collection/array/combine_hash.d.ts +6 -0
  42. package/src/core/collection/array/combine_hash.d.ts.map +1 -1
  43. package/src/core/collection/array/combine_hash.js +6 -0
  44. package/src/core/function/FunctionCompiler.js +2 -2
  45. package/src/core/geom/3d/mat4/m4_multiply.d.ts +3 -0
  46. package/src/core/geom/3d/mat4/m4_multiply.d.ts.map +1 -1
  47. package/src/core/geom/3d/mat4/m4_multiply.js +3 -0
  48. package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts +30 -0
  49. package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts.map +1 -0
  50. package/src/core/geom/3d/mat4/m4_multiply_f64.js +106 -0
  51. package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts +37 -0
  52. package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts.map +1 -0
  53. package/src/core/geom/3d/quaternion/quat3_look_rotation.js +172 -0
  54. package/src/core/geom/ConicRay.js +2 -2
  55. package/src/core/geom/Quaternion.d.ts +1 -0
  56. package/src/core/geom/Quaternion.d.ts.map +1 -1
  57. package/src/core/geom/Quaternion.js +12 -48
  58. package/src/core/geom/Vector4.d.ts.map +1 -1
  59. package/src/core/geom/Vector4.js +8 -5
  60. package/src/core/math/hash/XXH128Hash.d.ts +38 -0
  61. package/src/core/math/hash/XXH128Hash.d.ts.map +1 -0
  62. package/src/core/math/hash/XXH128Hash.js +55 -0
  63. package/src/core/math/hash/XXH3_SECRET.d.ts +13 -0
  64. package/src/core/math/hash/XXH3_SECRET.d.ts.map +1 -0
  65. package/src/core/math/hash/XXH3_SECRET.js +25 -0
  66. package/src/core/math/hash/crc32.d.ts +16 -0
  67. package/src/core/math/hash/crc32.d.ts.map +1 -0
  68. package/src/core/math/hash/crc32.js +96 -0
  69. package/src/core/math/hash/xxh3_128.d.ts +10 -0
  70. package/src/core/math/hash/xxh3_128.d.ts.map +1 -0
  71. package/src/core/math/hash/xxh3_128.js +341 -0
  72. package/src/core/math/hash/xxh3_64.d.ts +9 -0
  73. package/src/core/math/hash/xxh3_64.d.ts.map +1 -0
  74. package/src/core/math/hash/xxh3_64.js +241 -0
  75. package/src/core/math/hash/xxh3_common.d.ts +224 -0
  76. package/src/core/math/hash/xxh3_common.d.ts.map +1 -0
  77. package/src/core/math/hash/xxh3_common.js +476 -0
  78. package/src/core/math/lookup/ParameterLookupTable.js +2 -2
  79. package/src/core/model/node-graph/node/NodeInstancePortReference.js +2 -2
  80. package/src/core/model/reactive/model/ReactiveBinaryExpression.js +2 -2
  81. package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -2
  82. package/src/engine/Engine.d.ts.map +1 -1
  83. package/src/engine/Engine.js +9 -4
  84. package/src/engine/asset/AssetDescription.js +2 -2
  85. package/src/engine/ecs/animation/Animation.js +2 -2
  86. package/src/engine/ecs/animation/AnimationClip.d.ts.map +1 -1
  87. package/src/engine/ecs/animation/AnimationClip.js +7 -5
  88. package/src/engine/ecs/gui/GUIElement.d.ts.map +1 -1
  89. package/src/engine/ecs/gui/GUIElement.js +7 -5
  90. package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +2 -2
  91. package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
  92. package/src/engine/ecs/gui/position/ViewportPosition.js +11 -7
  93. package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
  94. package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +10 -0
  95. package/src/engine/ecs/transform/Transform64.d.ts +1 -1
  96. package/src/engine/ecs/transform/Transform64.d.ts.map +1 -1
  97. package/src/engine/ecs/transform/Transform64.js +5 -4
  98. package/src/engine/ecs/transform/t64_look_rotation.d.ts +4 -4
  99. package/src/engine/ecs/transform/t64_look_rotation.d.ts.map +1 -1
  100. package/src/engine/ecs/transform/t64_look_rotation.js +7 -18
  101. package/src/engine/graphics/ecs/animation/animator/AnimationClip.d.ts.map +1 -1
  102. package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +8 -5
  103. package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -2
  104. package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -2
  105. package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -2
  106. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -2
  107. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +2 -2
  108. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.d.ts.map +1 -1
  109. package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +8 -5
  110. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts.map +1 -1
  111. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +30 -1
  112. package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
  113. package/src/engine/graphics/ecs/decal/v2/Decal.js +9 -8
  114. package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.d.ts.map +1 -1
  115. package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.js +9 -6
  116. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +6 -0
  117. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  118. package/src/engine/graphics3/GPUParticleEmitterSystem.js +72 -29
  119. package/src/engine/graphics3/ParticipatingMedia.js +204 -204
  120. package/src/engine/graphics3/animation/AnimationClips.d.ts +5 -0
  121. package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -1
  122. package/src/engine/graphics3/animation/AnimationClips.js +5 -0
  123. package/src/engine/grid/obstacle/GridObstacle.js +2 -2
  124. package/src/engine/input/devices/KeyboardDevice.d.ts +1 -0
  125. package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
  126. package/src/engine/input/devices/KeyboardDevice.js +7 -6
  127. package/src/engine/intelligence/behavior/selector/WeightedElement.js +2 -2
  128. package/src/engine/interpolation/Interpolated.js +2 -2
  129. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
  130. package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +15 -2
  131. package/src/engine/network/CONGESTION_CONTROL.md +9 -9
  132. package/src/engine/network/MESSAGE_TRANSPORT.md +364 -0
  133. package/src/engine/network/NetworkSession.d.ts +31 -11
  134. package/src/engine/network/NetworkSession.d.ts.map +1 -1
  135. package/src/engine/network/NetworkSession.js +453 -286
  136. package/src/engine/network/README.md +77 -27
  137. package/src/engine/network/SMOOTHNESS_DESIGN.md +13 -5
  138. package/src/engine/network/diagnostics/BandwidthMeter.d.ts +1 -1
  139. package/src/engine/network/diagnostics/BandwidthMeter.js +1 -1
  140. package/src/engine/network/orchestrator/HostJoin.d.ts +111 -0
  141. package/src/engine/network/orchestrator/HostJoin.d.ts.map +1 -0
  142. package/src/engine/network/orchestrator/HostJoin.js +271 -0
  143. package/src/engine/network/orchestrator/NetworkPeer.d.ts +151 -112
  144. package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
  145. package/src/engine/network/orchestrator/NetworkPeer.js +450 -499
  146. package/src/engine/network/orchestrator/PendingSlices.d.ts +30 -0
  147. package/src/engine/network/orchestrator/PendingSlices.d.ts.map +1 -0
  148. package/src/engine/network/orchestrator/PendingSlices.js +83 -0
  149. package/src/engine/network/orchestrator/ReliableFrames.d.ts +34 -0
  150. package/src/engine/network/orchestrator/ReliableFrames.d.ts.map +1 -0
  151. package/src/engine/network/orchestrator/ReliableFrames.js +96 -0
  152. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +77 -10
  153. package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
  154. package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +236 -61
  155. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +20 -6
  156. package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
  157. package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +33 -8
  158. package/src/engine/network/replication/Replicator.d.ts.map +1 -1
  159. package/src/engine/network/replication/Replicator.js +7 -1
  160. package/src/engine/network/sim/ActionLog.d.ts +32 -5
  161. package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
  162. package/src/engine/network/sim/ActionLog.js +47 -5
  163. package/src/engine/network/sim/SimActionExecutor.d.ts +42 -2
  164. package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
  165. package/src/engine/network/sim/SimActionExecutor.js +100 -4
  166. package/src/engine/network/sim/Snapshotter.d.ts +12 -0
  167. package/src/engine/network/sim/Snapshotter.d.ts.map +1 -1
  168. package/src/engine/network/sim/Snapshotter.js +43 -0
  169. package/src/engine/network/state/Baseline.d.ts +1 -1
  170. package/src/engine/network/state/Baseline.js +1 -1
  171. package/src/engine/network/state/FrameBufferRing.d.ts +25 -6
  172. package/src/engine/network/state/FrameBufferRing.d.ts.map +1 -1
  173. package/src/engine/network/state/FrameBufferRing.js +51 -6
  174. package/src/engine/network/state/InputRing.d.ts +4 -0
  175. package/src/engine/network/state/InputRing.d.ts.map +1 -1
  176. package/src/engine/network/state/InputRing.js +7 -0
  177. package/src/engine/network/transport/DeferredTransport.d.ts.map +1 -1
  178. package/src/engine/network/transport/DeferredTransport.js +1 -0
  179. package/src/engine/network/transport/LoopbackTransport.d.ts.map +1 -1
  180. package/src/engine/network/transport/LoopbackTransport.js +4 -2
  181. package/src/engine/network/transport/Transport.d.ts +7 -0
  182. package/src/engine/network/transport/Transport.d.ts.map +1 -1
  183. package/src/engine/network/transport/Transport.js +8 -0
  184. package/src/engine/network/transport/adapters/NodeUDPTransport.d.ts.map +1 -1
  185. package/src/engine/network/transport/adapters/NodeUDPTransport.js +20 -5
  186. package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.d.ts.map +1 -1
  187. package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.js +8 -0
  188. package/src/engine/network/transport/adapters/WebTransportTransport.d.ts.map +1 -1
  189. package/src/engine/network/transport/adapters/WebTransportTransport.js +6 -0
  190. package/src/engine/network/transport/connection/Connection.d.ts +191 -0
  191. package/src/engine/network/transport/connection/Connection.d.ts.map +1 -0
  192. package/src/engine/network/transport/connection/Connection.js +1262 -0
  193. package/src/engine/network/transport/connection/RangeSet.d.ts +94 -0
  194. package/src/engine/network/transport/connection/RangeSet.d.ts.map +1 -0
  195. package/src/engine/network/transport/connection/RangeSet.js +260 -0
  196. package/src/engine/network/transport/connection/RxStream.d.ts +48 -0
  197. package/src/engine/network/transport/connection/RxStream.d.ts.map +1 -0
  198. package/src/engine/network/transport/connection/RxStream.js +211 -0
  199. package/src/engine/network/transport/connection/TxStream.d.ts +90 -0
  200. package/src/engine/network/transport/connection/TxStream.d.ts.map +1 -0
  201. package/src/engine/network/transport/connection/TxStream.js +243 -0
  202. package/src/engine/network/transport/connection/bytes_copy.d.ts +17 -0
  203. package/src/engine/network/transport/connection/bytes_copy.d.ts.map +1 -0
  204. package/src/engine/network/transport/connection/bytes_copy.js +34 -0
  205. package/src/engine/network/transport/connection/varint.d.ts +46 -0
  206. package/src/engine/network/transport/connection/varint.d.ts.map +1 -0
  207. package/src/engine/network/transport/connection/varint.js +107 -0
  208. package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
  209. package/src/engine/physics/cloth/ecs/Cloth.js +7 -5
  210. package/src/engine/physics/cloth/ecs/ClothCollider.d.ts.map +1 -1
  211. package/src/engine/physics/cloth/ecs/ClothCollider.js +7 -5
  212. package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts.map +1 -1
  213. package/src/engine/physics/cloth/ecs/ClothDynamics.js +20 -11
  214. package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
  215. package/src/engine/physics/fluid/FluidField.js +7 -5
  216. package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -1
  217. package/src/engine/physics/fluid/ecs/FluidComponent.js +19 -11
  218. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  219. package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +2 -2
  220. package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +2 -2
  221. package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
  222. package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +11 -7
  223. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
  224. package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +11 -7
  225. package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
  226. package/src/engine/physics/fluid/effector/WakeFluidEffector.js +16 -9
  227. package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +38 -7
  228. package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
  229. package/src/engine/sound/ecs/audio/AudioEmitter.js +47 -14
  230. package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.d.ts.map +1 -1
  231. package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.js +5 -1
  232. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts +18 -0
  233. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts.map +1 -0
  234. package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.js +48 -0
  235. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +12 -2
  236. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
  237. package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +173 -9
  238. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +9 -3
  239. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
  240. package/src/engine/sound/ecs/audio/LiveEmitterSet.js +28 -8
  241. package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts +8 -0
  242. package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
  243. package/src/engine/sound/ecs/trigger/AudioEventTrigger.js +192 -191
  244. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.d.ts.map +1 -1
  245. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.js +5 -1
  246. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts +18 -0
  247. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts.map +1 -0
  248. package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.js +51 -0
  249. package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.d.ts.map +1 -1
  250. package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.js +15 -1
  251. package/src/engine/sound/simulation/core/AcousticMedium.js +2 -2
  252. package/src/engine/sound/simulation/definition/AcousticDirectivity.js +2 -2
  253. package/src/engine/sound/simulation/definition/AcousticMaterial.d.ts.map +1 -1
  254. package/src/engine/sound/simulation/definition/AcousticMaterial.js +11 -7
  255. package/src/engine/sound/sopra/README.md +768 -644
  256. package/src/engine/sound/sopra/SopraEngine.d.ts +104 -8
  257. package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -1
  258. package/src/engine/sound/sopra/SopraEngine.js +327 -12
  259. package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -1
  260. package/src/engine/sound/sopra/definition/BusDefinition.js +5 -4
  261. package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -1
  262. package/src/engine/sound/sopra/definition/DuckingRule.js +7 -5
  263. package/src/engine/sound/sopra/definition/EventDescription.d.ts +28 -2
  264. package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
  265. package/src/engine/sound/sopra/definition/EventDescription.js +77 -17
  266. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +10 -0
  267. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -1
  268. package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +77 -55
  269. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts +31 -0
  270. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts.map +1 -0
  271. package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.js +75 -0
  272. package/src/engine/sound/sopra/definition/MixerSnapshot.js +2 -2
  273. package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -1
  274. package/src/engine/sound/sopra/definition/ParameterDefinition.js +7 -5
  275. package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +2 -2
  276. package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
  277. package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +4 -3
  278. package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +2 -2
  279. package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +3 -3
  280. package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
  281. package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +16 -9
  282. package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +2 -2
  283. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -1
  284. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
  285. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +2 -2
  286. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +38 -9
  287. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -1
  288. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +34 -5
  289. package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +7 -2
  290. package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
  291. package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +137 -120
  292. package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +3 -1
  293. package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
  294. package/src/engine/sound/sopra/definition/effect/EqEffect.js +146 -128
  295. package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +1 -0
  296. package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -1
  297. package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +8 -3
  298. package/src/engine/sound/sopra/legacy/SoundEmitter.d.ts.map +1 -1
  299. package/src/engine/sound/sopra/legacy/SoundEmitter.js +357 -352
  300. package/src/engine/sound/sopra/legacy/SoundTrack.d.ts.map +1 -1
  301. package/src/engine/sound/sopra/legacy/SoundTrack.js +281 -278
  302. package/src/engine/sound/sopra/runtime/BusGraph.d.ts +44 -2
  303. package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
  304. package/src/engine/sound/sopra/runtime/BusGraph.js +83 -43
  305. package/src/engine/sound/sopra/runtime/EffectChain.d.ts +96 -0
  306. package/src/engine/sound/sopra/runtime/EffectChain.d.ts.map +1 -0
  307. package/src/engine/sound/sopra/runtime/EffectChain.js +286 -0
  308. package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts +123 -0
  309. package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts.map +1 -0
  310. package/src/engine/sound/sopra/runtime/EffectParamOverrides.js +320 -0
  311. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +55 -5
  312. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  313. package/src/engine/sound/sopra/runtime/EventInstance.js +201 -26
  314. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +2 -1
  315. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -1
  316. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +6 -1
  317. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +15 -0
  318. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -1
  319. package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +32 -0
  320. package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -1
  321. package/src/engine/sound/sopra/util/MockAudioContext.js +3 -0
  322. package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +13 -3
  323. package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -1
  324. package/src/engine/sound/sopra/util/fadeOutAndStop.js +25 -13
  325. package/src/format/image/png/PNGReader.js +644 -644
  326. package/src/format/image/png/crc32.d.ts +1 -1
  327. package/src/format/image/png/crc32.js +7 -8
  328. package/src/shade/RENDERER_CONTRACT.md +6 -3
  329. package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +2 -2
  330. package/src/shade/descriptor/binding/BindGroupLayoutEntry.d.ts.map +1 -1
  331. package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +12 -8
  332. package/src/shade/descriptor/binding/StorageTextureBindingLayout.js +2 -2
  333. package/src/shade/descriptor/binding/TextureBindingLayout.js +2 -2
  334. package/src/shade/descriptor/blend/BlendComponent.js +2 -2
  335. package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +2 -2
  336. package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +2 -2
  337. package/src/shade/descriptor/pipeline/ProgrammableStage.js +2 -2
  338. package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +2 -2
  339. package/src/shade/descriptor/pipeline/render/ColorTargetState.js +2 -2
  340. package/src/shade/descriptor/pipeline/render/FragmentState.js +2 -2
  341. package/src/shade/descriptor/pipeline/render/PrimitiveState.js +2 -2
  342. package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.d.ts.map +1 -1
  343. package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +8 -5
  344. package/src/shade/descriptor/pipeline/render/VertexAttribute.js +2 -2
  345. package/src/shade/descriptor/texture/SamplerDescriptor.d.ts.map +1 -1
  346. package/src/shade/descriptor/texture/SamplerDescriptor.js +20 -12
  347. package/src/shade/descriptor/texture/TextureDescriptor.d.ts.map +1 -1
  348. package/src/shade/descriptor/texture/TextureDescriptor.js +11 -7
  349. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts +24 -0
  350. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -0
  351. package/src/shade/device/SHADE_DEVICE_FLOOR.js +34 -0
  352. package/src/shade/device/ShadeDeviceFailure.d.ts +12 -5
  353. package/src/shade/device/ShadeDeviceFailure.d.ts.map +1 -1
  354. package/src/shade/device/ShadeDeviceFailure.js +17 -8
  355. package/src/shade/device/ShadeDeviceFailureReason.d.ts +1 -1
  356. package/src/shade/device/ShadeDeviceFailureReason.js +2 -2
  357. package/src/shade/device/graph/BufferResourceDescriptor.d.ts.map +1 -1
  358. package/src/shade/device/graph/BufferResourceDescriptor.js +196 -193
  359. package/src/shade/device/graph/TextureResourceDescriptor.d.ts.map +1 -1
  360. package/src/shade/device/graph/TextureResourceDescriptor.js +178 -173
  361. package/src/shade/device/shade_device_floor_unmet.d.ts +13 -0
  362. package/src/shade/device/shade_device_floor_unmet.d.ts.map +1 -0
  363. package/src/shade/device/shade_device_floor_unmet.js +32 -0
  364. package/src/shade/device/timing/profile/sgpt_read_header.js +1 -1
  365. package/src/shade/device/timing/profile/sgpt_read_records.js +1 -1
  366. package/src/shade/device/timing/profile/sgpt_write_header.js +1 -1
  367. package/src/shade/device/timing/profile/sgpt_write_record.js +1 -1
  368. package/src/shade/renderer/Renderer.d.ts +2 -0
  369. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  370. package/src/shade/renderer/Renderer.js +29 -55
  371. package/src/shade/renderer/binding/BufferBinding.js +2 -2
  372. package/src/shade/renderer/buffer/GPUBufferAllocator.d.ts.map +1 -1
  373. package/src/shade/renderer/buffer/GPUBufferAllocator.js +9 -0
  374. package/src/shade/renderer/buffer/buffer_pool_ops.d.ts +21 -12
  375. package/src/shade/renderer/buffer/buffer_pool_ops.d.ts.map +1 -1
  376. package/src/shade/renderer/buffer/buffer_pool_ops.js +18 -19
  377. package/src/shade/renderer/camera/Camera.js +2 -2
  378. package/src/shade/renderer/geometry/Attribute.js +2 -2
  379. package/src/shade/renderer/geometry/Geometry.js +2 -2
  380. package/src/shade/renderer/geometry/geometry_deduplicate_vertices.js +2 -2
  381. package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +2 -2
  382. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.js +13 -13
  383. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_directory_block_checksum.js +41 -41
  384. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.js +41 -41
  385. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.js +25 -25
  386. package/src/shade/renderer/gpu_primitive/test/gpu_test.d.ts.map +1 -1
  387. package/src/shade/renderer/gpu_primitive/test/gpu_test.js +8 -11
  388. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  389. package/src/shade/renderer/material/StandardShadeMaterial.d.ts.map +1 -1
  390. package/src/shade/renderer/material/StandardShadeMaterial.js +13 -8
  391. package/src/shade/renderer/pool/TransientResourcePool.d.ts +24 -0
  392. package/src/shade/renderer/pool/TransientResourcePool.d.ts.map +1 -1
  393. package/src/shade/renderer/pool/TransientResourcePool.js +41 -10
  394. package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.d.ts.map +1 -1
  395. package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js +14 -5
  396. package/src/shade/renderer/scene/optimization/sampler2d_from_image_bitmap.js +1 -1
  397. package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
  398. package/src/shade/renderer/shader/ComputeShader.js +18 -2
  399. package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
  400. package/src/shade/renderer/shader/ImageShader.js +230 -218
  401. package/src/shade/renderer/shader/type/WGSLStructField.js +2 -2
  402. package/src/shade/renderer/shader/type/WebGPUArray.js +2 -2
  403. package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
  404. package/src/shade/renderer/shader/type/WebGPUStruct.js +9 -6
  405. package/src/shade/renderer/texture/ShadeTexture.d.ts.map +1 -1
  406. package/src/shade/renderer/texture/ShadeTexture.js +17 -10
  407. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +2 -2
  408. package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -4
  409. package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +6 -6
  410. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  411. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +46 -55
  412. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts +3 -3
  413. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
  414. package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +14 -4
  415. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +10 -1
  416. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  417. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +82 -40
  418. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +4 -1
  419. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
  420. package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +8 -4
  421. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +98 -86
  422. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
  423. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +440 -298
  424. package/src/view/common/HTMLElementCacheKey.d.ts.map +1 -1
  425. package/src/view/common/HTMLElementCacheKey.js +4 -3
  426. package/src/view/graphics/GraphicsContextFailureView.d.ts +1 -2
  427. package/src/view/graphics/GraphicsContextFailureView.d.ts.map +1 -1
  428. package/src/view/graphics/GraphicsContextFailureView.js +1 -2
  429. package/src/view/minimap/MinimapMarker.js +2 -2
  430. package/src/engine/network/transport/Channel.js +0 -336
  431. package/src/engine/network/transport/ReliableCommandPipeline.js +0 -335
  432. package/src/engine/network/transport/fragments/FragmentAssembler.js +0 -350
  433. package/src/engine/network/transport/fragments/FragmentRetention.js +0 -191
  434. package/src/engine/network/transport/fragments/fragment_send.js +0 -157
  435. package/src/engine/network/transport/fragments/packet_size.js +0 -107
@@ -2,6 +2,7 @@ import Signal from "../../../../core/events/signal/Signal.js";
2
2
  import { dB2Volume } from "../../dB2Volume.js";
3
3
  import { FADE_EPSILON, rampGain } from "../util/fadeOutAndStop.js";
4
4
  import { SOPRA_PANNING_MODEL_TO_WEBAUDIO, SopraPanningModel } from "../definition/SopraPanningModel.js";
5
+ import { EffectChain } from "./EffectChain.js";
5
6
  import { VOICE_POOL } from "./VoicePool.js";
6
7
  import { LOW_MID_HZ, MID_HIGH_HZ } from "../../simulation/render/reverbImpulseResponse.js";
7
8
  import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
@@ -185,11 +186,20 @@ export class EventInstance {
185
186
  #selfReleases = false;
186
187
 
187
188
  /**
188
- * Node that voices route into: the instance's attenuation gain (3D) or the bus input (2D).
189
+ * Node that voices route into: the head of the event's inserts, or the instance gain when it has none.
189
190
  * @type {AudioNode|null}
190
191
  */
191
192
  #chainHead = null;
192
193
 
194
+ /**
195
+ * This instance's own copy of the event's insert effects ({@link EventDescription.effects}), ahead of
196
+ * its fader. Built with the instance — before its buffers arrive — so its parameters can be moved from
197
+ * the moment `playEvent` returns, by {@link setEffectParam} / {@link approachEffectParam}. Null when the
198
+ * event has no inserts.
199
+ * @type {EffectChain|null}
200
+ */
201
+ #effects = null;
202
+
193
203
  /**
194
204
  * @type {GainNode|null}
195
205
  */
@@ -201,7 +211,7 @@ export class EventInstance {
201
211
  #panner = null;
202
212
 
203
213
  /**
204
- * Always-on per-instance trim gain — the chain head ALL voices route through (2D and 3D). Carries
214
+ * Always-on per-instance trim gain — the fader ALL voices route through (2D and 3D), after the inserts. Carries
205
215
  * the live instance volume (setGainDb / fades); composes (multiplies) with #attenuationGain in 3D.
206
216
  * @type {GainNode|null}
207
217
  */
@@ -247,6 +257,34 @@ export class EventInstance {
247
257
  */
248
258
  #audible = true;
249
259
 
260
+ /**
261
+ * Whether {@link position} was written since the panner last took it, as {@link moved} reports. True
262
+ * from the start, so the first update places the source.
263
+ * @type {boolean}
264
+ */
265
+ #source_moved = true;
266
+
267
+ /**
268
+ * The {@link SopraEngine#listenerVersion} this instance was last attenuated against; -1 = never.
269
+ * @type {number}
270
+ */
271
+ #listener_version = -1;
272
+
273
+ /**
274
+ * What the panner and the attenuation gain were last handed, NaN until they are. A transform
275
+ * announces any write — a rotation in place included — and a listener turning on the spot is a
276
+ * listener move too; neither changes what these hold, and a Web Audio write is not cheap, so each is
277
+ * compared before it is made.
278
+ * @type {number}
279
+ */
280
+ #written_x = NaN;
281
+ /** @type {number} */
282
+ #written_y = NaN;
283
+ /** @type {number} */
284
+ #written_z = NaN;
285
+ /** @type {number} */
286
+ #written_gain = NaN;
287
+
250
288
  /**
251
289
  * Logical start timestamp (audio clock). When set, the playhead is `now - startTime` from the
252
290
  * outset, so a promoted emitter resumes at the phase it "should" be at given elapsed real time
@@ -325,8 +363,14 @@ export class EventInstance {
325
363
  this.busId = busId;
326
364
 
327
365
  /**
328
- * World position for spatialization. Null = non-positional.
329
- * @type {Vector3|null}
366
+ * World position for spatialization, read by index. Null = non-positional.
367
+ *
368
+ * Held by reference, not copied, and read when the instance starts, after {@link moved}, and
369
+ * whenever the listener moves ({@link SopraEngine#setListener}). So whoever writes it says so with
370
+ * {@link moved}; a source written without saying so keeps sounding where it last was. Give each
371
+ * instance an array of its own: every instance reads the one it holds, so instances sharing one
372
+ * are all wherever it was last written. (The acoustic simulation reads it afresh on each solve.)
373
+ * @type {ArrayLike<number>|null}
330
374
  */
331
375
  this.position = position;
332
376
 
@@ -368,6 +412,10 @@ export class EventInstance {
368
412
  this.#pathing = pathing;
369
413
 
370
414
  this.sourceRadius = sourceRadius;
415
+
416
+ if (description.effects.length > 0) {
417
+ this.#effects = new EffectChain(engine.audioContext, description.effects);
418
+ }
371
419
  }
372
420
 
373
421
  /**
@@ -483,7 +531,7 @@ export class EventInstance {
483
531
  this.#buildOutputChain();
484
532
 
485
533
  // initial evaluation at the start time (spawns leaves due immediately, if audible)
486
- this.update(now, this.engine.listenerPosition);
534
+ this.update(now);
487
535
  }
488
536
 
489
537
  #buildOutputChain() {
@@ -492,7 +540,7 @@ export class EventInstance {
492
540
  const busInput = engine.busGraph.getInput(this.busId);
493
541
  const description = this.description;
494
542
 
495
- // the instance gain is the uniform chain head (2D and 3D), so live volume/fades have one home
543
+ // the instance gain is the uniform fader (2D and 3D), so live volume/fades have one home
496
544
  const pending = this.#pendingFade;
497
545
 
498
546
  this.#instanceGain = ctx.createGain();
@@ -591,7 +639,66 @@ export class EventInstance {
591
639
  this.#instanceGain.connect(busInput);
592
640
  }
593
641
 
594
- this.#chainHead = this.#instanceGain;
642
+ // the event's inserts sit ahead of the fader (pre-fader, as on a bus), so a fade-out fades what
643
+ // they produce rather than feeding them a fading signal: voices -> effects -> instanceGain -> ...
644
+ if (this.#effects !== null) {
645
+ this.#effects.output.connect(this.#instanceGain);
646
+ this.#chainHead = this.#effects.input;
647
+ } else {
648
+ this.#chainHead = this.#instanceGain;
649
+ }
650
+ }
651
+
652
+ /**
653
+ * Move a parameter of this instance's copy of one of the event's insert effects, now — one play of a
654
+ * cue made duller, brighter or louder than the others. Other instances of the event, and the
655
+ * {@link EventDescription} itself, are untouched.
656
+ *
657
+ * Valid from the moment the instance exists, including while its buffers are still loading. The effect
658
+ * is addressed by its position in {@link EventDescription.effects}, the parameter by one of its class's
659
+ * `parameters` (`'frequency'` on an `EqEffect`).
660
+ *
661
+ * @param {number} effectIndex
662
+ * @param {string} name
663
+ * @param {number} value in the parameter's own units (Hz, dB, seconds, ...)
664
+ */
665
+ setEffectParam(effectIndex, name, value) {
666
+ this.#effectChain().setParam(effectIndex, name, value);
667
+ }
668
+
669
+ /**
670
+ * Glide a parameter of this instance's copy of one of the event's insert effects toward `value` —
671
+ * tracking a game value while the sound plays. See {@link EffectChain#approachParam}; addressed as
672
+ * {@link setEffectParam}.
673
+ *
674
+ * @param {number} effectIndex
675
+ * @param {string} name
676
+ * @param {number} value
677
+ * @param {number} timeConstant seconds, above 0
678
+ */
679
+ approachEffectParam(effectIndex, name, value, timeConstant) {
680
+ this.#effectChain().approachParam(effectIndex, name, value, timeConstant);
681
+ }
682
+
683
+ /**
684
+ * Where this instance's effect parameter was last sent (a glide's target), or its defined value.
685
+ * @param {number} effectIndex
686
+ * @param {string} name
687
+ * @returns {number}
688
+ */
689
+ getEffectParam(effectIndex, name) {
690
+ return this.#effectChain().getParam(effectIndex, name);
691
+ }
692
+
693
+ /**
694
+ * @returns {EffectChain}
695
+ */
696
+ #effectChain() {
697
+ if (this.#effects === null) {
698
+ throw new Error(`sopra: event '${this.description.label}' has no effects`);
699
+ }
700
+
701
+ return this.#effects;
595
702
  }
596
703
 
597
704
  /**
@@ -769,7 +876,7 @@ export class EventInstance {
769
876
  this.#retire(timeline[i]);
770
877
  }
771
878
 
772
- this.update(this.engine.currentTime, this.engine.listenerPosition);
879
+ this.update(this.engine.currentTime);
773
880
  }
774
881
 
775
882
  /**
@@ -782,10 +889,13 @@ export class EventInstance {
782
889
  /**
783
890
  * Advance the instance one frame: update spatialization, then evaluate the timeline against the
784
891
  * playhead (spawning / virtualizing voices).
892
+ *
893
+ * The listener is the engine's ({@link SopraEngine#listenerPosition}), read here together with the
894
+ * version that says whether it moved, so a listener set during a tick is never paired with another's
895
+ * version.
785
896
  * @param {number} now context time
786
- * @param {Vector3|null} listenerPosition
787
897
  */
788
- update(now, listenerPosition) {
898
+ update(now) {
789
899
  if (this.state !== EventInstanceState.Playing) {
790
900
  return;
791
901
  }
@@ -811,25 +921,26 @@ export class EventInstance {
811
921
  }
812
922
 
813
923
  const description = this.description;
924
+ const engine = this.engine;
925
+ const listenerPosition = engine.listenerPosition;
814
926
 
815
927
  if (description.is3D && this.position !== null && listenerPosition !== null) {
816
- // the position is a live view over the emitter transform, and the listener pose comes
817
- // from one too, so both read by index
818
- const distance = v3_distance(
819
- this.position[0], this.position[1], this.position[2],
820
- listenerPosition[0], listenerPosition[1], listenerPosition[2]
821
- );
822
- const gain = Math.max(0, description.attenuation.evaluate(distance));
823
-
824
- this.#attenuationGain.gain.setValueAtTime(gain, 0);
825
-
826
- if (this.#panner !== null) {
827
- // absent for SopraPanningModel.None — positioned, but never rotated
828
- this.#panner.setPosition(this.position[0], this.position[1], this.position[2]);
928
+ /*
929
+ Spatialized when something moved, not every frame: the source (its writer reports it with
930
+ moved()) or the listener (setListener). Until one does, the gain, the panner and the
931
+ audibility worked out last time all still hold. A crowd of one-shots standing where they
932
+ were played wrote a panner position and a gain each, every frame, and a Chrome profile put
933
+ the panner write at about 20 us.
934
+ */
935
+ const source_moved = this.#source_moved;
936
+ const listener_version = engine.listenerVersion;
937
+
938
+ if (source_moved || listener_version !== this.#listener_version) {
939
+ this.#source_moved = false;
940
+ this.#listener_version = listener_version;
941
+
942
+ this.#spatialize(listenerPosition, source_moved);
829
943
  }
830
-
831
- this.currentGain = gain;
832
- this.#audible = distance <= description.distanceMax && gain > dB2Volume(description.virtualThresholdDb);
833
944
  } else {
834
945
  this.currentGain = 1;
835
946
  this.#audible = true;
@@ -847,6 +958,67 @@ export class EventInstance {
847
958
  }
848
959
  }
849
960
 
961
+ /**
962
+ * Report that {@link position} was written, so the next {@link update} puts the source where it now
963
+ * is: its panner, its distance attenuation and whether it is audible at all. The instance reads the
964
+ * array only when something has moved, so a write nobody reports is not heard.
965
+ *
966
+ * Cheap and idempotent: it marks the instance, and the work happens once, in the next update,
967
+ * however many writes were reported before it. Harmless on a 2D instance, or on one that has stopped.
968
+ */
969
+ moved() {
970
+ this.#source_moved = true;
971
+ }
972
+
973
+ /**
974
+ * Attenuate against the listener and, when the source moved, put the panner on it. Writes only what
975
+ * changed.
976
+ *
977
+ * @param {ArrayLike<number>} listenerPosition
978
+ * @param {boolean} source_moved
979
+ */
980
+ #spatialize(listenerPosition, source_moved) {
981
+ const description = this.description;
982
+
983
+ // the position is a live view over the emitter transform, and the listener pose comes from one
984
+ // too, so both read by index
985
+ const position = this.position;
986
+
987
+ const x = position[0];
988
+ const y = position[1];
989
+ const z = position[2];
990
+
991
+ const distance = v3_distance(
992
+ x, y, z,
993
+ listenerPosition[0], listenerPosition[1], listenerPosition[2]
994
+ );
995
+
996
+ const gain = Math.max(0, description.attenuation.evaluate(distance));
997
+
998
+ if (gain !== this.#written_gain) {
999
+ this.#attenuationGain.gain.setValueAtTime(gain, 0);
1000
+
1001
+ this.#written_gain = gain;
1002
+ }
1003
+
1004
+ // absent for SopraPanningModel.None — positioned, but never rotated
1005
+ const panner = this.#panner;
1006
+
1007
+ if (
1008
+ source_moved && panner !== null
1009
+ && (x !== this.#written_x || y !== this.#written_y || z !== this.#written_z)
1010
+ ) {
1011
+ panner.setPosition(x, y, z);
1012
+
1013
+ this.#written_x = x;
1014
+ this.#written_y = y;
1015
+ this.#written_z = z;
1016
+ }
1017
+
1018
+ this.currentGain = gain;
1019
+ this.#audible = distance <= description.distanceMax && gain > dB2Volume(description.virtualThresholdDb);
1020
+ }
1021
+
850
1022
  /**
851
1023
  * @param {number} now
852
1024
  */
@@ -983,6 +1155,9 @@ export class EventInstance {
983
1155
  if (this.#instanceGain !== null) {
984
1156
  this.#instanceGain.disconnect();
985
1157
  }
1158
+ if (this.#effects !== null) {
1159
+ this.#effects.disconnect();
1160
+ }
986
1161
 
987
1162
  if (this.onEnded.hasHandlers()) {
988
1163
  this.onEnded.send1(this);
@@ -1,5 +1,6 @@
1
1
  /**
2
- * Register every sopra definition adapter on a {@link BinarySerializationRegistry}.
2
+ * Register every sopra definition adapter, and the upgraders of their older formats, on a
3
+ * {@link BinarySerializationRegistry}.
3
4
  *
4
5
  * In production this is called from `GameBinarySerializationRegistry.initializeGameBinarySerializationRegistry`
5
6
  * (integration lands in P3); in P0 it backs the round-trip specs. Keeping the list here mirrors the
@@ -1 +1 @@
1
- {"version":3,"file":"populateSopraSerializationRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js"],"names":[],"mappings":"AAeA;;;;;;;;GAQG;AACH,gGAiBC"}
1
+ {"version":3,"file":"populateSopraSerializationRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js"],"names":[],"mappings":"AAiBA;;;;;;;;;GASG;AACH,gGAmBC"}
@@ -4,6 +4,8 @@ import { DuckingRuleSerializationAdapter } from "../definition/DuckingRuleSerial
4
4
  import { EqEffectSerializationAdapter } from "../definition/effect/EqEffectSerializationAdapter.js";
5
5
  import { ReverbEffectSerializationAdapter } from "../definition/effect/ReverbEffectSerializationAdapter.js";
6
6
  import { EventDescriptionSerializationAdapter } from "../definition/EventDescriptionSerializationAdapter.js";
7
+ import { EventDescriptionSerializationUpgrader_0_1 } from "../definition/EventDescriptionSerializationUpgrader_0_1.js";
8
+ import { EventDescription } from "../definition/EventDescription.js";
7
9
  import { MixerSnapshotSerializationAdapter } from "../definition/MixerSnapshotSerializationAdapter.js";
8
10
  import { ParameterDefinitionSerializationAdapter } from "../definition/ParameterDefinitionSerializationAdapter.js";
9
11
  import { BlendContainerAudioClipSerializationAdapter } from "../definition/clip/BlendContainerAudioClipSerializationAdapter.js";
@@ -14,7 +16,8 @@ import { SilenceAudioClipSerializationAdapter } from "../definition/clip/Silence
14
16
  import { SwitchContainerAudioClipSerializationAdapter } from "../definition/clip/SwitchContainerAudioClipSerializationAdapter.js";
15
17
 
16
18
  /**
17
- * Register every sopra definition adapter on a {@link BinarySerializationRegistry}.
19
+ * Register every sopra definition adapter, and the upgraders of their older formats, on a
20
+ * {@link BinarySerializationRegistry}.
18
21
  *
19
22
  * In production this is called from `GameBinarySerializationRegistry.initializeGameBinarySerializationRegistry`
20
23
  * (integration lands in P3); in P0 it backs the round-trip specs. Keeping the list here mirrors the
@@ -39,4 +42,6 @@ export function populateSopraSerializationRegistry(registry) {
39
42
  new MixerSnapshotSerializationAdapter(),
40
43
  new DuckingRuleSerializationAdapter()
41
44
  ]);
45
+
46
+ registry.registerUpgrader(EventDescription.typeName, new EventDescriptionSerializationUpgrader_0_1(registry));
42
47
  }
@@ -23,5 +23,20 @@ export function binaryRoundTrip<T>(objectAdapter: BinaryObjectSerializationAdapt
23
23
  restored: T;
24
24
  stable: boolean;
25
25
  };
26
+ /**
27
+ * Write `description` in `EventDescription`'s binary format VERSION 0 — the layout before events carried
28
+ * insert effects — exactly as the adapter of that version wrote it (its `effects` are not written). Frozen
29
+ * here so the specs can author genuine version-0 data, for the upgraders to be tested against what was
30
+ * actually saved rather than against the current writer.
31
+ *
32
+ * Writes the record body only: no class-name/version header (the object adapter writes that) — which is
33
+ * also the form the `AudioEmitter` / `AudioEventTrigger` component formats embed it in.
34
+ *
35
+ * @param {BinaryBuffer} buffer
36
+ * @param {BinaryObjectSerializationAdapter} objectAdapter writes the nested root clip
37
+ * @param {import("../definition/EventDescription.js").EventDescription} description
38
+ */
39
+ export function writeEventDescriptionVersion0(buffer: BinaryBuffer, objectAdapter: BinaryObjectSerializationAdapter, description: import("../definition/EventDescription.js").EventDescription): void;
26
40
  import { BinaryObjectSerializationAdapter } from "../../../ecs/storage/binary/object/BinaryObjectSerializationAdapter.js";
41
+ import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
27
42
  //# sourceMappingURL=sopraSerializationHarness.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sopraSerializationHarness.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/serialization/sopraSerializationHarness.js"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,0CAFa,gCAAgC,CAW5C;AAED;;;;;;;;;;;;;;GAcG;AACH,kDAJW,gCAAgC;;YAER,OAAO;EAczC;iDA/CgD,wEAAwE"}
1
+ {"version":3,"file":"sopraSerializationHarness.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/serialization/sopraSerializationHarness.js"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,0CAFa,gCAAgC,CAW5C;AAED;;;;;;;;;;;;;;GAcG;AACH,kDAJW,gCAAgC;;YAER,OAAO;EAczC;AAED;;;;;;;;;;;;GAYG;AACH,sDAJW,YAAY,iBACZ,gCAAgC,eAChC,OAAO,mCAAmC,EAAE,gBAAgB,QAkBtE;iDA9EgD,wEAAwE;6BAF5F,yCAAyC"}
@@ -1,4 +1,5 @@
1
1
  import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
2
+ import { serialize_animation_curve } from "../../../animation/curve/animation_curve_binary_codec.js";
2
3
  import { BinaryObjectSerializationAdapter } from "../../../ecs/storage/binary/object/BinaryObjectSerializationAdapter.js";
3
4
  import { BinarySerializationRegistry } from "../../../ecs/storage/binary/BinarySerializationRegistry.js";
4
5
  import { populateSopraSerializationRegistry } from "./populateSopraSerializationRegistry.js";
@@ -47,3 +48,34 @@ export function binaryRoundTrip(objectAdapter, value) {
47
48
 
48
49
  return { restored, stable: second.toHexString() === firstHex };
49
50
  }
51
+
52
+ /**
53
+ * Write `description` in `EventDescription`'s binary format VERSION 0 — the layout before events carried
54
+ * insert effects — exactly as the adapter of that version wrote it (its `effects` are not written). Frozen
55
+ * here so the specs can author genuine version-0 data, for the upgraders to be tested against what was
56
+ * actually saved rather than against the current writer.
57
+ *
58
+ * Writes the record body only: no class-name/version header (the object adapter writes that) — which is
59
+ * also the form the `AudioEmitter` / `AudioEventTrigger` component formats embed it in.
60
+ *
61
+ * @param {BinaryBuffer} buffer
62
+ * @param {BinaryObjectSerializationAdapter} objectAdapter writes the nested root clip
63
+ * @param {import("../definition/EventDescription.js").EventDescription} description
64
+ */
65
+ export function writeEventDescriptionVersion0(buffer, objectAdapter, description) {
66
+ buffer.writeUTF8String(description.label);
67
+ objectAdapter.serialize(buffer, description.rootClip);
68
+ buffer.writeUTF8String(description.busId);
69
+ buffer.writeFloat32(description.gainDb);
70
+ buffer.writeUint8(description.is3D ? 1 : 0);
71
+ buffer.writeUint8(description.panningModel);
72
+ buffer.writeFloat32(description.distanceMin);
73
+ buffer.writeFloat32(description.distanceMax);
74
+
75
+ serialize_animation_curve(buffer, description.attenuation);
76
+
77
+ buffer.writeUintVar(description.maxInstances);
78
+ buffer.writeFloat32(description.priority);
79
+ buffer.writeUint8(description.stealMode);
80
+ buffer.writeFloat32(description.virtualThresholdDb);
81
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"MockAudioContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/util/MockAudioContext.js"],"names":[],"mappings":"AAOA;IAOI;;;OAGG;IACH,oBAHW,MAAM,0BACN,OAAO,EAWjB;IAlBD;;OAEG;IACH,QAFU;QAAC,IAAI,EAAC,MAAM,CAAA;KAAC,EAAE,CAEb;IAOR,cAAkB;IAGd,yCAGC;IAIT,4CAIC;IAED,qDAMC;IAED,0DAQC;IAED,qEAGC;IAED,qEAGC;IAED,uCAGC;CACJ;AAoCD;IAMI;;OAEG;IACH,wCAFW;QAAC,qBAAqB,CAAC,EAAC,OAAO,CAAA;KAAC,EAM1C;IAXD,oBAAgB;IAEhB,mBAAmB;IAMf,+BAAkD;IAElD,2BAAyD;IAG7D;;OAEG;IACH,gBAEC;IAED,4BAIC;IAED,oCAsBC;IAED,oCAOC;IAED,0CAQC;IAED,8BAYC;IAED,iCAKC;IAED;;OAEG;IACH,qCAFW,MAAM,iBAMhB;IAED;;;;OAIG;IACH,+BAJW,MAAM,UACN,MAAM,cACN,MAAM;;;;;;MAehB;CACJ;AA1JD;IASI,qCAGC;IAVD;;OAEG;IACH,aAFU,aAAa,EAAE,CAER;IAEjB,sBAAqB;IAGjB,UAAgB;IAChB,aAAsB;IAG1B,0BAIC;IAED,mBAGC;IAED;;;OAGG;IACH,sBAHW,aAAa,GACX,OAAO,CAInB;CACJ"}
1
+ {"version":3,"file":"MockAudioContext.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/util/MockAudioContext.js"],"names":[],"mappings":"AAOA;IAOI;;;OAGG;IACH,oBAHW,MAAM,0BACN,OAAO,EAWjB;IAlBD;;OAEG;IACH,QAFU;QAAC,IAAI,EAAC,MAAM,CAAA;KAAC,EAAE,CAEb;IAOR,cAAkB;IAGd,yCAGC;IAIT,4CAIC;IAED,qDAMC;IAED,0DAQC;IAED,qEAGC;IAED,qEAGC;IAED,uCAGC;CACJ;AAoCD;IAMI;;OAEG;IACH,wCAFW;QAAC,qBAAqB,CAAC,EAAC,OAAO,CAAA;KAAC,EAM1C;IAXD,oBAAgB;IAEhB,mBAAmB;IAMf,+BAAkD;IAElD,2BAAyD;IAG7D;;OAEG;IACH,gBAEC;IAED,4BAIC;IAED,oCAsBC;IAED,oCAOC;IAED,0CAQC;IAED,8BAeC;IAED,iCAKC;IAED;;OAEG;IACH,qCAFW,MAAM,iBAMhB;IAED;;;;OAIG;IACH,+BAJW,MAAM,UACN,MAAM,cACN,MAAM;;;;;;MAehB;CACJ;AA7JD;IASI,qCAGC;IAVD;;OAEG;IACH,aAFU,aAAa,EAAE,CAER;IAEjB,sBAAqB;IAGjB,UAAgB;IAChB,aAAsB;IAG1B,0BAIC;IAED,mBAGC;IAED;;;OAGG;IACH,sBAHW,aAAa,GACX,OAAO,CAInB;CACJ"}
@@ -180,8 +180,11 @@ export class MockAudioContext {
180
180
  node.refDistance = 1;
181
181
  node.maxDistance = 10000;
182
182
  node.lastPosition = null;
183
+ // every position the panner was handed, in order, as a param records its automation
184
+ node.positions = [];
183
185
  node.setPosition = (x, y, z) => {
184
186
  node.lastPosition = { x, y, z };
187
+ node.positions.push(node.lastPosition);
185
188
  };
186
189
  return node;
187
190
  }
@@ -1,8 +1,18 @@
1
+ /**
2
+ * Cancel every automation event on `param` from `time` on, holding the value the automation has at `time` —
3
+ * so whatever is scheduled next starts from where the param actually is, not from where an interrupted ramp
4
+ * or glide was heading. The one place the engine does this: `cancelAndHoldAtTime` where the browser has it
5
+ * (it is unimplemented in Firefox), else the portable `cancelScheduledValues` + anchor at the current
6
+ * value.
7
+ *
8
+ * @param {AudioParam} param
9
+ * @param {number} time context time
10
+ */
11
+ export function cancelAndHold(param: AudioParam, time: number): void;
1
12
  /**
2
13
  * The ONE click-safe gain ramp. Anchor-then-ramp: pin the current value at the ramp start so the
3
- * origin is well-defined and re-trigger-safe (D1). Prefers `cancelAndHoldAtTime` but FEATURE-DETECTS
4
- * it (unimplemented in Firefox) and falls back to the portable `cancelScheduledValues` +
5
- * `setValueAtTime` idiom. Linear-ramps to `targetLinear` (use {@link FADE_EPSILON}, never 0, for fades
14
+ * origin is well-defined and re-trigger-safe (D1), through {@link cancelAndHold}. Linear-ramps to
15
+ * `targetLinear` (use {@link FADE_EPSILON}, never 0, for fades
6
16
  * to silence). Shared by every fade so no call site hand-rolls one.
7
17
  *
8
18
  * @param {AudioParam} param the gain param to ramp
@@ -1 +1 @@
1
- {"version":3,"file":"fadeOutAndStop.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/util/fadeOutAndStop.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;GAaG;AACH,gCAPW,UAAU,gBACV,MAAM,YACN,MAAM,OACN,gBAAgB,eAChB,MAAM,GACJ,MAAM,CAoBlB;AAED;;;;;;;;;GASG;AACH,yCANW,QAAQ,UACR,wBAAwB,GAAC,IAAI,OAC7B,gBAAgB,YAChB,MAAM,eACN,MAAM,QAShB;AA3DD;;;;;GAKG;AACH,2BAFU,MAAM,CAEmB"}
1
+ {"version":3,"file":"fadeOutAndStop.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/util/fadeOutAndStop.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,qCAHW,UAAU,QACV,MAAM,QAYhB;AAED;;;;;;;;;;;;GAYG;AACH,gCAPW,UAAU,gBACV,MAAM,YACN,MAAM,OACN,gBAAgB,eAChB,MAAM,GACJ,MAAM,CAWlB;AAED;;;;;;;;;GASG;AACH,yCANW,QAAQ,UACR,wBAAwB,GAAC,IAAI,OAC7B,gBAAgB,YAChB,MAAM,eACN,MAAM,QAShB;AAvED;;;;;GAKG;AACH,2BAFU,MAAM,CAEmB"}
@@ -6,11 +6,32 @@
6
6
  */
7
7
  export const FADE_EPSILON = 0.0001;
8
8
 
9
+ /**
10
+ * Cancel every automation event on `param` from `time` on, holding the value the automation has at `time` —
11
+ * so whatever is scheduled next starts from where the param actually is, not from where an interrupted ramp
12
+ * or glide was heading. The one place the engine does this: `cancelAndHoldAtTime` where the browser has it
13
+ * (it is unimplemented in Firefox), else the portable `cancelScheduledValues` + anchor at the current
14
+ * value.
15
+ *
16
+ * @param {AudioParam} param
17
+ * @param {number} time context time
18
+ */
19
+ export function cancelAndHold(param, time) {
20
+ if (typeof param.cancelAndHoldAtTime === "function") {
21
+ param.cancelAndHoldAtTime(time);
22
+ } else {
23
+ // read before cancelling: the anchor is the value the param holds now
24
+ const value = param.value;
25
+
26
+ param.cancelScheduledValues(time);
27
+ param.setValueAtTime(value, time);
28
+ }
29
+ }
30
+
9
31
  /**
10
32
  * The ONE click-safe gain ramp. Anchor-then-ramp: pin the current value at the ramp start so the
11
- * origin is well-defined and re-trigger-safe (D1). Prefers `cancelAndHoldAtTime` but FEATURE-DETECTS
12
- * it (unimplemented in Firefox) and falls back to the portable `cancelScheduledValues` +
13
- * `setValueAtTime` idiom. Linear-ramps to `targetLinear` (use {@link FADE_EPSILON}, never 0, for fades
33
+ * origin is well-defined and re-trigger-safe (D1), through {@link cancelAndHold}. Linear-ramps to
34
+ * `targetLinear` (use {@link FADE_EPSILON}, never 0, for fades
14
35
  * to silence). Shared by every fade so no call site hand-rolls one.
15
36
  *
16
37
  * @param {AudioParam} param the gain param to ramp
@@ -24,16 +45,7 @@ export function rampGain(param, targetLinear, duration, ctx, startAfter = 0) {
24
45
  const startTime = ctx.currentTime + startAfter;
25
46
  const endTime = startTime + duration;
26
47
 
27
- const currentValue = param.value;
28
-
29
- if (typeof param.cancelAndHoldAtTime === "function") {
30
- // holds the current automation value at startTime, discarding later scheduled events
31
- param.cancelAndHoldAtTime(startTime);
32
- } else {
33
- // portable fallback (Firefox): clear future events then explicitly anchor the value
34
- param.cancelScheduledValues(startTime);
35
- param.setValueAtTime(currentValue, startTime);
36
- }
48
+ cancelAndHold(param, startTime);
37
49
 
38
50
  param.linearRampToValueAtTime(targetLinear, endTime);
39
51