@babylonjs/core 7.53.1 → 7.53.3
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/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSound.js +12 -12
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.d.ts +15 -8
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js +23 -11
- package/AudioV2/abstractAudio/components/spatialAudioAttacherComponent.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.js +8 -0
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/staticSoundInstance.d.ts +2 -0
- package/AudioV2/abstractAudio/staticSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +4 -4
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +3 -3
- package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +23 -16
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +3 -3
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +13 -6
- package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +13 -8
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js +18 -14
- package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +10 -6
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +7 -3
- package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -1
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +5 -5
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +9 -9
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +4 -4
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +4 -0
- package/AudioV2/webAudio/webAudioStaticSound.js +14 -0
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/Culling/Helper/boundingInfoHelper.d.ts +2 -2
- package/Culling/Helper/boundingInfoHelper.js +2 -2
- package/Culling/Helper/boundingInfoHelper.js.map +1 -1
- package/Engines/abstractEngine.js +2 -3
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/Lights/IES/iesLoader.d.ts +1 -1
- package/Lights/IES/iesLoader.js +1 -1
- package/Lights/IES/iesLoader.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.d.ts +2 -2
- package/Lights/Shadows/shadowGenerator.js +2 -2
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/spotLight.d.ts +1 -1
- package/Lights/spotLight.js +1 -1
- package/Lights/spotLight.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.d.ts +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js +1 -1
- package/Materials/Node/Blocks/Fragment/prePassOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.d.ts +2 -2
- package/Materials/PBR/pbrBaseMaterial.js +2 -2
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Loaders/basisTextureLoader.d.ts +1 -0
- package/Materials/Textures/Loaders/basisTextureLoader.js +1 -0
- package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
- package/Materials/Textures/Loaders/exrTextureLoader.d.ts +5 -4
- package/Materials/Textures/Loaders/exrTextureLoader.js +5 -4
- package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
- package/Materials/Textures/internalTexture.js +2 -2
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/material.js +1 -1
- package/Materials/material.js.map +1 -1
- package/Maths/math.scalar.d.ts +1 -0
- package/Maths/math.scalar.functions.d.ts +9 -0
- package/Maths/math.scalar.functions.js +11 -0
- package/Maths/math.scalar.functions.js.map +1 -1
- package/Meshes/Node/Blocks/geometryEaseBlock.d.ts +96 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js +318 -0
- package/Meshes/Node/Blocks/geometryEaseBlock.js.map +1 -0
- package/Meshes/Node/index.d.ts +1 -0
- package/Meshes/Node/index.js +1 -0
- package/Meshes/Node/index.js.map +1 -1
- package/Meshes/csg2.d.ts +3 -3
- package/Meshes/csg2.js +3 -3
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/lattice.d.ts +2 -2
- package/Meshes/lattice.js +5 -4
- package/Meshes/lattice.js.map +1 -1
- package/Meshes/lattice.material.d.ts +2 -2
- package/Meshes/lattice.material.js +2 -2
- package/Meshes/lattice.material.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -2
- package/Meshes/mesh.js +2 -2
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.js +1 -1
- package/Meshes/subMesh.js.map +1 -1
- package/Misc/fileTools.d.ts +1 -1
- package/Misc/fileTools.js +1 -1
- package/Misc/fileTools.js.map +1 -1
- package/Physics/v2/characterController.d.ts +3 -2
- package/Physics/v2/characterController.js +12 -0
- package/Physics/v2/characterController.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +4 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +11 -16
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +6 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +7 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +3 -0
- package/scene.js +5 -0
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractSpatialAudio.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAIjE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,cAAc,EAAE,aAAuB;IACvC,cAAc,EAAE,aAAuB;IACvC,eAAe,EAAE,CAAW;IAC5B,aAAa,EAAE,SAA8B;IAC7C,WAAW,EAAE,KAAe;IAC5B,YAAY,EAAE,YAAgC;IAC9C,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE;IACxB,iBAAiB,EAAE,CAAW;IAC9B,aAAa,EAAE,CAAW;IAC1B,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE;IACxB,kBAAkB,EAAE,IAAI,UAAU,EAAE;CAC9B,CAAC;AA6FX;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAsC;IAC1E,OAAO,CACH,OAAO,CAAC,cAAc;QACtB,OAAO,CAAC,iBAAiB,KAAK,SAAS;QACvC,OAAO,CAAC,qBAAqB,KAAK,SAAS;QAC3C,OAAO,CAAC,qBAAqB,KAAK,SAAS;QAC3C,OAAO,CAAC,sBAAsB,KAAK,SAAS;QAC5C,OAAO,CAAC,oBAAoB,KAAK,SAAS;QAC1C,OAAO,CAAC,kBAAkB,KAAK,SAAS;QACxC,OAAO,CAAC,oBAAoB,KAAK,SAAS;QAC1C,OAAO,CAAC,mBAAmB,KAAK,SAAS;QACzC,OAAO,CAAC,eAAe,KAAK,SAAS;QACrC,OAAO,CAAC,wBAAwB,KAAK,SAAS;QAC9C,OAAO,CAAC,oBAAoB,KAAK,SAAS;QAC1C,OAAO,CAAC,eAAe,KAAK,SAAS;QACrC,OAAO,CAAC,yBAAyB,KAAK,SAAS,CAClD,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAgB,oBAAoB;CAyGzC","sourcesContent":["import { Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport type { Node } from \"../../../node\";\nimport type { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\n\nexport const _SpatialAudioDefaults = {\n coneInnerAngle: 6.28318530718 as number,\n coneOuterAngle: 6.28318530718 as number,\n coneOuterVolume: 0 as number,\n distanceModel: \"inverse\" as DistanceModelType,\n maxDistance: 10000 as number,\n panningModel: \"equalpower\" as PanningModelType,\n position: Vector3.Zero(),\n referenceDistance: 1 as number,\n rolloffFactor: 1 as number,\n rotation: Vector3.Zero(),\n rotationQuaternion: new Quaternion(),\n} as const;\n\n/**\n * Options for spatial audio.\n */\nexport interface ISpatialAudioOptions {\n /**\n * Whether to automatically update the spatial properties of the audio node. Defaults to `true`.\n */\n spatialAutoUpdate: boolean;\n /**\n * The spatial cone inner angle, in radians. Defaults to 2π.\n * - When the listener is inside the cone inner angle, the volume is at its maximum.\n */\n spatialConeInnerAngle: number;\n /**\n * The spatial cone outer angle, in radians. Defaults to 2π.\n * - When the listener is between the the cone inner and outer angles, the volume fades to its minimum as the listener approaches the outer angle.\n * - When the listener is outside the cone outer angle, the volume is at its minimum.\n */\n spatialConeOuterAngle: number;\n /**\n * The amount of volume reduction outside the {@link spatialConeOuterAngle}. Defaults to 0.\n */\n spatialConeOuterVolume: number;\n /**\n * The algorithm to use to reduce the volume of the audio source as it moves away from the listener. Defaults to \"inverse\".\n *\n * Possible values are:\n * - `\"linear\"`: The volume is reduced linearly as the source moves away from the listener.\n * - `\"inverse\"`: The volume is reduced inversely as the source moves away from the listener.\n * - `\"exponential\"`: The volume is reduced exponentially as the source moves away from the listener.\n *\n * @see {@link spatialMaxDistance}\n * @see {@link spatialReferenceDistance}\n * @see {@link spatialRolloffFactor}\n */\n spatialDistanceModel: \"linear\" | \"inverse\" | \"exponential\";\n /**\n * Enable spatial audio. Defaults to false.\n *\n * When set to `true`, the audio node's spatial properties will be initialized on creation and there will be no\n * delay when setting the first spatial value.\n *\n * When not specified, or set to `false`, the audio node's spatial properties will not be initialized on creation\n * and there will be a small delay when setting the first spatial value.\n *\n * - This option is ignored if any other spatial options are set.\n */\n spatialEnabled: boolean;\n /**\n * The maximum distance between the audio source and the listener, after which the volume is not reduced any further. Defaults to 10000.\n * - This value is used only when the {@link spatialDistanceModel} is set to `\"linear\"`.\n * @see {@link spatialDistanceModel}\n */\n spatialMaxDistance: number;\n /**\n * The minimum update time in seconds of the spatialization if it is attached to a mesh or transform node. Defaults to `0`.\n * - The spatialization's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.\n */\n spatialMinUpdateTime: number;\n /**\n * Possible values are:\n * - `\"equalpower\"`: Represents the equal-power panning algorithm, generally regarded as simple and efficient.\n * - `\"HRTF\"`: Renders a stereo output of higher quality than `\"equalpower\"` — it uses a convolution with measured impulse responses from human subjects.\n */\n spatialPanningModel: \"equalpower\" | \"HRTF\";\n /**\n * The spatial position. Defaults to (0, 0, 0).\n */\n spatialPosition: Vector3;\n /**\n * The distance for reducing volume as the audio source moves away from the listener – i.e. the distance the volume reduction starts at. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link spatialDistanceModel}\n */\n spatialReferenceDistance: number;\n /**\n * How quickly the volume is reduced as the source moves away from the listener. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link spatialDistanceModel}\n */\n spatialRolloffFactor: number;\n /**\n * The spatial rotation, as Euler angles. Defaults to (0, 0, 0).\n */\n spatialRotation: Vector3;\n /**\n * The spatial rotation, as a quaternion. Defaults to (0, 0, 0, 1).\n */\n spatialRotationQuaternion: Quaternion;\n}\n\n/**\n * @param options The spatial audio options to check.\n * @returns `true` if spatial audio options are defined, otherwise `false`.\n */\nexport function _HasSpatialAudioOptions(options: Partial<ISpatialAudioOptions>): boolean {\n return (\n options.spatialEnabled ||\n options.spatialAutoUpdate !== undefined ||\n options.spatialConeInnerAngle !== undefined ||\n options.spatialConeOuterAngle !== undefined ||\n options.spatialConeOuterVolume !== undefined ||\n options.spatialDistanceModel !== undefined ||\n options.spatialMaxDistance !== undefined ||\n options.spatialMinUpdateTime !== undefined ||\n options.spatialPanningModel !== undefined ||\n options.spatialPosition !== undefined ||\n options.spatialReferenceDistance !== undefined ||\n options.spatialRolloffFactor !== undefined ||\n options.spatialRotation !== undefined ||\n options.spatialRotationQuaternion !== undefined\n );\n}\n\n/**\n * Abstract class representing the `spatial` audio property on a sound or audio bus.\n *\n * @see {@link AudioEngineV2.listener}\n */\nexport abstract class AbstractSpatialAudio {\n /**\n * The spatial cone inner angle, in radians. Defaults to 2π.\n * - When the listener is inside the cone inner angle, the volume is at its maximum.\n */\n public abstract coneInnerAngle: number;\n\n /**\n * The spatial cone outer angle, in radians. Defaults to 2π.\n * - When the listener is between the the cone inner and outer angles, the volume fades to its minimum as the listener approaches the outer angle.\n * - When the listener is outside the cone outer angle, the volume is at its minimum.\n */\n public abstract coneOuterAngle: number;\n\n /**\n * The amount of volume reduction outside the {@link coneOuterAngle}. Defaults to 0.\n */\n public abstract coneOuterVolume: number;\n\n /**\n * The algorithm to use to reduce the volume of the audio source as it moves away from the listener. Defaults to \"inverse\".\n *\n * Possible values are:\n * - `\"linear\"`: The volume is reduced linearly as the source moves away from the listener.\n * - `\"inverse\"`: The volume is reduced inversely as the source moves away from the listener.\n * - `\"exponential\"`: The volume is reduced exponentially as the source moves away from the listener.\n *\n * @see {@link spatialMaxDistance}\n * @see {@link spatialReferenceDistance}\n * @see {@link spatialRolloffFactor}\n */\n public abstract distanceModel: \"linear\" | \"inverse\" | \"exponential\";\n\n /**\n * Whether the audio source is attached to a mesh or transform node.\n */\n public abstract isAttached: boolean;\n\n /**\n * The maximum distance between the audio source and the listener, after which the volume is not reduced any further. Defaults to 10000.\n * - This value is used only when the {@link distanceModel} is set to `\"linear\"`.\n * @see {@link distanceModel}\n */\n public abstract maxDistance: number;\n\n /**\n * The minimum update time in seconds of the spatialization if it is attached to a mesh or transform node. Defaults to `0`.\n * - The spatialization's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.\n */\n public abstract minUpdateTime: number;\n\n /**\n * The spatial panning model. Defaults to \"equalpower\".\n *\n * Possible values are:\n * - `\"equalpower\"`: Represents the equal-power panning algorithm, generally regarded as simple and efficient.\n * - `\"HRTF\"`:Renders a stereo output of higher quality than `\"equalpower\"` — it uses a convolution with measured impulse responses from human subjects.\n */\n public abstract panningModel: \"equalpower\" | \"HRTF\";\n\n /**\n * The spatial position. Defaults to (0, 0, 0).\n */\n public abstract position: Vector3;\n\n /**\n * The distance for reducing volume as the audio source moves away from the listener – i.e. the distance the volume reduction starts at. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link distanceModel}\n */\n public abstract referenceDistance: number;\n\n /**\n * How quickly the volume is reduced as the source moves away from the listener. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link distanceModel}\n */\n public abstract rolloffFactor: number;\n\n /**\n * The spatial rotation. Defaults to (0, 0, 0).\n */\n public abstract rotation: Vector3;\n\n /**\n * The spatial rotation quaternion. Defaults to (0, 0, 0, 1).\n */\n public abstract rotationQuaternion: Quaternion;\n\n /**\n * Attaches the audio source to a scene object.\n * @param sceneNode The scene node to attach the audio source to.\n * @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.\n * @param attachmentType Whather to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.\n */\n public abstract attach(sceneNode: Node, useBoundingBox?: boolean, attachmentType?: SpatialAudioAttachmentType): void;\n\n /**\n * Detaches the audio source from the currently attached graphics node.\n */\n public abstract detach(): void;\n /**\n * Updates the position and rotation in the audio engine to the current values.\n */\n public abstract update(): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"abstractSpatialAudio.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAKjE,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,cAAc,EAAE,aAAuB;IACvC,cAAc,EAAE,aAAuB;IACvC,eAAe,EAAE,CAAW;IAC5B,aAAa,EAAE,QAA6B;IAC5C,WAAW,EAAE,KAAe;IAC5B,WAAW,EAAE,CAAW;IACxB,YAAY,EAAE,YAAgC;IAC9C,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE;IACxB,aAAa,EAAE,CAAW;IAC1B,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE;IACxB,kBAAkB,EAAE,IAAI,UAAU,EAAE;CAC9B,CAAC;AA6FX;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAsC;IAC1E,OAAO,CACH,OAAO,CAAC,cAAc;QACtB,OAAO,CAAC,iBAAiB,KAAK,SAAS;QACvC,OAAO,CAAC,qBAAqB,KAAK,SAAS;QAC3C,OAAO,CAAC,qBAAqB,KAAK,SAAS;QAC3C,OAAO,CAAC,sBAAsB,KAAK,SAAS;QAC5C,OAAO,CAAC,oBAAoB,KAAK,SAAS;QAC1C,OAAO,CAAC,kBAAkB,KAAK,SAAS;QACxC,OAAO,CAAC,kBAAkB,KAAK,SAAS;QACxC,OAAO,CAAC,oBAAoB,KAAK,SAAS;QAC1C,OAAO,CAAC,mBAAmB,KAAK,SAAS;QACzC,OAAO,CAAC,eAAe,KAAK,SAAS;QACrC,OAAO,CAAC,oBAAoB,KAAK,SAAS;QAC1C,OAAO,CAAC,eAAe,KAAK,SAAS;QACrC,OAAO,CAAC,yBAAyB,KAAK,SAAS,CAClD,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAgB,oBAAoB;CAgHzC","sourcesContent":["import { Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport type { Node } from \"../../../node\";\nimport type { Nullable } from \"../../../types\";\nimport type { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\n\nexport const _SpatialAudioDefaults = {\n coneInnerAngle: 6.28318530718 as number,\n coneOuterAngle: 6.28318530718 as number,\n coneOuterVolume: 0 as number,\n distanceModel: \"linear\" as DistanceModelType,\n maxDistance: 10000 as number,\n minDistance: 1 as number,\n panningModel: \"equalpower\" as PanningModelType,\n position: Vector3.Zero(),\n rolloffFactor: 1 as number,\n rotation: Vector3.Zero(),\n rotationQuaternion: new Quaternion(),\n} as const;\n\n/**\n * Options for spatial audio.\n */\nexport interface ISpatialAudioOptions {\n /**\n * Whether to automatically update the spatial properties of the audio node. Defaults to `true`.\n */\n spatialAutoUpdate: boolean;\n /**\n * The spatial cone inner angle, in radians. Defaults to 2π.\n * - When the listener is inside the cone inner angle, the volume is at its maximum.\n */\n spatialConeInnerAngle: number;\n /**\n * The spatial cone outer angle, in radians. Defaults to 2π.\n * - When the listener is between the the cone inner and outer angles, the volume fades to its minimum as the listener approaches the outer angle.\n * - When the listener is outside the cone outer angle, the volume is at its minimum.\n */\n spatialConeOuterAngle: number;\n /**\n * The amount of volume reduction outside the {@link spatialConeOuterAngle}. Defaults to 0.\n */\n spatialConeOuterVolume: number;\n /**\n * The algorithm to use to reduce the volume of the audio source as it moves away from the listener. Defaults to \"inverse\".\n *\n * Possible values are:\n * - `\"linear\"`: The volume is reduced linearly as the source moves away from the listener.\n * - `\"inverse\"`: The volume is reduced inversely as the source moves away from the listener.\n * - `\"exponential\"`: The volume is reduced exponentially as the source moves away from the listener.\n *\n * @see {@link spatialMaxDistance}\n * @see {@link spatialMinDistance}\n * @see {@link spatialRolloffFactor}\n */\n spatialDistanceModel: \"linear\" | \"inverse\" | \"exponential\";\n /**\n * Enable spatial audio. Defaults to false.\n *\n * When set to `true`, the audio node's spatial properties will be initialized on creation and there will be no\n * delay when setting the first spatial value.\n *\n * When not specified, or set to `false`, the audio node's spatial properties will not be initialized on creation\n * and there will be a small delay when setting the first spatial value.\n *\n * - This option is ignored if any other spatial options are set.\n */\n spatialEnabled: boolean;\n /**\n * The maximum distance between the audio source and the listener, after which the volume is not reduced any further. Defaults to 10000.\n * - This value is used only when the {@link spatialDistanceModel} is set to `\"linear\"`.\n * @see {@link spatialDistanceModel}\n */\n spatialMaxDistance: number;\n /**\n * The minimum update time in seconds of the spatialization if it is attached to a mesh or transform node. Defaults to `0`.\n * - The spatialization's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.\n */\n spatialMinUpdateTime: number;\n /**\n * Possible values are:\n * - `\"equalpower\"`: Represents the equal-power panning algorithm, generally regarded as simple and efficient.\n * - `\"HRTF\"`: Renders a stereo output of higher quality than `\"equalpower\"` — it uses a convolution with measured impulse responses from human subjects.\n */\n spatialPanningModel: \"equalpower\" | \"HRTF\";\n /**\n * The spatial position. Defaults to (0, 0, 0).\n */\n spatialPosition: Vector3;\n /**\n * The distance for reducing volume as the audio source moves away from the listener – i.e. the distance the volume reduction starts at. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link spatialDistanceModel}\n */\n spatialMinDistance: number;\n /**\n * How quickly the volume is reduced as the source moves away from the listener. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link spatialDistanceModel}\n */\n spatialRolloffFactor: number;\n /**\n * The spatial rotation, as Euler angles. Defaults to (0, 0, 0).\n */\n spatialRotation: Vector3;\n /**\n * The spatial rotation, as a quaternion. Defaults to (0, 0, 0, 1).\n */\n spatialRotationQuaternion: Quaternion;\n}\n\n/**\n * @param options The spatial audio options to check.\n * @returns `true` if spatial audio options are defined, otherwise `false`.\n */\nexport function _HasSpatialAudioOptions(options: Partial<ISpatialAudioOptions>): boolean {\n return (\n options.spatialEnabled ||\n options.spatialAutoUpdate !== undefined ||\n options.spatialConeInnerAngle !== undefined ||\n options.spatialConeOuterAngle !== undefined ||\n options.spatialConeOuterVolume !== undefined ||\n options.spatialDistanceModel !== undefined ||\n options.spatialMaxDistance !== undefined ||\n options.spatialMinDistance !== undefined ||\n options.spatialMinUpdateTime !== undefined ||\n options.spatialPanningModel !== undefined ||\n options.spatialPosition !== undefined ||\n options.spatialRolloffFactor !== undefined ||\n options.spatialRotation !== undefined ||\n options.spatialRotationQuaternion !== undefined\n );\n}\n\n/**\n * Abstract class representing the `spatial` audio property on a sound or audio bus.\n *\n * @see {@link AudioEngineV2.listener}\n */\nexport abstract class AbstractSpatialAudio {\n /**\n * The spatial cone inner angle, in radians. Defaults to 2π.\n * - When the listener is inside the cone inner angle, the volume is at its maximum.\n */\n public abstract coneInnerAngle: number;\n\n /**\n * The spatial cone outer angle, in radians. Defaults to 2π.\n * - When the listener is between the the cone inner and outer angles, the volume fades to its minimum as the listener approaches the outer angle.\n * - When the listener is outside the cone outer angle, the volume is at its minimum.\n */\n public abstract coneOuterAngle: number;\n\n /**\n * The amount of volume reduction outside the {@link coneOuterAngle}. Defaults to 0.\n */\n public abstract coneOuterVolume: number;\n\n /**\n * The algorithm to use to reduce the volume of the audio source as it moves away from the listener. Defaults to \"inverse\".\n *\n * Possible values are:\n * - `\"linear\"`: The volume is reduced linearly as the source moves away from the listener.\n * - `\"inverse\"`: The volume is reduced inversely as the source moves away from the listener.\n * - `\"exponential\"`: The volume is reduced exponentially as the source moves away from the listener.\n *\n * @see {@link spatialMaxDistance}\n * @see {@link spatialMinDistance}\n * @see {@link spatialRolloffFactor}\n */\n public abstract distanceModel: \"linear\" | \"inverse\" | \"exponential\";\n\n /**\n * Whether the audio source is attached to a mesh or transform node.\n */\n public abstract isAttached: boolean;\n\n /**\n * The maximum distance between the audio source and the listener, after which the volume is not reduced any further. Defaults to 10000.\n * - This value is used only when the {@link distanceModel} is set to `\"linear\"`.\n * @see {@link distanceModel}\n */\n public abstract maxDistance: number;\n\n /**\n * The distance for reducing volume as the audio source moves away from the listener – i.e. the distance the volume reduction starts at. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link distanceModel}\n */\n public abstract minDistance: number;\n\n /**\n * The minimum update time in seconds of the spatialization if it is attached to a mesh or transform node. Defaults to `0`.\n * - The spatialization's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.\n */\n public abstract minUpdateTime: number;\n\n /**\n * The spatial panning model. Defaults to \"equalpower\".\n *\n * Possible values are:\n * - `\"equalpower\"`: Represents the equal-power panning algorithm, generally regarded as simple and efficient.\n * - `\"HRTF\"`:Renders a stereo output of higher quality than `\"equalpower\"` — it uses a convolution with measured impulse responses from human subjects.\n */\n public abstract panningModel: \"equalpower\" | \"HRTF\";\n\n /**\n * The spatial position. Defaults to (0, 0, 0).\n */\n public abstract position: Vector3;\n\n /**\n * How quickly the volume is reduced as the source moves away from the listener. Defaults to 1.\n * - This value is used by all distance models.\n * @see {@link distanceModel}\n */\n public abstract rolloffFactor: number;\n\n /**\n * The spatial rotation. Defaults to (0, 0, 0).\n */\n public abstract rotation: Vector3;\n\n /**\n * The spatial rotation quaternion. Defaults to (0, 0, 0, 1).\n */\n public abstract rotationQuaternion: Quaternion;\n\n /**\n * Attaches to a scene node.\n *\n * Detaches automatically before attaching to the given scene node.\n * If `sceneNode` is `null` it is the same as calling `detach()`.\n *\n * @param sceneNode The scene node to attach to, or `null` to detach.\n * @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.\n * @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.\n */\n public abstract attach(sceneNode: Nullable<Node>, useBoundingBox?: boolean, attachmentType?: SpatialAudioAttachmentType): void;\n\n /**\n * Detaches from the scene node if attached.\n */\n public abstract detach(): void;\n\n /**\n * Updates the position and rotation of the associated audio engine object in the audio rendering graph.\n *\n * This is called automatically by default and only needs to be called manually if automatic updates are disabled.\n */\n public abstract update(): void;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Quaternion, Vector3 } from "../../../Maths/math.vector";
|
|
2
2
|
import type { Node } from "../../../node";
|
|
3
|
+
import type { Nullable } from "../../../types";
|
|
3
4
|
import type { SpatialAudioAttachmentType } from "../../spatialAudioAttachmentType";
|
|
4
5
|
export declare const _SpatialAudioListenerDefaults: {
|
|
5
6
|
readonly position: Vector3;
|
|
@@ -69,18 +70,24 @@ export declare abstract class AbstractSpatialAudioListener {
|
|
|
69
70
|
*/
|
|
70
71
|
abstract rotationQuaternion: Quaternion;
|
|
71
72
|
/**
|
|
72
|
-
* Attaches
|
|
73
|
-
*
|
|
73
|
+
* Attaches to a scene node.
|
|
74
|
+
*
|
|
75
|
+
* Detaches automatically before attaching to the given scene node.
|
|
76
|
+
* If `sceneNode` is `null` it is the same as calling `detach()`.
|
|
77
|
+
*
|
|
78
|
+
* @param sceneNode The scene node to attach to, or `null` to detach.
|
|
74
79
|
* @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.
|
|
75
|
-
* @param attachmentType
|
|
80
|
+
* @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.
|
|
76
81
|
*/
|
|
77
|
-
abstract attach(sceneNode: Node
|
|
82
|
+
abstract attach(sceneNode: Nullable<Node>, useBoundingBox?: boolean, attachmentType?: SpatialAudioAttachmentType): void;
|
|
78
83
|
/**
|
|
79
|
-
* Detaches
|
|
84
|
+
* Detaches from the scene node if attached.
|
|
80
85
|
*/
|
|
81
86
|
abstract detach(): void;
|
|
82
87
|
/**
|
|
83
|
-
* Updates the position and rotation
|
|
88
|
+
* Updates the position and rotation of the associated audio engine object in the audio rendering graph.
|
|
89
|
+
*
|
|
90
|
+
* This is called automatically by default and only needs to be called manually if automatic updates are disabled.
|
|
84
91
|
*/
|
|
85
92
|
abstract update(): void;
|
|
86
93
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractSpatialAudioListener.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"abstractSpatialAudioListener.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAKjE,MAAM,CAAC,MAAM,6BAA6B,GAAG;IACzC,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE;IACxB,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE;IACxB,kBAAkB,EAAE,IAAI,UAAU,EAAE;CAC9B,CAAC;AAiCX;;;GAGG;AACH,MAAM,UAAU,+BAA+B,CAAC,OAA8C;IAC1F,OAAO,CACH,OAAO,CAAC,eAAe;QACvB,OAAO,CAAC,qBAAqB,KAAK,SAAS;QAC3C,OAAO,CAAC,gBAAgB,KAAK,SAAS;QACtC,OAAO,CAAC,gBAAgB,KAAK,SAAS;QACtC,OAAO,CAAC,0BAA0B,KAAK,SAAS,CACnD,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAgB,4BAA4B;CAkDjD","sourcesContent":["import { Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport type { Node } from \"../../../node\";\nimport type { Nullable } from \"../../../types\";\nimport type { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\n\nexport const _SpatialAudioListenerDefaults = {\n position: Vector3.Zero(),\n rotation: Vector3.Zero(),\n rotationQuaternion: new Quaternion(),\n} as const;\n\n/**\n * Options for spatial audio.\n */\nexport interface ISpatialAudioListenerOptions {\n /**\n * Whether to automatically update the position and rotation of the listener. Defaults to `true`.\n */\n listenerAutoUpdate: boolean;\n /**\n * Set to `true` to enable the listener. Defaults to `false`.\n */\n listenerEnabled: boolean;\n /**\n * The minimum update time in seconds of the listener if it is attached to a mesh, scene or transform node. Defaults to `0`.\n * - The listener's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.\n */\n listenerMinUpdateTime: number;\n /**\n * The listener position. Defaults to (0, 0, 0).\n */\n listenerPosition: Vector3;\n /**\n * The listener rotation, as Euler angles. Defaults to (0, 0, 0).\n */\n listenerRotation: Vector3;\n /**\n * The listener rotation, as a quaternion. Defaults to (0, 0, 0, 1).\n */\n listenerRotationQuaternion: Quaternion;\n}\n\n/**\n * @param options The spatial audio listener options to check.\n * @returns `true` if spatial audio listener options are defined, otherwise `false`.\n */\nexport function _HasSpatialAudioListenerOptions(options: Partial<ISpatialAudioListenerOptions>): boolean {\n return (\n options.listenerEnabled ||\n options.listenerMinUpdateTime !== undefined ||\n options.listenerPosition !== undefined ||\n options.listenerRotation !== undefined ||\n options.listenerRotationQuaternion !== undefined\n );\n}\n\n/**\n * Abstract class representing the spatial audio `listener` property on an audio engine.\n *\n * @see {@link AudioEngineV2.listener}\n */\nexport abstract class AbstractSpatialAudioListener {\n /**\n * Whether the listener is attached to a camera, mesh or transform node.\n */\n public abstract isAttached: boolean;\n\n /**\n * The minimum update time in seconds of the listener if it is attached to a mesh, scene or transform node. Defaults to `0`.\n * - The listener's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.\n */\n public abstract minUpdateTime: number;\n\n /**\n * The listener position. Defaults to (0, 0, 0).\n */\n public abstract position: Vector3;\n\n /**\n * The listener rotation, as Euler angles. Defaults to (0, 0, 0).\n */\n public abstract rotation: Vector3;\n\n /**\n * The listener rotation, as a quaternion. Defaults to (0, 0, 0, 1).\n */\n public abstract rotationQuaternion: Quaternion;\n\n /**\n * Attaches to a scene node.\n *\n * Detaches automatically before attaching to the given scene node.\n * If `sceneNode` is `null` it is the same as calling `detach()`.\n *\n * @param sceneNode The scene node to attach to, or `null` to detach.\n * @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.\n * @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.\n */\n public abstract attach(sceneNode: Nullable<Node>, useBoundingBox?: boolean, attachmentType?: SpatialAudioAttachmentType): void;\n\n /**\n * Detaches from the scene node if attached.\n */\n public abstract detach(): void;\n\n /**\n * Updates the position and rotation of the associated audio engine object in the audio rendering graph.\n *\n * This is called automatically by default and only needs to be called manually if automatic updates are disabled.\n */\n public abstract update(): void;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Quaternion, Vector3 } from "../../../Maths/math.vector";
|
|
2
2
|
import type { Node } from "../../../node";
|
|
3
|
+
import type { Nullable } from "../../../types";
|
|
3
4
|
import { SpatialAudioAttachmentType } from "../../spatialAudioAttachmentType";
|
|
4
5
|
import type { _AbstractAudioSubGraph } from "../subNodes/abstractAudioSubGraph";
|
|
5
6
|
import { AbstractSpatialAudio } from "./abstractSpatialAudio";
|
|
@@ -29,15 +30,15 @@ export declare abstract class _SpatialAudio extends AbstractSpatialAudio {
|
|
|
29
30
|
get maxDistance(): number;
|
|
30
31
|
set maxDistance(value: number);
|
|
31
32
|
/** @internal */
|
|
33
|
+
get minDistance(): number;
|
|
34
|
+
set minDistance(value: number);
|
|
35
|
+
/** @internal */
|
|
32
36
|
get panningModel(): PanningModelType;
|
|
33
37
|
set panningModel(value: PanningModelType);
|
|
34
38
|
/** @internal */
|
|
35
39
|
get position(): Vector3;
|
|
36
40
|
set position(value: Vector3);
|
|
37
41
|
/** @internal */
|
|
38
|
-
get referenceDistance(): number;
|
|
39
|
-
set referenceDistance(value: number);
|
|
40
|
-
/** @internal */
|
|
41
42
|
get rolloffFactor(): number;
|
|
42
43
|
set rolloffFactor(value: number);
|
|
43
44
|
/** @internal */
|
|
@@ -47,14 +48,18 @@ export declare abstract class _SpatialAudio extends AbstractSpatialAudio {
|
|
|
47
48
|
get rotationQuaternion(): Quaternion;
|
|
48
49
|
set rotationQuaternion(value: Quaternion);
|
|
49
50
|
/**
|
|
50
|
-
* Attaches
|
|
51
|
-
*
|
|
51
|
+
* Attaches to a scene node.
|
|
52
|
+
*
|
|
53
|
+
* Detaches automatically before attaching to the given scene node.
|
|
54
|
+
* If `sceneNode` is `null` it is the same as calling `detach()`.
|
|
55
|
+
*
|
|
56
|
+
* @param sceneNode The scene node to attach to, or `null` to detach.
|
|
52
57
|
* @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.
|
|
53
|
-
* @param attachmentType
|
|
58
|
+
* @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.
|
|
54
59
|
*/
|
|
55
|
-
attach(sceneNode: Node
|
|
60
|
+
attach(sceneNode: Nullable<Node>, useBoundingBox?: boolean, attachmentType?: SpatialAudioAttachmentType): void;
|
|
56
61
|
/**
|
|
57
|
-
* Detaches
|
|
62
|
+
* Detaches from the scene node if attached.
|
|
58
63
|
*/
|
|
59
64
|
detach(): void;
|
|
60
65
|
/** @internal */
|
|
@@ -62,6 +62,13 @@ export class _SpatialAudio extends AbstractSpatialAudio {
|
|
|
62
62
|
_SetSpatialAudioProperty(this._subGraph, "maxDistance", value);
|
|
63
63
|
}
|
|
64
64
|
/** @internal */
|
|
65
|
+
get minDistance() {
|
|
66
|
+
return _GetSpatialAudioProperty(this._subGraph, "minDistance");
|
|
67
|
+
}
|
|
68
|
+
set minDistance(value) {
|
|
69
|
+
_SetSpatialAudioProperty(this._subGraph, "minDistance", value);
|
|
70
|
+
}
|
|
71
|
+
/** @internal */
|
|
65
72
|
get panningModel() {
|
|
66
73
|
return _GetSpatialAudioProperty(this._subGraph, "panningModel");
|
|
67
74
|
}
|
|
@@ -77,13 +84,6 @@ export class _SpatialAudio extends AbstractSpatialAudio {
|
|
|
77
84
|
this._updatePosition();
|
|
78
85
|
}
|
|
79
86
|
/** @internal */
|
|
80
|
-
get referenceDistance() {
|
|
81
|
-
return _GetSpatialAudioProperty(this._subGraph, "referenceDistance");
|
|
82
|
-
}
|
|
83
|
-
set referenceDistance(value) {
|
|
84
|
-
_SetSpatialAudioProperty(this._subGraph, "referenceDistance", value);
|
|
85
|
-
}
|
|
86
|
-
/** @internal */
|
|
87
87
|
get rolloffFactor() {
|
|
88
88
|
return _GetSpatialAudioProperty(this._subGraph, "rolloffFactor");
|
|
89
89
|
}
|
|
@@ -107,16 +107,20 @@ export class _SpatialAudio extends AbstractSpatialAudio {
|
|
|
107
107
|
this._updateRotation();
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
* Attaches
|
|
111
|
-
*
|
|
110
|
+
* Attaches to a scene node.
|
|
111
|
+
*
|
|
112
|
+
* Detaches automatically before attaching to the given scene node.
|
|
113
|
+
* If `sceneNode` is `null` it is the same as calling `detach()`.
|
|
114
|
+
*
|
|
115
|
+
* @param sceneNode The scene node to attach to, or `null` to detach.
|
|
112
116
|
* @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.
|
|
113
|
-
* @param attachmentType
|
|
117
|
+
* @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.
|
|
114
118
|
*/
|
|
115
119
|
attach(sceneNode, useBoundingBox = false, attachmentType = 3 /* SpatialAudioAttachmentType.PositionAndRotation */) {
|
|
116
120
|
_GetSpatialAudioSubNode(this._subGraph)?.attach(sceneNode, useBoundingBox, attachmentType);
|
|
117
121
|
}
|
|
118
122
|
/**
|
|
119
|
-
* Detaches
|
|
123
|
+
* Detaches from the scene node if attached.
|
|
120
124
|
*/
|
|
121
125
|
detach() {
|
|
122
126
|
_GetSpatialAudioSubNode(this._subGraph)?.detach();
|
|
@@ -145,7 +149,7 @@ export class _SpatialAudio extends AbstractSpatialAudio {
|
|
|
145
149
|
const position = subNode.position;
|
|
146
150
|
if (!position.equalsWithEpsilon(this._position)) {
|
|
147
151
|
subNode.position.copyFrom(this._position);
|
|
148
|
-
subNode.
|
|
152
|
+
subNode._updatePosition();
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
_updateRotation(subNode = null) {
|
|
@@ -157,11 +161,11 @@ export class _SpatialAudio extends AbstractSpatialAudio {
|
|
|
157
161
|
}
|
|
158
162
|
if (!subNode.rotationQuaternion.equalsWithEpsilon(this._rotationQuaternion)) {
|
|
159
163
|
subNode.rotationQuaternion.copyFrom(this._rotationQuaternion);
|
|
160
|
-
subNode.
|
|
164
|
+
subNode._updateRotation();
|
|
161
165
|
}
|
|
162
166
|
else if (!subNode.rotation.equalsWithEpsilon(this._rotation)) {
|
|
163
167
|
subNode.rotation.copyFrom(this._rotation);
|
|
164
|
-
subNode.
|
|
168
|
+
subNode._updateRotation();
|
|
165
169
|
}
|
|
166
170
|
}
|
|
167
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatialAudio.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudio.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC9H,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAErF,gBAAgB;AAChB,MAAM,OAAgB,aAAc,SAAQ,oBAAoB;IAM5D,gBAAgB;IAChB,YAAmB,QAAgC;QAC/C,KAAK,EAAE,CAAC;QAER,MAAM,OAAO,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;QAClD,IAAI,OAAO,EAAE,CAAC;YACV,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YAC1C,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YAC1C,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAClE,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,SAAS,GAAG,qBAAqB,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;YACxD,IAAI,CAAC,SA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AE,CAAC;YACX,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAElD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACX,OAAO;YACX,CAAC;QACL,CAAC;QAED,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAClC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC9C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;QAC7B,CAAC;IACL,CAAC;IAEO,eAAe,CAAC,UAA0C,IAAI;QAClE,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO,GAAG,uBAAuB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAElD,IAAI,CAAC,OAAO,EAAE,CAAC;gBACX,OAAO;YACX,CAAC;QACL,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC1E,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAC9D,OAAO,CAAC,cAAc,EAAE,CAAC;QAC7B,CAAC;aAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1C,OAAO,CAAC,cAAc,EAAE,CAAC;QAC7B,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport type { Node } from \"../../../node\";\nimport type { Nullable } from \"../../../types\";\nimport { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\nimport type { _AbstractAudioSubGraph } from \"../subNodes/abstractAudioSubGraph\";\nimport { AudioSubNode } from \"../subNodes/audioSubNode\";\nimport type { _SpatialAudioSubNode } from \"../subNodes/spatialAudioSubNode\";\nimport { _GetSpatialAudioProperty, _GetSpatialAudioSubNode, _SetSpatialAudioProperty } from \"../subNodes/spatialAudioSubNode\";\nimport { _SpatialAudioDefaults, AbstractSpatialAudio } from \"./abstractSpatialAudio\";\n\n/** @internal */\nexport abstract class _SpatialAudio extends AbstractSpatialAudio {\n private _position: Vector3;\n private _rotation: Vector3;\n private _rotationQuaternion: Quaternion;\n private _subGraph: _AbstractAudioSubGraph;\n\n /** @internal */\n public constructor(subGraph: _AbstractAudioSubGraph) {\n super();\n\n const subNode = _GetSpatialAudioSubNode(subGraph);\n if (subNode) {\n this._position = subNode.position.clone();\n this._rotation = subNode.rotation.clone();\n this._rotationQuaternion = subNode.rotationQuaternion.clone();\n } else {\n this._position = _SpatialAudioDefaults.position.clone();\n this._rotation = _SpatialAudioDefaults.rotation.clone();\n this._rotationQuaternion = _SpatialAudioDefaults.rotationQuaternion.clone();\n\n subGraph.createAndAddSubNode(AudioSubNode.SPATIAL);\n }\n\n this._subGraph = subGraph;\n }\n\n /** @internal */\n public get coneInnerAngle(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"coneInnerAngle\") ?? _SpatialAudioDefaults.coneInnerAngle;\n }\n\n public set coneInnerAngle(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"coneInnerAngle\", value);\n }\n\n /** @internal */\n public get coneOuterAngle(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"coneOuterAngle\");\n }\n\n public set coneOuterAngle(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"coneOuterAngle\", value);\n }\n\n /** @internal */\n public get coneOuterVolume(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"coneOuterVolume\");\n }\n\n public set coneOuterVolume(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"coneOuterVolume\", value);\n }\n\n /** @internal */\n public get distanceModel(): DistanceModelType {\n return _GetSpatialAudioProperty(this._subGraph, \"distanceModel\");\n }\n\n public set distanceModel(value: DistanceModelType) {\n _SetSpatialAudioProperty(this._subGraph, \"distanceModel\", value);\n }\n\n /** @internal */\n public get isAttached(): boolean {\n return this._subGraph.getSubNode<_SpatialAudioSubNode>(AudioSubNode.SPATIAL)?.isAttached ?? false;\n }\n\n /** @internal */\n public get maxDistance(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"maxDistance\") ?? _SpatialAudioDefaults.maxDistance;\n }\n\n public set maxDistance(value: number) {\n if (value <= 0) {\n value = 0.000001;\n }\n\n _SetSpatialAudioProperty(this._subGraph, \"maxDistance\", value);\n }\n\n /** @internal */\n public get panningModel(): PanningModelType {\n return _GetSpatialAudioProperty(this._subGraph, \"panningModel\");\n }\n\n public set panningModel(value: PanningModelType) {\n _SetSpatialAudioProperty(this._subGraph, \"panningModel\", value);\n }\n\n /** @internal */\n public get position(): Vector3 {\n return this._position;\n }\n\n public set position(value: Vector3) {\n this._position = value;\n this._updatePosition();\n }\n\n /** @internal */\n public get referenceDistance(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"referenceDistance\");\n }\n\n public set referenceDistance(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"referenceDistance\", value);\n }\n\n /** @internal */\n public get rolloffFactor(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"rolloffFactor\");\n }\n\n public set rolloffFactor(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"rolloffFactor\", value);\n }\n\n /** @internal */\n public get rotation(): Vector3 {\n return this._rotation;\n }\n\n public set rotation(value: Vector3) {\n this._rotation = value;\n this._updateRotation();\n }\n\n /** @internal */\n public get rotationQuaternion(): Quaternion {\n return this._rotationQuaternion;\n }\n\n public set rotationQuaternion(value: Quaternion) {\n this._rotationQuaternion = value;\n this._updateRotation();\n }\n\n /**\n * Attaches the audio source to a scene object.\n * @param sceneNode The scene node to attach the audio source to.\n * @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.\n * @param attachmentType Whather to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.\n */\n public attach(sceneNode: Node, useBoundingBox: boolean = false, attachmentType: SpatialAudioAttachmentType = SpatialAudioAttachmentType.PositionAndRotation): void {\n _GetSpatialAudioSubNode(this._subGraph)?.attach(sceneNode, useBoundingBox, attachmentType);\n }\n\n /**\n * Detaches the audio source from the currently attached graphics node.\n */\n public detach(): void {\n _GetSpatialAudioSubNode(this._subGraph)?.detach();\n }\n\n /** @internal */\n public update(): void {\n const subNode = _GetSpatialAudioSubNode(this._subGraph);\n\n if (!subNode) {\n return;\n }\n\n if (subNode.isAttached) {\n subNode.update();\n } else {\n this._updatePosition(subNode);\n this._updateRotation(subNode);\n }\n }\n\n private _updatePosition(subNode: Nullable<_SpatialAudioSubNode> = null): void {\n if (!subNode) {\n subNode = _GetSpatialAudioSubNode(this._subGraph);\n\n if (!subNode) {\n return;\n }\n }\n\n const position = subNode.position;\n if (!position.equalsWithEpsilon(this._position)) {\n subNode.position.copyFrom(this._position);\n subNode.updatePosition();\n }\n }\n\n private _updateRotation(subNode: Nullable<_SpatialAudioSubNode> = null): void {\n if (!subNode) {\n subNode = _GetSpatialAudioSubNode(this._subGraph);\n\n if (!subNode) {\n return;\n }\n }\n\n if (!subNode.rotationQuaternion.equalsWithEpsilon(this._rotationQuaternion)) {\n subNode.rotationQuaternion.copyFrom(this._rotationQuaternion);\n subNode.updateRotation();\n } else if (!subNode.rotation.equalsWithEpsilon(this._rotation)) {\n subNode.rotation.copyFrom(this._rotation);\n subNode.updateRotation();\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"spatialAudio.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudio.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC9H,OAAO,EAAE,qBAAqB,EAAE,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AiB,CAAC,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC;YAC1E,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAC9D,OAAO,CAAC,eAAe,EAAE,CAAC;QAC9B,CAAC;aAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1C,OAAO,CAAC,eAAe,EAAE,CAAC;QAC9B,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport type { Node } from \"../../../node\";\nimport type { Nullable } from \"../../../types\";\nimport { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\nimport type { _AbstractAudioSubGraph } from \"../subNodes/abstractAudioSubGraph\";\nimport { AudioSubNode } from \"../subNodes/audioSubNode\";\nimport type { _SpatialAudioSubNode } from \"../subNodes/spatialAudioSubNode\";\nimport { _GetSpatialAudioProperty, _GetSpatialAudioSubNode, _SetSpatialAudioProperty } from \"../subNodes/spatialAudioSubNode\";\nimport { _SpatialAudioDefaults, AbstractSpatialAudio } from \"./abstractSpatialAudio\";\n\n/** @internal */\nexport abstract class _SpatialAudio extends AbstractSpatialAudio {\n private _position: Vector3;\n private _rotation: Vector3;\n private _rotationQuaternion: Quaternion;\n private _subGraph: _AbstractAudioSubGraph;\n\n /** @internal */\n public constructor(subGraph: _AbstractAudioSubGraph) {\n super();\n\n const subNode = _GetSpatialAudioSubNode(subGraph);\n if (subNode) {\n this._position = subNode.position.clone();\n this._rotation = subNode.rotation.clone();\n this._rotationQuaternion = subNode.rotationQuaternion.clone();\n } else {\n this._position = _SpatialAudioDefaults.position.clone();\n this._rotation = _SpatialAudioDefaults.rotation.clone();\n this._rotationQuaternion = _SpatialAudioDefaults.rotationQuaternion.clone();\n\n subGraph.createAndAddSubNode(AudioSubNode.SPATIAL);\n }\n\n this._subGraph = subGraph;\n }\n\n /** @internal */\n public get coneInnerAngle(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"coneInnerAngle\") ?? _SpatialAudioDefaults.coneInnerAngle;\n }\n\n public set coneInnerAngle(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"coneInnerAngle\", value);\n }\n\n /** @internal */\n public get coneOuterAngle(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"coneOuterAngle\");\n }\n\n public set coneOuterAngle(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"coneOuterAngle\", value);\n }\n\n /** @internal */\n public get coneOuterVolume(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"coneOuterVolume\");\n }\n\n public set coneOuterVolume(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"coneOuterVolume\", value);\n }\n\n /** @internal */\n public get distanceModel(): DistanceModelType {\n return _GetSpatialAudioProperty(this._subGraph, \"distanceModel\");\n }\n\n public set distanceModel(value: DistanceModelType) {\n _SetSpatialAudioProperty(this._subGraph, \"distanceModel\", value);\n }\n\n /** @internal */\n public get isAttached(): boolean {\n return this._subGraph.getSubNode<_SpatialAudioSubNode>(AudioSubNode.SPATIAL)?.isAttached ?? false;\n }\n\n /** @internal */\n public get maxDistance(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"maxDistance\") ?? _SpatialAudioDefaults.maxDistance;\n }\n\n public set maxDistance(value: number) {\n if (value <= 0) {\n value = 0.000001;\n }\n\n _SetSpatialAudioProperty(this._subGraph, \"maxDistance\", value);\n }\n\n /** @internal */\n public get minDistance(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"minDistance\");\n }\n\n public set minDistance(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"minDistance\", value);\n }\n\n /** @internal */\n public get panningModel(): PanningModelType {\n return _GetSpatialAudioProperty(this._subGraph, \"panningModel\");\n }\n\n public set panningModel(value: PanningModelType) {\n _SetSpatialAudioProperty(this._subGraph, \"panningModel\", value);\n }\n\n /** @internal */\n public get position(): Vector3 {\n return this._position;\n }\n\n public set position(value: Vector3) {\n this._position = value;\n this._updatePosition();\n }\n\n /** @internal */\n public get rolloffFactor(): number {\n return _GetSpatialAudioProperty(this._subGraph, \"rolloffFactor\");\n }\n\n public set rolloffFactor(value: number) {\n _SetSpatialAudioProperty(this._subGraph, \"rolloffFactor\", value);\n }\n\n /** @internal */\n public get rotation(): Vector3 {\n return this._rotation;\n }\n\n public set rotation(value: Vector3) {\n this._rotation = value;\n this._updateRotation();\n }\n\n /** @internal */\n public get rotationQuaternion(): Quaternion {\n return this._rotationQuaternion;\n }\n\n public set rotationQuaternion(value: Quaternion) {\n this._rotationQuaternion = value;\n this._updateRotation();\n }\n\n /**\n * Attaches to a scene node.\n *\n * Detaches automatically before attaching to the given scene node.\n * If `sceneNode` is `null` it is the same as calling `detach()`.\n *\n * @param sceneNode The scene node to attach to, or `null` to detach.\n * @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.\n * @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.\n */\n public attach(sceneNode: Nullable<Node>, useBoundingBox: boolean = false, attachmentType: SpatialAudioAttachmentType = SpatialAudioAttachmentType.PositionAndRotation): void {\n _GetSpatialAudioSubNode(this._subGraph)?.attach(sceneNode, useBoundingBox, attachmentType);\n }\n\n /**\n * Detaches from the scene node if attached.\n */\n public detach(): void {\n _GetSpatialAudioSubNode(this._subGraph)?.detach();\n }\n\n /** @internal */\n public update(): void {\n const subNode = _GetSpatialAudioSubNode(this._subGraph);\n\n if (!subNode) {\n return;\n }\n\n if (subNode.isAttached) {\n subNode.update();\n } else {\n this._updatePosition(subNode);\n this._updateRotation(subNode);\n }\n }\n\n private _updatePosition(subNode: Nullable<_SpatialAudioSubNode> = null): void {\n if (!subNode) {\n subNode = _GetSpatialAudioSubNode(this._subGraph);\n\n if (!subNode) {\n return;\n }\n }\n\n const position = subNode.position;\n if (!position.equalsWithEpsilon(this._position)) {\n subNode.position.copyFrom(this._position);\n subNode._updatePosition();\n }\n }\n\n private _updateRotation(subNode: Nullable<_SpatialAudioSubNode> = null): void {\n if (!subNode) {\n subNode = _GetSpatialAudioSubNode(this._subGraph);\n\n if (!subNode) {\n return;\n }\n }\n\n if (!subNode.rotationQuaternion.equalsWithEpsilon(this._rotationQuaternion)) {\n subNode.rotationQuaternion.copyFrom(this._rotationQuaternion);\n subNode._updateRotation();\n } else if (!subNode.rotation.equalsWithEpsilon(this._rotation)) {\n subNode.rotation.copyFrom(this._rotation);\n subNode._updateRotation();\n }\n }\n}\n"]}
|
|
@@ -11,20 +11,24 @@ export declare abstract class _SpatialAudioListener extends AbstractSpatialAudio
|
|
|
11
11
|
/** @internal */
|
|
12
12
|
get isAttached(): boolean;
|
|
13
13
|
/**
|
|
14
|
-
* Attaches
|
|
15
|
-
*
|
|
14
|
+
* Attaches to a scene node.
|
|
15
|
+
*
|
|
16
|
+
* Detaches automatically before attaching to the given scene node.
|
|
17
|
+
* If `sceneNode` is `null` it is the same as calling `detach()`.
|
|
18
|
+
*
|
|
19
|
+
* @param sceneNode The scene node to attach to, or `null` to detach.
|
|
16
20
|
* @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.
|
|
17
21
|
* @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.
|
|
18
22
|
*/
|
|
19
|
-
attach(sceneNode: Node
|
|
23
|
+
attach(sceneNode: Nullable<Node>, useBoundingBox?: boolean, attachmentType?: SpatialAudioAttachmentType): void;
|
|
20
24
|
/**
|
|
21
|
-
* Detaches
|
|
25
|
+
* Detaches from the scene node if attached.
|
|
22
26
|
*/
|
|
23
27
|
detach(): void;
|
|
24
28
|
/** @internal */
|
|
25
29
|
dispose(): void;
|
|
26
30
|
/** @internal */
|
|
27
31
|
setOptions(options: Partial<ISpatialAudioListenerOptions>): void;
|
|
28
|
-
abstract
|
|
29
|
-
abstract
|
|
32
|
+
abstract _updatePosition(): void;
|
|
33
|
+
abstract _updateRotation(): void;
|
|
30
34
|
}
|
|
@@ -12,8 +12,12 @@ export class _SpatialAudioListener extends AbstractSpatialAudioListener {
|
|
|
12
12
|
return this._attacherComponent !== null && this._attacherComponent.isAttached;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
* Attaches
|
|
16
|
-
*
|
|
15
|
+
* Attaches to a scene node.
|
|
16
|
+
*
|
|
17
|
+
* Detaches automatically before attaching to the given scene node.
|
|
18
|
+
* If `sceneNode` is `null` it is the same as calling `detach()`.
|
|
19
|
+
*
|
|
20
|
+
* @param sceneNode The scene node to attach to, or `null` to detach.
|
|
17
21
|
* @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.
|
|
18
22
|
* @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.
|
|
19
23
|
*/
|
|
@@ -24,7 +28,7 @@ export class _SpatialAudioListener extends AbstractSpatialAudioListener {
|
|
|
24
28
|
this._attacherComponent.attach(sceneNode, useBoundingBox, attachmentType);
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
|
-
* Detaches
|
|
31
|
+
* Detaches from the scene node if attached.
|
|
28
32
|
*/
|
|
29
33
|
detach() {
|
|
30
34
|
this._attacherComponent?.detach();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatialAudioListener.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudioListener.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE7G,gBAAgB;AAChB,MAAM,OAAgB,qBAAsB,SAAQ,4BAA4B;IAG5E;QACI,KAAK,EAAE,CAAC;QAHF,uBAAkB,GAA6C,IAAI,CAAC;QAK1E,IAAI,CAAC,kBAAkB,GAAG,IAAI,8BAA8B,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,gBAAgB;IAChB,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,kBAAkB,KAAK,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC;IAClF,CAAC;IAED
|
|
1
|
+
{"version":3,"file":"spatialAudioListener.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudioListener.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,EAAE,6BAA6B,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE7G,gBAAgB;AAChB,MAAM,OAAgB,qBAAsB,SAAQ,4BAA4B;IAG5E;QACI,KAAK,EAAE,CAAC;QAHF,uBAAkB,GAA6C,IAAI,CAAC;QAK1E,IAAI,CAAC,kBAAkB,GAAG,IAAI,8BAA8B,CAAC,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,gBAAgB;IAChB,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,kBAAkB,KAAK,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC;IAClF,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,SAAyB,EAAE,iBAA0B,KAAK,EAAE,uEAA2F;QACjK,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC3B,IAAI,CAAC,kBAAkB,GAAG,IAAI,8BAA8B,CAAC,IAAI,CAAC,CAAC;QACvE,CAAC;QACD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACI,MAAM;QACT,IAAI,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;IAED,gBAAgB;IACT,OAAO;QACV,IAAI,CAAC,kBAAkB,EAAE,OAAO,EAAE,CAAC;QACnC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,UAAU,CAAC,OAA8C;QAC5D,IAAI,OAAO,CAAC,qBAAqB,KAAK,SAAS,EAAE,CAAC;YAC9C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,qBAAqB,CAAC;QACvD,CAAC;QAED,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAC3B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACrD,CAAC;QAED,IAAI,OAAO,CAAC,0BAA0B,EAAE,CAAC;YACrC,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,0BAA0B,CAAC,KAAK,EAAE,CAAC;QACzE,CAAC;aAAM,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACrD,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,kBAAkB,GAAG,6BAA6B,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QACvF,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;CAIJ","sourcesContent":["import type { Node } from \"../../../node\";\nimport type { Nullable } from \"../../../types\";\nimport { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\nimport { _SpatialAudioAttacherComponent } from \"../components/spatialAudioAttacherComponent\";\nimport type { ISpatialAudioListenerOptions } from \"./abstractSpatialAudioListener\";\nimport { _SpatialAudioListenerDefaults, AbstractSpatialAudioListener } from \"./abstractSpatialAudioListener\";\n\n/** @internal */\nexport abstract class _SpatialAudioListener extends AbstractSpatialAudioListener {\n protected _attacherComponent: Nullable<_SpatialAudioAttacherComponent> = null;\n\n protected constructor() {\n super();\n\n this._attacherComponent = new _SpatialAudioAttacherComponent(this);\n }\n\n /** @internal */\n public get isAttached(): boolean {\n return this._attacherComponent !== null && this._attacherComponent.isAttached;\n }\n\n /**\n * Attaches to a scene node.\n *\n * Detaches automatically before attaching to the given scene node.\n * If `sceneNode` is `null` it is the same as calling `detach()`.\n *\n * @param sceneNode The scene node to attach to, or `null` to detach.\n * @param useBoundingBox Whether to use the bounding box of the node for positioning. Defaults to `false`.\n * @param attachmentType Whether to attach to the node's position and/or rotation. Defaults to `PositionAndRotation`.\n */\n public attach(sceneNode: Nullable<Node>, useBoundingBox: boolean = false, attachmentType: SpatialAudioAttachmentType = SpatialAudioAttachmentType.PositionAndRotation): void {\n if (!this._attacherComponent) {\n this._attacherComponent = new _SpatialAudioAttacherComponent(this);\n }\n this._attacherComponent.attach(sceneNode, useBoundingBox, attachmentType);\n }\n\n /**\n * Detaches from the scene node if attached.\n */\n public detach(): void {\n this._attacherComponent?.detach();\n }\n\n /** @internal */\n public dispose(): void {\n this._attacherComponent?.dispose();\n this._attacherComponent = null;\n }\n\n /** @internal */\n public setOptions(options: Partial<ISpatialAudioListenerOptions>): void {\n if (options.listenerMinUpdateTime !== undefined) {\n this.minUpdateTime = options.listenerMinUpdateTime;\n }\n\n if (options.listenerPosition) {\n this.position = options.listenerPosition.clone();\n }\n\n if (options.listenerRotationQuaternion) {\n this.rotationQuaternion = options.listenerRotationQuaternion.clone();\n } else if (options.listenerRotation) {\n this.rotation = options.listenerRotation.clone();\n } else {\n this.rotationQuaternion = _SpatialAudioListenerDefaults.rotationQuaternion.clone();\n }\n\n this.update();\n }\n\n public abstract _updatePosition(): void;\n public abstract _updateRotation(): void;\n}\n"]}
|
|
@@ -32,15 +32,15 @@ export declare class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {
|
|
|
32
32
|
get distanceModel(): "linear" | "inverse" | "exponential";
|
|
33
33
|
set distanceModel(value: "linear" | "inverse" | "exponential");
|
|
34
34
|
/** @internal */
|
|
35
|
+
get minDistance(): number;
|
|
36
|
+
set minDistance(value: number);
|
|
37
|
+
/** @internal */
|
|
35
38
|
get maxDistance(): number;
|
|
36
39
|
set maxDistance(value: number);
|
|
37
40
|
/** @internal */
|
|
38
41
|
get panningModel(): "equalpower" | "HRTF";
|
|
39
42
|
set panningModel(value: "equalpower" | "HRTF");
|
|
40
43
|
/** @internal */
|
|
41
|
-
get referenceDistance(): number;
|
|
42
|
-
set referenceDistance(value: number);
|
|
43
|
-
/** @internal */
|
|
44
44
|
get rolloffFactor(): number;
|
|
45
45
|
set rolloffFactor(value: number);
|
|
46
46
|
/** @internal */
|
|
@@ -48,9 +48,9 @@ export declare class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {
|
|
|
48
48
|
/** @internal */
|
|
49
49
|
get outNode(): AudioNode;
|
|
50
50
|
/** @internal */
|
|
51
|
-
|
|
51
|
+
_updatePosition(): void;
|
|
52
52
|
/** @internal */
|
|
53
|
-
|
|
53
|
+
_updateRotation(): void;
|
|
54
54
|
protected _connect(node: IWebAudioInNode): boolean;
|
|
55
55
|
protected _disconnect(node: IWebAudioInNode): boolean;
|
|
56
56
|
/** @internal */
|
|
@@ -63,6 +63,13 @@ export class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {
|
|
|
63
63
|
this.node.maxDistance = maxDistance;
|
|
64
64
|
}
|
|
65
65
|
/** @internal */
|
|
66
|
+
get minDistance() {
|
|
67
|
+
return this.node.refDistance;
|
|
68
|
+
}
|
|
69
|
+
set minDistance(value) {
|
|
70
|
+
this.node.refDistance = value;
|
|
71
|
+
}
|
|
72
|
+
/** @internal */
|
|
66
73
|
get maxDistance() {
|
|
67
74
|
return this.node.maxDistance;
|
|
68
75
|
}
|
|
@@ -77,13 +84,6 @@ export class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {
|
|
|
77
84
|
this.node.panningModel = value;
|
|
78
85
|
}
|
|
79
86
|
/** @internal */
|
|
80
|
-
get referenceDistance() {
|
|
81
|
-
return this.node.refDistance;
|
|
82
|
-
}
|
|
83
|
-
set referenceDistance(value) {
|
|
84
|
-
this.node.refDistance = value;
|
|
85
|
-
}
|
|
86
|
-
/** @internal */
|
|
87
87
|
get rolloffFactor() {
|
|
88
88
|
return this.node.rolloffFactor;
|
|
89
89
|
}
|
|
@@ -99,7 +99,7 @@ export class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {
|
|
|
99
99
|
return this.node;
|
|
100
100
|
}
|
|
101
101
|
/** @internal */
|
|
102
|
-
|
|
102
|
+
_updatePosition() {
|
|
103
103
|
if (this._lastPosition.equalsWithEpsilon(this.position)) {
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
@@ -109,7 +109,7 @@ export class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {
|
|
|
109
109
|
this._lastPosition.copyFrom(this.position);
|
|
110
110
|
}
|
|
111
111
|
/** @internal */
|
|
112
|
-
|
|
112
|
+
_updateRotation() {
|
|
113
113
|
if (!this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion)) {
|
|
114
114
|
TmpQuaternion.copyFrom(this.rotationQuaternion);
|
|
115
115
|
this._lastRotationQuaternion.copyFrom(this.rotationQuaternion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatialWebAudioSubNode.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAI/F,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;AAChC,MAAM,aAAa,GAAG,IAAI,UAAU,EAAE,CAAC;AACvC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAEjC,SAAS,GAAG,CAAC,OAAe;IACxB,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC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AAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gBAAgB;IACT,YAAY;QACf,OAAO,yBAAyB,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import { Matrix, Quaternion, Vector3 } from \"../../../Maths/math.vector\";\r\nimport { _SpatialAudioSubNode } from \"../../abstractAudio/subNodes/spatialAudioSubNode\";\r\nimport { _SpatialAudioDefaults } from \"../../abstractAudio/subProperties/abstractSpatialAudio\";\r\nimport type { _WebAudioEngine } from \"../webAudioEngine\";\r\nimport type { IWebAudioInNode } from \"../webAudioNode\";\r\n\r\nconst TmpMatrix = Matrix.Zero();\r\nconst TmpQuaternion = new Quaternion();\r\nconst TmpVector = Vector3.Zero();\r\n\r\nfunction d2r(degrees: number): number {\r\n return (degrees * Math.PI) / 180;\r\n}\r\n\r\nfunction r2d(radians: number): number {\r\n return (radians * 180) / Math.PI;\r\n}\r\n\r\n/** @internal */\r\nexport async function _CreateSpatialAudioSubNodeAsync(engine: _WebAudioEngine): Promise<_SpatialAudioSubNode> {\r\n return new _SpatialWebAudioSubNode(engine);\r\n}\r\n\r\n/** @internal */\r\nexport class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {\r\n private _lastPosition: Vector3 = Vector3.Zero();\r\n private _lastRotation: Vector3 = Vector3.Zero();\r\n private _lastRotationQuaternion: Quaternion = new Quaternion();\r\n\r\n /** @internal */\r\n public readonly position = _SpatialAudioDefaults.position.clone();\r\n /** @internal */\r\n public readonly rotation: Vector3 = _SpatialAudioDefaults.rotation.clone();\r\n /** @internal */\r\n public readonly rotationQuaternion: Quaternion = _SpatialAudioDefaults.rotationQuaternion.clone();\r\n\r\n /** @internal */\r\n public readonly node: PannerNode;\r\n\r\n /** @internal */\r\n public constructor(engine: _WebAudioEngine) {\r\n super(engine);\r\n\r\n this.node = new PannerNode(engine.audioContext);\r\n }\r\n\r\n /** @internal */\r\n public get coneInnerAngle(): number {\r\n return d2r(this.node.coneInnerAngle);\r\n }\r\n\r\n public set coneInnerAngle(value: number) {\r\n this.node.coneInnerAngle = r2d(value);\r\n }\r\n\r\n /** @internal */\r\n public get coneOuterAngle(): number {\r\n return d2r(this.node.coneOuterAngle);\r\n }\r\n\r\n public set coneOuterAngle(value: number) {\r\n this.node.coneOuterAngle = r2d(value);\r\n }\r\n\r\n /** @internal */\r\n public get coneOuterVolume(): number {\r\n return this.node.coneOuterGain;\r\n }\r\n\r\n public set coneOuterVolume(value: number) {\r\n this.node.coneOuterGain = value;\r\n }\r\n\r\n /** @internal */\r\n public get distanceModel(): \"linear\" | \"inverse\" | \"exponential\" {\r\n return this.node.distanceModel;\r\n }\r\n\r\n public set distanceModel(value: \"linear\" | \"inverse\" | \"exponential\") {\r\n this.node.distanceModel = value;\r\n\r\n // Wiggle the max distance to make the change take effect.\r\n const maxDistance = this.node.maxDistance;\r\n this.node.maxDistance = maxDistance + 0.001;\r\n this.node.maxDistance = maxDistance;\r\n }\r\n\r\n /** @internal */\r\n public get maxDistance(): number {\r\n return this.node.maxDistance;\r\n }\r\n\r\n public set maxDistance(value: number) {\r\n this.node.maxDistance = value;\r\n }\r\n\r\n /** @internal */\r\n public get panningModel(): \"equalpower\" | \"HRTF\" {\r\n return this.node.panningModel;\r\n }\r\n\r\n public set panningModel(value: \"equalpower\" | \"HRTF\") {\r\n this.node.panningModel = value;\r\n }\r\n\r\n /** @internal */\r\n public get referenceDistance(): number {\r\n return this.node.refDistance;\r\n }\r\n\r\n public set referenceDistance(value: number) {\r\n this.node.refDistance = value;\r\n }\r\n\r\n /** @internal */\r\n public get rolloffFactor(): number {\r\n return this.node.rolloffFactor;\r\n }\r\n\r\n public set rolloffFactor(value: number) {\r\n this.node.rolloffFactor = value;\r\n }\r\n\r\n /** @internal */\r\n public get inNode(): AudioNode {\r\n return this.node;\r\n }\r\n\r\n /** @internal */\r\n public get outNode(): AudioNode {\r\n return this.node;\r\n }\r\n\r\n /** @internal */\r\n public updatePosition(): void {\r\n if (this._lastPosition.equalsWithEpsilon(this.position)) {\r\n return;\r\n }\r\n\r\n this.node.positionX.value = this.position.x;\r\n this.node.positionY.value = this.position.y;\r\n this.node.positionZ.value = this.position.z;\r\n\r\n this._lastPosition.copyFrom(this.position);\r\n }\r\n\r\n /** @internal */\r\n public updateRotation(): void {\r\n if (!this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion)) {\r\n TmpQuaternion.copyFrom(this.rotationQuaternion);\r\n this._lastRotationQuaternion.copyFrom(this.rotationQuaternion);\r\n } else if (!this._lastRotation.equalsWithEpsilon(this.rotation)) {\r\n Quaternion.FromEulerAnglesToRef(this.rotation.x, this.rotation.y, this.rotation.z, TmpQuaternion);\r\n this._lastRotation.copyFrom(this.rotation);\r\n } else {\r\n return;\r\n }\r\n\r\n Matrix.FromQuaternionToRef(TmpQuaternion, TmpMatrix);\r\n Vector3.TransformNormalToRef(Vector3.RightReadOnly, TmpMatrix, TmpVector);\r\n\r\n this.node.orientationX.value = TmpVector.x;\r\n this.node.orientationY.value = TmpVector.y;\r\n this.node.orientationZ.value = TmpVector.z;\r\n }\r\n\r\n protected override _connect(node: IWebAudioInNode): boolean {\r\n const connected = super._connect(node);\r\n\r\n if (!connected) {\r\n return false;\r\n }\r\n\r\n // If the wrapped node is not available now, it will be connected later by the subgraph.\r\n if (node.inNode) {\r\n this.node.connect(node.inNode);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n protected override _disconnect(node: IWebAudioInNode): boolean {\r\n const disconnected = super._disconnect(node);\r\n\r\n if (!disconnected) {\r\n return false;\r\n }\r\n\r\n if (node.inNode) {\r\n this.node.disconnect(node.inNode);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public getClassName(): string {\r\n return \"_SpatialWebAudioSubNode\";\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"spatialWebAudioSubNode.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/webAudio/subNodes/spatialWebAudioSubN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AAC;YACb,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,wFAAwF;QACxF,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnC,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAEkB,WAAW,CAAC,IAAqB;QAChD,MAAM,YAAY,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAE7C,IAAI,CAAC,YAAY,EAAE,CAAC;YAChB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACtC,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gBAAgB;IACT,YAAY;QACf,OAAO,yBAAyB,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import { Matrix, Quaternion, Vector3 } from \"../../../Maths/math.vector\";\r\nimport { _SpatialAudioSubNode } from \"../../abstractAudio/subNodes/spatialAudioSubNode\";\r\nimport { _SpatialAudioDefaults } from \"../../abstractAudio/subProperties/abstractSpatialAudio\";\r\nimport type { _WebAudioEngine } from \"../webAudioEngine\";\r\nimport type { IWebAudioInNode } from \"../webAudioNode\";\r\n\r\nconst TmpMatrix = Matrix.Zero();\r\nconst TmpQuaternion = new Quaternion();\r\nconst TmpVector = Vector3.Zero();\r\n\r\nfunction d2r(degrees: number): number {\r\n return (degrees * Math.PI) / 180;\r\n}\r\n\r\nfunction r2d(radians: number): number {\r\n return (radians * 180) / Math.PI;\r\n}\r\n\r\n/** @internal */\r\nexport async function _CreateSpatialAudioSubNodeAsync(engine: _WebAudioEngine): Promise<_SpatialAudioSubNode> {\r\n return new _SpatialWebAudioSubNode(engine);\r\n}\r\n\r\n/** @internal */\r\nexport class _SpatialWebAudioSubNode extends _SpatialAudioSubNode {\r\n private _lastPosition: Vector3 = Vector3.Zero();\r\n private _lastRotation: Vector3 = Vector3.Zero();\r\n private _lastRotationQuaternion: Quaternion = new Quaternion();\r\n\r\n /** @internal */\r\n public readonly position = _SpatialAudioDefaults.position.clone();\r\n /** @internal */\r\n public readonly rotation: Vector3 = _SpatialAudioDefaults.rotation.clone();\r\n /** @internal */\r\n public readonly rotationQuaternion: Quaternion = _SpatialAudioDefaults.rotationQuaternion.clone();\r\n\r\n /** @internal */\r\n public readonly node: PannerNode;\r\n\r\n /** @internal */\r\n public constructor(engine: _WebAudioEngine) {\r\n super(engine);\r\n\r\n this.node = new PannerNode(engine.audioContext);\r\n }\r\n\r\n /** @internal */\r\n public get coneInnerAngle(): number {\r\n return d2r(this.node.coneInnerAngle);\r\n }\r\n\r\n public set coneInnerAngle(value: number) {\r\n this.node.coneInnerAngle = r2d(value);\r\n }\r\n\r\n /** @internal */\r\n public get coneOuterAngle(): number {\r\n return d2r(this.node.coneOuterAngle);\r\n }\r\n\r\n public set coneOuterAngle(value: number) {\r\n this.node.coneOuterAngle = r2d(value);\r\n }\r\n\r\n /** @internal */\r\n public get coneOuterVolume(): number {\r\n return this.node.coneOuterGain;\r\n }\r\n\r\n public set coneOuterVolume(value: number) {\r\n this.node.coneOuterGain = value;\r\n }\r\n\r\n /** @internal */\r\n public get distanceModel(): \"linear\" | \"inverse\" | \"exponential\" {\r\n return this.node.distanceModel;\r\n }\r\n\r\n public set distanceModel(value: \"linear\" | \"inverse\" | \"exponential\") {\r\n this.node.distanceModel = value;\r\n\r\n // Wiggle the max distance to make the change take effect.\r\n const maxDistance = this.node.maxDistance;\r\n this.node.maxDistance = maxDistance + 0.001;\r\n this.node.maxDistance = maxDistance;\r\n }\r\n\r\n /** @internal */\r\n public get minDistance(): number {\r\n return this.node.refDistance;\r\n }\r\n\r\n public set minDistance(value: number) {\r\n this.node.refDistance = value;\r\n }\r\n\r\n /** @internal */\r\n public get maxDistance(): number {\r\n return this.node.maxDistance;\r\n }\r\n\r\n public set maxDistance(value: number) {\r\n this.node.maxDistance = value;\r\n }\r\n\r\n /** @internal */\r\n public get panningModel(): \"equalpower\" | \"HRTF\" {\r\n return this.node.panningModel;\r\n }\r\n\r\n public set panningModel(value: \"equalpower\" | \"HRTF\") {\r\n this.node.panningModel = value;\r\n }\r\n\r\n /** @internal */\r\n public get rolloffFactor(): number {\r\n return this.node.rolloffFactor;\r\n }\r\n\r\n public set rolloffFactor(value: number) {\r\n this.node.rolloffFactor = value;\r\n }\r\n\r\n /** @internal */\r\n public get inNode(): AudioNode {\r\n return this.node;\r\n }\r\n\r\n /** @internal */\r\n public get outNode(): AudioNode {\r\n return this.node;\r\n }\r\n\r\n /** @internal */\r\n public _updatePosition(): void {\r\n if (this._lastPosition.equalsWithEpsilon(this.position)) {\r\n return;\r\n }\r\n\r\n this.node.positionX.value = this.position.x;\r\n this.node.positionY.value = this.position.y;\r\n this.node.positionZ.value = this.position.z;\r\n\r\n this._lastPosition.copyFrom(this.position);\r\n }\r\n\r\n /** @internal */\r\n public _updateRotation(): void {\r\n if (!this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion)) {\r\n TmpQuaternion.copyFrom(this.rotationQuaternion);\r\n this._lastRotationQuaternion.copyFrom(this.rotationQuaternion);\r\n } else if (!this._lastRotation.equalsWithEpsilon(this.rotation)) {\r\n Quaternion.FromEulerAnglesToRef(this.rotation.x, this.rotation.y, this.rotation.z, TmpQuaternion);\r\n this._lastRotation.copyFrom(this.rotation);\r\n } else {\r\n return;\r\n }\r\n\r\n Matrix.FromQuaternionToRef(TmpQuaternion, TmpMatrix);\r\n Vector3.TransformNormalToRef(Vector3.RightReadOnly, TmpMatrix, TmpVector);\r\n\r\n this.node.orientationX.value = TmpVector.x;\r\n this.node.orientationY.value = TmpVector.y;\r\n this.node.orientationZ.value = TmpVector.z;\r\n }\r\n\r\n protected override _connect(node: IWebAudioInNode): boolean {\r\n const connected = super._connect(node);\r\n\r\n if (!connected) {\r\n return false;\r\n }\r\n\r\n // If the wrapped node is not available now, it will be connected later by the subgraph.\r\n if (node.inNode) {\r\n this.node.connect(node.inNode);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n protected override _disconnect(node: IWebAudioInNode): boolean {\r\n const disconnected = super._disconnect(node);\r\n\r\n if (!disconnected) {\r\n return false;\r\n }\r\n\r\n if (node.inNode) {\r\n this.node.disconnect(node.inNode);\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /** @internal */\r\n public getClassName(): string {\r\n return \"_SpatialWebAudioSubNode\";\r\n }\r\n}\r\n"]}
|
|
@@ -49,12 +49,12 @@ class _SpatialWebAudioListener extends _SpatialAudioListener {
|
|
|
49
49
|
this._attacherComponent?.update();
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
52
|
+
this._updatePosition();
|
|
53
|
+
this._updateRotation();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
/** @internal */
|
|
57
|
-
|
|
57
|
+
_updatePosition() {
|
|
58
58
|
if (this._lastPosition.equalsWithEpsilon(this.position)) {
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
@@ -65,7 +65,7 @@ class _SpatialWebAudioListener extends _SpatialAudioListener {
|
|
|
65
65
|
this._lastPosition.copyFrom(this.position);
|
|
66
66
|
}
|
|
67
67
|
/** @internal */
|
|
68
|
-
|
|
68
|
+
_updateRotation() {
|
|
69
69
|
if (!this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion)) {
|
|
70
70
|
TmpQuaternion.copyFrom(this.rotationQuaternion);
|
|
71
71
|
this._lastRotationQuaternion.copyFrom(this.rotationQuaternion);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spatialWebAudioListener.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/webAudio/subProperties/spatialWebAudioListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,4BAA4B,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CAAC,aAAa,GAAG,KAAK,CAAC;IACjD,CAAC;IAED,gBAAgB;IACA,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,iBAAiB,CAAC,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC,iBAAiB,GAAG,IAAK,CAAC;IACnC,CAAC;IAED,gBAAgB;IACT,MAAM;QACT,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,IAAI,CAAC,kBAAkB,EAAE,MAAM,EAAE,CAAC;QACtC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"spatialWebAudioListener.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/webAudio/subProperties/spatialWebAudioListener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,wDAAwD,CAAC;AAC/F,OAAO,EAAE,gCAAgC,EAAE,MAAM,+CAA+C,CAAC;AAGjG,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;AAChC,MAAM,aAAa,GAAG,IAAI,UAAU,EAAE,CAAC;AACvC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAEjC,gBAAgB;AAChB,MAAM,UAAU,2BAA2B,CAAC,MAAuB,EAAE,UAAmB,EAAE,aAAqB;IAC3G,OAAO,IAAI,wBAAwB,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;AAC3E,CAAC;AAED;;;;GAIG;AACH,MAAM,wBAAyB,SAAQ,qBAAqB;IAcxD,gBAAgB;IAChB,YAAmB,MAAuB,EAAE,UAAmB,EAAE,aAAqB;QAClF,KAAK,EAAE,CAAC;QAdJ,kBAAa,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACxC,kBAAa,GAAY,OAAO,CAAC,IAAI,EAAE,C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G,SAAS,CAAC,CAAC,CAAC;QACtC,QAAQ,CAAC,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;QACtC,QAAQ,CAAC,QAAQ,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;QAEtC,OAAO,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACjE,QAAQ,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;QACjC,QAAQ,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;QACjC,QAAQ,CAAC,GAAG,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import { Matrix, Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport { _SpatialAudioListener } from \"../../abstractAudio/subProperties/spatialAudioListener\";\nimport { _SpatialWebAudioUpdaterComponent } from \"../components/spatialWebAudioUpdaterComponent\";\nimport type { _WebAudioEngine } from \"../webAudioEngine\";\n\nconst TmpMatrix = Matrix.Zero();\nconst TmpQuaternion = new Quaternion();\nconst TmpVector = Vector3.Zero();\n\n/** @internal */\nexport function _CreateSpatialAudioListener(engine: _WebAudioEngine, autoUpdate: boolean, minUpdateTime: number): _SpatialAudioListener {\n return new _SpatialWebAudioListener(engine, autoUpdate, minUpdateTime);\n}\n\n/**\n * This sub property is not backed by a sub node and all properties are set directly on the audio context listener.\n *\n * @internal\n */\nclass _SpatialWebAudioListener extends _SpatialAudioListener {\n private _audioContext: AudioContext;\n private _lastPosition: Vector3 = Vector3.Zero();\n private _lastRotation: Vector3 = Vector3.Zero();\n private _lastRotationQuaternion: Quaternion = new Quaternion();\n private _updaterComponent: _SpatialWebAudioUpdaterComponent;\n\n /** @internal */\n public readonly position: Vector3 = Vector3.Zero();\n /** @internal */\n public readonly rotation: Vector3 = Vector3.Zero();\n /** @internal */\n public readonly rotationQuaternion: Quaternion = new Quaternion();\n\n /** @internal */\n public constructor(engine: _WebAudioEngine, autoUpdate: boolean, minUpdateTime: number) {\n super();\n\n this._audioContext = engine.audioContext;\n this._updaterComponent = new _SpatialWebAudioUpdaterComponent(this, autoUpdate, minUpdateTime);\n }\n\n /** @internal */\n public get minUpdateTime(): number {\n return this._updaterComponent.minUpdateTime;\n }\n\n /** @internal */\n public set minUpdateTime(value: number) {\n this._updaterComponent.minUpdateTime = value;\n }\n\n /** @internal */\n public override dispose(): void {\n super.dispose();\n\n this._updaterComponent.dispose();\n this._updaterComponent = null!;\n }\n\n /** @internal */\n public update(): void {\n if (this.isAttached) {\n this._attacherComponent?.update();\n } else {\n this._updatePosition();\n this._updateRotation();\n }\n }\n\n /** @internal */\n public _updatePosition(): void {\n if (this._lastPosition.equalsWithEpsilon(this.position)) {\n return;\n }\n\n const listener = this._audioContext.listener;\n listener.positionX.value = this.position.x;\n listener.positionY.value = this.position.y;\n listener.positionZ.value = this.position.z;\n\n this._lastPosition.copyFrom(this.position);\n }\n\n /** @internal */\n public _updateRotation(): void {\n if (!this._lastRotationQuaternion.equalsWithEpsilon(this.rotationQuaternion)) {\n TmpQuaternion.copyFrom(this.rotationQuaternion);\n this._lastRotationQuaternion.copyFrom(this.rotationQuaternion);\n } else if (!this._lastRotation.equalsWithEpsilon(this.rotation)) {\n Quaternion.FromEulerAnglesToRef(this.rotation.x, this.rotation.y, this.rotation.z, TmpQuaternion);\n this._lastRotation.copyFrom(this.rotation);\n } else {\n return;\n }\n\n Matrix.FromQuaternionToRef(TmpQuaternion, TmpMatrix);\n const listener = this._audioContext.listener;\n\n // NB: The WebAudio API is right-handed.\n Vector3.TransformNormalToRef(Vector3.RightHandedForwardReadOnly, TmpMatrix, TmpVector);\n listener.forwardX.value = TmpVector.x;\n listener.forwardY.value = TmpVector.y;\n listener.forwardZ.value = TmpVector.z;\n\n Vector3.TransformNormalToRef(Vector3.Up(), TmpMatrix, TmpVector);\n listener.upX.value = TmpVector.x;\n listener.upY.value = TmpVector.y;\n listener.upZ.value = TmpVector.z;\n }\n}\n"]}
|
|
@@ -86,6 +86,10 @@ declare class _WebAudioStaticSoundInstance extends _StaticSoundInstance implemen
|
|
|
86
86
|
set currentTime(value: number);
|
|
87
87
|
get outNode(): Nullable<AudioNode>;
|
|
88
88
|
/** @internal */
|
|
89
|
+
set pitch(value: number);
|
|
90
|
+
/** @internal */
|
|
91
|
+
set playbackRate(value: number);
|
|
92
|
+
/** @internal */
|
|
89
93
|
get startTime(): number;
|
|
90
94
|
/** @internal */
|
|
91
95
|
dispose(): void;
|