@types/three 0.182.0 → 0.183.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (312) hide show
  1. three/README.md +1 -1
  2. three/examples/jsm/Addons.d.ts +0 -3
  3. three/examples/jsm/controls/OrbitControls.d.ts +39 -0
  4. three/examples/jsm/effects/AnaglyphEffect.d.ts +4 -0
  5. three/examples/jsm/environments/ColorEnvironment.d.ts +9 -0
  6. three/examples/jsm/gpgpu/BitonicSort.d.ts +5 -5
  7. three/examples/jsm/helpers/AnimationPathHelper.d.ts +38 -0
  8. three/examples/jsm/helpers/ViewHelper.d.ts +4 -1
  9. three/examples/jsm/inspector/tabs/Parameters.d.ts +3 -0
  10. three/examples/jsm/inspector/ui/Item.d.ts +5 -0
  11. three/examples/jsm/libs/meshopt_decoder.module.d.ts +1 -1
  12. three/examples/jsm/lights/LightProbeGenerator.d.ts +11 -5
  13. three/examples/jsm/loaders/ColladaLoader.d.ts +27 -4
  14. three/examples/jsm/objects/SkyMesh.d.ts +11 -6
  15. three/examples/jsm/objects/Water2Mesh.d.ts +7 -7
  16. three/examples/jsm/objects/WaterMesh.d.ts +6 -6
  17. three/examples/jsm/postprocessing/EffectComposer.d.ts +9 -10
  18. three/examples/jsm/postprocessing/UnrealBloomPass.d.ts +4 -9
  19. three/examples/jsm/tsl/display/AnaglyphPassNode.d.ts +30 -0
  20. three/examples/jsm/tsl/display/AnamorphicNode.d.ts +1 -1
  21. three/examples/jsm/tsl/display/BilateralBlurNode.d.ts +27 -0
  22. three/examples/jsm/tsl/display/BloomNode.d.ts +5 -5
  23. three/examples/jsm/tsl/display/CRT.d.ts +22 -0
  24. three/examples/jsm/tsl/display/DenoiseNode.d.ts +5 -5
  25. three/examples/jsm/tsl/display/DotScreenNode.d.ts +4 -6
  26. three/examples/jsm/tsl/display/GTAONode.d.ts +8 -8
  27. three/examples/jsm/tsl/display/GaussianBlurNode.d.ts +4 -2
  28. three/examples/jsm/tsl/display/GodraysNode.d.ts +20 -0
  29. three/examples/jsm/tsl/display/LensflareNode.d.ts +6 -6
  30. three/examples/jsm/tsl/display/Lut3DNode.d.ts +5 -5
  31. three/examples/jsm/tsl/display/MotionBlur.d.ts +1 -1
  32. three/examples/jsm/tsl/display/OutlineNode.d.ts +6 -6
  33. three/examples/jsm/tsl/display/PixelationPassNode.d.ts +10 -10
  34. three/examples/jsm/tsl/display/RGBShiftNode.d.ts +2 -2
  35. three/examples/jsm/tsl/display/RetroPassNode.d.ts +17 -0
  36. three/examples/jsm/tsl/display/SSAAPassNode.d.ts +1 -1
  37. three/examples/jsm/tsl/display/SSGINode.d.ts +11 -11
  38. three/examples/jsm/tsl/display/SSRNode.d.ts +6 -6
  39. three/examples/jsm/tsl/display/SSSNode.d.ts +5 -5
  40. three/examples/jsm/tsl/display/Shape.d.ts +3 -0
  41. three/examples/jsm/tsl/display/TransitionNode.d.ts +3 -3
  42. three/examples/jsm/tsl/display/boxBlur.d.ts +1 -1
  43. three/examples/jsm/tsl/display/depthAwareBlend.d.ts +15 -0
  44. three/examples/jsm/tsl/display/hashBlur.d.ts +1 -1
  45. three/examples/jsm/tsl/math/Bayer.d.ts +2 -0
  46. three/examples/jsm/tsl/utils/Raymarching.d.ts +2 -2
  47. three/package.json +3 -3
  48. three/src/Three.Core.d.ts +1 -1
  49. three/src/Three.TSL.d.ts +6 -11
  50. three/src/Three.WebGPU.Nodes.d.ts +2 -0
  51. three/src/Three.WebGPU.d.ts +3 -0
  52. three/src/Three.d.ts +2 -2
  53. three/src/animation/AnimationClip.d.ts +1 -1
  54. three/src/animation/KeyframeTrack.d.ts +19 -5
  55. three/src/animation/PropertyMixer.d.ts +5 -4
  56. three/src/audio/Audio.d.ts +224 -157
  57. three/src/audio/AudioAnalyser.d.ts +32 -27
  58. three/src/audio/AudioContext.d.ts +12 -12
  59. three/src/audio/AudioListener.d.ts +44 -65
  60. three/src/audio/PositionalAudio.d.ts +69 -62
  61. three/src/cameras/ArrayCamera.d.ts +21 -24
  62. three/src/cameras/Camera.d.ts +14 -53
  63. three/src/cameras/CubeCamera.d.ts +32 -28
  64. three/src/cameras/OrthographicCamera.d.ts +70 -100
  65. three/src/cameras/PerspectiveCamera.d.ts +133 -146
  66. three/src/cameras/StereoCamera.d.ts +24 -30
  67. three/src/constants.d.ts +14 -2
  68. three/src/core/Clock.d.ts +3 -0
  69. three/src/core/Object3D.d.ts +31 -7
  70. three/src/geometries/TorusGeometry.d.ts +22 -3
  71. three/src/helpers/ArrowHelper.d.ts +34 -50
  72. three/src/helpers/AxesHelper.d.ts +22 -36
  73. three/src/helpers/Box3Helper.d.ts +14 -25
  74. three/src/helpers/BoxHelper.d.ts +28 -39
  75. three/src/helpers/CameraHelper.d.ts +31 -52
  76. three/src/helpers/DirectionalLightHelper.d.ts +32 -53
  77. three/src/helpers/GridHelper.d.ts +15 -29
  78. three/src/helpers/HemisphereLightHelper.d.ts +26 -49
  79. three/src/helpers/PlaneHelper.d.ts +21 -33
  80. three/src/helpers/PointLightHelper.d.ts +25 -50
  81. three/src/helpers/PolarGridHelper.d.ts +19 -32
  82. three/src/helpers/SkeletonHelper.d.ts +26 -50
  83. three/src/helpers/SpotLightHelper.d.ts +28 -55
  84. three/src/lights/AmbientLight.d.ts +15 -23
  85. three/src/lights/DirectionalLight.d.ts +40 -82
  86. three/src/lights/DirectionalLightShadow.d.ts +6 -61
  87. three/src/lights/HemisphereLight.d.ts +20 -47
  88. three/src/lights/Light.d.ts +18 -48
  89. three/src/lights/LightProbe.d.ts +24 -29
  90. three/src/lights/LightShadow.d.ts +107 -91
  91. three/src/lights/PointLight.d.ts +36 -77
  92. three/src/lights/PointLightShadow.d.ts +9 -6
  93. three/src/lights/RectAreaLight.d.ts +39 -59
  94. three/src/lights/SpotLight.d.ts +62 -116
  95. three/src/lights/SpotLightShadow.d.ts +17 -59
  96. three/src/lights/webgpu/IESSpotLight.d.ts +13 -1
  97. three/src/lights/webgpu/ProjectorLight.d.ts +9 -10
  98. three/src/materials/MeshLambertMaterial.d.ts +6 -0
  99. three/src/materials/MeshPhongMaterial.d.ts +6 -0
  100. three/src/materials/nodes/Line2NodeMaterial.d.ts +0 -6
  101. three/src/materials/nodes/LineBasicNodeMaterial.d.ts +0 -4
  102. three/src/materials/nodes/MeshBasicNodeMaterial.d.ts +1 -2
  103. three/src/materials/nodes/MeshLambertNodeMaterial.d.ts +0 -2
  104. three/src/materials/nodes/MeshNormalNodeMaterial.d.ts +0 -2
  105. three/src/materials/nodes/MeshSSSNodeMaterial.d.ts +5 -8
  106. three/src/materials/nodes/MeshToonNodeMaterial.d.ts +0 -4
  107. three/src/materials/nodes/NodeMaterial.d.ts +9 -3
  108. three/src/materials/nodes/SpriteNodeMaterial.d.ts +0 -3
  109. three/src/materials/nodes/VolumeNodeMaterial.d.ts +0 -2
  110. three/src/materials/nodes/manager/NodeMaterialObserver.d.ts +39 -93
  111. three/src/math/Color.d.ts +1 -0
  112. three/src/math/Vector3.d.ts +2 -2
  113. three/src/math/interpolants/BezierInterpolant.d.ts +7 -0
  114. three/src/nodes/Nodes.d.ts +55 -35
  115. three/src/nodes/TSL.d.ts +2 -5
  116. three/src/nodes/accessors/Arrays.d.ts +19 -10
  117. three/src/nodes/accessors/BufferAttributeNode.d.ts +99 -33
  118. three/src/nodes/accessors/BufferNode.d.ts +21 -7
  119. three/src/nodes/accessors/Camera.d.ts +10 -10
  120. three/src/nodes/accessors/CubeTextureNode.d.ts +1 -1
  121. three/src/nodes/accessors/InstanceNode.d.ts +6 -0
  122. three/src/nodes/accessors/Lights.d.ts +9 -6
  123. three/src/nodes/accessors/MaterialNode.d.ts +1 -3
  124. three/src/nodes/accessors/MaterialProperties.d.ts +4 -4
  125. three/src/nodes/accessors/MaterialReferenceNode.d.ts +1 -1
  126. three/src/nodes/accessors/ModelNode.d.ts +34 -17
  127. three/src/nodes/accessors/MorphNode.d.ts +1 -1
  128. three/src/nodes/accessors/Normal.d.ts +13 -15
  129. three/src/nodes/accessors/Object3DNode.d.ts +35 -16
  130. three/src/nodes/accessors/Position.d.ts +9 -7
  131. three/src/nodes/accessors/ReferenceNode.d.ts +16 -7
  132. three/src/nodes/accessors/ReflectVector.d.ts +4 -5
  133. three/src/nodes/accessors/RendererReferenceNode.d.ts +1 -1
  134. three/src/nodes/accessors/SceneProperties.d.ts +5 -0
  135. three/src/nodes/accessors/SkinningNode.d.ts +5 -3
  136. three/src/nodes/accessors/StorageBufferNode.d.ts +49 -22
  137. three/src/nodes/accessors/StorageTextureNode.d.ts +1 -1
  138. three/src/nodes/accessors/Tangent.d.ts +5 -7
  139. three/src/nodes/accessors/Texture3DNode.d.ts +1 -1
  140. three/src/nodes/accessors/TextureBicubic.d.ts +3 -2
  141. three/src/nodes/accessors/TextureNode.d.ts +19 -18
  142. three/src/nodes/accessors/UV.d.ts +1 -1
  143. three/src/nodes/accessors/UniformArrayNode.d.ts +10 -8
  144. three/src/nodes/accessors/UserDataNode.d.ts +1 -1
  145. three/src/nodes/accessors/VelocityNode.d.ts +3 -3
  146. three/src/nodes/accessors/VertexColorNode.d.ts +1 -1
  147. three/src/nodes/code/FunctionCallNode.d.ts +0 -1
  148. three/src/nodes/code/FunctionNode.d.ts +7 -3
  149. three/src/nodes/core/ArrayNode.d.ts +2 -3
  150. three/src/nodes/core/AttributeNode.d.ts +12 -6
  151. three/src/nodes/core/BypassNode.d.ts +2 -3
  152. three/src/nodes/core/ConstNode.d.ts +10 -3
  153. three/src/nodes/core/ContextNode.d.ts +23 -28
  154. three/src/nodes/core/IndexNode.d.ts +1 -1
  155. three/src/nodes/core/InputNode.d.ts +12 -4
  156. three/src/nodes/core/InspectorNode.d.ts +2 -3
  157. three/src/nodes/core/IsolateNode.d.ts +2 -7
  158. three/src/nodes/core/MRTNode.d.ts +7 -0
  159. three/src/nodes/core/Node.d.ts +258 -39
  160. three/src/nodes/core/NodeAttribute.d.ts +30 -5
  161. three/src/nodes/core/NodeBuilder.d.ts +5 -3
  162. three/src/nodes/core/NodeCache.d.ts +24 -48
  163. three/src/nodes/core/NodeError.d.ts +9 -0
  164. three/src/nodes/core/NodeParser.d.ts +2 -0
  165. three/src/nodes/core/NodeUniform.d.ts +33 -9
  166. three/src/nodes/core/NodeVar.d.ts +33 -5
  167. three/src/nodes/core/NodeVarying.d.ts +32 -4
  168. three/src/nodes/core/ParameterNode.d.ts +11 -4
  169. three/src/nodes/core/PropertyNode.d.ts +45 -35
  170. three/src/nodes/core/StackTrace.d.ts +9 -0
  171. three/src/nodes/core/StructType.d.ts +3 -1
  172. three/src/nodes/core/StructTypeNode.d.ts +19 -5
  173. three/src/nodes/core/TempNode.d.ts +9 -3
  174. three/src/nodes/core/UniformNode.d.ts +53 -15
  175. three/src/nodes/core/VarNode.d.ts +15 -14
  176. three/src/nodes/core/VaryingNode.d.ts +14 -19
  177. three/src/nodes/core/constants.d.ts +9 -4
  178. three/src/nodes/display/BlendModes.d.ts +7 -27
  179. three/src/nodes/display/ColorAdjustment.d.ts +8 -9
  180. three/src/nodes/display/ColorSpaceNode.d.ts +2 -8
  181. three/src/nodes/display/FrontFacingNode.d.ts +1 -1
  182. three/src/nodes/display/PassNode.d.ts +9 -5
  183. three/src/nodes/display/RenderOutputNode.d.ts +3 -7
  184. three/src/nodes/display/ScreenNode.d.ts +25 -17
  185. three/src/nodes/display/ToneMappingNode.d.ts +3 -7
  186. three/src/nodes/display/ViewportDepthNode.d.ts +11 -7
  187. three/src/nodes/display/ViewportTextureNode.d.ts +2 -0
  188. three/src/nodes/fog/Fog.d.ts +5 -3
  189. three/src/nodes/geometry/RangeNode.d.ts +51 -9
  190. three/src/nodes/gpgpu/AtomicFunctionNode.d.ts +2 -0
  191. three/src/nodes/gpgpu/BarrierNode.d.ts +2 -0
  192. three/src/nodes/gpgpu/ComputeNode.d.ts +2 -7
  193. three/src/nodes/lighting/AnalyticLightNode.d.ts +1 -1
  194. three/src/nodes/lighting/HemisphereLightNode.d.ts +3 -2
  195. three/src/nodes/lighting/LightProbeNode.d.ts +1 -1
  196. three/src/nodes/lighting/LightUtils.d.ts +1 -1
  197. three/src/nodes/lighting/LightingContextNode.d.ts +1 -1
  198. three/src/nodes/lighting/SpotLightNode.d.ts +0 -6
  199. three/src/nodes/materialx/MaterialXNodes.d.ts +11 -11
  200. three/src/nodes/math/BitcountNode.d.ts +2 -0
  201. three/src/nodes/math/ConditionalNode.d.ts +43 -22
  202. three/src/nodes/math/Hash.d.ts +1 -1
  203. three/src/nodes/math/MathNode.d.ts +603 -267
  204. three/src/nodes/math/MathUtils.d.ts +9 -5
  205. three/src/nodes/math/OperatorNode.d.ts +490 -227
  206. three/src/nodes/math/TriNoise3D.d.ts +3 -3
  207. three/src/nodes/pmrem/PMREMNode.d.ts +1 -1
  208. three/src/nodes/procedural/Checker.d.ts +1 -1
  209. three/src/nodes/tsl/TSLCore.d.ts +1683 -224
  210. three/src/nodes/utils/ArrayElementNode.d.ts +9 -4
  211. three/src/nodes/utils/DebugNode.d.ts +2 -5
  212. three/src/nodes/utils/Discard.d.ts +2 -3
  213. three/src/nodes/utils/FlipNode.d.ts +11 -0
  214. three/src/nodes/utils/LoopNode.d.ts +17 -13
  215. three/src/nodes/utils/MaxMipLevelNode.d.ts +1 -1
  216. three/src/nodes/utils/Oscillators.d.ts +4 -4
  217. three/src/nodes/utils/Packing.d.ts +3 -3
  218. three/src/nodes/utils/PostProcessingUtils.d.ts +5 -5
  219. three/src/nodes/utils/RemapNode.d.ts +33 -39
  220. three/src/nodes/utils/RotateNode.d.ts +17 -8
  221. three/src/nodes/utils/SplitNode.d.ts +1 -2
  222. three/src/nodes/utils/SpriteSheetUV.d.ts +7 -0
  223. three/src/nodes/utils/StorageArrayElementNode.d.ts +18 -9
  224. three/src/nodes/utils/Timer.d.ts +4 -4
  225. three/src/nodes/utils/TriplanarTextures.d.ts +2 -2
  226. three/src/nodes/utils/UVUtils.d.ts +6 -4
  227. three/src/objects/BatchedMesh.d.ts +6 -4
  228. three/src/objects/InstancedMesh.d.ts +32 -24
  229. three/src/renderers/WebGLRenderer.d.ts +4 -93
  230. three/src/renderers/common/Animation.d.ts +46 -9
  231. three/src/renderers/common/Attributes.d.ts +11 -13
  232. three/src/renderers/common/Backend.d.ts +0 -2
  233. three/src/renderers/common/Background.d.ts +17 -15
  234. three/src/renderers/common/BindGroup.d.ts +27 -13
  235. three/src/renderers/common/Binding.d.ts +15 -3
  236. three/src/renderers/common/Bindings.d.ts +41 -17
  237. three/src/renderers/common/BlendMode.d.ts +22 -0
  238. three/src/renderers/common/Buffer.d.ts +35 -11
  239. three/src/renderers/common/BufferUtils.d.ts +3 -4
  240. three/src/renderers/common/BundleGroup.d.ts +16 -6
  241. three/src/renderers/common/CanvasTarget.d.ts +76 -13
  242. three/src/renderers/common/ChainMap.d.ts +12 -9
  243. three/src/renderers/common/ClippingContext.d.ts +61 -10
  244. three/src/renderers/common/Color4.d.ts +10 -5
  245. three/src/renderers/common/ComputePipeline.d.ts +16 -2
  246. three/src/renderers/common/Constants.d.ts +5 -3
  247. three/src/renderers/common/CubeRenderTarget.d.ts +24 -7
  248. three/src/renderers/common/DataMap.d.ts +10 -18
  249. three/src/renderers/common/Geometries.d.ts +39 -20
  250. three/src/renderers/common/Info.d.ts +62 -9
  251. three/src/renderers/common/InspectorBase.d.ts +19 -7
  252. three/src/renderers/common/Lighting.d.ts +2 -6
  253. three/src/renderers/common/Pipeline.d.ts +14 -2
  254. three/src/renderers/common/Pipelines.d.ts +58 -60
  255. three/src/renderers/common/PostProcessing.d.ts +14 -17
  256. three/src/renderers/common/ProgrammableStage.d.ts +48 -8
  257. three/src/renderers/common/RenderBundle.d.ts +4 -2
  258. three/src/renderers/common/RenderBundles.d.ts +6 -3
  259. three/src/renderers/common/RenderContext.d.ts +175 -7
  260. three/src/renderers/common/RenderContexts.d.ts +20 -25
  261. three/src/renderers/common/RenderList.d.ts +77 -11
  262. three/src/renderers/common/RenderLists.d.ts +16 -4
  263. three/src/renderers/common/RenderObject.d.ts +223 -47
  264. three/src/renderers/common/{RenderPipeline.d.ts → RenderObjectPipeline.d.ts} +17 -5
  265. three/src/renderers/common/RenderObjects.d.ts +55 -22
  266. three/src/renderers/common/Renderer.d.ts +625 -207
  267. three/src/renderers/common/Textures.d.ts +24 -46
  268. three/src/renderers/common/TimestampQueryPool.d.ts +62 -8
  269. three/src/renderers/common/Uniform.d.ts +143 -58
  270. three/src/renderers/common/UniformBuffer.d.ts +7 -5
  271. three/src/renderers/common/UniformsGroup.d.ts +50 -35
  272. three/src/renderers/common/XRManager.d.ts +321 -83
  273. three/src/renderers/common/XRRenderTarget.d.ts +49 -6
  274. three/src/renderers/common/nodes/NodeBuilderState.d.ts +75 -15
  275. three/src/renderers/common/nodes/NodeLibrary.d.ts +25 -5
  276. three/src/renderers/common/nodes/{Nodes.d.ts → NodeManager.d.ts} +54 -73
  277. three/src/renderers/common/nodes/NodeUniform.d.ts +60 -70
  278. three/src/renderers/common/nodes/NodeUniformsGroup.d.ts +23 -4
  279. three/src/renderers/shaders/UniformsLib.d.ts +0 -3
  280. three/src/renderers/webgl/WebGLAttributes.d.ts +9 -7
  281. three/src/renderers/webgl/WebGLEnvironments.d.ts +8 -0
  282. three/src/renderers/webgl/WebGLExtensions.d.ts +1 -1
  283. three/src/renderers/webgl/WebGLIndexedBufferRenderer.d.ts +9 -5
  284. three/src/renderers/webgl/WebGLLights.d.ts +19 -18
  285. three/src/renderers/webgl/WebGLObjects.d.ts +15 -2
  286. three/src/renderers/webgl/WebGLProgram.d.ts +2 -10
  287. three/src/renderers/webgl/WebGLPrograms.d.ts +2 -2
  288. three/src/renderers/webgl/WebGLRenderLists.d.ts +1 -3
  289. three/src/renderers/webgl/WebGLShadowMap.d.ts +0 -5
  290. three/src/renderers/webgl/WebGLState.d.ts +305 -28
  291. three/src/renderers/webgl/WebGLTextures.d.ts +10 -9
  292. three/src/renderers/webgl/WebGLUniforms.d.ts +0 -7
  293. three/src/renderers/webgpu/WebGPUBackend.d.ts +0 -1
  294. three/src/renderers/webgpu/nodes/BasicNodeLibrary.d.ts +2 -4
  295. three/src/renderers/webgpu/nodes/StandardNodeLibrary.d.ts +15 -4
  296. three/src/renderers/webgpu/nodes/WGSLNodeBuilder.d.ts +1 -1
  297. three/src/scenes/Fog.d.ts +31 -37
  298. three/src/scenes/FogExp2.d.ts +26 -31
  299. three/src/scenes/Scene.d.ts +51 -65
  300. three/src/textures/CompressedArrayTexture.d.ts +1 -1
  301. three/src/textures/DataArrayTexture.d.ts +1 -1
  302. three/src/utils.d.ts +5 -0
  303. three/examples/jsm/materials/MeshGouraudMaterial.d.ts +0 -18
  304. three/examples/jsm/materials/MeshPostProcessingMaterial.d.ts +0 -13
  305. three/examples/jsm/shaders/GodRaysShader.d.ts +0 -44
  306. three/src/nodes/accessors/SceneNode.d.ts +0 -21
  307. three/src/nodes/code/ScriptableNode.d.ts +0 -21
  308. three/src/nodes/code/ScriptableValueNode.d.ts +0 -9
  309. three/src/nodes/display/PosterizeNode.d.ts +0 -13
  310. three/src/nodes/utils/SpriteSheetUVNode.d.ts +0 -15
  311. three/src/renderers/webgl/WebGLCubeMaps.d.ts +0 -8
  312. three/src/renderers/webgl/WebGLCubeUVMaps.d.ts +0 -9
@@ -1,273 +1,340 @@
1
1
  import { Object3D } from "../core/Object3D.js";
2
- import { AudioContext } from "./AudioContext.js";
3
2
  import { AudioListener } from "./AudioListener.js";
4
3
 
5
- // Extras / Audio /////////////////////////////////////////////////////////////////////
6
-
7
4
  /**
8
- * Create a non-positional ( global ) {@link Audio} object.
9
- * This uses the {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API | Web {@link Audio} API}.
10
- * @example
11
- * ```typescript
5
+ * Represents a non-positional ( global ) audio object.
6
+ *
7
+ * This and related audio modules make use of the [Web Audio API](https://www.w3.org/TR/webaudio-1.1/).
8
+ *
9
+ * ```js
12
10
  * // create an AudioListener and add it to the camera
13
11
  * const listener = new THREE.AudioListener();
14
- * camera.add(listener);
15
- * // create a global {@link Audio} source
16
- * const sound = new THREE.Audio(listener);
17
- * // load a sound and set it as the {@link Audio} object's buffer
12
+ * camera.add( listener );
13
+ *
14
+ * // create a global audio source
15
+ * const sound = new THREE.Audio( listener );
16
+ *
17
+ * // load a sound and set it as the Audio object's buffer
18
18
  * const audioLoader = new THREE.AudioLoader();
19
- * audioLoader.load('sounds/ambient.ogg', function (buffer) {
20
- * sound.setBuffer(buffer);
21
- * sound.setLoop(true);
22
- * sound.setVolume(0.5);
23
- * sound.play();
19
+ * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {
20
+ * sound.setBuffer( buffer );
21
+ * sound.setLoop( true );
22
+ * sound.setVolume( 0.5 );
23
+ * sound.play();
24
24
  * });
25
25
  * ```
26
- * @see Example: {@link https://threejs.org/examples/#webaudio_sandbox | webaudio / sandbox }
27
- * @see Example: {@link https://threejs.org/examples/#webaudio_visualizer | webaudio / visualizer }
28
- * @see {@link https://threejs.org/docs/index.html#api/en/audio/Audio | Official Documentation}
29
- * @see {@link https://github.com/mrdoob/three.js/blob/master/src/audio/Audio.js | Source}
30
26
  */
31
- export class Audio<NodeType extends AudioNode = GainNode> extends Object3D {
27
+ export class Audio<TNode extends AudioNode = GainNode> extends Object3D {
32
28
  /**
33
- * Create a new instance of {@link Audio}
34
- * @param listener (required) {@link AudioListener | AudioListener} instance.
29
+ * Constructs a new audio.
30
+ *
31
+ * @param {AudioListener} listener - The global audio listener.
35
32
  */
36
33
  constructor(listener: AudioListener);
37
-
38
34
  /**
39
- * A Read-only _string_ to check if `this` object type.
40
- * @remarks Sub-classes will update this value.
41
- * @defaultValue `Audio`
35
+ * The global audio listener.
42
36
  */
43
- readonly type: string | "Audio";
44
-
37
+ readonly listener: AudioListener;
45
38
  /**
46
- * A reference to the listener object of this audio.
39
+ * The audio context.
47
40
  */
48
- listener: AudioListener;
49
-
41
+ readonly context: AudioContext;
50
42
  /**
51
- * The {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioContext | AudioContext} of the {@link AudioListener | listener} given in the constructor.
43
+ * The gain node used for volume control.
52
44
  */
53
- context: AudioContext;
54
-
45
+ readonly gain: GainNode;
55
46
  /**
56
- * A {@link https://developer.mozilla.org/en-US/docs/Web/API/GainNode | GainNode} created using
57
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createGain | AudioContext.createGain}().
47
+ * Whether to start playback automatically or not.
58
48
  */
59
- gain: GainNode;
60
-
49
+ autoplay: boolean;
61
50
  /**
62
- * Whether to start playback automatically.
63
- * @defaultValue `false`
51
+ * A reference to an audio buffer.
52
+ *
53
+ * Defined via {@link Audio#setBuffer}.
54
+ *
55
+ * @default null
64
56
  */
65
- autoplay: boolean;
66
-
67
- buffer: AudioBuffer | null;
68
-
57
+ readonly buffer: AudioBuffer | null;
69
58
  /**
70
- * Modify pitch, measured in cents. +/- 100 is a semitone. +/- 1200 is an octave.
71
- * @defaultValue `0`
59
+ * Modify pitch, measured in cents. +/- 100 is a semitone.
60
+ * +/- 1200 is an octave.
61
+ *
62
+ * Defined via {@link Audio#setDetune}.
63
+ *
64
+ * @default 0
72
65
  */
73
- detune: number;
74
-
66
+ readonly detune: number;
75
67
  /**
68
+ * Whether the audio should loop or not.
69
+ *
70
+ * Defined via {@link Audio#setLoop}.
71
+ *
76
72
  * @default false
77
73
  */
78
- loop: boolean;
79
-
74
+ readonly loop: boolean;
80
75
  /**
76
+ * Defines where in the audio buffer the replay should
77
+ * start, in seconds.
78
+ *
81
79
  * @default 0
82
80
  */
83
81
  loopStart: number;
84
-
85
82
  /**
83
+ * Defines where in the audio buffer the replay should
84
+ * stop, in seconds.
85
+ *
86
86
  * @default 0
87
87
  */
88
88
  loopEnd: number;
89
-
90
89
  /**
91
- * An offset to the time within the {@link Audio} buffer that playback should begin.
92
- * Same as the {@link Audio.offset | offset} parameter of {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/start | AudioBufferSourceNode.start()}.
93
- * @defaultValue `0`
90
+ * An offset to the time within the audio buffer the playback
91
+ * should begin, in seconds.
92
+ *
93
+ * @default 0
94
94
  */
95
95
  offset: number;
96
-
97
96
  /**
98
- * Overrides the duration of the audio. Same as the {@link Audio.duration | duration} parameter of
99
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/start | AudioBufferSourceNode.start()}.
100
- * @defaultValue `undefined` _to play the whole buffer_.
97
+ * Overrides the default duration of the audio.
98
+ *
99
+ * @default undefined
101
100
  */
102
101
  duration: number | undefined;
103
-
104
102
  /**
105
- * Speed of playback.
106
- * @defaultValue `1`
103
+ * The playback speed.
104
+ *
105
+ * Defined via {@link Audio#setPlaybackRate}.
106
+ *
107
+ * @default 1
107
108
  */
108
- playbackRate: number;
109
-
109
+ readonly playbackRate: number;
110
110
  /**
111
- * Whether the {@link Audio} is currently playing.
112
- * @defaultValue `false`
111
+ * Indicates whether the audio is playing or not.
112
+ *
113
+ * This flag will be automatically set when using {@link Audio#play},
114
+ * {@link Audio#pause}, {@link Audio#stop}.
115
+ *
116
+ * @default false
113
117
  */
114
- isPlaying: boolean;
115
-
118
+ readonly isPlaying: boolean;
116
119
  /**
117
- * Whether playback can be controlled using the {@link Audio.play | play}(), {@link Audio.pause | pause}() etc. methods.
118
- * @defaultValue `true`
120
+ * Indicates whether the audio playback can be controlled
121
+ * with method like {@link Audio#play} or {@link Audio#pause}.
122
+ *
123
+ * This flag will be automatically set when audio sources are
124
+ * defined.
125
+ *
126
+ * @default true
119
127
  */
120
- hasPlaybackControl: boolean;
121
-
128
+ readonly hasPlaybackControl: boolean;
122
129
  /**
123
- * Type of the {@link Audio} source.
124
- * @defaultValue 'empty'.
130
+ * Holds a reference to the current audio source.
131
+ *
132
+ * The property is automatically by one of the `set*()` methods.
133
+ *
134
+ * @default null
125
135
  */
126
- sourceType: string;
127
-
136
+ readonly source: AudioNode | null;
128
137
  /**
129
- * An {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode | AudioBufferSourceNode} created using
130
- * {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createBufferSource | AudioContext.createBufferSource()}.
138
+ * Defines the source type.
139
+ *
140
+ * The property is automatically set by one of the `set*()` methods.
141
+ *
142
+ * @default 'empty'
131
143
  */
132
- source: AudioScheduledSourceNode | null;
133
-
144
+ readonly sourceType: "empty" | "audioNode" | "mediaNode" | "mediaStreamNode" | "buffer";
134
145
  /**
135
- * Represents an array of {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioNode | AudioNodes}.
136
- * Can be used to apply a variety of low-order filters to create more complex sound effects.
137
- * In most cases, the array contains instances of {@link https://developer.mozilla.org/en-US/docs/Web/API/BiquadFilterNode | BiquadFilterNodes}.
138
- * Filters are set via {@link THREE.Audio.setFilter | Audio.setFilter} or {@link THREE.Audio.setFilters | Audio.setFilters}.
139
- * @defaultValue `[]`
146
+ * Can be used to apply a variety of low-order filters to create
147
+ * more complex sound effects e.g. via `BiquadFilterNode`.
148
+ *
149
+ * The property is automatically set by {@link Audio#setFilters}.
140
150
  */
141
- filters: AudioNode[];
142
-
151
+ readonly filters: AudioNode[];
143
152
  /**
144
- * Return the {@link Audio.gain | gainNode}.
153
+ * Returns the output audio node.
154
+ *
155
+ * @return {GainNode} The output node.
145
156
  */
146
- getOutput(): NodeType;
147
-
157
+ getOutput(): TNode;
148
158
  /**
149
- * Setup the {@link Audio.source | source} to the audioBuffer, and sets {@link Audio.sourceType | sourceType} to 'audioNode'.
150
- * @remarks Also sets {@link Audio.hasPlaybackControl | hasPlaybackControl} to false.
159
+ * Sets the given audio node as the source of this instance.
160
+ *
161
+ * {@link Audio#sourceType} is set to `audioNode` and {@link Audio#hasPlaybackControl} to `false`.
162
+ *
163
+ * @param {AudioNode} audioNode - The audio node like an instance of `OscillatorNode`.
164
+ * @return {Audio} A reference to this instance.
151
165
  */
152
- setNodeSource(audioNode: AudioScheduledSourceNode): this;
153
-
166
+ setNodeSource(audioNode: AudioNode): this;
154
167
  /**
155
- * Applies the given object of type {@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement | HTMLMediaElement} as the source of this audio.
156
- * @remarks Also sets {@link Audio.hasPlaybackControl | hasPlaybackControl} to false.
168
+ * Sets the given media element as the source of this instance.
169
+ *
170
+ * {@link Audio#sourceType} is set to `mediaNode` and {@link Audio#hasPlaybackControl} to `false`.
171
+ *
172
+ * @param {HTMLMediaElement} mediaElement - The media element.
173
+ * @return {Audio} A reference to this instance.
157
174
  */
158
175
  setMediaElementSource(mediaElement: HTMLMediaElement): this;
159
-
160
176
  /**
161
- * Applies the given object of type {@link https://developer.mozilla.org/en-US/docs/Web/API/MediaStream | MediaStream} as the source of this audio.
162
- * @remarks Also sets {@link Audio.hasPlaybackControl | hasPlaybackControl} to false.
177
+ * Sets the given media stream as the source of this instance.
178
+ *
179
+ * {@link Audio#sourceType} is set to `mediaStreamNode` and {@link Audio#hasPlaybackControl} to `false`.
180
+ *
181
+ * @param {MediaStream} mediaStream - The media stream.
182
+ * @return {Audio} A reference to this instance.
163
183
  */
164
184
  setMediaStreamSource(mediaStream: MediaStream): this;
165
-
166
185
  /**
167
- * Setup the {@link Audio.source | source} to the audioBuffer, and sets {@link Audio.sourceType | sourceType} to 'buffer'.
168
- * @remarks If {@link Audio.autoplay | autoplay}, also starts playback.
186
+ * Sets the given audio buffer as the source of this instance.
187
+ *
188
+ * {@link Audio#sourceType} is set to `buffer` and {@link Audio#hasPlaybackControl} to `true`.
189
+ *
190
+ * @param {AudioBuffer} audioBuffer - The audio buffer.
191
+ * @return {Audio} A reference to this instance.
169
192
  */
170
193
  setBuffer(audioBuffer: AudioBuffer): this;
171
-
172
194
  /**
173
- * If {@link Audio.hasPlaybackControl | hasPlaybackControl} is true, starts playback.
195
+ * Starts the playback of the audio.
196
+ *
197
+ * Can only be used with compatible audio sources that allow playback control.
198
+ *
199
+ * @param {number} [delay=0] - The delay, in seconds, at which the audio should start playing.
200
+ * @return {Audio|undefined} A reference to this instance.
174
201
  */
175
- play(delay?: number): this;
176
-
202
+ play(delay?: number): this | undefined;
177
203
  /**
178
- * If {@link Audio.hasPlaybackControl | hasPlaybackControl} is true, pauses playback.
204
+ * Pauses the playback of the audio.
205
+ *
206
+ * Can only be used with compatible audio sources that allow playback control.
207
+ *
208
+ * @return {Audio|undefined} A reference to this instance.
179
209
  */
180
- pause(): this;
181
-
210
+ pause(): this | undefined;
182
211
  /**
183
- * If {@link Audio.hasPlaybackControl | hasPlaybackControl} is enabled, stops playback.
184
- * @param delay (optional) - The delay, in seconds, at which the audio should start playing.
212
+ * Stops the playback of the audio.
213
+ *
214
+ * Can only be used with compatible audio sources that allow playback control.
215
+ *
216
+ * @param {number} [delay=0] - The delay, in seconds, at which the audio should stop playing.
217
+ * @return {Audio|undefined} A reference to this instance.
185
218
  */
186
- stop(delay?: number): this;
187
-
219
+ stop(delay?: number): this | undefined;
188
220
  /**
189
- * Called automatically when playback finished.
221
+ * Connects to the audio source. This is used internally on
222
+ * initialisation and when setting / removing filters.
223
+ *
224
+ * @return {Audio} A reference to this instance.
190
225
  */
191
- onEnded(): void;
192
-
226
+ connect(): this;
193
227
  /**
194
- * Connect to the {@link THREE.Audio.source | Audio.source}
195
- * @remarks This is used internally on initialisation and when setting / removing filters.
228
+ * Disconnects to the audio source. This is used internally on
229
+ * initialisation and when setting / removing filters.
230
+ *
231
+ * @return {Audio|undefined} A reference to this instance.
196
232
  */
197
- connect(): this;
233
+ disconnect(): this | undefined;
198
234
  /**
199
- * Disconnect from the {@link THREE.Audio.source | Audio.source}
200
- * @remarks This is used internally when setting / removing filters.
235
+ * Returns the current set filters.
236
+ *
237
+ * @return {Array<AudioNode>} The list of filters.
201
238
  */
202
- disconnect(): this;
203
-
239
+ getFilters(): AudioNode[];
204
240
  /**
205
- * Returns the detuning of oscillation in cents.
241
+ * Sets an array of filters and connects them with the audio source.
242
+ *
243
+ * @param {Array<AudioNode>} [value] - A list of filters.
244
+ * @return {Audio} A reference to this instance.
206
245
  */
207
- getDetune(): number;
246
+ setFilters(value?: AudioNode[]): this;
208
247
  /**
209
248
  * Defines the detuning of oscillation in cents.
210
- * @param value Expects a `Float`
249
+ *
250
+ * @param {number} value - The detuning of oscillation in cents.
251
+ * @return {Audio} A reference to this instance.
211
252
  */
212
253
  setDetune(value: number): this;
213
-
214
254
  /**
215
- * Returns the first element of the {@link Audio.filters | filters} array.
255
+ * Returns the detuning of oscillation in cents.
256
+ *
257
+ * @return {number} The detuning of oscillation in cents.
216
258
  */
217
- getFilter(): AudioNode;
259
+ getDetune(): number;
218
260
  /**
219
- * Applies a single filter node to the audio.
261
+ * Returns the first filter in the list of filters.
262
+ *
263
+ * @return {AudioNode|undefined} The first filter in the list of filters.
220
264
  */
221
- setFilter(filter: AudioNode): this;
222
-
265
+ getFilter(): AudioNode | undefined;
223
266
  /**
224
- * Returns the {@link Audio.filters | filters} array.
267
+ * Applies a single filter node to the audio.
268
+ *
269
+ * @param {AudioNode} [filter] - The filter to set.
270
+ * @return {Audio} A reference to this instance.
225
271
  */
226
- getFilters(): AudioNode[];
272
+ setFilter(filter?: AudioNode): this;
227
273
  /**
228
- * Applies an array of filter nodes to the audio.
229
- * @param value Arrays of filters.
274
+ * Sets the playback rate.
275
+ *
276
+ * Can only be used with compatible audio sources that allow playback control.
277
+ *
278
+ * @param {number} [value] - The playback rate to set.
279
+ * @return {Audio|undefined} A reference to this instance.
230
280
  */
231
- setFilters(value: AudioNode[]): this;
232
-
281
+ setPlaybackRate(value?: number): this | undefined;
233
282
  /**
234
- * Return the value of {@link Audio.playbackRate | playbackRate}.
283
+ * Returns the current playback rate.
284
+
285
+ * @return {number} The playback rate.
235
286
  */
236
287
  getPlaybackRate(): number;
237
288
  /**
238
- * If {@link Audio.hasPlaybackControl | hasPlaybackControl} is enabled, set the {@link Audio.playbackRate | playbackRate} to `value`.
239
- * @param value Expects a `Float`
289
+ * Automatically called when playback finished.
240
290
  */
241
- setPlaybackRate(value: number): this;
242
-
291
+ onEnded(): void;
243
292
  /**
244
- * Return the value of {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/loop | source.loop} (whether playback should loop).
293
+ * Returns the loop flag.
294
+ *
295
+ * Can only be used with compatible audio sources that allow playback control.
296
+ *
297
+ * @return {boolean} Whether the audio should loop or not.
245
298
  */
246
299
  getLoop(): boolean;
247
300
  /**
248
- * Set {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/loop | source.loop} to `value` (whether playback should loop).
249
- * @param value
301
+ * Sets the loop flag.
302
+ *
303
+ * Can only be used with compatible audio sources that allow playback control.
304
+ *
305
+ * @param {boolean} value - Whether the audio should loop or not.
306
+ * @return {Audio|undefined} A reference to this instance.
250
307
  */
251
- setLoop(value: boolean): this;
252
-
308
+ setLoop(value: boolean): this | undefined;
253
309
  /**
254
- * Set {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/loopStart | source.loopStart} to `value`.
255
- * @param value Expects a `Float`
310
+ * Sets the loop start value which defines where in the audio buffer the replay should
311
+ * start, in seconds.
312
+ *
313
+ * @param {number} value - The loop start value.
314
+ * @return {Audio} A reference to this instance.
256
315
  */
257
316
  setLoopStart(value: number): this;
258
317
  /**
259
- * Set {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode/loopEnd | source.loopEnd} to `value`.
260
- * @param value Expects a `Float`
318
+ * Sets the loop end value which defines where in the audio buffer the replay should
319
+ * stop, in seconds.
320
+ *
321
+ * @param {number} value - The loop end value.
322
+ * @return {Audio} A reference to this instance.
261
323
  */
262
324
  setLoopEnd(value: number): this;
263
-
264
325
  /**
265
- * Return the current volume.
326
+ * Returns the volume.
327
+ *
328
+ * @return {number} The volume.
266
329
  */
267
330
  getVolume(): number;
268
331
  /**
269
- * Set the volume.
270
- * @param value Expects a `Float`
332
+ * Sets the volume.
333
+ *
334
+ * @param {number} value - The volume to set.
335
+ * @return {Audio} A reference to this instance.
271
336
  */
272
337
  setVolume(value: number): this;
338
+ copy(source: Audio, recursive?: boolean): this;
339
+ clone(recursive?: boolean): this;
273
340
  }
@@ -1,58 +1,63 @@
1
1
  import { Audio } from "./Audio.js";
2
2
 
3
3
  /**
4
- * Create a {@link AudioAnalyser} object, which uses an {@link https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode | AnalyserNode} to analyse audio data.
5
- * This uses the {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API | Web Audio API}.
6
- * @example
7
- * ```typescript
4
+ * This class can be used to analyse audio data.
5
+ *
6
+ * ```js
8
7
  * // create an AudioListener and add it to the camera
9
8
  * const listener = new THREE.AudioListener();
10
- * camera.add(listener);
9
+ * camera.add( listener );
10
+ *
11
11
  * // create an Audio source
12
- * const sound = new THREE.Audio(listener);
12
+ * const sound = new THREE.Audio( listener );
13
+ *
13
14
  * // load a sound and set it as the Audio object's buffer
14
15
  * const audioLoader = new THREE.AudioLoader();
15
- * audioLoader.load('sounds/ambient.ogg', function (buffer) {
16
- * sound.setBuffer(buffer);
17
- * sound.setLoop(true);
18
- * sound.setVolume(0.5);
19
- * sound.play();
16
+ * audioLoader.load( 'sounds/ambient.ogg', function( buffer ) {
17
+ * sound.setBuffer( buffer );
18
+ * sound.setLoop(true);
19
+ * sound.setVolume(0.5);
20
+ * sound.play();
20
21
  * });
22
+ *
21
23
  * // create an AudioAnalyser, passing in the sound and desired fftSize
22
- * const analyser = new THREE.AudioAnalyser(sound, 32);
24
+ * const analyser = new THREE.AudioAnalyser( sound, 32 );
25
+ *
23
26
  * // get the average frequency of the sound
24
27
  * const data = analyser.getAverageFrequency();
25
28
  * ```
26
- * @see Example: {@link https://threejs.org/examples/#webaudio_sandbox | webaudio / sandbox }
27
- * @see Example: {@link https://threejs.org/examples/#webaudio_visualizer | webaudio / visualizer }
28
- * @see {@link https://threejs.org/docs/index.html#api/en/audio/AudioAnalyser | Official Documentation}
29
- * @see {@link https://github.com/mrdoob/three.js/blob/master/src/audio/AudioAnalyser.js | Source}
30
29
  */
31
30
  export class AudioAnalyser {
32
31
  /**
33
- * Create a new {@link {@link AudioAnalyser} | AudioAnalyser}.
34
- * @param audio
35
- * @param fftSize See {@link https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/fftSize | AnalyserNode.fftSize }. Expects a `unsigned integer`. Default `2048`.
32
+ * Constructs a new audio analyzer.
33
+ *
34
+ * @param {Audio} audio - The audio to analyze.
35
+ * @param {number} [fftSize=2048] - The window size in samples that is used when performing a Fast Fourier Transform (FFT) to get frequency domain data.
36
36
  */
37
37
  constructor(audio: Audio<AudioNode>, fftSize?: number);
38
-
39
38
  /**
40
- * An {@link https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode | AnalyserNode} used to analyze audio.
39
+ * The global audio listener.
41
40
  */
42
41
  analyser: AnalyserNode;
43
-
44
42
  /**
45
- * A Uint8Array with size determined by {@link https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/frequencyBinCount | analyser.frequencyBinCount} used to hold analysis data.
43
+ * Holds the analyzed data.
46
44
  */
47
45
  data: Uint8Array;
48
-
49
46
  /**
50
- * Uses the Web Audio's {@link https://developer.mozilla.org/en-US/docs/Web/API/AnalyserNode/getByteFrequencyData | getByteFrequencyData} method
47
+ * Returns an array with frequency data of the audio.
48
+ *
49
+ * Each item in the array represents the decibel value for a specific frequency.
50
+ * The frequencies are spread linearly from 0 to 1/2 of the sample rate.
51
+ * For example, for 48000 sample rate, the last item of the array will represent
52
+ * the decibel value for 24000 Hz.
53
+ *
54
+ * @return {Uint8Array} The frequency data.
51
55
  */
52
56
  getFrequencyData(): Uint8Array;
53
-
54
57
  /**
55
- * Get the average of the frequencies returned by the {@link AudioAnalyser.getFrequencyData | getFrequencyData} method.
58
+ * Returns the average of the frequencies returned by {@link AudioAnalyser#getFrequencyData}.
59
+ *
60
+ * @return {number} The average frequency.
56
61
  */
57
62
  getAverageFrequency(): number;
58
63
  }
@@ -1,19 +1,19 @@
1
1
  /**
2
- * This contains methods for setting up an {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioContext | AudioContext}.
3
- * Used internally by the {@link AudioListener | AudioListener} and {@link AudioLoader | AudioLoader} classes.
4
- * This uses the {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API | Web Audio API}.
5
- * @see {@link https://threejs.org/docs/index.html#api/en/audio/AudioContext | Official Documentation}
6
- * @see {@link https://github.com/mrdoob/three.js/blob/master/src/audio/AudioContext.js | Source}
2
+ * Manages the global audio context in the engine.
3
+ *
4
+ * @hideconstructor
7
5
  */
8
- export namespace AudioContext {
6
+ export class AudioContext {
9
7
  /**
10
- * Return the value of the variable `context` in the outer scope, if defined, otherwise set it to a new {@link https://developer.mozilla.org/en-US/docs/Web/API/AudioContext | AudioContext}.
8
+ * Returns the global native audio context.
9
+ *
10
+ * @return {AudioContext} The native audio context.
11
11
  */
12
- function getContext(): AudioContext;
13
-
12
+ static getContext(): AudioContext;
14
13
  /**
15
- * Set the variable `context` in the outer scope to `value`.
16
- * @param value
14
+ * Allows to set the global native audio context from outside.
15
+ *
16
+ * @param {AudioContext} value - The native context to set.
17
17
  */
18
- function setContext(context: AudioContext): void;
18
+ static setContext(value: AudioContext): void;
19
19
  }