@woosh/meep-engine 2.154.0 → 2.156.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.
- package/README.md +1 -1
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/view/ecs/ComponentControlView.d.ts +0 -9
- package/editor/view/ecs/ComponentControlView.js +2 -98
- package/package.json +1 -1
- package/src/core/binary/32BitEncoder.js +1 -1
- package/src/core/binary/to_half_float_uint16.js +3 -3
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_build_hierarchy_radix.js +275 -253
- package/src/core/cache/Cache.d.ts.map +1 -1
- package/src/core/cache/Cache.js +7 -0
- package/src/core/cache/FrequencySketch.d.ts.map +1 -1
- package/src/core/cache/FrequencySketch.js +8 -4
- package/src/core/clipboard/obtainClipBoard.d.ts +6 -0
- package/src/core/clipboard/obtainClipBoard.d.ts.map +1 -0
- package/src/core/clipboard/obtainClipBoard.js +29 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts +6 -0
- package/src/core/clipboard/safeClipboardReadText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardReadText.js +55 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts +8 -0
- package/src/core/clipboard/safeClipboardWriteText.d.ts.map +1 -0
- package/src/core/clipboard/safeClipboardWriteText.js +23 -0
- package/src/core/collection/array/array_quick_sort_by_lookup_map.js +1 -1
- package/src/core/collection/array/array_set_diff_sorting.d.ts.map +1 -1
- package/src/core/collection/array/array_set_diff_sorting.js +4 -1
- package/src/core/collection/array/array_shuffle.d.ts.map +1 -1
- package/src/core/collection/array/array_shuffle.js +30 -27
- package/src/core/collection/array/binarySearchLowIndex.d.ts.map +1 -1
- package/src/core/collection/array/binarySearchLowIndex.js +4 -3
- package/src/core/collection/array/typed/array_buffer_hash.js +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.d.ts.map +1 -1
- package/src/core/collection/array/typed/is_typed_array_equals.js +12 -2
- package/src/core/collection/heap/BinaryHeap.d.ts.map +1 -1
- package/src/core/collection/heap/BinaryHeap.js +12 -2
- package/src/core/collection/queue/Deque.d.ts.map +1 -1
- package/src/core/collection/queue/Deque.js +10 -8
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +4 -2
- package/src/core/collection/table/RowFirstTableSpec.js +2 -2
- package/src/core/color/operations/color_lerp.d.ts.map +1 -1
- package/src/core/color/operations/color_lerp.js +10 -3
- package/src/core/color/rgb2uint32.js +1 -1
- package/src/core/color/rgbe9995_to_rgb.js +1 -1
- package/src/core/function/objectsEqual.d.ts.map +1 -1
- package/src/core/function/objectsEqual.js +2 -1
- package/src/core/geom/2d/aabb/AABB2.d.ts.map +1 -1
- package/src/core/geom/2d/aabb/AABB2.js +12 -11
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/convex_hull_jarvis_2d.js +30 -4
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.d.ts.map +1 -1
- package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +6 -2
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/SpatialHashGrid.js +388 -386
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.d.ts.map +1 -1
- package/src/core/geom/2d/hash-grid/shg_query_elements_line.js +8 -3
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/QuadTreeDatum.js +9 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts +3 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.d.ts.map +1 -1
- package/src/core/geom/2d/quad-tree/qt_query_data_nearest_to_point.js +3 -1
- package/src/core/geom/2d/quad-tree-binary/QuadTree.js +714 -714
- package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
- package/src/core/geom/2d/r-tree/StaticR2Tree.js +5 -4
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +33 -29
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_near_distance_to_intersection_ray_segment.js +3 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_signed_distance_to_aabb3.js +10 -7
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.d.ts.map +1 -1
- package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js +30 -9
- package/src/core/geom/3d/aabb/compute_aabb_from_points.js +3 -3
- package/src/core/geom/3d/box/box3_raycast.d.ts +37 -0
- package/src/core/geom/3d/box/box3_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/box/box3_raycast.js +81 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts +35 -0
- package/src/core/geom/3d/capsule/capsule_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/capsule/capsule_raycast.js +93 -0
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.d.ts.map +1 -1
- package/src/core/geom/3d/cone/compute_bounding_cone_of_2_cones.js +4 -0
- package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.d.ts.map +1 -1
- package/src/core/geom/3d/line/line3_compute_segment_point_distance_eikonal.js +3 -2
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/decompose_matrix_4_array.js +12 -2
- package/src/core/geom/3d/mat4/eulerAnglesFromMatrix.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply_alphatensor.js +19 -13
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.d.ts.map +1 -1
- package/src/core/geom/3d/octahedra/octahedral_direction_to_uv.js +3 -2
- package/src/core/geom/3d/plane/plane3_compute_plane_intersection.js +3 -2
- package/src/core/geom/3d/shape/MeshShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/MeshShape3D.js +7 -0
- package/src/core/geom/3d/shape/UnionShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/UnionShape3D.js +3 -2
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.d.ts.map +1 -1
- package/src/core/geom/3d/shape/util/shape3d_voxelize_to_grid.js +153 -148
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +7 -0
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.d.ts.map +1 -1
- package/src/core/geom/3d/sphere/harmonics/sh3_sample_by_direction.js +13 -10
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.d.ts +1 -1
- package/src/core/geom/3d/sphere/sphere_projected_sphere_radius_sqr.js +2 -2
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts +33 -0
- package/src/core/geom/3d/sphere/sphere_raycast.d.ts.map +1 -0
- package/src/core/geom/3d/sphere/sphere_raycast.js +47 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts +24 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.d.ts.map +1 -0
- package/src/core/geom/3d/tetrahedra/tetrahedral_mesh_tet_get_neighbours.js +39 -0
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.d.ts.map +1 -1
- package/src/core/geom/3d/tetrahedra/triangle/trace_triangular_depth_map.js +4 -2
- package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +3 -3
- package/src/core/geom/3d/topology/simplify/decimate_edge_collapse_snap.js +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.d.ts.map +1 -1
- package/src/core/geom/3d/topology/tm_vertex_compute_normal.js +4 -2
- package/src/core/geom/3d/util/make_justified_point_grid.d.ts.map +1 -1
- package/src/core/geom/3d/util/make_justified_point_grid.js +18 -10
- package/src/core/geom/ConicRay.d.ts.map +1 -1
- package/src/core/geom/ConicRay.js +11 -13
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.d.ts.map +1 -1
- package/src/core/geom/packing/max-rect/removeRedundantBoxes.js +19 -4
- package/src/core/geom/vec3/v3_array_copy.d.ts +3 -3
- package/src/core/geom/vec3/v3_array_copy.d.ts.map +1 -1
- package/src/core/geom/vec3/v3_array_copy.js +2 -2
- package/src/core/geom/vec3/v3_cross.d.ts +17 -0
- package/src/core/geom/vec3/v3_cross.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_cross.js +20 -0
- package/src/core/geom/vec3/v3_orthonormal_matrix_from_normal.d.ts.map +1 -0
- package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.js +1 -1
- package/src/core/geom/vec3/v3_subtract.d.ts +16 -0
- package/src/core/geom/vec3/v3_subtract.d.ts.map +1 -0
- package/src/core/geom/vec3/v3_subtract.js +19 -0
- package/src/core/graph/coloring/colorizeGraph.js +2 -2
- package/src/core/graph/csr/CSRGraph.d.ts.map +1 -1
- package/src/core/graph/csr/CSRGraph.js +325 -319
- package/src/core/graph/layout/CircleLayout.d.ts.map +1 -1
- package/src/core/graph/layout/CircleLayout.js +8 -6
- package/src/core/graph/metis/native/refine/compute_kway_params.d.ts.map +1 -1
- package/src/core/graph/metis/native/refine/compute_kway_params.js +139 -138
- package/src/core/graph/mn_graph_coarsen.d.ts.map +1 -1
- package/src/core/graph/mn_graph_coarsen.js +4 -2
- package/src/core/graph/v2/NodeContainer.js +7 -7
- package/src/core/localization/LocalizationEngine.js +1 -1
- package/src/core/math/bell_membership_function.d.ts.map +1 -1
- package/src/core/math/bell_membership_function.js +3 -1
- package/src/core/math/complex/complex_add.d.ts +4 -4
- package/src/core/math/complex/complex_add.d.ts.map +1 -1
- package/src/core/math/complex/complex_add.js +3 -3
- package/src/core/math/complex/complex_div.d.ts +4 -4
- package/src/core/math/complex/complex_div.d.ts.map +1 -1
- package/src/core/math/complex/complex_div.js +3 -3
- package/src/core/math/complex/complex_mul.d.ts +4 -4
- package/src/core/math/complex/complex_mul.d.ts.map +1 -1
- package/src/core/math/complex/complex_mul.js +3 -3
- package/src/core/math/complex/complex_sub.d.ts +4 -4
- package/src/core/math/complex/complex_sub.d.ts.map +1 -1
- package/src/core/math/complex/complex_sub.js +3 -3
- package/src/core/math/idct_1d.d.ts +4 -4
- package/src/core/math/idct_1d.d.ts.map +1 -1
- package/src/core/math/idct_1d.js +3 -3
- package/src/core/math/noise/create_simplex_noise_2d.d.ts.map +1 -1
- package/src/core/math/noise/create_simplex_noise_2d.js +4 -2
- package/src/core/math/noise/sdnoise.d.ts.map +1 -1
- package/src/core/math/noise/sdnoise.js +12 -9
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/compute_bhmie_optical_properties.js +94 -50
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts +3 -6
- package/src/core/math/physics/mie/lorenz_mie_coefs.d.ts.map +1 -1
- package/src/core/math/physics/mie/lorenz_mie_coefs.js +180 -157
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts +3 -4
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.d.ts.map +1 -1
- package/src/core/math/physics/mie/mie_ab_to_optical_properties.js +47 -21
- package/src/core/math/random/randomIntegerBetween.d.ts.map +1 -1
- package/src/core/math/random/randomIntegerBetween.js +4 -1
- package/src/core/math/solveCubic.d.ts.map +1 -1
- package/src/core/math/solveCubic.js +95 -82
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.d.ts.map +1 -1
- package/src/core/math/spline/computeCatmullRomSplineUniformDistance.js +13 -0
- package/src/core/math/statistics/softmax.js +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts +1 -0
- package/src/core/model/node-graph/visual/NodeGraphVisualData.d.ts.map +1 -1
- package/src/core/model/node-graph/visual/NodeGraphVisualData.js +2 -1
- package/src/core/model/node-graph/visual/NodeVisualData.js +1 -1
- package/src/core/model/object/ImmutableObjectPool.d.ts +7 -0
- package/src/core/model/object/ImmutableObjectPool.d.ts.map +1 -1
- package/src/core/model/object/ImmutableObjectPool.js +20 -10
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.d.ts.map +1 -1
- package/src/core/model/reactive/evaluation/MultiPredicateEvaluator.js +39 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.d.ts.map +1 -1
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -0
- package/src/core/parser/simple/readHexToken.d.ts.map +1 -1
- package/src/core/parser/simple/readHexToken.js +6 -0
- package/src/core/primitives/numbers/number_pretty_print.d.ts.map +1 -1
- package/src/core/primitives/numbers/number_pretty_print.js +4 -1
- package/src/core/primitives/strings/string_jaro_winkler.js +1 -1
- package/src/core/process/CompositeProcess.js +1 -1
- package/src/core/process/action/AsynchronousDelayAction.d.ts.map +1 -1
- package/src/core/process/action/AsynchronousDelayAction.js +3 -0
- package/src/core/process/executor/ConcurrentExecutor.d.ts.map +1 -1
- package/src/core/process/executor/ConcurrentExecutor.js +3 -2
- package/src/core/process/task/util/randomCountTask.d.ts.map +1 -1
- package/src/core/process/task/util/randomCountTask.js +3 -1
- package/src/core/process/undo/ActionProcessor.d.ts.map +1 -1
- package/src/core/process/undo/ActionProcessor.js +5 -3
- package/src/core/process/worker/WorkerBuilder.js +3 -3
- package/src/engine/animation/curve/AnimationCurve.d.ts.map +1 -1
- package/src/engine/animation/curve/AnimationCurve.js +4 -2
- package/src/engine/control/first-person/DESIGN.md +1 -1
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts +55 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.d.ts.map +1 -0
- package/src/engine/control/first-person/FirstPersonMotionPhase.js +134 -0
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +23 -2
- package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerController.js +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts +168 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerConfig.js +115 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +71 -0
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
- package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +255 -55
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts +82 -43
- package/src/engine/control/first-person/abilities/LedgeGrab.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/LedgeGrab.js +405 -213
- package/src/engine/control/first-person/abilities/Mantle.d.ts +6 -0
- package/src/engine/control/first-person/abilities/Mantle.d.ts.map +1 -1
- package/src/engine/control/first-person/abilities/Mantle.js +104 -45
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts +61 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.d.ts.map +1 -0
- package/src/engine/control/first-person/abilities/ScrambleUp.js +182 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts +84 -0
- package/src/engine/control/first-person/math/jumpDynamics.d.ts.map +1 -0
- package/src/engine/control/first-person/math/jumpDynamics.js +108 -0
- package/src/engine/control/first-person/prototype_first_person_controller.js +45 -1
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +1 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +8 -0
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +1 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +1 -1
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +1 -1
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/texture/sample_material.js +1 -1
- package/src/engine/graphics/shadows/testShadowMapRendering.js +1 -1
- package/src/engine/physics/CONSTRAINT_SOLVER_BENCH_LOG.md +208 -0
- package/src/engine/physics/CONSTRAINT_SOLVER_IMPROVEMENTS_PLAN.md +364 -0
- package/src/engine/physics/PLAN.md +6 -5
- package/src/engine/physics/constraint/solve_constraints.d.ts +4 -1
- package/src/engine/physics/constraint/solve_constraints.d.ts.map +1 -1
- package/src/engine/physics/constraint/solve_constraints.js +147 -33
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +1750 -1747
- package/src/engine/physics/fluid/ecs/FluidSystem.d.ts +3 -3
- package/src/engine/physics/gjk/gjk_epa_penetration.d.ts +12 -8
- package/src/engine/physics/gjk/gjk_epa_penetration.d.ts.map +1 -1
- package/src/engine/physics/gjk/gjk_epa_penetration.js +447 -158
- package/src/engine/physics/narrowphase/convex_convex_manifold.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_convex_manifold.js +22 -25
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts +32 -13
- package/src/engine/physics/narrowphase/convex_decomposition.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/convex_decomposition.js +61 -65
- package/src/engine/physics/narrowphase/mesh_convex_hull.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/mesh_convex_hull.js +13 -8
- package/src/engine/physics/narrowphase/refine_ray_concave.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_concave.js +5 -3
- package/src/engine/physics/narrowphase/refine_ray_hit.d.ts.map +1 -1
- package/src/engine/physics/narrowphase/refine_ray_hit.js +81 -78
- package/src/engine/sound/SoundEngine.d.ts.map +1 -1
- package/src/engine/sound/SoundEngine.js +28 -0
- package/src/engine/sound/dB2Volume.d.ts +1 -1
- package/src/engine/sound/dB2Volume.d.ts.map +1 -1
- package/src/engine/sound/dB2Volume.js +1 -1
- package/src/engine/sound/ecs/SoundController.d.ts +4 -0
- package/src/engine/sound/ecs/SoundController.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundController.js +4 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts +5 -0
- package/src/engine/sound/ecs/SoundControllerSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/SoundControllerSystem.js +5 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +69 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitter.js +83 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +97 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +238 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +90 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +324 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts +59 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.js +140 -0
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts +16 -65
- package/src/engine/sound/ecs/emitter/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +19 -224
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts +26 -29
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterComponentContext.js +168 -135
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts +36 -59
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +154 -390
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts +20 -23
- package/src/engine/sound/ecs/emitter/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/ecs/emitter/SoundTrack.js +34 -152
- package/src/engine/sound/sopra/IMPLEMENTATION_PLAN.md +993 -0
- package/src/engine/sound/sopra/README.md +643 -7
- package/src/engine/sound/sopra/SopraEngine.d.ts +229 -0
- package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -0
- package/src/engine/sound/sopra/SopraEngine.js +423 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts +26 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/AssetManagerBufferProvider.js +71 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts +24 -0
- package/src/engine/sound/sopra/asset/BufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/BufferProvider.js +29 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts +31 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.d.ts.map +1 -0
- package/src/engine/sound/sopra/asset/StubBufferProvider.js +58 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts +83 -0
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinition.js +142 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/BusDefinitionSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts +71 -0
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRule.js +106 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/DuckingRuleSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts +132 -0
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescription.js +259 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +71 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts +51 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +83 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/MixerSnapshotSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts +72 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +117 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/ParameterDefinitionSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts +14 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/SopraPanningModel.js +20 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts +10 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/VoiceStealMode.js +18 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts +93 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +109 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts +80 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +181 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClipSerializationAdapter.js +74 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts +34 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +100 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts +101 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +230 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClipSerializationAdapter.js +54 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts +103 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +191 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SampleAudioClipSerializationAdapter.js +39 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts +40 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClip.js +91 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SequenceContainerAudioClipSerializationAdapter.js +42 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts +44 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +77 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClipSerializationAdapter.js +27 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +65 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +131 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts +17 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClipSerializationAdapter.js +41 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +24 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +24 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +70 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +120 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/CompressorEffectSerializationAdapter.js +31 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +74 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +128 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/EqEffectSerializationAdapter.js +29 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +49 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +101 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts +18 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffectSerializationAdapter.js +25 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts +31 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.d.ts.map +1 -0
- package/src/engine/sound/sopra/legacy/soundEmitterToEventDescription.js +106 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +79 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/BusGraph.js +227 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +144 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EventInstance.js +579 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/ParameterStore.js +98 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts +42 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/SopraPlaybackContext.js +68 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts +67 -0
- package/src/engine/sound/sopra/runtime/Voice.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/Voice.js +145 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts +38 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoiceManager.js +136 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts +12 -0
- package/src/engine/sound/sopra/runtime/VoicePool.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/VoicePool.js +17 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +11 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +42 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts +33 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraJSON.js +99 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +27 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +49 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts +74 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/MockAudioContext.js +215 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts +15 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/buildAttenuationCurve.js +40 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +34 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.js +60 -0
- package/src/engine/sound/volume2dB.d.ts +1 -1
- package/src/engine/sound/volume2dB.d.ts.map +1 -1
- package/src/engine/sound/volume2dB.js +1 -1
- package/src/engine/graphics/sh3/path_tracer/sampling/v3_orthonormal_matrix_from_normal.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.d.ts +0 -66
- package/src/engine/physics/narrowphase/ray_shapes.d.ts.map +0 -1
- package/src/engine/physics/narrowphase/ray_shapes.js +0 -187
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts +0 -23
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundEmitterChannel.js +0 -32
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts +0 -18
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.d.ts.map +0 -1
- package/src/engine/sound/ecs/emitter/SoundTrackNodes.js +0 -18
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts +0 -26
- package/src/engine/sound/sopra/AbstractAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/AbstractAudioClip.js +0 -29
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/ContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/ContainerAudioClip.js +0 -13
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts +0 -12
- package/src/engine/sound/sopra/RandomContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/RandomContainerAudioClip.js +0 -15
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts +0 -7
- package/src/engine/sound/sopra/SequenceContainerAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SequenceContainerAudioClip.js +0 -8
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts +0 -13
- package/src/engine/sound/sopra/SilenceAudioClip.d.ts.map +0 -1
- package/src/engine/sound/sopra/SilenceAudioClip.js +0 -15
- /package/src/{engine/graphics/sh3/path_tracer/sampling → core/geom/vec3}/v3_orthonormal_matrix_from_normal.d.ts +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BusDefinitionSerializationAdapter } from "../definition/BusDefinitionSerializationAdapter.js";
|
|
2
|
+
import { CompressorEffectSerializationAdapter } from "../definition/effect/CompressorEffectSerializationAdapter.js";
|
|
3
|
+
import { DuckingRuleSerializationAdapter } from "../definition/DuckingRuleSerializationAdapter.js";
|
|
4
|
+
import { EqEffectSerializationAdapter } from "../definition/effect/EqEffectSerializationAdapter.js";
|
|
5
|
+
import { ReverbEffectSerializationAdapter } from "../definition/effect/ReverbEffectSerializationAdapter.js";
|
|
6
|
+
import { EventDescriptionSerializationAdapter } from "../definition/EventDescriptionSerializationAdapter.js";
|
|
7
|
+
import { MixerSnapshotSerializationAdapter } from "../definition/MixerSnapshotSerializationAdapter.js";
|
|
8
|
+
import { ParameterDefinitionSerializationAdapter } from "../definition/ParameterDefinitionSerializationAdapter.js";
|
|
9
|
+
import { BlendContainerAudioClipSerializationAdapter } from "../definition/clip/BlendContainerAudioClipSerializationAdapter.js";
|
|
10
|
+
import { RandomContainerAudioClipSerializationAdapter } from "../definition/clip/RandomContainerAudioClipSerializationAdapter.js";
|
|
11
|
+
import { SampleAudioClipSerializationAdapter } from "../definition/clip/SampleAudioClipSerializationAdapter.js";
|
|
12
|
+
import { SequenceContainerAudioClipSerializationAdapter } from "../definition/clip/SequenceContainerAudioClipSerializationAdapter.js";
|
|
13
|
+
import { SilenceAudioClipSerializationAdapter } from "../definition/clip/SilenceAudioClipSerializationAdapter.js";
|
|
14
|
+
import { SwitchContainerAudioClipSerializationAdapter } from "../definition/clip/SwitchContainerAudioClipSerializationAdapter.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Register every sopra definition adapter on a {@link BinarySerializationRegistry}.
|
|
18
|
+
*
|
|
19
|
+
* In production this is called from `GameBinarySerializationRegistry.initializeGameBinarySerializationRegistry`
|
|
20
|
+
* (integration lands in P3); in P0 it backs the round-trip specs. Keeping the list here mirrors the
|
|
21
|
+
* behavior-tree `populateNodeRegistry` convention.
|
|
22
|
+
*
|
|
23
|
+
* @param {BinarySerializationRegistry} registry
|
|
24
|
+
*/
|
|
25
|
+
export function populateSopraSerializationRegistry(registry) {
|
|
26
|
+
registry.registerAdapters([
|
|
27
|
+
new SampleAudioClipSerializationAdapter(),
|
|
28
|
+
new SilenceAudioClipSerializationAdapter(),
|
|
29
|
+
new SequenceContainerAudioClipSerializationAdapter(),
|
|
30
|
+
new RandomContainerAudioClipSerializationAdapter(),
|
|
31
|
+
new SwitchContainerAudioClipSerializationAdapter(),
|
|
32
|
+
new BlendContainerAudioClipSerializationAdapter(),
|
|
33
|
+
new ParameterDefinitionSerializationAdapter(),
|
|
34
|
+
new EqEffectSerializationAdapter(),
|
|
35
|
+
new CompressorEffectSerializationAdapter(),
|
|
36
|
+
new ReverbEffectSerializationAdapter(),
|
|
37
|
+
new EventDescriptionSerializationAdapter(),
|
|
38
|
+
new BusDefinitionSerializationAdapter(),
|
|
39
|
+
new MixerSnapshotSerializationAdapter(),
|
|
40
|
+
new DuckingRuleSerializationAdapter()
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {AbstractAudioClip} clip
|
|
3
|
+
* @returns {{type:string, data:*}}
|
|
4
|
+
*/
|
|
5
|
+
export function serializeAudioClipToJSON(clip: AbstractAudioClip): {
|
|
6
|
+
type: string;
|
|
7
|
+
data: any;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* @param {{type:string, data:*}} json
|
|
11
|
+
* @returns {AbstractAudioClip}
|
|
12
|
+
*/
|
|
13
|
+
export function deserializeAudioClipFromJSON({ type, data }: {
|
|
14
|
+
type: string;
|
|
15
|
+
data: any;
|
|
16
|
+
}): AbstractAudioClip;
|
|
17
|
+
/**
|
|
18
|
+
* @param {AbstractAudioEffect} effect
|
|
19
|
+
* @returns {{type:string, data:*}}
|
|
20
|
+
*/
|
|
21
|
+
export function serializeAudioEffectToJSON(effect: AbstractAudioEffect): {
|
|
22
|
+
type: string;
|
|
23
|
+
data: any;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @param {{type:string, data:*}} json
|
|
27
|
+
* @returns {AbstractAudioEffect}
|
|
28
|
+
*/
|
|
29
|
+
export function deserializeAudioEffectFromJSON({ type, data }: {
|
|
30
|
+
type: string;
|
|
31
|
+
data: any;
|
|
32
|
+
}): AbstractAudioEffect;
|
|
33
|
+
//# sourceMappingURL=sopraJSON.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sopraJSON.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/serialization/sopraJSON.js"],"names":[],"mappings":"AAiBA;;;GAGG;AACH,mEAFa;IAAC,IAAI,EAAC,MAAM,CAAC;IAAC,IAAI,MAAE;CAAC,CAOjC;AAED;;;GAGG;AACH,6DAHW;IAAC,IAAI,EAAC,MAAM,CAAC;IAAC,IAAI,MAAE;CAAC,qBAgC/B;AAED;;;GAGG;AACH,yEAFa;IAAC,IAAI,EAAC,MAAM,CAAC;IAAC,IAAI,MAAE;CAAC,CAOjC;AAED;;;GAGG;AACH,+DAHW;IAAC,IAAI,EAAC,MAAM,CAAC;IAAC,IAAI,MAAE;CAAC,uBAuB/B"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { CompressorEffect } from "../definition/effect/CompressorEffect.js";
|
|
2
|
+
import { EqEffect } from "../definition/effect/EqEffect.js";
|
|
3
|
+
import { ReverbEffect } from "../definition/effect/ReverbEffect.js";
|
|
4
|
+
import { BlendContainerAudioClip } from "../definition/clip/BlendContainerAudioClip.js";
|
|
5
|
+
import { RandomContainerAudioClip } from "../definition/clip/RandomContainerAudioClip.js";
|
|
6
|
+
import { SampleAudioClip } from "../definition/clip/SampleAudioClip.js";
|
|
7
|
+
import { SequenceContainerAudioClip } from "../definition/clip/SequenceContainerAudioClip.js";
|
|
8
|
+
import { SilenceAudioClip } from "../definition/clip/SilenceAudioClip.js";
|
|
9
|
+
import { SwitchContainerAudioClip } from "../definition/clip/SwitchContainerAudioClip.js";
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Type-tagged polymorphic JSON (de)serialization for the sopra clip and effect hierarchies.
|
|
13
|
+
* Mirrors the dormant material/ subsystem's serializeSoundMaterialToJSON pattern. The switch
|
|
14
|
+
* statements reference class bindings at CALL time (not module-eval time), which keeps these safe
|
|
15
|
+
* under the import cycle with container clips (whose toJSON/fromJSON call back into here).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {AbstractAudioClip} clip
|
|
20
|
+
* @returns {{type:string, data:*}}
|
|
21
|
+
*/
|
|
22
|
+
export function serializeAudioClipToJSON(clip) {
|
|
23
|
+
return {
|
|
24
|
+
type: Object.getPrototypeOf(clip).constructor.typeName,
|
|
25
|
+
data: clip.toJSON()
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @param {{type:string, data:*}} json
|
|
31
|
+
* @returns {AbstractAudioClip}
|
|
32
|
+
*/
|
|
33
|
+
export function deserializeAudioClipFromJSON({ type, data }) {
|
|
34
|
+
let instance;
|
|
35
|
+
|
|
36
|
+
switch (type) {
|
|
37
|
+
case SampleAudioClip.typeName:
|
|
38
|
+
instance = new SampleAudioClip();
|
|
39
|
+
break;
|
|
40
|
+
case SilenceAudioClip.typeName:
|
|
41
|
+
instance = new SilenceAudioClip();
|
|
42
|
+
break;
|
|
43
|
+
case SequenceContainerAudioClip.typeName:
|
|
44
|
+
instance = new SequenceContainerAudioClip();
|
|
45
|
+
break;
|
|
46
|
+
case RandomContainerAudioClip.typeName:
|
|
47
|
+
instance = new RandomContainerAudioClip();
|
|
48
|
+
break;
|
|
49
|
+
case SwitchContainerAudioClip.typeName:
|
|
50
|
+
instance = new SwitchContainerAudioClip();
|
|
51
|
+
break;
|
|
52
|
+
case BlendContainerAudioClip.typeName:
|
|
53
|
+
instance = new BlendContainerAudioClip();
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
throw new Error(`Unsupported audio clip type '${type}'`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
instance.fromJSON(data);
|
|
60
|
+
|
|
61
|
+
return instance;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @param {AbstractAudioEffect} effect
|
|
66
|
+
* @returns {{type:string, data:*}}
|
|
67
|
+
*/
|
|
68
|
+
export function serializeAudioEffectToJSON(effect) {
|
|
69
|
+
return {
|
|
70
|
+
type: Object.getPrototypeOf(effect).constructor.typeName,
|
|
71
|
+
data: effect.toJSON()
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @param {{type:string, data:*}} json
|
|
77
|
+
* @returns {AbstractAudioEffect}
|
|
78
|
+
*/
|
|
79
|
+
export function deserializeAudioEffectFromJSON({ type, data }) {
|
|
80
|
+
let instance;
|
|
81
|
+
|
|
82
|
+
switch (type) {
|
|
83
|
+
case EqEffect.typeName:
|
|
84
|
+
instance = new EqEffect();
|
|
85
|
+
break;
|
|
86
|
+
case CompressorEffect.typeName:
|
|
87
|
+
instance = new CompressorEffect();
|
|
88
|
+
break;
|
|
89
|
+
case ReverbEffect.typeName:
|
|
90
|
+
instance = new ReverbEffect();
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
throw new Error(`Unsupported audio effect type '${type}'`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
instance.fromJSON(data);
|
|
97
|
+
|
|
98
|
+
return instance;
|
|
99
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build a binary object adapter backed by a registry with every sopra adapter registered — the real
|
|
3
|
+
* production (de)serialization path. Shared by the per-adapter round-trip specs.
|
|
4
|
+
* @returns {BinaryObjectSerializationAdapter}
|
|
5
|
+
*/
|
|
6
|
+
export function makeSopraObjectAdapter(): BinaryObjectSerializationAdapter;
|
|
7
|
+
/**
|
|
8
|
+
* Serialize `value` to binary, deserialize a fresh copy, then re-serialize that copy. Returns the
|
|
9
|
+
* restored value and whether the bytes were byte-stable across the round-trip — the precision-agnostic
|
|
10
|
+
* correctness invariant: the adapter reads back exactly what it wrote (float64 fields are stored as
|
|
11
|
+
* float32, so byte-stability is the right check rather than a strict `.equals` on the originals).
|
|
12
|
+
*
|
|
13
|
+
* NOTE for callers: give each field a DISTINCT value. Byte-stability detects a swapped read/write of
|
|
14
|
+
* two same-type fields only when their values differ (the re-serialized bytes then diverge); equal
|
|
15
|
+
* values would hide such a swap.
|
|
16
|
+
*
|
|
17
|
+
* @template T
|
|
18
|
+
* @param {BinaryObjectSerializationAdapter} objectAdapter
|
|
19
|
+
* @param {T} value
|
|
20
|
+
* @returns {{restored: T, stable: boolean}}
|
|
21
|
+
*/
|
|
22
|
+
export function binaryRoundTrip<T>(objectAdapter: BinaryObjectSerializationAdapter, value: T): {
|
|
23
|
+
restored: T;
|
|
24
|
+
stable: boolean;
|
|
25
|
+
};
|
|
26
|
+
import { BinaryObjectSerializationAdapter } from "../../../ecs/storage/binary/object/BinaryObjectSerializationAdapter.js";
|
|
27
|
+
//# sourceMappingURL=sopraSerializationHarness.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
|
|
2
|
+
import { BinaryObjectSerializationAdapter } from "../../../ecs/storage/binary/object/BinaryObjectSerializationAdapter.js";
|
|
3
|
+
import { BinarySerializationRegistry } from "../../../ecs/storage/binary/BinarySerializationRegistry.js";
|
|
4
|
+
import { populateSopraSerializationRegistry } from "./populateSopraSerializationRegistry.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Build a binary object adapter backed by a registry with every sopra adapter registered — the real
|
|
8
|
+
* production (de)serialization path. Shared by the per-adapter round-trip specs.
|
|
9
|
+
* @returns {BinaryObjectSerializationAdapter}
|
|
10
|
+
*/
|
|
11
|
+
export function makeSopraObjectAdapter() {
|
|
12
|
+
const registry = new BinarySerializationRegistry();
|
|
13
|
+
|
|
14
|
+
populateSopraSerializationRegistry(registry);
|
|
15
|
+
|
|
16
|
+
const objectAdapter = new BinaryObjectSerializationAdapter();
|
|
17
|
+
objectAdapter.initialize(registry);
|
|
18
|
+
|
|
19
|
+
return objectAdapter;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Serialize `value` to binary, deserialize a fresh copy, then re-serialize that copy. Returns the
|
|
24
|
+
* restored value and whether the bytes were byte-stable across the round-trip — the precision-agnostic
|
|
25
|
+
* correctness invariant: the adapter reads back exactly what it wrote (float64 fields are stored as
|
|
26
|
+
* float32, so byte-stability is the right check rather than a strict `.equals` on the originals).
|
|
27
|
+
*
|
|
28
|
+
* NOTE for callers: give each field a DISTINCT value. Byte-stability detects a swapped read/write of
|
|
29
|
+
* two same-type fields only when their values differ (the re-serialized bytes then diverge); equal
|
|
30
|
+
* values would hide such a swap.
|
|
31
|
+
*
|
|
32
|
+
* @template T
|
|
33
|
+
* @param {BinaryObjectSerializationAdapter} objectAdapter
|
|
34
|
+
* @param {T} value
|
|
35
|
+
* @returns {{restored: T, stable: boolean}}
|
|
36
|
+
*/
|
|
37
|
+
export function binaryRoundTrip(objectAdapter, value) {
|
|
38
|
+
const first = new BinaryBuffer();
|
|
39
|
+
objectAdapter.serialize(first, value);
|
|
40
|
+
const firstHex = first.toHexString();
|
|
41
|
+
|
|
42
|
+
first.position = 0;
|
|
43
|
+
const restored = objectAdapter.deserialize(first);
|
|
44
|
+
|
|
45
|
+
const second = new BinaryBuffer();
|
|
46
|
+
objectAdapter.serialize(second, restored);
|
|
47
|
+
|
|
48
|
+
return { restored, stable: second.toHexString() === firstHex };
|
|
49
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export class MockAudioParam {
|
|
2
|
+
/**
|
|
3
|
+
* @param {number} value
|
|
4
|
+
* @param {boolean} supportsCancelAndHold whether to expose cancelAndHoldAtTime (Firefox lacks it)
|
|
5
|
+
*/
|
|
6
|
+
constructor(value?: number, supportsCancelAndHold?: boolean);
|
|
7
|
+
/**
|
|
8
|
+
* @type {{type:string}[]}
|
|
9
|
+
*/
|
|
10
|
+
events: {
|
|
11
|
+
type: string;
|
|
12
|
+
}[];
|
|
13
|
+
value: number;
|
|
14
|
+
cancelAndHoldAtTime: (time: any) => this;
|
|
15
|
+
setValueAtTime(value: any, time: any): this;
|
|
16
|
+
linearRampToValueAtTime(value: any, time: any): this;
|
|
17
|
+
exponentialRampToValueAtTime(value: any, time: any): this;
|
|
18
|
+
setTargetAtTime(value: any, startTime: any, timeConstant: any): this;
|
|
19
|
+
setValueCurveAtTime(curve: any, startTime: any, duration: any): this;
|
|
20
|
+
cancelScheduledValues(time: any): this;
|
|
21
|
+
}
|
|
22
|
+
export class MockAudioContext {
|
|
23
|
+
/**
|
|
24
|
+
* @param {{supportsCancelAndHold?:boolean}} [options]
|
|
25
|
+
*/
|
|
26
|
+
constructor({ supportsCancelAndHold }?: {
|
|
27
|
+
supportsCancelAndHold?: boolean;
|
|
28
|
+
});
|
|
29
|
+
currentTime: number;
|
|
30
|
+
sampleRate: number;
|
|
31
|
+
supportsCancelAndHold: boolean;
|
|
32
|
+
destination: MockAudioNode;
|
|
33
|
+
/**
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
private __param;
|
|
37
|
+
createGain(): MockAudioNode;
|
|
38
|
+
createBufferSource(): MockAudioNode;
|
|
39
|
+
createBiquadFilter(): MockAudioNode;
|
|
40
|
+
createDynamicsCompressor(): MockAudioNode;
|
|
41
|
+
createPanner(): MockAudioNode;
|
|
42
|
+
createConvolver(): MockAudioNode;
|
|
43
|
+
/**
|
|
44
|
+
* @param {number} numberOfChannels
|
|
45
|
+
* @param {number} length samples per channel
|
|
46
|
+
* @param {number} sampleRate
|
|
47
|
+
*/
|
|
48
|
+
createBuffer(numberOfChannels: number, length: number, sampleRate: number): {
|
|
49
|
+
numberOfChannels: number;
|
|
50
|
+
length: number;
|
|
51
|
+
sampleRate: number;
|
|
52
|
+
duration: number;
|
|
53
|
+
getChannelData: (channel: any) => any;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
declare class MockAudioNode {
|
|
57
|
+
constructor(kind: any, context: any);
|
|
58
|
+
/**
|
|
59
|
+
* @type {MockAudioNode[]}
|
|
60
|
+
*/
|
|
61
|
+
connections: MockAudioNode[];
|
|
62
|
+
disconnected: boolean;
|
|
63
|
+
kind: any;
|
|
64
|
+
context: any;
|
|
65
|
+
connect(target: any): any;
|
|
66
|
+
disconnect(): void;
|
|
67
|
+
/**
|
|
68
|
+
* @param {MockAudioNode} target
|
|
69
|
+
* @returns {boolean}
|
|
70
|
+
*/
|
|
71
|
+
isConnectedTo(target: MockAudioNode): boolean;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=MockAudioContext.d.ts.map
|
|
@@ -0,0 +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;;;;OAIG;IACH,+BAJW,MAAM,UACN,MAAM,cACN,MAAM;;;;;;MAehB;CACJ;AAjJD;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"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Minimal recording WebAudio test double for the ECS-free sopra core. NOT a spec (filename does not
|
|
3
|
+
* end in .spec/.test, so Jest does not execute it as a suite). Records the node graph and AudioParam
|
|
4
|
+
* automation so tests can assert routing, gain, effect order and scheduling without a real
|
|
5
|
+
* AudioContext.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export class MockAudioParam {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @type {{type:string}[]}
|
|
12
|
+
*/
|
|
13
|
+
events = [];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @param {number} value
|
|
17
|
+
* @param {boolean} supportsCancelAndHold whether to expose cancelAndHoldAtTime (Firefox lacks it)
|
|
18
|
+
*/
|
|
19
|
+
constructor(value = 0, supportsCancelAndHold = true) {
|
|
20
|
+
this.value = value;
|
|
21
|
+
|
|
22
|
+
if (supportsCancelAndHold) {
|
|
23
|
+
this.cancelAndHoldAtTime = (time) => {
|
|
24
|
+
this.events.push({ type: 'cancelAndHold', time });
|
|
25
|
+
return this;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setValueAtTime(value, time) {
|
|
31
|
+
this.value = value;
|
|
32
|
+
this.events.push({ type: 'setValueAtTime', value, time });
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
linearRampToValueAtTime(value, time) {
|
|
37
|
+
// NB: a ramp does NOT change `.value` (which tracks the last *explicitly set* value —
|
|
38
|
+
// construction / setValueAtTime / cancelAndHold). The ramp target lives in `events[]`. This
|
|
39
|
+
// lets tests assert re-anchoring of chained/interrupting fades.
|
|
40
|
+
this.events.push({ type: 'linearRamp', value, time });
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
exponentialRampToValueAtTime(value, time) {
|
|
45
|
+
if (value === 0) {
|
|
46
|
+
// mirror the real WebAudio constraint so the click-trap is caught in tests
|
|
47
|
+
throw new Error('exponentialRampToValueAtTime: target must be non-zero');
|
|
48
|
+
}
|
|
49
|
+
// see linearRampToValueAtTime: ramps do not move `.value`; the target lives in `events[]`
|
|
50
|
+
this.events.push({ type: 'exponentialRamp', value, time });
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
setTargetAtTime(value, startTime, timeConstant) {
|
|
55
|
+
this.events.push({ type: 'setTarget', value, startTime, timeConstant });
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setValueCurveAtTime(curve, startTime, duration) {
|
|
60
|
+
this.events.push({ type: 'curve', curve, startTime, duration });
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
cancelScheduledValues(time) {
|
|
65
|
+
this.events.push({ type: 'cancel', time });
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class MockAudioNode {
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @type {MockAudioNode[]}
|
|
74
|
+
*/
|
|
75
|
+
connections = [];
|
|
76
|
+
|
|
77
|
+
disconnected = false;
|
|
78
|
+
|
|
79
|
+
constructor(kind, context) {
|
|
80
|
+
this.kind = kind;
|
|
81
|
+
this.context = context;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
connect(target) {
|
|
85
|
+
this.disconnected = false; // track live state, not a sticky "was ever disconnected" flag
|
|
86
|
+
this.connections.push(target);
|
|
87
|
+
return target;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
disconnect() {
|
|
91
|
+
this.disconnected = true;
|
|
92
|
+
this.connections = [];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @param {MockAudioNode} target
|
|
97
|
+
* @returns {boolean}
|
|
98
|
+
*/
|
|
99
|
+
isConnectedTo(target) {
|
|
100
|
+
return this.connections.indexOf(target) !== -1;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export class MockAudioContext {
|
|
105
|
+
|
|
106
|
+
currentTime = 0;
|
|
107
|
+
|
|
108
|
+
sampleRate = 44100;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {{supportsCancelAndHold?:boolean}} [options]
|
|
112
|
+
*/
|
|
113
|
+
constructor({ supportsCancelAndHold = true } = {}) {
|
|
114
|
+
this.supportsCancelAndHold = supportsCancelAndHold;
|
|
115
|
+
|
|
116
|
+
this.destination = new MockAudioNode('destination', this);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
__param(value) {
|
|
123
|
+
return new MockAudioParam(value, this.supportsCancelAndHold);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
createGain() {
|
|
127
|
+
const node = new MockAudioNode('gain', this);
|
|
128
|
+
node.gain = this.__param(1);
|
|
129
|
+
return node;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
createBufferSource() {
|
|
133
|
+
const node = new MockAudioNode('source', this);
|
|
134
|
+
|
|
135
|
+
node.buffer = null;
|
|
136
|
+
node.loop = false;
|
|
137
|
+
node.loopStart = 0;
|
|
138
|
+
node.loopEnd = 0;
|
|
139
|
+
node.playbackRate = this.__param(1);
|
|
140
|
+
node.detune = this.__param(0);
|
|
141
|
+
node.onended = null;
|
|
142
|
+
node.started = null;
|
|
143
|
+
node.stopped = null;
|
|
144
|
+
|
|
145
|
+
node.start = (when = 0, offset = 0, duration) => {
|
|
146
|
+
node.started = { when, offset, duration };
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
node.stop = (when = 0) => {
|
|
150
|
+
node.stopped = { when };
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return node;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
createBiquadFilter() {
|
|
157
|
+
const node = new MockAudioNode('biquad', this);
|
|
158
|
+
node.type = 'peaking';
|
|
159
|
+
node.frequency = this.__param(350);
|
|
160
|
+
node.Q = this.__param(1);
|
|
161
|
+
node.gain = this.__param(0);
|
|
162
|
+
return node;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
createDynamicsCompressor() {
|
|
166
|
+
const node = new MockAudioNode('compressor', this);
|
|
167
|
+
node.threshold = this.__param(-24);
|
|
168
|
+
node.knee = this.__param(30);
|
|
169
|
+
node.ratio = this.__param(12);
|
|
170
|
+
node.attack = this.__param(0.003);
|
|
171
|
+
node.release = this.__param(0.25);
|
|
172
|
+
return node;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
createPanner() {
|
|
176
|
+
const node = new MockAudioNode('panner', this);
|
|
177
|
+
node.panningModel = 'equalpower';
|
|
178
|
+
node.distanceModel = 'inverse';
|
|
179
|
+
node.rolloffFactor = 1;
|
|
180
|
+
node.refDistance = 1;
|
|
181
|
+
node.maxDistance = 10000;
|
|
182
|
+
node.lastPosition = null;
|
|
183
|
+
node.setPosition = (x, y, z) => {
|
|
184
|
+
node.lastPosition = { x, y, z };
|
|
185
|
+
};
|
|
186
|
+
return node;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
createConvolver() {
|
|
190
|
+
const node = new MockAudioNode('convolver', this);
|
|
191
|
+
node.buffer = null;
|
|
192
|
+
node.normalize = true;
|
|
193
|
+
return node;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @param {number} numberOfChannels
|
|
198
|
+
* @param {number} length samples per channel
|
|
199
|
+
* @param {number} sampleRate
|
|
200
|
+
*/
|
|
201
|
+
createBuffer(numberOfChannels, length, sampleRate) {
|
|
202
|
+
const channels = [];
|
|
203
|
+
for (let i = 0; i < numberOfChannels; i++) {
|
|
204
|
+
channels.push(new Float32Array(length));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
numberOfChannels,
|
|
209
|
+
length,
|
|
210
|
+
sampleRate,
|
|
211
|
+
duration: length / sampleRate,
|
|
212
|
+
getChannelData: (channel) => channels[channel]
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Author a distance→gain attenuation {@link AnimationCurve} by sampling a falloff function at evenly
|
|
3
|
+
* spaced distances between `distanceMin` and `distanceMax`. Lets the physically-based legacy falloffs
|
|
4
|
+
* (`interpolate_irradiance_linear/logarithmic/smith`) be reused to build attenuation presets that
|
|
5
|
+
* match the old engine at the sampled distances (D4), while the runtime just evaluates the curve.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} distanceMin
|
|
8
|
+
* @param {number} distanceMax
|
|
9
|
+
* @param {function(distance:number, min:number, max:number):number} falloff
|
|
10
|
+
* @param {number} [sampleCount] number of keyframes (>= 2)
|
|
11
|
+
* @returns {AnimationCurve}
|
|
12
|
+
*/
|
|
13
|
+
export function buildAttenuationCurve(distanceMin: number, distanceMax: number, falloff: any, sampleCount?: number): AnimationCurve;
|
|
14
|
+
import { AnimationCurve } from "../../../animation/curve/AnimationCurve.js";
|
|
15
|
+
//# sourceMappingURL=buildAttenuationCurve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildAttenuationCurve.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/sopra/util/buildAttenuationCurve.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,mDANW,MAAM,eACN,MAAM,8BAEN,MAAM,GACJ,cAAc,CA0B1B;+BAvC8B,4CAA4C"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AnimationCurve } from "../../../animation/curve/AnimationCurve.js";
|
|
2
|
+
import { Keyframe } from "../../../animation/curve/Keyframe.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Author a distance→gain attenuation {@link AnimationCurve} by sampling a falloff function at evenly
|
|
6
|
+
* spaced distances between `distanceMin` and `distanceMax`. Lets the physically-based legacy falloffs
|
|
7
|
+
* (`interpolate_irradiance_linear/logarithmic/smith`) be reused to build attenuation presets that
|
|
8
|
+
* match the old engine at the sampled distances (D4), while the runtime just evaluates the curve.
|
|
9
|
+
*
|
|
10
|
+
* @param {number} distanceMin
|
|
11
|
+
* @param {number} distanceMax
|
|
12
|
+
* @param {function(distance:number, min:number, max:number):number} falloff
|
|
13
|
+
* @param {number} [sampleCount] number of keyframes (>= 2)
|
|
14
|
+
* @returns {AnimationCurve}
|
|
15
|
+
*/
|
|
16
|
+
export function buildAttenuationCurve(distanceMin, distanceMax, falloff, sampleCount = 8) {
|
|
17
|
+
// A degenerate range (max <= min) has no falloff region to sample: every keyframe would land at
|
|
18
|
+
// the same distance, so alignAllTangents would divide by a zero time-delta and emit NaN tangents
|
|
19
|
+
// (which serialize to JSON null). Fall back to a finite flat-1 (no-attenuation) curve.
|
|
20
|
+
if (distanceMax <= distanceMin) {
|
|
21
|
+
return AnimationCurve.constant(0, 1, 1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const n = Math.max(2, sampleCount);
|
|
25
|
+
|
|
26
|
+
const curve = new AnimationCurve();
|
|
27
|
+
|
|
28
|
+
for (let i = 0; i < n; i++) {
|
|
29
|
+
const t = i / (n - 1);
|
|
30
|
+
const distance = distanceMin + (distanceMax - distanceMin) * t;
|
|
31
|
+
const gain = falloff(distance, distanceMin, distanceMax);
|
|
32
|
+
|
|
33
|
+
curve.add(Keyframe.from(distance, gain));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// smooth the segments between samples
|
|
37
|
+
curve.alignAllTangents();
|
|
38
|
+
|
|
39
|
+
return curve;
|
|
40
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 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
|
|
6
|
+
* to silence). Shared by every fade so no call site hand-rolls one.
|
|
7
|
+
*
|
|
8
|
+
* @param {AudioParam} param the gain param to ramp
|
|
9
|
+
* @param {number} targetLinear target linear gain
|
|
10
|
+
* @param {number} duration ramp duration in seconds
|
|
11
|
+
* @param {BaseAudioContext} ctx
|
|
12
|
+
* @param {number} [startAfter=0] delay before the ramp begins, in seconds
|
|
13
|
+
* @returns {number} the absolute context time at which the ramp completes
|
|
14
|
+
*/
|
|
15
|
+
export function rampGain(param: AudioParam, targetLinear: number, duration: number, ctx: BaseAudioContext, startAfter?: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Click-safe fade-out of a single gain that also stops a source node once silent. Used for node-level
|
|
18
|
+
* fades; EventInstance fades use {@link rampGain} directly on its instance gain.
|
|
19
|
+
*
|
|
20
|
+
* @param {GainNode} gainNode the gain to fade
|
|
21
|
+
* @param {AudioScheduledSourceNode|null} source source to stop once silent (may be null)
|
|
22
|
+
* @param {BaseAudioContext} ctx
|
|
23
|
+
* @param {number} duration fade duration in seconds
|
|
24
|
+
* @param {number} [startAfter=0] delay before the fade begins, in seconds
|
|
25
|
+
*/
|
|
26
|
+
export function fadeOutAndStop(gainNode: GainNode, source: AudioScheduledSourceNode | null, ctx: BaseAudioContext, duration: number, startAfter?: number): void;
|
|
27
|
+
/**
|
|
28
|
+
* Smallest non-zero gain to ramp toward. Ramping a GainNode to exactly 0 (especially with an
|
|
29
|
+
* exponential ramp) is the classic WebAudio click/throw trap, so we always target this epsilon and
|
|
30
|
+
* stop the source just after the gain has effectively reached silence.
|
|
31
|
+
* @type {number}
|
|
32
|
+
*/
|
|
33
|
+
export const FADE_EPSILON: number;
|
|
34
|
+
//# sourceMappingURL=fadeOutAndStop.d.ts.map
|
|
@@ -0,0 +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"}
|