@onerjs/core 8.31.9 → 8.32.1

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 (371) hide show
  1. package/Audio/Interfaces/ISoundOptions.d.ts +1 -1
  2. package/Audio/Interfaces/ISoundOptions.js.map +1 -1
  3. package/Audio/audioEngine.d.ts +3 -4
  4. package/Audio/audioEngine.js +9 -6
  5. package/Audio/audioEngine.js.map +1 -1
  6. package/Audio/sound.d.ts +33 -54
  7. package/Audio/sound.js +450 -718
  8. package/Audio/sound.js.map +1 -1
  9. package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +1 -1
  10. package/AudioV2/abstractAudio/abstractAudioOutNode.js +1 -1
  11. package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -1
  12. package/AudioV2/abstractAudio/abstractSound.d.ts +1 -1
  13. package/AudioV2/abstractAudio/abstractSound.js +2 -2
  14. package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
  15. package/AudioV2/abstractAudio/abstractSoundSource.d.ts +11 -3
  16. package/AudioV2/abstractAudio/abstractSoundSource.js +37 -1
  17. package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
  18. package/AudioV2/abstractAudio/audioBus.d.ts +8 -3
  19. package/AudioV2/abstractAudio/audioBus.js +24 -1
  20. package/AudioV2/abstractAudio/audioBus.js.map +1 -1
  21. package/AudioV2/abstractAudio/staticSound.d.ts +1 -1
  22. package/AudioV2/abstractAudio/staticSound.js +2 -2
  23. package/AudioV2/abstractAudio/staticSound.js.map +1 -1
  24. package/AudioV2/abstractAudio/streamingSound.d.ts +1 -1
  25. package/AudioV2/abstractAudio/streamingSound.js +2 -2
  26. package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
  27. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +1 -1
  28. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +3 -0
  29. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
  30. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +1 -0
  31. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +1 -0
  32. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -1
  33. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +12 -2
  34. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +2 -0
  35. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -1
  36. package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +6 -0
  37. package/AudioV2/abstractAudio/subProperties/spatialAudio.js +25 -0
  38. package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
  39. package/AudioV2/webAudio/components/webAudioParameterComponent.js +2 -2
  40. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  41. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +3 -0
  42. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +14 -17
  43. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
  44. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +1 -0
  45. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -1
  46. package/AudioV2/webAudio/subProperties/spatialWebAudio.js +1 -0
  47. package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -1
  48. package/AudioV2/webAudio/webAudioBus.d.ts +2 -7
  49. package/AudioV2/webAudio/webAudioBus.js +4 -24
  50. package/AudioV2/webAudio/webAudioBus.js.map +1 -1
  51. package/AudioV2/webAudio/webAudioEngine.js +1 -0
  52. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  53. package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -7
  54. package/AudioV2/webAudio/webAudioSoundSource.js +3 -24
  55. package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
  56. package/AudioV2/webAudio/webAudioStaticSound.d.ts +3 -7
  57. package/AudioV2/webAudio/webAudioStaticSound.js +13 -26
  58. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  59. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +3 -7
  60. package/AudioV2/webAudio/webAudioStreamingSound.js +6 -23
  61. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  62. package/Behaviors/Cameras/autoRotationBehavior.d.ts +4 -0
  63. package/Behaviors/Cameras/autoRotationBehavior.js +7 -0
  64. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  65. package/Behaviors/Cameras/bouncingBehavior.d.ts +5 -0
  66. package/Behaviors/Cameras/bouncingBehavior.js +8 -0
  67. package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
  68. package/Behaviors/Cameras/framingBehavior.d.ts +4 -0
  69. package/Behaviors/Cameras/framingBehavior.js +7 -0
  70. package/Behaviors/Cameras/framingBehavior.js.map +1 -1
  71. package/Behaviors/Cameras/interpolatingBehavior.d.ts +7 -2
  72. package/Behaviors/Cameras/interpolatingBehavior.js +12 -4
  73. package/Behaviors/Cameras/interpolatingBehavior.js.map +1 -1
  74. package/Behaviors/Meshes/attachToBoxBehavior.d.ts +5 -0
  75. package/Behaviors/Meshes/attachToBoxBehavior.js +8 -1
  76. package/Behaviors/Meshes/attachToBoxBehavior.js.map +1 -1
  77. package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +5 -2
  78. package/Behaviors/Meshes/baseSixDofDragBehavior.js +8 -0
  79. package/Behaviors/Meshes/baseSixDofDragBehavior.js.map +1 -1
  80. package/Behaviors/Meshes/fadeInOutBehavior.d.ts +5 -0
  81. package/Behaviors/Meshes/fadeInOutBehavior.js +6 -0
  82. package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
  83. package/Behaviors/Meshes/handConstraintBehavior.d.ts +5 -0
  84. package/Behaviors/Meshes/handConstraintBehavior.js +8 -0
  85. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  86. package/Behaviors/Meshes/multiPointerScaleBehavior.d.ts +5 -0
  87. package/Behaviors/Meshes/multiPointerScaleBehavior.js +8 -0
  88. package/Behaviors/Meshes/multiPointerScaleBehavior.js.map +1 -1
  89. package/Behaviors/Meshes/pointerDragBehavior.d.ts +1 -1
  90. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  91. package/Behaviors/Meshes/sixDofDragBehavior.js +1 -1
  92. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  93. package/Behaviors/Meshes/surfaceMagnetismBehavior.d.ts +5 -0
  94. package/Behaviors/Meshes/surfaceMagnetismBehavior.js +7 -0
  95. package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
  96. package/Behaviors/behavior.d.ts +4 -0
  97. package/Behaviors/behavior.js.map +1 -1
  98. package/Cameras/arcRotateCamera.js +4 -5
  99. package/Cameras/arcRotateCamera.js.map +1 -1
  100. package/Cameras/geospatialCamera.d.ts +4 -5
  101. package/Cameras/geospatialCamera.js +42 -29
  102. package/Cameras/geospatialCamera.js.map +1 -1
  103. package/Cameras/geospatialCameraMovement.js +1 -1
  104. package/Cameras/geospatialCameraMovement.js.map +1 -1
  105. package/Compute/computeEffect.js +5 -1
  106. package/Compute/computeEffect.js.map +1 -1
  107. package/Compute/computeShader.d.ts +4 -0
  108. package/Compute/computeShader.js +9 -3
  109. package/Compute/computeShader.js.map +1 -1
  110. package/Debug/debugLayer.d.ts +1 -1
  111. package/Debug/debugLayer.js.map +1 -1
  112. package/Engines/abstractEngine.d.ts +2 -2
  113. package/Engines/abstractEngine.js +2 -2
  114. package/Engines/abstractEngine.js.map +1 -1
  115. package/Engines/thinEngine.js +1 -1
  116. package/Engines/thinEngine.js.map +1 -1
  117. package/Engines/webgpuEngine.js +8 -9
  118. package/Engines/webgpuEngine.js.map +1 -1
  119. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.d.ts +74 -0
  120. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js +179 -0
  121. package/FrameGraph/Node/Blocks/PostProcesses/volumetricLightingBlock.js.map +1 -0
  122. package/FrameGraph/Node/Blocks/index.d.ts +2 -0
  123. package/FrameGraph/Node/Blocks/index.js +2 -0
  124. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  125. package/FrameGraph/Node/Blocks/lightingVolumeBlock.d.ts +43 -0
  126. package/FrameGraph/Node/Blocks/lightingVolumeBlock.js +93 -0
  127. package/FrameGraph/Node/Blocks/lightingVolumeBlock.js.map +1 -0
  128. package/FrameGraph/Passes/renderPass.js +2 -2
  129. package/FrameGraph/Passes/renderPass.js.map +1 -1
  130. package/FrameGraph/Tasks/Layers/baseLayerTask.d.ts +2 -0
  131. package/FrameGraph/Tasks/Layers/baseLayerTask.js +6 -0
  132. package/FrameGraph/Tasks/Layers/baseLayerTask.js.map +1 -1
  133. package/FrameGraph/Tasks/Layers/glowLayerTask.d.ts +1 -0
  134. package/FrameGraph/Tasks/Layers/glowLayerTask.js +3 -0
  135. package/FrameGraph/Tasks/Layers/glowLayerTask.js.map +1 -1
  136. package/FrameGraph/Tasks/Layers/highlightLayerTask.d.ts +1 -0
  137. package/FrameGraph/Tasks/Layers/highlightLayerTask.js +3 -0
  138. package/FrameGraph/Tasks/Layers/highlightLayerTask.js.map +1 -1
  139. package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +1 -0
  140. package/FrameGraph/Tasks/Misc/computeShaderTask.js +3 -0
  141. package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -1
  142. package/FrameGraph/Tasks/Misc/cullObjectsTask.d.ts +1 -0
  143. package/FrameGraph/Tasks/Misc/cullObjectsTask.js +3 -0
  144. package/FrameGraph/Tasks/Misc/cullObjectsTask.js.map +1 -1
  145. package/FrameGraph/Tasks/Misc/executeTask.d.ts +1 -0
  146. package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
  147. package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
  148. package/FrameGraph/Tasks/Misc/lightingVolumeTask.d.ts +32 -0
  149. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js +63 -0
  150. package/FrameGraph/Tasks/Misc/lightingVolumeTask.js.map +1 -0
  151. package/FrameGraph/Tasks/PostProcesses/anaglyphTask.d.ts +1 -0
  152. package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js +3 -0
  153. package/FrameGraph/Tasks/PostProcesses/anaglyphTask.js.map +1 -1
  154. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.d.ts +1 -0
  155. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js +3 -0
  156. package/FrameGraph/Tasks/PostProcesses/blackAndWhiteTask.js.map +1 -1
  157. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.d.ts +1 -0
  158. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js +3 -0
  159. package/FrameGraph/Tasks/PostProcesses/bloomMergeTask.js.map +1 -1
  160. package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -0
  161. package/FrameGraph/Tasks/PostProcesses/bloomTask.js +3 -0
  162. package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
  163. package/FrameGraph/Tasks/PostProcesses/blurTask.d.ts +1 -0
  164. package/FrameGraph/Tasks/PostProcesses/blurTask.js +3 -0
  165. package/FrameGraph/Tasks/PostProcesses/blurTask.js.map +1 -1
  166. package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.d.ts +1 -0
  167. package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js +3 -0
  168. package/FrameGraph/Tasks/PostProcesses/chromaticAberrationTask.js.map +1 -1
  169. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.d.ts +1 -0
  170. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js +3 -0
  171. package/FrameGraph/Tasks/PostProcesses/circleOfConfusionTask.js.map +1 -1
  172. package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.d.ts +1 -0
  173. package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js +3 -0
  174. package/FrameGraph/Tasks/PostProcesses/colorCorrectionTask.js.map +1 -1
  175. package/FrameGraph/Tasks/PostProcesses/convolutionTask.d.ts +1 -0
  176. package/FrameGraph/Tasks/PostProcesses/convolutionTask.js +3 -0
  177. package/FrameGraph/Tasks/PostProcesses/convolutionTask.js.map +1 -1
  178. package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.d.ts +1 -0
  179. package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js +3 -0
  180. package/FrameGraph/Tasks/PostProcesses/customPostProcessTask.js.map +1 -1
  181. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.d.ts +1 -0
  182. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js +3 -0
  183. package/FrameGraph/Tasks/PostProcesses/depthOfFieldBlurTask.js.map +1 -1
  184. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.d.ts +1 -0
  185. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js +3 -0
  186. package/FrameGraph/Tasks/PostProcesses/depthOfFieldMergeTask.js.map +1 -1
  187. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.d.ts +1 -0
  188. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js +3 -0
  189. package/FrameGraph/Tasks/PostProcesses/depthOfFieldTask.js.map +1 -1
  190. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.d.ts +1 -0
  191. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js +3 -0
  192. package/FrameGraph/Tasks/PostProcesses/extractHighlightsTask.js.map +1 -1
  193. package/FrameGraph/Tasks/PostProcesses/filterTask.d.ts +1 -0
  194. package/FrameGraph/Tasks/PostProcesses/filterTask.js +3 -0
  195. package/FrameGraph/Tasks/PostProcesses/filterTask.js.map +1 -1
  196. package/FrameGraph/Tasks/PostProcesses/fxaaTask.d.ts +1 -0
  197. package/FrameGraph/Tasks/PostProcesses/fxaaTask.js +3 -0
  198. package/FrameGraph/Tasks/PostProcesses/fxaaTask.js.map +1 -1
  199. package/FrameGraph/Tasks/PostProcesses/grainTask.d.ts +1 -0
  200. package/FrameGraph/Tasks/PostProcesses/grainTask.js +3 -0
  201. package/FrameGraph/Tasks/PostProcesses/grainTask.js.map +1 -1
  202. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.d.ts +1 -0
  203. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js +3 -0
  204. package/FrameGraph/Tasks/PostProcesses/imageProcessingTask.js.map +1 -1
  205. package/FrameGraph/Tasks/PostProcesses/motionBlurTask.d.ts +1 -0
  206. package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js +3 -0
  207. package/FrameGraph/Tasks/PostProcesses/motionBlurTask.js.map +1 -1
  208. package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +2 -0
  209. package/FrameGraph/Tasks/PostProcesses/passTask.js +6 -0
  210. package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -1
  211. package/FrameGraph/Tasks/PostProcesses/postProcessTask.d.ts +3 -2
  212. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js +3 -0
  213. package/FrameGraph/Tasks/PostProcesses/postProcessTask.js.map +1 -1
  214. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.d.ts +1 -0
  215. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js +3 -0
  216. package/FrameGraph/Tasks/PostProcesses/screenSpaceCurvatureTask.js.map +1 -1
  217. package/FrameGraph/Tasks/PostProcesses/sharpenTask.d.ts +1 -0
  218. package/FrameGraph/Tasks/PostProcesses/sharpenTask.js +3 -0
  219. package/FrameGraph/Tasks/PostProcesses/sharpenTask.js.map +1 -1
  220. package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.d.ts +1 -0
  221. package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js +3 -0
  222. package/FrameGraph/Tasks/PostProcesses/ssao2BlurTask.js.map +1 -1
  223. package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.d.ts +1 -0
  224. package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js +3 -0
  225. package/FrameGraph/Tasks/PostProcesses/ssao2RenderingPipelineTask.js.map +1 -1
  226. package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
  227. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +3 -0
  228. package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
  229. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.d.ts +1 -0
  230. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js +3 -0
  231. package/FrameGraph/Tasks/PostProcesses/ssrBlurTask.js.map +1 -1
  232. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.d.ts +1 -0
  233. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js +3 -0
  234. package/FrameGraph/Tasks/PostProcesses/ssrRenderingPipelineTask.js.map +1 -1
  235. package/FrameGraph/Tasks/PostProcesses/ssrTask.d.ts +1 -0
  236. package/FrameGraph/Tasks/PostProcesses/ssrTask.js +3 -0
  237. package/FrameGraph/Tasks/PostProcesses/ssrTask.js.map +1 -1
  238. package/FrameGraph/Tasks/PostProcesses/taaTask.d.ts +1 -0
  239. package/FrameGraph/Tasks/PostProcesses/taaTask.js +3 -0
  240. package/FrameGraph/Tasks/PostProcesses/taaTask.js.map +1 -1
  241. package/FrameGraph/Tasks/PostProcesses/tonemapTask.d.ts +1 -0
  242. package/FrameGraph/Tasks/PostProcesses/tonemapTask.js +3 -0
  243. package/FrameGraph/Tasks/PostProcesses/tonemapTask.js.map +1 -1
  244. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.d.ts +31 -0
  245. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js +60 -0
  246. package/FrameGraph/Tasks/PostProcesses/volumetricLightingBlendVolumeTask.js.map +1 -0
  247. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.d.ts +93 -0
  248. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js +183 -0
  249. package/FrameGraph/Tasks/PostProcesses/volumetricLightingTask.js.map +1 -0
  250. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +1 -0
  251. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -0
  252. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
  253. package/FrameGraph/Tasks/Rendering/geometryRendererTask.d.ts +1 -0
  254. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js +3 -0
  255. package/FrameGraph/Tasks/Rendering/geometryRendererTask.js.map +1 -1
  256. package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +1 -0
  257. package/FrameGraph/Tasks/Rendering/objectRendererTask.js +4 -1
  258. package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
  259. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +1 -0
  260. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +3 -0
  261. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
  262. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +1 -0
  263. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +3 -0
  264. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
  265. package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -0
  266. package/FrameGraph/Tasks/Texture/clearTextureTask.js +4 -1
  267. package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
  268. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.d.ts +1 -0
  269. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js +3 -0
  270. package/FrameGraph/Tasks/Texture/copyToBackbufferColorTask.js.map +1 -1
  271. package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +1 -0
  272. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +21 -4
  273. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
  274. package/FrameGraph/Tasks/Texture/generateMipMapsTask.d.ts +1 -0
  275. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js +3 -0
  276. package/FrameGraph/Tasks/Texture/generateMipMapsTask.js.map +1 -1
  277. package/FrameGraph/frameGraphRenderContext.d.ts +3 -2
  278. package/FrameGraph/frameGraphRenderContext.js +14 -5
  279. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  280. package/FrameGraph/frameGraphTask.d.ts +5 -0
  281. package/FrameGraph/frameGraphTask.js +11 -2
  282. package/FrameGraph/frameGraphTask.js.map +1 -1
  283. package/FrameGraph/index.d.ts +2 -0
  284. package/FrameGraph/index.js +2 -0
  285. package/FrameGraph/index.js.map +1 -1
  286. package/Helpers/sceneHelpers.js +1 -1
  287. package/Helpers/sceneHelpers.js.map +1 -1
  288. package/Lights/index.d.ts +1 -0
  289. package/Lights/index.js +1 -0
  290. package/Lights/index.js.map +1 -1
  291. package/Lights/lightingVolume.d.ts +95 -0
  292. package/Lights/lightingVolume.js +536 -0
  293. package/Lights/lightingVolume.js.map +1 -0
  294. package/Loading/Plugins/babylonFileLoader.js.map +1 -1
  295. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +7 -0
  296. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +21 -5
  297. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  298. package/Materials/floatingOriginMatrixOverrides.js +6 -5
  299. package/Materials/floatingOriginMatrixOverrides.js.map +1 -1
  300. package/Materials/uniformBuffer.d.ts +1 -0
  301. package/Materials/uniformBuffer.js +8 -1
  302. package/Materials/uniformBuffer.js.map +1 -1
  303. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +5 -2
  304. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +138 -45
  305. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  306. package/Meshes/geometry.d.ts +2 -1
  307. package/Meshes/geometry.js +6 -2
  308. package/Meshes/geometry.js.map +1 -1
  309. package/Meshes/mesh.d.ts +2 -1
  310. package/Meshes/mesh.js +4 -3
  311. package/Meshes/mesh.js.map +1 -1
  312. package/Particles/Node/Blocks/Update/updateFlowMapBlock.d.ts +9 -1
  313. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js +8 -0
  314. package/Particles/Node/Blocks/Update/updateFlowMapBlock.js.map +1 -1
  315. package/Particles/Node/Blocks/Update/updateNoiseBlock.d.ts +39 -0
  316. package/Particles/Node/Blocks/Update/updateNoiseBlock.js +102 -0
  317. package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -0
  318. package/Particles/Node/Blocks/index.d.ts +1 -0
  319. package/Particles/Node/Blocks/index.js +1 -0
  320. package/Particles/Node/Blocks/index.js.map +1 -1
  321. package/Particles/Node/Blocks/particleSourceTextureBlock.d.ts +9 -5
  322. package/Particles/Node/Blocks/particleSourceTextureBlock.js +31 -13
  323. package/Particles/Node/Blocks/particleSourceTextureBlock.js.map +1 -1
  324. package/Particles/Node/nodeParticleSystemSet.helper.js +39 -21
  325. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  326. package/Particles/particle.d.ts +2 -2
  327. package/Particles/particle.js +4 -2
  328. package/Particles/particle.js.map +1 -1
  329. package/Particles/thinParticleSystem.d.ts +1 -1
  330. package/Particles/thinParticleSystem.function.js +2 -2
  331. package/Particles/thinParticleSystem.function.js.map +1 -1
  332. package/Particles/thinParticleSystem.js.map +1 -1
  333. package/Physics/v2/characterController.d.ts +42 -2
  334. package/Physics/v2/characterController.js +140 -46
  335. package/Physics/v2/characterController.js.map +1 -1
  336. package/Shaders/gaussianSplatting.vertex.js +2 -2
  337. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  338. package/Shaders/volumetricLightingBlendVolume.fragment.d.ts +5 -0
  339. package/Shaders/volumetricLightingBlendVolume.fragment.js +21 -0
  340. package/Shaders/volumetricLightingBlendVolume.fragment.js.map +1 -0
  341. package/Shaders/volumetricLightingRenderVolume.fragment.d.ts +7 -0
  342. package/Shaders/volumetricLightingRenderVolume.fragment.js +25 -0
  343. package/Shaders/volumetricLightingRenderVolume.fragment.js.map +1 -0
  344. package/Shaders/volumetricLightingRenderVolume.vertex.d.ts +9 -0
  345. package/Shaders/volumetricLightingRenderVolume.vertex.js +18 -0
  346. package/Shaders/volumetricLightingRenderVolume.vertex.js.map +1 -0
  347. package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
  348. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  349. package/ShadersWGSL/gaussianSplattingDepth.fragment.d.ts +0 -1
  350. package/ShadersWGSL/gaussianSplattingDepth.fragment.js +0 -2
  351. package/ShadersWGSL/gaussianSplattingDepth.fragment.js.map +1 -1
  352. package/ShadersWGSL/lightingVolume.compute.d.ts +5 -0
  353. package/ShadersWGSL/lightingVolume.compute.js +33 -0
  354. package/ShadersWGSL/lightingVolume.compute.js.map +1 -0
  355. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.d.ts +5 -0
  356. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js +22 -0
  357. package/ShadersWGSL/volumetricLightingBlendVolume.fragment.js.map +1 -0
  358. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.d.ts +7 -0
  359. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js +27 -0
  360. package/ShadersWGSL/volumetricLightingRenderVolume.fragment.js.map +1 -0
  361. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.d.ts +7 -0
  362. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js +17 -0
  363. package/ShadersWGSL/volumetricLightingRenderVolume.vertex.js.map +1 -0
  364. package/States/IStencilState.d.ts +48 -2
  365. package/States/IStencilState.js.map +1 -1
  366. package/States/alphaCullingState.d.ts +1 -0
  367. package/States/alphaCullingState.js +3 -0
  368. package/States/alphaCullingState.js.map +1 -1
  369. package/package.json +1 -1
  370. package/scene.js +6 -4
  371. package/scene.js.map +1 -1
@@ -3,12 +3,21 @@ import { AbstractAudioOutNode } from "./abstractAudioOutNode.js";
3
3
  * Abstract class representing a sound in the audio engine.
4
4
  */
5
5
  export class AbstractSoundSource extends AbstractAudioOutNode {
6
- constructor(name, engine, nodeType = 2 /* AudioNodeType.HAS_OUTPUTS */) {
6
+ constructor(name, engine, options, nodeType = 2 /* AudioNodeType.HAS_OUTPUTS */) {
7
7
  super(name, engine, nodeType);
8
+ this._spatialAutoUpdate = true;
9
+ this._spatialMinUpdateTime = 0;
8
10
  this._outBus = null;
11
+ this._spatial = null;
9
12
  this._onOutBusDisposed = () => {
10
13
  this._outBus = null;
11
14
  };
15
+ if (typeof options.spatialAutoUpdate === "boolean") {
16
+ this._spatialAutoUpdate = options.spatialAutoUpdate;
17
+ }
18
+ if (typeof options.spatialMinUpdateTime === "number") {
19
+ this._spatialMinUpdateTime = options.spatialMinUpdateTime;
20
+ }
12
21
  }
13
22
  /**
14
23
  * The output bus for the sound.
@@ -35,12 +44,39 @@ export class AbstractSoundSource extends AbstractAudioOutNode {
35
44
  }
36
45
  }
37
46
  }
47
+ /**
48
+ * The spatial audio features.
49
+ */
50
+ get spatial() {
51
+ if (this._spatial) {
52
+ return this._spatial;
53
+ }
54
+ return this._initSpatialProperty();
55
+ }
38
56
  /**
39
57
  * Releases associated resources.
40
58
  */
41
59
  dispose() {
42
60
  super.dispose();
61
+ this._spatial?.dispose();
62
+ this._spatial = null;
43
63
  this._outBus = null;
44
64
  }
65
+ _initSpatialProperty() {
66
+ return (this._spatial = this._createSpatialProperty(this._spatialAutoUpdate, this._spatialMinUpdateTime));
67
+ }
68
+ /** @internal */
69
+ get _isSpatial() {
70
+ return this._spatial !== null;
71
+ }
72
+ set _isSpatial(value) {
73
+ if (value && !this._spatial) {
74
+ this._initSpatialProperty();
75
+ }
76
+ else if (!value && this._spatial) {
77
+ this._spatial.dispose();
78
+ this._spatial = null;
79
+ }
80
+ }
45
81
  }
46
82
  //# sourceMappingURL=abstractSoundSource.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"abstractSoundSource.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractSoundSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAuB9D;;GAEG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,oBAAoB;IAGlE,YAAsB,IAAY,EAAE,MAAqB,EAAE,4CAAmD;QAC1G,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAH1B,YAAO,GAA8B,IAAI,CAAC;QAuD1C,sBAAiB,GAAG,GAAG,EAAE;YAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACxB,CAAC,CAAC;IArDF,CAAC;IAED;;;OAGG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAiC;QAC/C,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YACxE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC7D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAYD;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;CAKJ","sourcesContent":["import type { Nullable } from \"../../types\";\nimport { AudioNodeType } from \"./abstractAudioNode\";\nimport type { IAbstractAudioOutNodeOptions } from \"./abstractAudioOutNode\";\nimport { AbstractAudioOutNode } from \"./abstractAudioOutNode\";\nimport type { PrimaryAudioBus } from \"./audioBus\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { AbstractSpatialAudio, ISpatialAudioOptions } from \"./subProperties/abstractSpatialAudio\";\nimport type { AbstractStereoAudio, IStereoAudioOptions } from \"./subProperties/abstractStereoAudio\";\n\n/**\n * Options for creating a sound source.\n */\nexport interface ISoundSourceOptions extends IAbstractAudioOutNodeOptions, ISpatialAudioOptions, IStereoAudioOptions {\n /**\n * The output bus for the sound source. Defaults to `null`.\n * - If not set or `null`, and `outBusAutoDefault` is `true`, then the sound source is automatically connected to the audio engine's default main bus.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: Nullable<PrimaryAudioBus>;\n\n /**\n * Whether the sound's `outBus` should default to the audio engine's main bus. Defaults to `true` for all sound sources except microphones.\n */\n outBusAutoDefault: boolean;\n}\n\n/**\n * Abstract class representing a sound in the audio engine.\n */\nexport abstract class AbstractSoundSource extends AbstractAudioOutNode {\n private _outBus: Nullable<PrimaryAudioBus> = null;\n\n protected constructor(name: string, engine: AudioEngineV2, nodeType: AudioNodeType = AudioNodeType.HAS_OUTPUTS) {\n super(name, engine, nodeType);\n }\n\n /**\n * The output bus for the sound.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n public get outBus(): Nullable<PrimaryAudioBus> {\n return this._outBus;\n }\n\n public set outBus(outBus: Nullable<PrimaryAudioBus>) {\n if (this._outBus === outBus) {\n return;\n }\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed);\n if (!this._disconnect(this._outBus)) {\n throw new Error(\"Disconnect failed\");\n }\n }\n\n this._outBus = outBus;\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.add(this._onOutBusDisposed);\n if (!this._connect(this._outBus)) {\n throw new Error(\"Connect failed\");\n }\n }\n }\n\n /**\n * The spatial features of the sound.\n */\n public abstract spatial: AbstractSpatialAudio;\n\n /**\n * The stereo features of the sound.\n */\n public abstract stereo: AbstractStereoAudio;\n\n /**\n * Releases associated resources.\n */\n public override dispose(): void {\n super.dispose();\n\n this._outBus = null;\n }\n\n private _onOutBusDisposed = () => {\n this._outBus = null;\n };\n}\n"]}
1
+ {"version":3,"file":"abstractSoundSource.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractSoundSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAuB9D;;GAEG;AACH,MAAM,OAAgB,mBAAoB,SAAQ,oBAAoB;IAMlE,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAqC,EAAE,4CAAmD;QACjJ,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QANjB,uBAAkB,GAAY,IAAI,CAAC;QACnC,0BAAqB,GAAW,CAAC,CAAC;QAC3C,YAAO,GAA8B,IAAI,CAAC;QAC1C,aAAQ,GAAmC,IAAI,CAAC;QA6EhD,sBAAiB,GAAG,GAAG,EAAE;YAC7B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACxB,CAAC,CAAC;QA1EE,IAAI,OAAO,OAAO,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACjD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACxD,C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EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAIS,oBAAoB;QAC1B,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC9G,CAAC;IAMD,gBAAgB;IAChB,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC;IAClC,CAAC;IAED,IAAW,UAAU,CAAC,KAAc;QAChC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC1B,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAChC,CAAC;aAAM,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzB,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\nimport { AudioNodeType } from \"./abstractAudioNode\";\nimport type { IAbstractAudioOutNodeOptions } from \"./abstractAudioOutNode\";\nimport { AbstractAudioOutNode } from \"./abstractAudioOutNode\";\nimport type { PrimaryAudioBus } from \"./audioBus\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { AbstractSpatialAudio, ISpatialAudioOptions } from \"./subProperties/abstractSpatialAudio\";\nimport type { AbstractStereoAudio, IStereoAudioOptions } from \"./subProperties/abstractStereoAudio\";\n\n/**\n * Options for creating a sound source.\n */\nexport interface ISoundSourceOptions extends IAbstractAudioOutNodeOptions, ISpatialAudioOptions, IStereoAudioOptions {\n /**\n * The output bus for the sound source. Defaults to `null`.\n * - If not set or `null`, and `outBusAutoDefault` is `true`, then the sound source is automatically connected to the audio engine's default main bus.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: Nullable<PrimaryAudioBus>;\n\n /**\n * Whether the sound's `outBus` should default to the audio engine's main bus. Defaults to `true` for all sound sources except microphones.\n */\n outBusAutoDefault: boolean;\n}\n\n/**\n * Abstract class representing a sound in the audio engine.\n */\nexport abstract class AbstractSoundSource extends AbstractAudioOutNode {\n private readonly _spatialAutoUpdate: boolean = true;\n private readonly _spatialMinUpdateTime: number = 0;\n private _outBus: Nullable<PrimaryAudioBus> = null;\n private _spatial: Nullable<AbstractSpatialAudio> = null;\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<ISoundSourceOptions>, nodeType: AudioNodeType = AudioNodeType.HAS_OUTPUTS) {\n super(name, engine, nodeType);\n\n if (typeof options.spatialAutoUpdate === \"boolean\") {\n this._spatialAutoUpdate = options.spatialAutoUpdate;\n }\n\n if (typeof options.spatialMinUpdateTime === \"number\") {\n this._spatialMinUpdateTime = options.spatialMinUpdateTime;\n }\n }\n\n /**\n * The output bus for the sound.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n public get outBus(): Nullable<PrimaryAudioBus> {\n return this._outBus;\n }\n\n public set outBus(outBus: Nullable<PrimaryAudioBus>) {\n if (this._outBus === outBus) {\n return;\n }\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed);\n if (!this._disconnect(this._outBus)) {\n throw new Error(\"Disconnect failed\");\n }\n }\n\n this._outBus = outBus;\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.add(this._onOutBusDisposed);\n if (!this._connect(this._outBus)) {\n throw new Error(\"Connect failed\");\n }\n }\n }\n\n /**\n * The spatial audio features.\n */\n public get spatial(): AbstractSpatialAudio {\n if (this._spatial) {\n return this._spatial;\n }\n return this._initSpatialProperty();\n }\n\n /**\n * The stereo features of the sound.\n */\n public abstract stereo: AbstractStereoAudio;\n\n /**\n * Releases associated resources.\n */\n public override dispose(): void {\n super.dispose();\n\n this._spatial?.dispose();\n this._spatial = null;\n\n this._outBus = null;\n }\n\n protected abstract _createSpatialProperty(autoUpdate: boolean, minUpdateTime: number): AbstractSpatialAudio;\n\n protected _initSpatialProperty(): AbstractSpatialAudio {\n return (this._spatial = this._createSpatialProperty(this._spatialAutoUpdate, this._spatialMinUpdateTime));\n }\n\n private _onOutBusDisposed = () => {\n this._outBus = null;\n };\n\n /** @internal */\n public get _isSpatial(): boolean {\n return this._spatial !== null;\n }\n\n public set _isSpatial(value: boolean) {\n if (value && !this._spatial) {\n this._initSpatialProperty();\n } else if (!value && this._spatial) {\n this._spatial.dispose();\n this._spatial = null;\n }\n }\n}\n"]}
@@ -24,17 +24,20 @@ export interface IAudioBusOptions extends IAbstractAudioBusOptions, ISpatialAudi
24
24
  * Audio buses are created by the {@link CreateAudioBusAsync} function.
25
25
  */
26
26
  export declare abstract class AudioBus extends AbstractAudioBus {
27
+ private readonly _spatialAutoUpdate;
28
+ private readonly _spatialMinUpdateTime;
27
29
  private _outBus;
28
- protected constructor(name: string, engine: AudioEngineV2);
30
+ private _spatial;
31
+ protected constructor(name: string, engine: AudioEngineV2, options: Partial<IAudioBusOptions>);
29
32
  /**
30
33
  * The output bus of the audio bus. Defaults to the audio engine's default main bus.
31
34
  */
32
35
  get outBus(): Nullable<PrimaryAudioBus>;
33
36
  set outBus(outBus: Nullable<PrimaryAudioBus>);
34
37
  /**
35
- * The spatial features of the audio bus.
38
+ * The spatial audio features.
36
39
  */
37
- abstract readonly spatial: AbstractSpatialAudio;
40
+ get spatial(): AbstractSpatialAudio;
38
41
  /**
39
42
  * The stereo features of the audio bus.
40
43
  */
@@ -43,5 +46,7 @@ export declare abstract class AudioBus extends AbstractAudioBus {
43
46
  * Releases associated resources.
44
47
  */
45
48
  dispose(): void;
49
+ protected abstract _createSpatialProperty(autoUpdate: boolean, minUpdateTime: number): AbstractSpatialAudio;
50
+ protected _initSpatialProperty(): AbstractSpatialAudio;
46
51
  private _onOutBusDisposed;
47
52
  }
@@ -7,12 +7,21 @@ import { AbstractAudioBus } from "./abstractAudioBus.js";
7
7
  * Audio buses are created by the {@link CreateAudioBusAsync} function.
8
8
  */
9
9
  export class AudioBus extends AbstractAudioBus {
10
- constructor(name, engine) {
10
+ constructor(name, engine, options) {
11
11
  super(name, engine);
12
+ this._spatialAutoUpdate = true;
13
+ this._spatialMinUpdateTime = 0;
12
14
  this._outBus = null;
15
+ this._spatial = null;
13
16
  this._onOutBusDisposed = () => {
14
17
  this.outBus = this.engine.defaultMainBus;
15
18
  };
19
+ if (typeof options.spatialAutoUpdate === "boolean") {
20
+ this._spatialAutoUpdate = options.spatialAutoUpdate;
21
+ }
22
+ if (typeof options.spatialMinUpdateTime === "number") {
23
+ this._spatialMinUpdateTime = options.spatialMinUpdateTime;
24
+ }
16
25
  }
17
26
  /**
18
27
  * The output bus of the audio bus. Defaults to the audio engine's default main bus.
@@ -38,12 +47,26 @@ export class AudioBus extends AbstractAudioBus {
38
47
  }
39
48
  }
40
49
  }
50
+ /**
51
+ * The spatial audio features.
52
+ */
53
+ get spatial() {
54
+ if (this._spatial) {
55
+ return this._spatial;
56
+ }
57
+ return this._initSpatialProperty();
58
+ }
41
59
  /**
42
60
  * Releases associated resources.
43
61
  */
44
62
  dispose() {
45
63
  super.dispose();
64
+ this._spatial?.dispose();
65
+ this._spatial = null;
46
66
  this._outBus = null;
47
67
  }
68
+ _initSpatialProperty() {
69
+ return (this._spatial = this._createSpatialProperty(this._spatialAutoUpdate, this._spatialMinUpdateTime));
70
+ }
48
71
  }
49
72
  //# sourceMappingURL=audioBus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"audioBus.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/audioBus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAoBtD;;;;;;GAMG;AACH,MAAM,OAAgB,QAAS,SAAQ,gBAAgB;IAGnD,YAAsB,IAAY,EAAE,MAAqB;QACrD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAHhB,YAAO,GAA8B,IAAI,CAAC;QAuD1C,sBAAiB,GAAG,GAAG,EAAE;YAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7C,CAAC,CAAC;IArDF,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAiC;QAC/C,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAExE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAE7D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAYD;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;CAKJ","sourcesContent":["import type { Nullable } from \"../../types\";\nimport type { IAbstractAudioBusOptions } from \"./abstractAudioBus\";\nimport { AbstractAudioBus } from \"./abstractAudioBus\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { MainAudioBus } from \"./mainAudioBus\";\nimport type { AbstractSpatialAudio, ISpatialAudioOptions } from \"./subProperties/abstractSpatialAudio\";\nimport type { AbstractStereoAudio, IStereoAudioOptions } from \"./subProperties/abstractStereoAudio\";\n\n// NB: Secondary audio buses will be added later.\nexport type PrimaryAudioBus = MainAudioBus | AudioBus;\n\n/**\n * Options for creating an audio bus.\n */\nexport interface IAudioBusOptions extends IAbstractAudioBusOptions, ISpatialAudioOptions, IStereoAudioOptions {\n /**\n * The output bus of the audio bus. Defaults to the audio engine's default main bus.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: PrimaryAudioBus;\n}\n\n/**\n * Abstract class for an audio bus that has spatial audio and stereo output capabilities.\n *\n * Instances of this class can be connected to other audio buses.\n *\n * Audio buses are created by the {@link CreateAudioBusAsync} function.\n */\nexport abstract class AudioBus extends AbstractAudioBus {\n private _outBus: Nullable<PrimaryAudioBus> = null;\n\n protected constructor(name: string, engine: AudioEngineV2) {\n super(name, engine);\n }\n\n /**\n * The output bus of the audio bus. Defaults to the audio engine's default main bus.\n */\n public get outBus(): Nullable<PrimaryAudioBus> {\n return this._outBus;\n }\n\n public set outBus(outBus: Nullable<PrimaryAudioBus>) {\n if (this._outBus === outBus) {\n return;\n }\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed);\n\n if (!this._disconnect(this._outBus)) {\n throw new Error(\"Disconnect failed\");\n }\n }\n\n this._outBus = outBus;\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.add(this._onOutBusDisposed);\n\n if (!this._connect(this._outBus)) {\n throw new Error(\"Connect failed\");\n }\n }\n }\n\n /**\n * The spatial features of the audio bus.\n */\n public abstract readonly spatial: AbstractSpatialAudio;\n\n /**\n * The stereo features of the audio bus.\n */\n public abstract readonly stereo: AbstractStereoAudio;\n\n /**\n * Releases associated resources.\n */\n public override dispose(): void {\n super.dispose();\n this._outBus = null;\n }\n\n private _onOutBusDisposed = () => {\n this.outBus = this.engine.defaultMainBus;\n };\n}\n"]}
1
+ {"version":3,"file":"audioBus.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/audioBus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAoBtD;;;;;;GAMG;AACH,MAAM,OAAgB,QAAS,SAAQ,gBAAgB;IAMnD,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAkC;QACzF,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QANP,uBAAkB,GAAY,IAAI,CAAC;QACnC,0BAAqB,GAAW,CAAC,CAAC;QAC3C,YAAO,GAA8B,IAAI,CAAC;QAC1C,aAAQ,GAAmC,IAAI,CAAC;QA8EhD,sBAAiB,GAAG,GAAG,EAAE;YAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7C,CAAC,CAAC;QA3EE,IAAI,OAAO,OAAO,CAAC,iBAAiB,KAAK,SAAS,EAAE,CAAC;YACjD,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACxD,CAAC;QAED,IAAI,OAAO,OAAO,CAAC,oBAAoB,KAAK,QAAQ,EAAE,CAAC;YACnD,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QAC9D,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAW,MAAM,CAAC,MAAiC;QAC/C,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAExE,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAE7D,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtC,CAAC;QACL,CAAC;IACL,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACd,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;QACD,OAAO,IAAI,CAAC,oBAAoB,EAAE,CAAC;IACvC,CAAC;IAOD;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAEhB,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACxB,CAAC;IAIS,oBAAoB;QAC1B,OAAO,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC;IAC9G,CAAC;CAKJ","sourcesContent":["import type { Nullable } from \"../../types\";\nimport type { IAbstractAudioBusOptions } from \"./abstractAudioBus\";\nimport { AbstractAudioBus } from \"./abstractAudioBus\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { MainAudioBus } from \"./mainAudioBus\";\nimport type { AbstractSpatialAudio, ISpatialAudioOptions } from \"./subProperties/abstractSpatialAudio\";\nimport type { AbstractStereoAudio, IStereoAudioOptions } from \"./subProperties/abstractStereoAudio\";\n\n// NB: Secondary audio buses will be added later.\nexport type PrimaryAudioBus = MainAudioBus | AudioBus;\n\n/**\n * Options for creating an audio bus.\n */\nexport interface IAudioBusOptions extends IAbstractAudioBusOptions, ISpatialAudioOptions, IStereoAudioOptions {\n /**\n * The output bus of the audio bus. Defaults to the audio engine's default main bus.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: PrimaryAudioBus;\n}\n\n/**\n * Abstract class for an audio bus that has spatial audio and stereo output capabilities.\n *\n * Instances of this class can be connected to other audio buses.\n *\n * Audio buses are created by the {@link CreateAudioBusAsync} function.\n */\nexport abstract class AudioBus extends AbstractAudioBus {\n private readonly _spatialAutoUpdate: boolean = true;\n private readonly _spatialMinUpdateTime: number = 0;\n private _outBus: Nullable<PrimaryAudioBus> = null;\n private _spatial: Nullable<AbstractSpatialAudio> = null;\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IAudioBusOptions>) {\n super(name, engine);\n\n if (typeof options.spatialAutoUpdate === \"boolean\") {\n this._spatialAutoUpdate = options.spatialAutoUpdate;\n }\n\n if (typeof options.spatialMinUpdateTime === \"number\") {\n this._spatialMinUpdateTime = options.spatialMinUpdateTime;\n }\n }\n\n /**\n * The output bus of the audio bus. Defaults to the audio engine's default main bus.\n */\n public get outBus(): Nullable<PrimaryAudioBus> {\n return this._outBus;\n }\n\n public set outBus(outBus: Nullable<PrimaryAudioBus>) {\n if (this._outBus === outBus) {\n return;\n }\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.removeCallback(this._onOutBusDisposed);\n\n if (!this._disconnect(this._outBus)) {\n throw new Error(\"Disconnect failed\");\n }\n }\n\n this._outBus = outBus;\n\n if (this._outBus) {\n this._outBus.onDisposeObservable.add(this._onOutBusDisposed);\n\n if (!this._connect(this._outBus)) {\n throw new Error(\"Connect failed\");\n }\n }\n }\n\n /**\n * The spatial audio features.\n */\n public get spatial(): AbstractSpatialAudio {\n if (this._spatial) {\n return this._spatial;\n }\n return this._initSpatialProperty();\n }\n\n /**\n * The stereo features of the audio bus.\n */\n public abstract readonly stereo: AbstractStereoAudio;\n\n /**\n * Releases associated resources.\n */\n public override dispose(): void {\n super.dispose();\n\n this._spatial?.dispose();\n this._spatial = null;\n\n this._outBus = null;\n }\n\n protected abstract _createSpatialProperty(autoUpdate: boolean, minUpdateTime: number): AbstractSpatialAudio;\n\n protected _initSpatialProperty(): AbstractSpatialAudio {\n return (this._spatial = this._createSpatialProperty(this._spatialAutoUpdate, this._spatialMinUpdateTime));\n }\n\n private _onOutBusDisposed = () => {\n this.outBus = this.engine.defaultMainBus;\n };\n}\n"]}
@@ -104,7 +104,7 @@ export declare abstract class StaticSound extends AbstractSound {
104
104
  * This buffer can be shared with other static sounds.
105
105
  */
106
106
  abstract readonly buffer: StaticSoundBuffer;
107
- protected constructor(name: string, engine: AudioEngineV2);
107
+ protected constructor(name: string, engine: AudioEngineV2, options: Partial<IStaticSoundOptions>);
108
108
  /**
109
109
  * The amount of time to play the sound for, in seconds. Defaults to `0`.
110
110
  * - If less than or equal to `0`, the sound plays for its full duration.
@@ -12,8 +12,8 @@ import { AbstractSound } from "./abstractSound.js";
12
12
  * Static sounds are created by the {@link CreateSoundAsync} function.
13
13
  */
14
14
  export class StaticSound extends AbstractSound {
15
- constructor(name, engine) {
16
- super(name, engine);
15
+ constructor(name, engine, options) {
16
+ super(name, engine, options);
17
17
  }
18
18
  /**
19
19
  * The amount of time to play the sound for, in seconds. Defaults to `0`.
@@ -1 +1 @@
1
- {"version":3,"file":"staticSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/staticSound.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0FhD;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,WAAY,SAAQ,aAAa;IAWnD,YAAsB,IAAY,EAAE,MAAqB;QACrD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AC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,UAA4C,EAAE;QACtD,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,6BAAqB,CAAC;QACxC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,SAAS,4BAAoB,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;CAGJ","sourcesContent":["import type { Nullable } from \"../../types\";\nimport { SoundState } from \"../soundState\";\nimport type { IAbstractSoundOptions, IAbstractSoundPlayOptions, IAbstractSoundStoredOptions } from \"./abstractSound\";\nimport { AbstractSound } from \"./abstractSound\";\nimport type { PrimaryAudioBus } from \"./audioBus\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { IStaticSoundBufferOptions, StaticSoundBuffer } from \"./staticSoundBuffer\";\nimport type { _StaticSoundInstance } from \"./staticSoundInstance\";\n\n/** @internal */\nexport interface IStaticSoundOptionsBase {\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n duration: number;\n /**\n * The end of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n * - Has no effect if {@link loop} is `false`.\n */\n loopEnd: number;\n /**\n * The start of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n * - Has no effect if {@link loop} is `false`.\n *\n */\n loopStart: number;\n}\n\n/**\n * Options stored in a static sound.\n * @internal\n */\nexport interface IStaticSoundStoredOptions extends IAbstractSoundStoredOptions, IStaticSoundOptionsBase {\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Can be combined with {@link playbackRate}.\n */\n pitch: number;\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Can be combined with {@link pitch}.\n */\n playbackRate: number;\n}\n\n/**\n * Options for creating a static sound.\n */\nexport interface IStaticSoundOptions extends IAbstractSoundOptions, IStaticSoundBufferOptions, IStaticSoundStoredOptions {}\n\n/**\n * Options for playing a static sound.\n */\nexport interface IStaticSoundPlayOptions extends IAbstractSoundPlayOptions, IStaticSoundOptionsBase {\n /**\n * The time to wait before playing the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for stopping a static sound.\n */\nexport interface IStaticSoundStopOptions {\n /**\n * The time to wait before stopping the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for cloning a static sound.\n * - @see {@link StaticSound.clone}.\n */\nexport interface IStaticSoundCloneOptions {\n /**\n * Whether to clone the sound buffer when cloning the sound. Defaults to `false`.\n * - If `true`, the original sound's buffer is cloned, and the cloned sound will use its own copy.\n * - If `false`, the sound buffer is shared with the original sound.\n */\n cloneBuffer: boolean;\n\n /**\n * The output bus for the cloned sound. Defaults to `null`.\n * - If not set or `null`, the cloned sound uses the original sound's `outBus`.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: Nullable<PrimaryAudioBus>;\n}\n\n/**\n * Abstract class representing a static sound.\n *\n * A static sound has a sound buffer that is loaded into memory all at once. This allows it to have more capabilities\n * than a streaming sound, such as loop points and playback rate changes, but it also means that the sound must be\n * fully downloaded and decoded before it can be played, which may take a long time for sounds with long durations.\n *\n * To prevent downloading and decoding a sound multiple times, a sound's buffer can be shared with other sounds.\n * See {@link CreateSoundBufferAsync}, {@link StaticSoundBuffer} and {@link StaticSound.buffer} for more information.\n *\n * Static sounds are created by the {@link CreateSoundAsync} function.\n */\nexport abstract class StaticSound extends AbstractSound {\n protected override _instances: Set<_StaticSoundInstance>;\n protected abstract override readonly _options: IStaticSoundStoredOptions;\n\n /**\n * The sound buffer that the sound uses.\n *\n * This buffer can be shared with other static sounds.\n */\n public abstract readonly buffer: StaticSoundBuffer;\n\n protected constructor(name: string, engine: AudioEngineV2) {\n super(name, engine);\n }\n\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n public get duration(): number {\n return this._options.duration;\n }\n\n public set duration(value: number) {\n this._options.duration = value;\n }\n\n /**\n * The start of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n */\n public get loopStart(): number {\n return this._options.loopStart;\n }\n\n public set loopStart(value: number) {\n this._options.loopStart = value;\n }\n\n /**\n * The end of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n */\n public get loopEnd(): number {\n return this._options.loopEnd;\n }\n\n public set loopEnd(value: number) {\n this._options.loopEnd = value;\n }\n\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Gets combined with {@link playbackRate} to determine the final pitch.\n */\n public get pitch(): number {\n return this._options.pitch;\n }\n\n public set pitch(value: number) {\n this._options.pitch = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.pitch = value;\n }\n }\n\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Gets combined with {@link pitch} to determine the final playback rate.\n */\n public get playbackRate(): number {\n return this._options.playbackRate;\n }\n\n public set playbackRate(value: number) {\n this._options.playbackRate = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.playbackRate = value;\n }\n }\n\n /**\n * Clones the sound.\n * @param options Options for cloning the sound.\n */\n public abstract cloneAsync(options?: Partial<IStaticSoundCloneOptions>): Promise<StaticSound>;\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public play(options: Partial<IStaticSoundPlayOptions> = {}): void {\n if (this.state === SoundState.Paused) {\n this.resume();\n return;\n }\n\n options.duration ??= this.duration;\n options.loop ??= this.loop;\n options.loopStart ??= this.loopStart;\n options.loopEnd ??= this.loopEnd;\n options.startOffset ??= this.startOffset;\n options.volume ??= 1;\n options.waitTime ??= 0;\n\n const instance = this._createInstance();\n this._beforePlay(instance);\n instance.play(options);\n this._afterPlay(instance);\n\n this._stopExcessInstances();\n }\n\n /**\n * Stops the sound.\n * - Triggers `onEndedObservable` if the sound is playing.\n * @param options - The options to use when stopping the sound.\n */\n public stop(options: Partial<IStaticSoundStopOptions> = {}): void {\n if (options.waitTime && 0 < options.waitTime) {\n this._setState(SoundState.Stopping);\n } else {\n this._setState(SoundState.Stopped);\n }\n\n if (!this._instances) {\n return;\n }\n\n for (const instance of Array.from(this._instances)) {\n instance.stop(options);\n }\n }\n\n protected abstract override _createInstance(): _StaticSoundInstance;\n}\n"]}
1
+ {"version":3,"file":"staticSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/staticSound.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0FhD;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,WAAY,SAAQ,aAAa;IAWnD,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAqC;QAC5F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED,IAAW,QAAQ,CAAC,KAAa;QAC7B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;IACnC,CAAC;IAED,IAAW,SAA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K,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;CAGJ","sourcesContent":["import type { Nullable } from \"../../types\";\nimport { SoundState } from \"../soundState\";\nimport type { IAbstractSoundOptions, IAbstractSoundPlayOptions, IAbstractSoundStoredOptions } from \"./abstractSound\";\nimport { AbstractSound } from \"./abstractSound\";\nimport type { PrimaryAudioBus } from \"./audioBus\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { IStaticSoundBufferOptions, StaticSoundBuffer } from \"./staticSoundBuffer\";\nimport type { _StaticSoundInstance } from \"./staticSoundInstance\";\n\n/** @internal */\nexport interface IStaticSoundOptionsBase {\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n duration: number;\n /**\n * The end of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n * - Has no effect if {@link loop} is `false`.\n */\n loopEnd: number;\n /**\n * The start of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n * - Has no effect if {@link loop} is `false`.\n *\n */\n loopStart: number;\n}\n\n/**\n * Options stored in a static sound.\n * @internal\n */\nexport interface IStaticSoundStoredOptions extends IAbstractSoundStoredOptions, IStaticSoundOptionsBase {\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Can be combined with {@link playbackRate}.\n */\n pitch: number;\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Can be combined with {@link pitch}.\n */\n playbackRate: number;\n}\n\n/**\n * Options for creating a static sound.\n */\nexport interface IStaticSoundOptions extends IAbstractSoundOptions, IStaticSoundBufferOptions, IStaticSoundStoredOptions {}\n\n/**\n * Options for playing a static sound.\n */\nexport interface IStaticSoundPlayOptions extends IAbstractSoundPlayOptions, IStaticSoundOptionsBase {\n /**\n * The time to wait before playing the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for stopping a static sound.\n */\nexport interface IStaticSoundStopOptions {\n /**\n * The time to wait before stopping the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for cloning a static sound.\n * - @see {@link StaticSound.clone}.\n */\nexport interface IStaticSoundCloneOptions {\n /**\n * Whether to clone the sound buffer when cloning the sound. Defaults to `false`.\n * - If `true`, the original sound's buffer is cloned, and the cloned sound will use its own copy.\n * - If `false`, the sound buffer is shared with the original sound.\n */\n cloneBuffer: boolean;\n\n /**\n * The output bus for the cloned sound. Defaults to `null`.\n * - If not set or `null`, the cloned sound uses the original sound's `outBus`.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: Nullable<PrimaryAudioBus>;\n}\n\n/**\n * Abstract class representing a static sound.\n *\n * A static sound has a sound buffer that is loaded into memory all at once. This allows it to have more capabilities\n * than a streaming sound, such as loop points and playback rate changes, but it also means that the sound must be\n * fully downloaded and decoded before it can be played, which may take a long time for sounds with long durations.\n *\n * To prevent downloading and decoding a sound multiple times, a sound's buffer can be shared with other sounds.\n * See {@link CreateSoundBufferAsync}, {@link StaticSoundBuffer} and {@link StaticSound.buffer} for more information.\n *\n * Static sounds are created by the {@link CreateSoundAsync} function.\n */\nexport abstract class StaticSound extends AbstractSound {\n protected override _instances: Set<_StaticSoundInstance>;\n protected abstract override readonly _options: IStaticSoundStoredOptions;\n\n /**\n * The sound buffer that the sound uses.\n *\n * This buffer can be shared with other static sounds.\n */\n public abstract readonly buffer: StaticSoundBuffer;\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IStaticSoundOptions>) {\n super(name, engine, options);\n }\n\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n public get duration(): number {\n return this._options.duration;\n }\n\n public set duration(value: number) {\n this._options.duration = value;\n }\n\n /**\n * The start of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n */\n public get loopStart(): number {\n return this._options.loopStart;\n }\n\n public set loopStart(value: number) {\n this._options.loopStart = value;\n }\n\n /**\n * The end of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n */\n public get loopEnd(): number {\n return this._options.loopEnd;\n }\n\n public set loopEnd(value: number) {\n this._options.loopEnd = value;\n }\n\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Gets combined with {@link playbackRate} to determine the final pitch.\n */\n public get pitch(): number {\n return this._options.pitch;\n }\n\n public set pitch(value: number) {\n this._options.pitch = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.pitch = value;\n }\n }\n\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Gets combined with {@link pitch} to determine the final playback rate.\n */\n public get playbackRate(): number {\n return this._options.playbackRate;\n }\n\n public set playbackRate(value: number) {\n this._options.playbackRate = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.playbackRate = value;\n }\n }\n\n /**\n * Clones the sound.\n * @param options Options for cloning the sound.\n */\n public abstract cloneAsync(options?: Partial<IStaticSoundCloneOptions>): Promise<StaticSound>;\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public play(options: Partial<IStaticSoundPlayOptions> = {}): void {\n if (this.state === SoundState.Paused) {\n this.resume();\n return;\n }\n\n options.duration ??= this.duration;\n options.loop ??= this.loop;\n options.loopStart ??= this.loopStart;\n options.loopEnd ??= this.loopEnd;\n options.startOffset ??= this.startOffset;\n options.volume ??= 1;\n options.waitTime ??= 0;\n\n const instance = this._createInstance();\n this._beforePlay(instance);\n instance.play(options);\n this._afterPlay(instance);\n\n this._stopExcessInstances();\n }\n\n /**\n * Stops the sound.\n * - Triggers `onEndedObservable` if the sound is playing.\n * @param options - The options to use when stopping the sound.\n */\n public stop(options: Partial<IStaticSoundStopOptions> = {}): void {\n if (options.waitTime && 0 < options.waitTime) {\n this._setState(SoundState.Stopping);\n } else {\n this._setState(SoundState.Stopped);\n }\n\n if (!this._instances) {\n return;\n }\n\n for (const instance of Array.from(this._instances)) {\n instance.stop(options);\n }\n }\n\n protected abstract override _createInstance(): _StaticSoundInstance;\n}\n"]}
@@ -41,7 +41,7 @@ export interface IStreamingSoundStoredOptions extends IAbstractSoundStoredOption
41
41
  export declare abstract class StreamingSound extends AbstractSound {
42
42
  private _preloadedInstances;
43
43
  protected abstract readonly _options: IStreamingSoundStoredOptions;
44
- protected constructor(name: string, engine: AudioEngineV2);
44
+ protected constructor(name: string, engine: AudioEngineV2, options: Partial<IStreamingSoundOptions>);
45
45
  /**
46
46
  * The number of instances to preload. Defaults to `1`.
47
47
  */
@@ -13,8 +13,8 @@ import { AbstractSound } from "./abstractSound.js";
13
13
  * Streaming sounds are created by the {@link CreateStreamingSoundAsync} function.
14
14
  */
15
15
  export class StreamingSound extends AbstractSound {
16
- constructor(name, engine) {
17
- super(name, engine);
16
+ constructor(name, engine, options) {
17
+ super(name, engine, options);
18
18
  this._preloadedInstances = new Array();
19
19
  }
20
20
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"streamingSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/streamingSound.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA4BhD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,cAAe,SAAQ,aAAa;IAKtD,YAAsB,IAAY,EAAE,MAAqB;QACrD,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QALhB,wBAAmB,GAAG,IAAI,KAAK,EAA2B,CAAC;IAMnE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY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AAC,CAAC;QACzD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { SoundState } from \"../soundState\";\nimport type { IAbstractSoundOptions, IAbstractSoundPlayOptions, IAbstractSoundStoredOptions } from \"./abstractSound\";\nimport { AbstractSound } from \"./abstractSound\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { _StreamingSoundInstance } from \"./streamingSoundInstance\";\n\n/** @internal */\nexport interface IStreamingSoundOptionsBase {\n /**\n * The number of instances to preload. Defaults to 1.\n * */\n preloadCount: number;\n}\n\n/**\n * Options for creating a streaming sound.\n */\nexport interface IStreamingSoundOptions extends IAbstractSoundOptions, IStreamingSoundOptionsBase {}\n\n/**\n * Options for playing a streaming sound.\n */\nexport interface IStreamingSoundPlayOptions extends IAbstractSoundPlayOptions {}\n\n/**\n * Options stored in a streaming sound.\n * @internal\n */\nexport interface IStreamingSoundStoredOptions extends IAbstractSoundStoredOptions, IStreamingSoundOptionsBase {}\n\n/**\n * Abstract class representing a streaming sound.\n *\n * A streaming sound has a sound buffer that is loaded into memory in chunks as it is played. This allows it to be played\n * more quickly than a static sound, but it also means that it cannot have loop points or playback rate changes.\n *\n * Due to the way streaming sounds are typically implemented, there can be a significant delay when attempting to play\n * a streaming sound for the first time. To prevent this delay, it is recommended to preload instances of the sound\n * using the {@link IStreamingSoundStoredOptions.preloadCount} options, or the {@link preloadInstanceAsync} and\n * {@link preloadInstancesAsync} methods before calling the `play` method.\n *\n * Streaming sounds are created by the {@link CreateStreamingSoundAsync} function.\n */\nexport abstract class StreamingSound extends AbstractSound {\n private _preloadedInstances = new Array<_StreamingSoundInstance>();\n\n protected abstract override readonly _options: IStreamingSoundStoredOptions;\n\n protected constructor(name: string, engine: AudioEngineV2) {\n super(name, engine);\n }\n\n /**\n * The number of instances to preload. Defaults to `1`.\n */\n public get preloadCount(): number {\n return this._options.preloadCount ?? 1;\n }\n\n /**\n * Returns the number of instances that have been preloaded.\n */\n public get preloadCompletedCount(): number {\n return this._preloadedInstances.length;\n }\n\n /**\n * Preloads an instance of the sound.\n * @returns A promise that resolves when the instance is preloaded.\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\n public preloadInstanceAsync(): Promise<void> {\n const instance = this._createInstance();\n\n this._addPreloadedInstance(instance);\n\n return instance.preloadedPromise;\n }\n\n /**\n * Preloads the given number of instances of the sound.\n * @param count - The number of instances to preload.\n * @returns A promise that resolves when all instances are preloaded.\n */\n public async preloadInstancesAsync(count: number): Promise<void> {\n for (let i = 0; i < count; i++) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.preloadInstanceAsync();\n }\n\n await Promise.all(this._preloadedInstances.map(async (instance) => await instance.preloadedPromise));\n }\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public play(options: Partial<IStreamingSoundPlayOptions> = {}): void {\n if (this.state === SoundState.Paused) {\n this.resume();\n return;\n }\n\n let instance: _StreamingSoundInstance;\n\n if (this.preloadCompletedCount > 0) {\n instance = this._preloadedInstances[0];\n instance.startOffset = this.startOffset;\n this._removePreloadedInstance(instance);\n } else {\n instance = this._createInstance();\n }\n\n const onInstanceStateChanged = () => {\n if (instance.state === SoundState.Started) {\n this._stopExcessInstances();\n instance.onStateChangedObservable.removeCallback(onInstanceStateChanged);\n }\n };\n instance.onStateChangedObservable.add(onInstanceStateChanged);\n\n options.startOffset ??= this.startOffset;\n options.loop ??= this.loop;\n options.volume ??= 1;\n\n this._beforePlay(instance);\n instance.play(options);\n this._afterPlay(instance);\n }\n\n /**\n * Stops the sound.\n */\n public stop(): void {\n this._setState(SoundState.Stopped);\n\n if (!this._instances) {\n return;\n }\n\n for (const instance of Array.from(this._instances)) {\n instance.stop();\n }\n }\n\n protected abstract override _createInstance(): _StreamingSoundInstance;\n\n private _addPreloadedInstance(instance: _StreamingSoundInstance): void {\n if (!this._preloadedInstances.includes(instance)) {\n this._preloadedInstances.push(instance);\n }\n }\n\n private _removePreloadedInstance(instance: _StreamingSoundInstance): void {\n const index = this._preloadedInstances.indexOf(instance);\n if (index !== -1) {\n this._preloadedInstances.splice(index, 1);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"streamingSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/streamingSound.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA4BhD;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,cAAe,SAAQ,aAAa;IAKtD,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAwC;QAC/F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QALzB,wBAAmB,GAAG,IAAI,KAAK,EAA2B,CAAC;IAMnE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAW,qBAAqB;QAC5B,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACH,2FAA2F;IACpF,oBAAoB;QACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QAExC,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAErC,OAAO,QAAQ,CAAC,gBAAgB,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,qBAAqB,CAAC,KAAa;QAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,mEAAmE;YACnE,IAAI,CAAC,oBAAoB,EAAE,CAAC;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AC,CAAC;QAC3B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACI,IAAI;QACP,IAAI,CAAC,SAAS,4BAAoB,CAAC;QAEnC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC;IACL,CAAC;IAIO,qBAAqB,CAAC,QAAiC;QAC3D,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/C,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;IACL,CAAC;IAEO,wBAAwB,CAAC,QAAiC;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { SoundState } from \"../soundState\";\nimport type { IAbstractSoundOptions, IAbstractSoundPlayOptions, IAbstractSoundStoredOptions } from \"./abstractSound\";\nimport { AbstractSound } from \"./abstractSound\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { _StreamingSoundInstance } from \"./streamingSoundInstance\";\n\n/** @internal */\nexport interface IStreamingSoundOptionsBase {\n /**\n * The number of instances to preload. Defaults to 1.\n * */\n preloadCount: number;\n}\n\n/**\n * Options for creating a streaming sound.\n */\nexport interface IStreamingSoundOptions extends IAbstractSoundOptions, IStreamingSoundOptionsBase {}\n\n/**\n * Options for playing a streaming sound.\n */\nexport interface IStreamingSoundPlayOptions extends IAbstractSoundPlayOptions {}\n\n/**\n * Options stored in a streaming sound.\n * @internal\n */\nexport interface IStreamingSoundStoredOptions extends IAbstractSoundStoredOptions, IStreamingSoundOptionsBase {}\n\n/**\n * Abstract class representing a streaming sound.\n *\n * A streaming sound has a sound buffer that is loaded into memory in chunks as it is played. This allows it to be played\n * more quickly than a static sound, but it also means that it cannot have loop points or playback rate changes.\n *\n * Due to the way streaming sounds are typically implemented, there can be a significant delay when attempting to play\n * a streaming sound for the first time. To prevent this delay, it is recommended to preload instances of the sound\n * using the {@link IStreamingSoundStoredOptions.preloadCount} options, or the {@link preloadInstanceAsync} and\n * {@link preloadInstancesAsync} methods before calling the `play` method.\n *\n * Streaming sounds are created by the {@link CreateStreamingSoundAsync} function.\n */\nexport abstract class StreamingSound extends AbstractSound {\n private _preloadedInstances = new Array<_StreamingSoundInstance>();\n\n protected abstract override readonly _options: IStreamingSoundStoredOptions;\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IStreamingSoundOptions>) {\n super(name, engine, options);\n }\n\n /**\n * The number of instances to preload. Defaults to `1`.\n */\n public get preloadCount(): number {\n return this._options.preloadCount ?? 1;\n }\n\n /**\n * Returns the number of instances that have been preloaded.\n */\n public get preloadCompletedCount(): number {\n return this._preloadedInstances.length;\n }\n\n /**\n * Preloads an instance of the sound.\n * @returns A promise that resolves when the instance is preloaded.\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\n public preloadInstanceAsync(): Promise<void> {\n const instance = this._createInstance();\n\n this._addPreloadedInstance(instance);\n\n return instance.preloadedPromise;\n }\n\n /**\n * Preloads the given number of instances of the sound.\n * @param count - The number of instances to preload.\n * @returns A promise that resolves when all instances are preloaded.\n */\n public async preloadInstancesAsync(count: number): Promise<void> {\n for (let i = 0; i < count; i++) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.preloadInstanceAsync();\n }\n\n await Promise.all(this._preloadedInstances.map(async (instance) => await instance.preloadedPromise));\n }\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public play(options: Partial<IStreamingSoundPlayOptions> = {}): void {\n if (this.state === SoundState.Paused) {\n this.resume();\n return;\n }\n\n let instance: _StreamingSoundInstance;\n\n if (this.preloadCompletedCount > 0) {\n instance = this._preloadedInstances[0];\n instance.startOffset = this.startOffset;\n this._removePreloadedInstance(instance);\n } else {\n instance = this._createInstance();\n }\n\n const onInstanceStateChanged = () => {\n if (instance.state === SoundState.Started) {\n this._stopExcessInstances();\n instance.onStateChangedObservable.removeCallback(onInstanceStateChanged);\n }\n };\n instance.onStateChangedObservable.add(onInstanceStateChanged);\n\n options.startOffset ??= this.startOffset;\n options.loop ??= this.loop;\n options.volume ??= 1;\n\n this._beforePlay(instance);\n instance.play(options);\n this._afterPlay(instance);\n }\n\n /**\n * Stops the sound.\n */\n public stop(): void {\n this._setState(SoundState.Stopped);\n\n if (!this._instances) {\n return;\n }\n\n for (const instance of Array.from(this._instances)) {\n instance.stop();\n }\n }\n\n protected abstract override _createInstance(): _StreamingSoundInstance;\n\n private _addPreloadedInstance(instance: _StreamingSoundInstance): void {\n if (!this._preloadedInstances.includes(instance)) {\n this._preloadedInstances.push(instance);\n }\n }\n\n private _removePreloadedInstance(instance: _StreamingSoundInstance): void {\n const index = this._preloadedInstances.indexOf(instance);\n if (index !== -1) {\n this._preloadedInstances.splice(index, 1);\n }\n }\n}\n"]}
@@ -61,7 +61,7 @@ export declare abstract class _AbstractAudioSubGraph {
61
61
  *
62
62
  * @internal
63
63
  */
64
- removeSubNodeAsync(subNode: _AbstractAudioSubNode): Promise<void>;
64
+ removeSubNodeAsync(subNode: Nullable<_AbstractAudioSubNode>): Promise<void>;
65
65
  protected abstract _createSubNode(name: string): Promise<_AbstractAudioSubNode>;
66
66
  /**
67
67
  * Called when sub-nodes are added or removed.
@@ -103,6 +103,9 @@ export class _AbstractAudioSubGraph {
103
103
  * @internal
104
104
  */
105
105
  async removeSubNodeAsync(subNode) {
106
+ if (!subNode) {
107
+ return;
108
+ }
106
109
  await this._createSubNodePromisesResolvedAsync();
107
110
  const name = subNode.name;
108
111
  if (this._subNodes[name]) {
@@ -1 +1 @@
1
- {"version":3,"file":"abstractAudioSubGraph.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,sBAAsB;IAA5C;QACY,2BAAsB,GAAsD,EAAE,CAAC;QAC/E,gBAAW,GAAG,KAAK,CAAC;QACpB,cAAS,GAA6C,EAAE,CAAC;QA8HzD,uBAAkB,GAAG,CAAC,IAAuB,EAAE,EAAE;YACrD,MAAM,OAAO,GAAG,IAA8B,CAAC;YAE/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEpC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC9B,CAAC,CAAC;IACN,CAAC;IAnIG;;;;;;;OAOG;IACI,aAAa,CAAkC,IAAkB,EAAE,QAA2B;QACjG,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,IAAI,EAAE,CAAC;YACP,QAAQ,CAAC,IAAS,CAAC,CAAC;YACpB,OAAO;QACX,CAAC;QAED,mFAAmF;QACnF,IAAI,CAAC,mCAAmC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;YACjD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;YACnC,IAAI,IAAI,EAAE,CAAC;gBACP,QAAQ,CAAC,IAAS,CAAC,CAAC;gBACpB,OAAO;YACX,CAAC;YAED,mFAAmF;YACnF,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,I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C,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAEzC,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9B,CAAC;IAUS,KAAK,CAAC,mCAAmC;QAC/C,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACzE,CAAC;IAEO,WAAW,CAAC,IAA2B;QAC3C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO;QACX,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAEjC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAE1D,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9B,CAAC;CASJ","sourcesContent":["import type { Nullable } from \"../../../types\";\nimport type { AbstractAudioNode, AbstractNamedAudioNode } from \"../abstractAudioNode\";\nimport type { _AbstractAudioSubNode } from \"./abstractAudioSubNode\";\nimport type { AudioSubNode } from \"./audioSubNode\";\n\n/**\n * Adds common sub graph functionality to an audio node.\n *\n * Audio nodes such as static sounds, streaming sounds, and buses can use audio sub graphs to process audio internally\n * before sending it to connected downstream audio nodes. This is useful for applying effects, spatial audio, and other\n * audio processing tasks common to multiple audio node classes.\n *\n * A key feature of audio sub graphs is their audio sub nodes are created asynchronously on demand so the minimum set\n * of sub nodes are used at all times to save memory and CPU resources. The tradeoff is a small delay when first\n * setting a property backed by a sub node. This delay is avoided by using the appropriate options to initialize the\n * sub node on creation, e.g. `spatialEnabled` and `stereoEnabled`, or by setting any creation option backed by the\n * sub node, e.g. `spatialPosition` and `stereoPan`.\n *\n * @internal\n */\nexport abstract class _AbstractAudioSubGraph {\n private _createSubNodePromises: { [key: string]: Promise<_AbstractAudioSubNode> } = {};\n private _isDisposed = false;\n private _subNodes: { [key: string]: _AbstractAudioSubNode } = {};\n\n /**\n * Executes the given callback with the named sub node, creating the sub node if needed.\n *\n * @param name The name of the sub node\n * @param callback The function to call with the named sub node\n *\n * @internal\n */\n public callOnSubNode<T extends _AbstractAudioSubNode>(name: AudioSubNode, callback: (node: T) => void): void {\n const node = this.getSubNode(name);\n if (node) {\n callback(node as T);\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n this._createSubNodePromisesResolvedAsync().then(() => {\n const node = this.getSubNode(name);\n if (node) {\n callback(node as T);\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n this.createAndAddSubNodeAsync(name).then((node) => {\n callback(node as T);\n });\n });\n }\n\n /**\n * Creates the named subnode and adds it to the sub graph.\n *\n * @param name The name of the sub node.\n * @returns A promise that resolves to the created sub node.\n *\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\n public createAndAddSubNodeAsync(name: AudioSubNode): Promise<_AbstractAudioSubNode> {\n // eslint-disable-next-line github/no-then\n this._createSubNodePromises[name] ||= this._createSubNode(name).then((node) => {\n this._addSubNode(node);\n return node;\n });\n\n return this._createSubNodePromises[name];\n }\n\n /**\n * Releases associated resources.\n *\n * @internal\n */\n public dispose() {\n this._isDisposed = true;\n\n const subNodes = Object.values(this._subNodes);\n for (const subNode of subNodes) {\n subNode.dispose();\n }\n\n this._subNodes = {};\n this._createSubNodePromises = {};\n }\n\n /**\n * Gets a previously created sub node.\n *\n * @param name - The name of the sub node\n * @returns The named sub node, or `null` if it has not been created, yet\n *\n * @internal\n * */\n public getSubNode<T extends _AbstractAudioSubNode>(name: string): Nullable<T> {\n return (this._subNodes[name] as T) ?? null;\n }\n\n /**\n * Removes a sub node from the sub graph.\n *\n * @param subNode - The sub node to remove\n * @returns A promise that resolves when the sub node is removed\n *\n * @internal\n */\n public async removeSubNodeAsync(subNode: _AbstractAudioSubNode): Promise<void> {\n await this._createSubNodePromisesResolvedAsync();\n\n const name = subNode.name;\n if (this._subNodes[name]) {\n delete this._subNodes[name];\n }\n\n delete this._createSubNodePromises[name];\n\n this._onSubNodesChanged();\n }\n\n protected abstract _createSubNode(name: string): Promise<_AbstractAudioSubNode>;\n\n /**\n * Called when sub-nodes are added or removed.\n * - Override this to connect and reconnect sub-nodes as needed.\n */\n protected abstract _onSubNodesChanged(): void;\n\n protected async _createSubNodePromisesResolvedAsync(): Promise<_AbstractAudioSubNode[]> {\n return await Promise.all(Object.values(this._createSubNodePromises));\n }\n\n private _addSubNode(node: _AbstractAudioSubNode): void {\n if (this._isDisposed) {\n node.dispose();\n return;\n }\n\n this._subNodes[node.name] = node;\n\n node.onDisposeObservable.addOnce(this._onSubNodeDisposed);\n\n this._onSubNodesChanged();\n }\n\n private _onSubNodeDisposed = (node: AbstractAudioNode) => {\n const subNode = node as AbstractNamedAudioNode;\n\n delete this._subNodes[subNode.name];\n\n this._onSubNodesChanged();\n };\n}\n"]}
1
+ {"version":3,"file":"abstractAudioSubGraph.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAgB,sBAAsB;IAA5C;QACY,2BAAsB,GAAsD,EAAE,CAAC;QAC/E,gBAAW,GAAG,KAAK,CAAC;QACpB,cAAS,GAA6C,EAAE,CAAC;QAkIzD,uBAAkB,GAAG,CAAC,IAAuB,EAAE,EAAE;YACrD,MAAM,OAAO,GAAG,IAA8B,CAAC;YAE/C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEpC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC9B,CAAC,CAAC;IACN,CAAC;IAvIG;;;;;;;OAOG;IACI,aAAa,CAAkC,IAAkB,EAAE,QAA2B;QACjG,MAAM,IAAI,GAAG,IAAI,C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,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;;SAOK;IACE,UAAU,CAAkC,IAAY;QAC3D,OAAQ,IAAI,CAAC,SAAS,CAAC,IAAI,CAAO,IAAI,IAAI,CAAC;IAC/C,CAAC;IAED;;;;;;;OAOG;IACI,KAAK,CAAC,kBAAkB,CAAC,OAAwC;QACpE,IAAI,CAAC,OAAO,EAAE,CAAC;YACX,OAAO;QACX,CAAC;QAED,MAAM,IAAI,CAAC,mCAAmC,EAAE,CAAC;QAEjD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;YACvB,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;QAEzC,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9B,CAAC;IAUS,KAAK,CAAC,mCAAmC;QAC/C,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;IACzE,CAAC;IAEO,WAAW,CAAC,IAA2B;QAC3C,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,OAAO;QACX,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;QAEjC,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAE1D,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9B,CAAC;CASJ","sourcesContent":["import type { Nullable } from \"../../../types\";\nimport type { AbstractAudioNode, AbstractNamedAudioNode } from \"../abstractAudioNode\";\nimport type { _AbstractAudioSubNode } from \"./abstractAudioSubNode\";\nimport type { AudioSubNode } from \"./audioSubNode\";\n\n/**\n * Adds common sub graph functionality to an audio node.\n *\n * Audio nodes such as static sounds, streaming sounds, and buses can use audio sub graphs to process audio internally\n * before sending it to connected downstream audio nodes. This is useful for applying effects, spatial audio, and other\n * audio processing tasks common to multiple audio node classes.\n *\n * A key feature of audio sub graphs is their audio sub nodes are created asynchronously on demand so the minimum set\n * of sub nodes are used at all times to save memory and CPU resources. The tradeoff is a small delay when first\n * setting a property backed by a sub node. This delay is avoided by using the appropriate options to initialize the\n * sub node on creation, e.g. `spatialEnabled` and `stereoEnabled`, or by setting any creation option backed by the\n * sub node, e.g. `spatialPosition` and `stereoPan`.\n *\n * @internal\n */\nexport abstract class _AbstractAudioSubGraph {\n private _createSubNodePromises: { [key: string]: Promise<_AbstractAudioSubNode> } = {};\n private _isDisposed = false;\n private _subNodes: { [key: string]: _AbstractAudioSubNode } = {};\n\n /**\n * Executes the given callback with the named sub node, creating the sub node if needed.\n *\n * @param name The name of the sub node\n * @param callback The function to call with the named sub node\n *\n * @internal\n */\n public callOnSubNode<T extends _AbstractAudioSubNode>(name: AudioSubNode, callback: (node: T) => void): void {\n const node = this.getSubNode(name);\n if (node) {\n callback(node as T);\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n this._createSubNodePromisesResolvedAsync().then(() => {\n const node = this.getSubNode(name);\n if (node) {\n callback(node as T);\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\n this.createAndAddSubNodeAsync(name).then((node) => {\n callback(node as T);\n });\n });\n }\n\n /**\n * Creates the named subnode and adds it to the sub graph.\n *\n * @param name The name of the sub node.\n * @returns A promise that resolves to the created sub node.\n *\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\n public createAndAddSubNodeAsync(name: AudioSubNode): Promise<_AbstractAudioSubNode> {\n // eslint-disable-next-line github/no-then\n this._createSubNodePromises[name] ||= this._createSubNode(name).then((node) => {\n this._addSubNode(node);\n return node;\n });\n\n return this._createSubNodePromises[name];\n }\n\n /**\n * Releases associated resources.\n *\n * @internal\n */\n public dispose() {\n this._isDisposed = true;\n\n const subNodes = Object.values(this._subNodes);\n for (const subNode of subNodes) {\n subNode.dispose();\n }\n\n this._subNodes = {};\n this._createSubNodePromises = {};\n }\n\n /**\n * Gets a previously created sub node.\n *\n * @param name - The name of the sub node\n * @returns The named sub node, or `null` if it has not been created, yet\n *\n * @internal\n * */\n public getSubNode<T extends _AbstractAudioSubNode>(name: string): Nullable<T> {\n return (this._subNodes[name] as T) ?? null;\n }\n\n /**\n * Removes a sub node from the sub graph.\n *\n * @param subNode - The sub node to remove\n * @returns A promise that resolves when the sub node is removed\n *\n * @internal\n */\n public async removeSubNodeAsync(subNode: Nullable<_AbstractAudioSubNode>): Promise<void> {\n if (!subNode) {\n return;\n }\n\n await this._createSubNodePromisesResolvedAsync();\n\n const name = subNode.name;\n if (this._subNodes[name]) {\n delete this._subNodes[name];\n }\n\n delete this._createSubNodePromises[name];\n\n this._onSubNodesChanged();\n }\n\n protected abstract _createSubNode(name: string): Promise<_AbstractAudioSubNode>;\n\n /**\n * Called when sub-nodes are added or removed.\n * - Override this to connect and reconnect sub-nodes as needed.\n */\n protected abstract _onSubNodesChanged(): void;\n\n protected async _createSubNodePromisesResolvedAsync(): Promise<_AbstractAudioSubNode[]> {\n return await Promise.all(Object.values(this._createSubNodePromises));\n }\n\n private _addSubNode(node: _AbstractAudioSubNode): void {\n if (this._isDisposed) {\n node.dispose();\n return;\n }\n\n this._subNodes[node.name] = node;\n\n node.onDisposeObservable.addOnce(this._onSubNodeDisposed);\n\n this._onSubNodesChanged();\n }\n\n private _onSubNodeDisposed = (node: AbstractAudioNode) => {\n const subNode = node as AbstractNamedAudioNode;\n\n delete this._subNodes[subNode.name];\n\n this._onSubNodesChanged();\n };\n}\n"]}
@@ -17,6 +17,7 @@ export declare abstract class _SpatialAudioSubNode extends _AbstractAudioSubNode
17
17
  abstract distanceModel: DistanceModelType;
18
18
  abstract maxDistance: number;
19
19
  abstract minDistance: number;
20
+ abstract orientation: Vector3;
20
21
  abstract panningModel: PanningModelType;
21
22
  abstract position: Vector3;
22
23
  abstract rolloffFactor: number;
@@ -37,6 +37,7 @@ export class _SpatialAudioSubNode extends _AbstractAudioSubNode {
37
37
  this.distanceModel = options.spatialDistanceModel ?? _SpatialAudioDefaults.distanceModel;
38
38
  this.maxDistance = options.spatialMaxDistance ?? _SpatialAudioDefaults.maxDistance;
39
39
  this.minDistance = options.spatialMinDistance ?? _SpatialAudioDefaults.minDistance;
40
+ this.orientation = options.spatialOrientation ?? _SpatialAudioDefaults.orientation;
40
41
  this.panningModel = options.spatialPanningModel ?? _SpatialAudioDefaults.panningModel;
41
42
  this.rolloffFactor = options.spatialRolloffFactor ?? _SpatialAudioDefaults.rolloffFactor;
42
43
  if (options.spatialPosition) {
@@ -1 +1 @@
1
- {"version":3,"file":"spatialAudioSubNode.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,gBAAgB;AAChB,MAAM,OAAgB,oBAAqB,SAAQ,qBAAqB;IAGpE,YAAsB,MAAqB;QACvC,KAAK,uCAAuB,MAAM,CAAC,CAAC;QAHhC,uBAAkB,GAA6C,IAAI,CAAC;IAI5E,CAAC;IAeD,gBAAgB;IAChB,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,kBAAkB,KAAK,IAAI,IAAI,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC;IAClF,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,SAAyB,EAAE,cAAuB,EAAE,cAA0C;QACxG,IAAI,CAAC,MAAM,EAAE,CAAC;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AC;YAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QACpD,CAAC;QAED,IAAI,OAAO,CAAC,yBAAyB,EAAE,CAAC;YACpC,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACxE,CAAC;aAAM,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QACpD,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,kBAAkB,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAC/E,CAAC;QAED,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,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,eAAe,EAAE,CAAC;YACvB,IAAI,CAAC,eAAe,EAAE,CAAC;QAC3B,CAAC;IACL,CAAC;CAIJ;AAED,gBAAgB;AAChB,MAAM,UAAU,uBAAuB,CAAC,QAAgC;IACpE,OAAO,QAAQ,CAAC,UAAU,sCAA4C,CAAC;AAC3E,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,wBAAwB,CAA+C,QAAgC,EAAE,QAAW,EAAE,KAA8B;IAChK,QAAQ,CAAC,aAAa,uCAA6C,CAAC,IAAI,EAAE,EAAE;QACxE,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import type { Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport type { Node } from \"../../../node\";\nimport type { Nullable } from \"../../../types\";\nimport type { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\nimport type { AudioEngineV2 } from \"../audioEngineV2\";\nimport { _SpatialAudioAttacherComponent } from \"../components/spatialAudioAttacherComponent\";\nimport type { ISpatialAudioOptions } from \"../subProperties/abstractSpatialAudio\";\nimport { _SpatialAudioDefaults } from \"../subProperties/abstractSpatialAudio\";\nimport type { _AbstractAudioSubGraph } from \"./abstractAudioSubGraph\";\nimport { _AbstractAudioSubNode } from \"./abstractAudioSubNode\";\nimport { AudioSubNode } from \"./audioSubNode\";\n\n/** @internal */\nexport abstract class _SpatialAudioSubNode extends _AbstractAudioSubNode {\n private _attacherComponent: Nullable<_SpatialAudioAttacherComponent> = null;\n\n protected constructor(engine: AudioEngineV2) {\n super(AudioSubNode.SPATIAL, engine);\n }\n\n public abstract coneInnerAngle: number;\n public abstract coneOuterAngle: number;\n public abstract coneOuterVolume: number;\n public abstract distanceModel: DistanceModelType;\n public abstract maxDistance: number;\n public abstract minDistance: number;\n public abstract panningModel: PanningModelType;\n public abstract position: Vector3;\n public abstract rolloffFactor: number;\n public abstract rotation: Vector3;\n public abstract rotationQuaternion: Quaternion;\n public abstract _inNode: AudioNode;\n\n /** @internal */\n public get isAttached(): boolean {\n return this._attacherComponent !== null && this._attacherComponent.isAttached;\n }\n\n /** @internal */\n public attach(sceneNode: Nullable<Node>, useBoundingBox: boolean, attachmentType: SpatialAudioAttachmentType): void {\n this.detach();\n\n if (!this._attacherComponent) {\n this._attacherComponent = new _SpatialAudioAttacherComponent(this);\n }\n\n this._attacherComponent.attach(sceneNode, useBoundingBox, attachmentType);\n }\n\n /** @internal */\n public detach(): void {\n this._attacherComponent?.detach();\n }\n\n /** @internal */\n public override dispose(): void {\n super.dispose();\n\n this._attacherComponent?.dispose();\n this._attacherComponent = null;\n }\n\n /** @internal */\n public setOptions(options: Partial<ISpatialAudioOptions>): void {\n this.coneInnerAngle = options.spatialConeInnerAngle ?? _SpatialAudioDefaults.coneInnerAngle;\n this.coneOuterAngle = options.spatialConeOuterAngle ?? _SpatialAudioDefaults.coneOuterAngle;\n this.coneOuterVolume = options.spatialConeOuterVolume ?? _SpatialAudioDefaults.coneOuterVolume;\n this.distanceModel = options.spatialDistanceModel ?? _SpatialAudioDefaults.distanceModel;\n this.maxDistance = options.spatialMaxDistance ?? _SpatialAudioDefaults.maxDistance;\n this.minDistance = options.spatialMinDistance ?? _SpatialAudioDefaults.minDistance;\n this.panningModel = options.spatialPanningModel ?? _SpatialAudioDefaults.panningModel;\n this.rolloffFactor = options.spatialRolloffFactor ?? _SpatialAudioDefaults.rolloffFactor;\n\n if (options.spatialPosition) {\n this.position = options.spatialPosition.clone();\n }\n\n if (options.spatialRotationQuaternion) {\n this.rotationQuaternion = options.spatialRotationQuaternion.clone();\n } else if (options.spatialRotation) {\n this.rotation = options.spatialRotation.clone();\n } else {\n this.rotationQuaternion = _SpatialAudioDefaults.rotationQuaternion.clone();\n }\n\n this.update();\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 public abstract _updatePosition(): void;\n public abstract _updateRotation(): void;\n}\n\n/** @internal */\nexport function _GetSpatialAudioSubNode(subGraph: _AbstractAudioSubGraph): Nullable<_SpatialAudioSubNode> {\n return subGraph.getSubNode<_SpatialAudioSubNode>(AudioSubNode.SPATIAL);\n}\n\n/** @internal */\nexport function _SetSpatialAudioProperty<K extends keyof typeof _SpatialAudioDefaults>(subGraph: _AbstractAudioSubGraph, property: K, value: _SpatialAudioSubNode[K]): void {\n subGraph.callOnSubNode<_SpatialAudioSubNode>(AudioSubNode.SPATIAL, (node) => {\n node[property] = value;\n });\n}\n"]}
1
+ {"version":3,"file":"spatialAudioSubNode.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,8BAA8B,EAAE,MAAM,6CAA6C,CAAC;AAE7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAE9E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e,EAAE,CAAC;QAC3B,CAAC;IACL,CAAC;CAIJ;AAED,gBAAgB;AAChB,MAAM,UAAU,uBAAuB,CAAC,QAAgC;IACpE,OAAO,QAAQ,CAAC,UAAU,sCAA4C,CAAC;AAC3E,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,wBAAwB,CAA+C,QAAgC,EAAE,QAAW,EAAE,KAA8B;IAChK,QAAQ,CAAC,aAAa,uCAA6C,CAAC,IAAI,EAAE,EAAE;QACxE,IAAI,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import type { Quaternion, Vector3 } from \"../../../Maths/math.vector\";\nimport type { Node } from \"../../../node\";\nimport type { Nullable } from \"../../../types\";\nimport type { SpatialAudioAttachmentType } from \"../../spatialAudioAttachmentType\";\nimport type { AudioEngineV2 } from \"../audioEngineV2\";\nimport { _SpatialAudioAttacherComponent } from \"../components/spatialAudioAttacherComponent\";\nimport type { ISpatialAudioOptions } from \"../subProperties/abstractSpatialAudio\";\nimport { _SpatialAudioDefaults } from \"../subProperties/abstractSpatialAudio\";\nimport type { _AbstractAudioSubGraph } from \"./abstractAudioSubGraph\";\nimport { _AbstractAudioSubNode } from \"./abstractAudioSubNode\";\nimport { AudioSubNode } from \"./audioSubNode\";\n\n/** @internal */\nexport abstract class _SpatialAudioSubNode extends _AbstractAudioSubNode {\n private _attacherComponent: Nullable<_SpatialAudioAttacherComponent> = null;\n\n protected constructor(engine: AudioEngineV2) {\n super(AudioSubNode.SPATIAL, engine);\n }\n\n public abstract coneInnerAngle: number;\n public abstract coneOuterAngle: number;\n public abstract coneOuterVolume: number;\n public abstract distanceModel: DistanceModelType;\n public abstract maxDistance: number;\n public abstract minDistance: number;\n public abstract orientation: Vector3;\n public abstract panningModel: PanningModelType;\n public abstract position: Vector3;\n public abstract rolloffFactor: number;\n public abstract rotation: Vector3;\n public abstract rotationQuaternion: Quaternion;\n public abstract _inNode: AudioNode;\n\n /** @internal */\n public get isAttached(): boolean {\n return this._attacherComponent !== null && this._attacherComponent.isAttached;\n }\n\n /** @internal */\n public attach(sceneNode: Nullable<Node>, useBoundingBox: boolean, attachmentType: SpatialAudioAttachmentType): void {\n this.detach();\n\n if (!this._attacherComponent) {\n this._attacherComponent = new _SpatialAudioAttacherComponent(this);\n }\n\n this._attacherComponent.attach(sceneNode, useBoundingBox, attachmentType);\n }\n\n /** @internal */\n public detach(): void {\n this._attacherComponent?.detach();\n }\n\n /** @internal */\n public override dispose(): void {\n super.dispose();\n\n this._attacherComponent?.dispose();\n this._attacherComponent = null;\n }\n\n /** @internal */\n public setOptions(options: Partial<ISpatialAudioOptions>): void {\n this.coneInnerAngle = options.spatialConeInnerAngle ?? _SpatialAudioDefaults.coneInnerAngle;\n this.coneOuterAngle = options.spatialConeOuterAngle ?? _SpatialAudioDefaults.coneOuterAngle;\n this.coneOuterVolume = options.spatialConeOuterVolume ?? _SpatialAudioDefaults.coneOuterVolume;\n this.distanceModel = options.spatialDistanceModel ?? _SpatialAudioDefaults.distanceModel;\n this.maxDistance = options.spatialMaxDistance ?? _SpatialAudioDefaults.maxDistance;\n this.minDistance = options.spatialMinDistance ?? _SpatialAudioDefaults.minDistance;\n this.orientation = options.spatialOrientation ?? _SpatialAudioDefaults.orientation;\n this.panningModel = options.spatialPanningModel ?? _SpatialAudioDefaults.panningModel;\n this.rolloffFactor = options.spatialRolloffFactor ?? _SpatialAudioDefaults.rolloffFactor;\n\n if (options.spatialPosition) {\n this.position = options.spatialPosition.clone();\n }\n\n if (options.spatialRotationQuaternion) {\n this.rotationQuaternion = options.spatialRotationQuaternion.clone();\n } else if (options.spatialRotation) {\n this.rotation = options.spatialRotation.clone();\n } else {\n this.rotationQuaternion = _SpatialAudioDefaults.rotationQuaternion.clone();\n }\n\n this.update();\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 public abstract _updatePosition(): void;\n public abstract _updateRotation(): void;\n}\n\n/** @internal */\nexport function _GetSpatialAudioSubNode(subGraph: _AbstractAudioSubGraph): Nullable<_SpatialAudioSubNode> {\n return subGraph.getSubNode<_SpatialAudioSubNode>(AudioSubNode.SPATIAL);\n}\n\n/** @internal */\nexport function _SetSpatialAudioProperty<K extends keyof typeof _SpatialAudioDefaults>(subGraph: _AbstractAudioSubGraph, property: K, value: _SpatialAudioSubNode[K]): void {\n subGraph.callOnSubNode<_SpatialAudioSubNode>(AudioSubNode.SPATIAL, (node) => {\n node[property] = value;\n });\n}\n"]}
@@ -9,6 +9,7 @@ export declare const _SpatialAudioDefaults: {
9
9
  readonly distanceModel: DistanceModelType;
10
10
  readonly maxDistance: number;
11
11
  readonly minDistance: number;
12
+ readonly orientation: Vector3;
12
13
  readonly panningModel: PanningModelType;
13
14
  readonly position: Vector3;
14
15
  readonly rolloffFactor: number;
@@ -74,6 +75,10 @@ export interface ISpatialAudioOptions {
74
75
  * - The spatialization's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.
75
76
  */
76
77
  spatialMinUpdateTime: number;
78
+ /**
79
+ * The spatial orientation used to determine the direction of the audio source. Defaults to (0, 0, -1).
80
+ */
81
+ spatialOrientation: Vector3;
77
82
  /**
78
83
  * Possible values are:
79
84
  * - `"equalpower"`: Represents the equal-power panning algorithm, generally regarded as simple and efficient.
@@ -165,6 +170,10 @@ export declare abstract class AbstractSpatialAudio {
165
170
  * - The spatialization's position and rotation will not update faster than this time, but they may update slower depending on the frame rate.
166
171
  */
167
172
  abstract minUpdateTime: number;
173
+ /**
174
+ * The spatial orientation used to determine the direction of the audio source. Defaults to (0, 0, -1).
175
+ */
176
+ abstract orientation: Vector3;
168
177
  /**
169
178
  * The spatial panning model. Defaults to "equalpower".
170
179
  *
@@ -184,11 +193,11 @@ export declare abstract class AbstractSpatialAudio {
184
193
  */
185
194
  abstract rolloffFactor: number;
186
195
  /**
187
- * The spatial rotation. Defaults to (0, 0, 0).
196
+ * The spatial rotation used to determine the direction of the audio source. Defaults to (0, 0, 0).
188
197
  */
189
198
  abstract rotation: Vector3;
190
199
  /**
191
- * The spatial rotation quaternion. Defaults to (0, 0, 0, 1).
200
+ * The spatial rotation quaternion used to determine the direction of the audio source. Defaults to (0, 0, 0, 1).
192
201
  */
193
202
  abstract rotationQuaternion: Quaternion;
194
203
  /**
@@ -212,4 +221,5 @@ export declare abstract class AbstractSpatialAudio {
212
221
  * This is called automatically by default and only needs to be called manually if automatic updates are disabled.
213
222
  */
214
223
  abstract update(): void;
224
+ abstract dispose(): void;
215
225
  }
@@ -6,6 +6,7 @@ export const _SpatialAudioDefaults = {
6
6
  distanceModel: "linear",
7
7
  maxDistance: 10000,
8
8
  minDistance: 1,
9
+ orientation: Vector3.Right(),
9
10
  panningModel: "equalpower",
10
11
  position: Vector3.Zero(),
11
12
  rolloffFactor: 1,
@@ -26,6 +27,7 @@ export function _HasSpatialAudioOptions(options) {
26
27
  options.spatialMaxDistance !== undefined ||
27
28
  options.spatialMinDistance !== undefined ||
28
29
  options.spatialMinUpdateTime !== undefined ||
30
+ options.spatialOrientation !== undefined ||
29
31
  options.spatialPanningModel !== undefined ||
30
32
  options.spatialPosition !== undefined ||
31
33
  options.spatialRolloffFactor !== undefined ||
@@ -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;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
+ {"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,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE;IAC5B,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;AAiGX;;;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,kBAAkB,KAAK,SAAS;QACxC,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;CAuHzC","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 orientation: Vector3.Right(),\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 * The spatial orientation used to determine the direction of the audio source. Defaults to (0, 0, -1).\n */\n spatialOrientation: Vector3;\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.spatialOrientation !== 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 orientation used to determine the direction of the audio source. Defaults to (0, 0, -1).\n */\n public abstract orientation: Vector3;\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 used to determine the direction of the audio source. Defaults to (0, 0, 0).\n */\n public abstract rotation: Vector3;\n\n /**\n * The spatial rotation quaternion used to determine the direction of the audio source. 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 public abstract dispose(): void;\n}\n"]}