@babylonjs/core 7.51.3 → 7.52.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 (166) hide show
  1. package/Audio/Interfaces/IAudioEngineOptions.d.ts +2 -0
  2. package/Audio/Interfaces/IAudioEngineOptions.js.map +1 -1
  3. package/AudioV2/abstractAudio/abstractAudioBus.d.ts +22 -0
  4. package/AudioV2/abstractAudio/abstractAudioBus.js +35 -0
  5. package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -0
  6. package/AudioV2/abstractAudio/abstractAudioNode.d.ts +99 -0
  7. package/AudioV2/abstractAudio/abstractAudioNode.js +149 -0
  8. package/AudioV2/abstractAudio/abstractAudioNode.js.map +1 -0
  9. package/AudioV2/abstractAudio/abstractSound.d.ts +152 -0
  10. package/AudioV2/abstractAudio/abstractSound.js +202 -0
  11. package/AudioV2/abstractAudio/abstractSound.js.map +1 -0
  12. package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +34 -0
  13. package/AudioV2/abstractAudio/abstractSoundInstance.js +35 -0
  14. package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -0
  15. package/AudioV2/abstractAudio/audioBus.d.ts +48 -0
  16. package/AudioV2/abstractAudio/audioBus.js +53 -0
  17. package/AudioV2/abstractAudio/audioBus.js.map +1 -0
  18. package/AudioV2/abstractAudio/audioEngineV2.d.ts +193 -0
  19. package/AudioV2/abstractAudio/audioEngineV2.js +155 -0
  20. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -0
  21. package/AudioV2/abstractAudio/index.d.ts +10 -0
  22. package/AudioV2/abstractAudio/index.js +12 -0
  23. package/AudioV2/abstractAudio/index.js.map +1 -0
  24. package/AudioV2/abstractAudio/mainAudioBus.d.ts +22 -0
  25. package/AudioV2/abstractAudio/mainAudioBus.js +18 -0
  26. package/AudioV2/abstractAudio/mainAudioBus.js.map +1 -0
  27. package/AudioV2/abstractAudio/mainAudioOut.d.ts +13 -0
  28. package/AudioV2/abstractAudio/mainAudioOut.js +15 -0
  29. package/AudioV2/abstractAudio/mainAudioOut.js.map +1 -0
  30. package/AudioV2/abstractAudio/staticSound.d.ts +134 -0
  31. package/AudioV2/abstractAudio/staticSound.js +113 -0
  32. package/AudioV2/abstractAudio/staticSound.js.map +1 -0
  33. package/AudioV2/abstractAudio/staticSoundBuffer.d.ts +46 -0
  34. package/AudioV2/abstractAudio/staticSoundBuffer.js +17 -0
  35. package/AudioV2/abstractAudio/staticSoundBuffer.js.map +1 -0
  36. package/AudioV2/abstractAudio/staticSoundInstance.d.ts +15 -0
  37. package/AudioV2/abstractAudio/staticSoundInstance.js +5 -0
  38. package/AudioV2/abstractAudio/staticSoundInstance.js.map +1 -0
  39. package/AudioV2/abstractAudio/streamingSound.d.ts +77 -0
  40. package/AudioV2/abstractAudio/streamingSound.js +109 -0
  41. package/AudioV2/abstractAudio/streamingSound.js.map +1 -0
  42. package/AudioV2/abstractAudio/streamingSoundInstance.d.ts +25 -0
  43. package/AudioV2/abstractAudio/streamingSoundInstance.js +29 -0
  44. package/AudioV2/abstractAudio/streamingSoundInstance.js.map +1 -0
  45. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.d.ts +53 -0
  46. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +97 -0
  47. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -0
  48. package/AudioV2/abstractAudio/subNodes/abstractAudioSubNode.d.ts +13 -0
  49. package/AudioV2/abstractAudio/subNodes/abstractAudioSubNode.js +33 -0
  50. package/AudioV2/abstractAudio/subNodes/abstractAudioSubNode.js.map +1 -0
  51. package/AudioV2/abstractAudio/subNodes/audioSubNode.d.ts +6 -0
  52. package/AudioV2/abstractAudio/subNodes/audioSubNode.js +8 -0
  53. package/AudioV2/abstractAudio/subNodes/audioSubNode.js.map +1 -0
  54. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.d.ts +31 -0
  55. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js +46 -0
  56. package/AudioV2/abstractAudio/subNodes/spatialAudioSubNode.js.map +1 -0
  57. package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.d.ts +19 -0
  58. package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js +27 -0
  59. package/AudioV2/abstractAudio/subNodes/stereoAudioSubNode.js.map +1 -0
  60. package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.d.ts +28 -0
  61. package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js +24 -0
  62. package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js.map +1 -0
  63. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.d.ts +187 -0
  64. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js +41 -0
  65. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudio.js.map +1 -0
  66. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.d.ts +59 -0
  67. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js +21 -0
  68. package/AudioV2/abstractAudio/subProperties/abstractSpatialAudioListener.js.map +1 -0
  69. package/AudioV2/abstractAudio/subProperties/abstractStereoAudio.d.ts +38 -0
  70. package/AudioV2/abstractAudio/subProperties/abstractStereoAudio.js +18 -0
  71. package/AudioV2/abstractAudio/subProperties/abstractStereoAudio.js.map +1 -0
  72. package/AudioV2/abstractAudio/subProperties/index.d.ts +3 -0
  73. package/AudioV2/abstractAudio/subProperties/index.js +4 -0
  74. package/AudioV2/abstractAudio/subProperties/index.js.map +1 -0
  75. package/AudioV2/abstractAudio/subProperties/spatialAudio.d.ts +49 -0
  76. package/AudioV2/abstractAudio/subProperties/spatialAudio.js +129 -0
  77. package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -0
  78. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.d.ts +9 -0
  79. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js +22 -0
  80. package/AudioV2/abstractAudio/subProperties/spatialAudioListener.js.map +1 -0
  81. package/AudioV2/abstractAudio/subProperties/stereoAudio.d.ts +11 -0
  82. package/AudioV2/abstractAudio/subProperties/stereoAudio.js +18 -0
  83. package/AudioV2/abstractAudio/subProperties/stereoAudio.js.map +1 -0
  84. package/AudioV2/audioUtils.d.ts +3 -0
  85. package/AudioV2/audioUtils.js +6 -0
  86. package/AudioV2/audioUtils.js.map +1 -0
  87. package/AudioV2/index.d.ts +3 -0
  88. package/AudioV2/index.js +5 -0
  89. package/AudioV2/index.js.map +1 -0
  90. package/AudioV2/soundState.d.ts +29 -0
  91. package/AudioV2/soundState.js +31 -0
  92. package/AudioV2/soundState.js.map +1 -0
  93. package/AudioV2/webAudio/index.d.ts +5 -0
  94. package/AudioV2/webAudio/index.js +6 -0
  95. package/AudioV2/webAudio/index.js.map +1 -0
  96. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +59 -0
  97. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +156 -0
  98. package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -0
  99. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.d.ts +24 -0
  100. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js +55 -0
  101. package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js.map +1 -0
  102. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.d.ts +24 -0
  103. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js +55 -0
  104. package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js.map +1 -0
  105. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.d.ts +26 -0
  106. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js +54 -0
  107. package/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.js.map +1 -0
  108. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.d.ts +21 -0
  109. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js +112 -0
  110. package/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.js.map +1 -0
  111. package/AudioV2/webAudio/subProperties/spatialWebAudio.d.ts +10 -0
  112. package/AudioV2/webAudio/subProperties/spatialWebAudio.js +26 -0
  113. package/AudioV2/webAudio/subProperties/spatialWebAudio.js.map +1 -0
  114. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.d.ts +4 -0
  115. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +108 -0
  116. package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -0
  117. package/AudioV2/webAudio/webAudioBus.d.ts +35 -0
  118. package/AudioV2/webAudio/webAudioBus.js +63 -0
  119. package/AudioV2/webAudio/webAudioBus.js.map +1 -0
  120. package/AudioV2/webAudio/webAudioEngine.d.ts +110 -0
  121. package/AudioV2/webAudio/webAudioEngine.js +227 -0
  122. package/AudioV2/webAudio/webAudioEngine.js.map +1 -0
  123. package/AudioV2/webAudio/webAudioMainBus.d.ts +29 -0
  124. package/AudioV2/webAudio/webAudioMainBus.js +64 -0
  125. package/AudioV2/webAudio/webAudioMainBus.js.map +1 -0
  126. package/AudioV2/webAudio/webAudioMainOut.d.ts +20 -0
  127. package/AudioV2/webAudio/webAudioMainOut.js +35 -0
  128. package/AudioV2/webAudio/webAudioMainOut.js.map +1 -0
  129. package/AudioV2/webAudio/webAudioNode.d.ts +24 -0
  130. package/AudioV2/webAudio/webAudioNode.js +2 -0
  131. package/AudioV2/webAudio/webAudioNode.js.map +1 -0
  132. package/AudioV2/webAudio/webAudioStaticSound.d.ts +106 -0
  133. package/AudioV2/webAudio/webAudioStaticSound.js +368 -0
  134. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -0
  135. package/AudioV2/webAudio/webAudioStreamingSound.d.ts +94 -0
  136. package/AudioV2/webAudio/webAudioStreamingSound.js +358 -0
  137. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -0
  138. package/Engines/abstractEngine.d.ts +6 -1
  139. package/Engines/abstractEngine.js +8 -5
  140. package/Engines/abstractEngine.js.map +1 -1
  141. package/Engines/engine.common.js +0 -4
  142. package/Engines/engine.common.js.map +1 -1
  143. package/Engines/engine.d.ts +0 -1
  144. package/Engines/engine.js +0 -1
  145. package/Engines/engine.js.map +1 -1
  146. package/Lights/Shadows/cascadedShadowGenerator.js +33 -20
  147. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  148. package/Materials/Textures/hdrCubeTexture.js +4 -1
  149. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  150. package/Meshes/geometry.js +7 -15
  151. package/Meshes/geometry.js.map +1 -1
  152. package/Misc/fileTools.d.ts +3 -1
  153. package/Misc/fileTools.js +2 -2
  154. package/Misc/fileTools.js.map +1 -1
  155. package/Shaders/ShadersInclude/shadowMapFragment.js +1 -0
  156. package/Shaders/ShadersInclude/shadowMapFragment.js.map +1 -1
  157. package/Shaders/iblCdfDebug.fragment.js +2 -2
  158. package/Shaders/iblCdfDebug.fragment.js.map +1 -1
  159. package/ShadersWGSL/ShadersInclude/shadowMapFragment.js +1 -0
  160. package/ShadersWGSL/ShadersInclude/shadowMapFragment.js.map +1 -1
  161. package/ShadersWGSL/iblCdfDebug.fragment.js +2 -2
  162. package/ShadersWGSL/iblCdfDebug.fragment.js.map +1 -1
  163. package/index.d.ts +1 -0
  164. package/index.js +1 -0
  165. package/index.js.map +1 -1
  166. package/package.json +1 -1
@@ -5,10 +5,12 @@
5
5
  export interface IAudioEngineOptions {
6
6
  /**
7
7
  * Specifies an existing Audio Context for the audio engine
8
+ * @deprecated Please use AudioEngineV2 instead
8
9
  */
9
10
  audioContext?: AudioContext;
10
11
  /**
11
12
  * Specifies a destination node for the audio engine
13
+ * @deprecated Please use AudioEngineV2 instead
12
14
  */
13
15
  audioDestination?: AudioDestinationNode | MediaStreamAudioDestinationNode;
14
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"IAudioEngineOptions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Audio/Interfaces/IAudioEngineOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Interface used to define options for the Audio Engine\r\n * @since 5.0.0\r\n */\r\nexport interface IAudioEngineOptions {\r\n /**\r\n * Specifies an existing Audio Context for the audio engine\r\n */\r\n audioContext?: AudioContext;\r\n /**\r\n * Specifies a destination node for the audio engine\r\n */\r\n audioDestination?: AudioDestinationNode | MediaStreamAudioDestinationNode;\r\n}\r\n"]}
1
+ {"version":3,"file":"IAudioEngineOptions.js","sourceRoot":"","sources":["../../../../../dev/core/src/Audio/Interfaces/IAudioEngineOptions.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * Interface used to define options for the Audio Engine\r\n * @since 5.0.0\r\n */\r\nexport interface IAudioEngineOptions {\r\n /**\r\n * Specifies an existing Audio Context for the audio engine\r\n * @deprecated Please use AudioEngineV2 instead\r\n */\r\n audioContext?: AudioContext;\r\n /**\r\n * Specifies a destination node for the audio engine\r\n * @deprecated Please use AudioEngineV2 instead\r\n */\r\n audioDestination?: AudioDestinationNode | MediaStreamAudioDestinationNode;\r\n}\r\n"]}
@@ -0,0 +1,22 @@
1
+ import { AbstractNamedAudioNode } from "./abstractAudioNode";
2
+ import type { AudioEngineV2 } from "./audioEngineV2";
3
+ import type { _AbstractAudioSubGraph } from "./subNodes/abstractAudioSubGraph";
4
+ /**
5
+ * Abstract class representing an audio bus with volume control.
6
+ *
7
+ * An audio bus is a node in the audio graph that can have multiple inputs and outputs. It is typically used to group
8
+ * sounds together and apply effects to them.
9
+ */
10
+ export declare abstract class AbstractAudioBus extends AbstractNamedAudioNode {
11
+ protected abstract _subGraph: _AbstractAudioSubGraph;
12
+ protected constructor(name: string, engine: AudioEngineV2);
13
+ /**
14
+ * The output volume of the bus.
15
+ */
16
+ get volume(): number;
17
+ set volume(value: number);
18
+ /**
19
+ * Releases associated resources.
20
+ */
21
+ dispose(): void;
22
+ }
@@ -0,0 +1,35 @@
1
+ import { AbstractNamedAudioNode } from "./abstractAudioNode.js";
2
+ import { _GetVolumeAudioProperty, _GetVolumeAudioSubNode } from "./subNodes/volumeAudioSubNode.js";
3
+ /**
4
+ * Abstract class representing an audio bus with volume control.
5
+ *
6
+ * An audio bus is a node in the audio graph that can have multiple inputs and outputs. It is typically used to group
7
+ * sounds together and apply effects to them.
8
+ */
9
+ export class AbstractAudioBus extends AbstractNamedAudioNode {
10
+ constructor(name, engine) {
11
+ super(name, engine, 3 /* AudioNodeType.HAS_INPUTS_AND_OUTPUTS */);
12
+ }
13
+ /**
14
+ * The output volume of the bus.
15
+ */
16
+ get volume() {
17
+ return _GetVolumeAudioProperty(this._subGraph, "volume");
18
+ }
19
+ set volume(value) {
20
+ // The volume subnode is created on initialization and should always exist.
21
+ const node = _GetVolumeAudioSubNode(this._subGraph);
22
+ if (!node) {
23
+ throw new Error("No volume subnode");
24
+ }
25
+ node.volume = value;
26
+ }
27
+ /**
28
+ * Releases associated resources.
29
+ */
30
+ dispose() {
31
+ super.dispose();
32
+ this._subGraph.dispose();
33
+ }
34
+ }
35
+ //# sourceMappingURL=abstractAudioBus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractAudioBus.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractAudioBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAiB,MAAM,qBAAqB,CAAC;AAG5E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEhG;;;;;GAKG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,sBAAsB;IAGjE,YAAsB,IAAY,EAAE,MAAqB;QACrD,KAAK,CAAC,IAAI,EAAE,MAAM,+CAAuC,CAAC;IAC9D,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,uBAAuB,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED,IAAW,MAAM,CAAC,KAAa;QAC3B,2EAA2E;QAC3E,MAAM,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,EAAE,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAED;;OAEG;IACa,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACJ","sourcesContent":["import { AbstractNamedAudioNode, AudioNodeType } from \"./abstractAudioNode\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { _AbstractAudioSubGraph } from \"./subNodes/abstractAudioSubGraph\";\nimport { _GetVolumeAudioProperty, _GetVolumeAudioSubNode } from \"./subNodes/volumeAudioSubNode\";\n\n/**\n * Abstract class representing an audio bus with volume control.\n *\n * An audio bus is a node in the audio graph that can have multiple inputs and outputs. It is typically used to group\n * sounds together and apply effects to them.\n */\nexport abstract class AbstractAudioBus extends AbstractNamedAudioNode {\n protected abstract _subGraph: _AbstractAudioSubGraph;\n\n protected constructor(name: string, engine: AudioEngineV2) {\n super(name, engine, AudioNodeType.HAS_INPUTS_AND_OUTPUTS);\n }\n\n /**\n * The output volume of the bus.\n */\n public get volume(): number {\n return _GetVolumeAudioProperty(this._subGraph, \"volume\");\n }\n\n public set volume(value: number) {\n // The volume subnode is created on initialization and should always exist.\n const node = _GetVolumeAudioSubNode(this._subGraph);\n if (!node) {\n throw new Error(\"No volume subnode\");\n }\n\n node.volume = value;\n }\n\n /**\n * Releases associated resources.\n */\n public override dispose(): void {\n super.dispose();\n this._subGraph.dispose();\n }\n}\n"]}
@@ -0,0 +1,99 @@
1
+ import { Observable } from "../../Misc/observable";
2
+ import type { AudioEngineV2 } from "./audioEngineV2";
3
+ export declare enum AudioNodeType {
4
+ HAS_INPUTS = 1,
5
+ HAS_OUTPUTS = 2,
6
+ HAS_INPUTS_AND_OUTPUTS = 3
7
+ }
8
+ /**
9
+ * Abstract class for an audio node.
10
+ *
11
+ * An audio node is a processing unit that can receive audio data from an upstream node and/or send audio data to a
12
+ * downstream node.
13
+ *
14
+ * Nodes can be connected to other nodes to create an audio graph. The audio graph represents the flow of audio data.
15
+ *
16
+ * There are 3 types of audio nodes:
17
+ * 1. Input: Receives audio data from upstream nodes.
18
+ * 2. Output: Sends audio data to downstream nodes.
19
+ * 3. Input/Output: Receives audio data from upstream nodes and sends audio data to downstream nodes.
20
+ */
21
+ export declare abstract class AbstractAudioNode {
22
+ /**
23
+ * The connected downstream audio nodes.
24
+ * - Undefined for input nodes.
25
+ */
26
+ protected readonly _downstreamNodes?: Set<AbstractAudioNode>;
27
+ /**
28
+ * The connected upstream audio nodes.
29
+ * - Undefined for output nodes.
30
+ */
31
+ protected readonly _upstreamNodes?: Set<AbstractAudioNode>;
32
+ /**
33
+ * The audio engine this node belongs to.
34
+ */
35
+ readonly engine: AudioEngineV2;
36
+ /**
37
+ * Observable for when the audio node is disposed.
38
+ */
39
+ readonly onDisposeObservable: Observable<AbstractAudioNode>;
40
+ protected constructor(engine: AudioEngineV2, nodeType: AudioNodeType);
41
+ /**
42
+ * Releases associated resources.
43
+ * - Triggers `onDisposeObservable`.
44
+ * @see {@link onDisposeObservable}
45
+ */
46
+ dispose(): void;
47
+ /**
48
+ * Gets a string identifying the name of the class
49
+ * @returns the class's name as a string
50
+ */
51
+ abstract getClassName(): string;
52
+ /**
53
+ * Connect to a downstream audio input node.
54
+ * @param node - The downstream audio input node to connect
55
+ * @returns `true` if the node is successfully connected; otherwise `false`
56
+ */
57
+ protected _connect(node: AbstractAudioNode): boolean;
58
+ /**
59
+ * Disconnects a downstream audio input node.
60
+ * @param node - The downstream audio input node to disconnect
61
+ * @returns `true` if the node is successfully disconnected; otherwise `false`
62
+ */
63
+ protected _disconnect(node: AbstractAudioNode): boolean;
64
+ /**
65
+ * Called when an upstream audio output node is connecting.
66
+ * @param node - The connecting upstream audio node
67
+ * @returns `true` if the node is successfully connected; otherwise `false`
68
+ */
69
+ private _onConnect;
70
+ /**
71
+ * Called when an upstream audio output node disconnects.
72
+ * @param node - The disconnecting upstream audio node
73
+ * @returns `true` if node is sucessfully disconnected; otherwise `false`
74
+ */
75
+ private _onDisconnect;
76
+ }
77
+ /**
78
+ * Abstract class for a named audio node.
79
+ */
80
+ export declare abstract class AbstractNamedAudioNode extends AbstractAudioNode {
81
+ private _name;
82
+ /**
83
+ * Observable for when the audio node is renamed.
84
+ */
85
+ readonly onNameChangedObservable: Observable<{
86
+ newName: string;
87
+ oldName: string;
88
+ node: AbstractNamedAudioNode;
89
+ }>;
90
+ protected constructor(name: string, engine: AudioEngineV2, nodeType: AudioNodeType);
91
+ /**
92
+ * The name of the audio node.
93
+ * - Triggers `onNameChangedObservable` when changed.
94
+ * @see {@link onNameChangedObservable}
95
+ */
96
+ get name(): string;
97
+ set name(newName: string);
98
+ dispose(): void;
99
+ }
@@ -0,0 +1,149 @@
1
+ import { Observable } from "../../Misc/observable.js";
2
+ export var AudioNodeType;
3
+ (function (AudioNodeType) {
4
+ AudioNodeType[AudioNodeType["HAS_INPUTS"] = 1] = "HAS_INPUTS";
5
+ AudioNodeType[AudioNodeType["HAS_OUTPUTS"] = 2] = "HAS_OUTPUTS";
6
+ AudioNodeType[AudioNodeType["HAS_INPUTS_AND_OUTPUTS"] = 3] = "HAS_INPUTS_AND_OUTPUTS";
7
+ })(AudioNodeType || (AudioNodeType = {}));
8
+ /**
9
+ * Abstract class for an audio node.
10
+ *
11
+ * An audio node is a processing unit that can receive audio data from an upstream node and/or send audio data to a
12
+ * downstream node.
13
+ *
14
+ * Nodes can be connected to other nodes to create an audio graph. The audio graph represents the flow of audio data.
15
+ *
16
+ * There are 3 types of audio nodes:
17
+ * 1. Input: Receives audio data from upstream nodes.
18
+ * 2. Output: Sends audio data to downstream nodes.
19
+ * 3. Input/Output: Receives audio data from upstream nodes and sends audio data to downstream nodes.
20
+ */
21
+ export class AbstractAudioNode {
22
+ constructor(engine, nodeType) {
23
+ /**
24
+ * Observable for when the audio node is disposed.
25
+ */
26
+ this.onDisposeObservable = new Observable();
27
+ this.engine = engine;
28
+ if (nodeType & 1 /* AudioNodeType.HAS_INPUTS */) {
29
+ this._upstreamNodes = new Set();
30
+ }
31
+ if (nodeType & 2 /* AudioNodeType.HAS_OUTPUTS */) {
32
+ this._downstreamNodes = new Set();
33
+ }
34
+ }
35
+ /**
36
+ * Releases associated resources.
37
+ * - Triggers `onDisposeObservable`.
38
+ * @see {@link onDisposeObservable}
39
+ */
40
+ dispose() {
41
+ if (this._downstreamNodes) {
42
+ for (const node of Array.from(this._downstreamNodes)) {
43
+ if (!this._disconnect(node)) {
44
+ throw new Error("Disconnect failed");
45
+ }
46
+ }
47
+ this._downstreamNodes.clear();
48
+ }
49
+ if (this._upstreamNodes) {
50
+ for (const node of Array.from(this._upstreamNodes)) {
51
+ if (!node._disconnect(this)) {
52
+ throw new Error("Disconnect failed");
53
+ }
54
+ }
55
+ this._upstreamNodes.clear();
56
+ }
57
+ this.onDisposeObservable.notifyObservers(this);
58
+ this.onDisposeObservable.clear();
59
+ }
60
+ /**
61
+ * Connect to a downstream audio input node.
62
+ * @param node - The downstream audio input node to connect
63
+ * @returns `true` if the node is successfully connected; otherwise `false`
64
+ */
65
+ _connect(node) {
66
+ if (!this._downstreamNodes) {
67
+ return false;
68
+ }
69
+ if (this._downstreamNodes.has(node)) {
70
+ return false;
71
+ }
72
+ if (!node._onConnect(this)) {
73
+ return false;
74
+ }
75
+ this._downstreamNodes.add(node);
76
+ return true;
77
+ }
78
+ /**
79
+ * Disconnects a downstream audio input node.
80
+ * @param node - The downstream audio input node to disconnect
81
+ * @returns `true` if the node is successfully disconnected; otherwise `false`
82
+ */
83
+ _disconnect(node) {
84
+ if (!this._downstreamNodes) {
85
+ return false;
86
+ }
87
+ if (!this._downstreamNodes.delete(node)) {
88
+ return false;
89
+ }
90
+ return node._onDisconnect(this);
91
+ }
92
+ /**
93
+ * Called when an upstream audio output node is connecting.
94
+ * @param node - The connecting upstream audio node
95
+ * @returns `true` if the node is successfully connected; otherwise `false`
96
+ */
97
+ _onConnect(node) {
98
+ if (!this._upstreamNodes) {
99
+ return false;
100
+ }
101
+ if (this._upstreamNodes.has(node)) {
102
+ return false;
103
+ }
104
+ this._upstreamNodes.add(node);
105
+ return true;
106
+ }
107
+ /**
108
+ * Called when an upstream audio output node disconnects.
109
+ * @param node - The disconnecting upstream audio node
110
+ * @returns `true` if node is sucessfully disconnected; otherwise `false`
111
+ */
112
+ _onDisconnect(node) {
113
+ return this._upstreamNodes?.delete(node) ?? false;
114
+ }
115
+ }
116
+ /**
117
+ * Abstract class for a named audio node.
118
+ */
119
+ export class AbstractNamedAudioNode extends AbstractAudioNode {
120
+ constructor(name, engine, nodeType) {
121
+ super(engine, nodeType);
122
+ /**
123
+ * Observable for when the audio node is renamed.
124
+ */
125
+ this.onNameChangedObservable = new Observable();
126
+ this._name = name;
127
+ }
128
+ /**
129
+ * The name of the audio node.
130
+ * - Triggers `onNameChangedObservable` when changed.
131
+ * @see {@link onNameChangedObservable}
132
+ */
133
+ get name() {
134
+ return this._name;
135
+ }
136
+ set name(newName) {
137
+ if (this._name === newName) {
138
+ return;
139
+ }
140
+ const oldName = this._name;
141
+ this._name = newName;
142
+ this.onNameChangedObservable.notifyObservers({ newName, oldName, node: this });
143
+ }
144
+ dispose() {
145
+ super.dispose();
146
+ this.onNameChangedObservable.clear();
147
+ }
148
+ }
149
+ //# sourceMappingURL=abstractAudioNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstractAudioNode.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractAudioNode.ts"],"names":[],"mappings":"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","sourcesContent":["import { Observable } from \"../../Misc/observable\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\n\nexport const enum AudioNodeType {\n HAS_INPUTS = 1,\n HAS_OUTPUTS = 2,\n HAS_INPUTS_AND_OUTPUTS = 3,\n}\n\n/**\n * Abstract class for an audio node.\n *\n * An audio node is a processing unit that can receive audio data from an upstream node and/or send audio data to a\n * downstream node.\n *\n * Nodes can be connected to other nodes to create an audio graph. The audio graph represents the flow of audio data.\n *\n * There are 3 types of audio nodes:\n * 1. Input: Receives audio data from upstream nodes.\n * 2. Output: Sends audio data to downstream nodes.\n * 3. Input/Output: Receives audio data from upstream nodes and sends audio data to downstream nodes.\n */\nexport abstract class AbstractAudioNode {\n /**\n * The connected downstream audio nodes.\n * - Undefined for input nodes.\n */\n protected readonly _downstreamNodes?: Set<AbstractAudioNode>;\n\n /**\n * The connected upstream audio nodes.\n * - Undefined for output nodes.\n */\n protected readonly _upstreamNodes?: Set<AbstractAudioNode>;\n\n /**\n * The audio engine this node belongs to.\n */\n public readonly engine: AudioEngineV2;\n\n /**\n * Observable for when the audio node is disposed.\n */\n public readonly onDisposeObservable = new Observable<AbstractAudioNode>();\n\n protected constructor(engine: AudioEngineV2, nodeType: AudioNodeType) {\n this.engine = engine;\n\n if (nodeType & AudioNodeType.HAS_INPUTS) {\n this._upstreamNodes = new Set<AbstractAudioNode>();\n }\n\n if (nodeType & AudioNodeType.HAS_OUTPUTS) {\n this._downstreamNodes = new Set<AbstractAudioNode>();\n }\n }\n\n /**\n * Releases associated resources.\n * - Triggers `onDisposeObservable`.\n * @see {@link onDisposeObservable}\n */\n public dispose(): void {\n if (this._downstreamNodes) {\n for (const node of Array.from(this._downstreamNodes)) {\n if (!this._disconnect(node)) {\n throw new Error(\"Disconnect failed\");\n }\n }\n this._downstreamNodes.clear();\n }\n\n if (this._upstreamNodes) {\n for (const node of Array.from(this._upstreamNodes)) {\n if (!node._disconnect(this)) {\n throw new Error(\"Disconnect failed\");\n }\n }\n this._upstreamNodes.clear();\n }\n\n this.onDisposeObservable.notifyObservers(this);\n this.onDisposeObservable.clear();\n }\n\n /**\n * Gets a string identifying the name of the class\n * @returns the class's name as a string\n */\n public abstract getClassName(): string;\n\n /**\n * Connect to a downstream audio input node.\n * @param node - The downstream audio input node to connect\n * @returns `true` if the node is successfully connected; otherwise `false`\n */\n protected _connect(node: AbstractAudioNode): boolean {\n if (!this._downstreamNodes) {\n return false;\n }\n\n if (this._downstreamNodes.has(node)) {\n return false;\n }\n\n if (!node._onConnect(this)) {\n return false;\n }\n\n this._downstreamNodes.add(node);\n\n return true;\n }\n\n /**\n * Disconnects a downstream audio input node.\n * @param node - The downstream audio input node to disconnect\n * @returns `true` if the node is successfully disconnected; otherwise `false`\n */\n protected _disconnect(node: AbstractAudioNode): boolean {\n if (!this._downstreamNodes) {\n return false;\n }\n\n if (!this._downstreamNodes.delete(node)) {\n return false;\n }\n\n return node._onDisconnect(this);\n }\n\n /**\n * Called when an upstream audio output node is connecting.\n * @param node - The connecting upstream audio node\n * @returns `true` if the node is successfully connected; otherwise `false`\n */\n private _onConnect(node: AbstractAudioNode): boolean {\n if (!this._upstreamNodes) {\n return false;\n }\n\n if (this._upstreamNodes.has(node)) {\n return false;\n }\n\n this._upstreamNodes.add(node);\n\n return true;\n }\n\n /**\n * Called when an upstream audio output node disconnects.\n * @param node - The disconnecting upstream audio node\n * @returns `true` if node is sucessfully disconnected; otherwise `false`\n */\n private _onDisconnect(node: AbstractAudioNode): boolean {\n return this._upstreamNodes?.delete(node) ?? false;\n }\n}\n\n/**\n * Abstract class for a named audio node.\n */\nexport abstract class AbstractNamedAudioNode extends AbstractAudioNode {\n private _name: string;\n\n /**\n * Observable for when the audio node is renamed.\n */\n public readonly onNameChangedObservable = new Observable<{ newName: string; oldName: string; node: AbstractNamedAudioNode }>();\n\n protected constructor(name: string, engine: AudioEngineV2, nodeType: AudioNodeType) {\n super(engine, nodeType);\n\n this._name = name;\n }\n\n /**\n * The name of the audio node.\n * - Triggers `onNameChangedObservable` when changed.\n * @see {@link onNameChangedObservable}\n */\n public get name(): string {\n return this._name;\n }\n\n public set name(newName: string) {\n if (this._name === newName) {\n return;\n }\n\n const oldName = this._name;\n\n this._name = newName;\n\n this.onNameChangedObservable.notifyObservers({ newName, oldName, node: this });\n }\n\n public override dispose(): void {\n super.dispose();\n\n this.onNameChangedObservable.clear();\n }\n}\n"]}
@@ -0,0 +1,152 @@
1
+ import { Observable } from "../../Misc/observable";
2
+ import type { Nullable } from "../../types";
3
+ import { SoundState } from "../soundState";
4
+ import { AbstractNamedAudioNode } from "./abstractAudioNode";
5
+ import type { _AbstractSoundInstance } from "./abstractSoundInstance";
6
+ import type { PrimaryAudioBus } from "./audioBus";
7
+ import type { AudioEngineV2 } from "./audioEngineV2";
8
+ import type { _AbstractAudioSubGraph } from "./subNodes/abstractAudioSubGraph";
9
+ import type { IVolumeAudioOptions } from "./subNodes/volumeAudioSubNode";
10
+ import type { AbstractSpatialAudio, ISpatialAudioOptions } from "./subProperties/abstractSpatialAudio";
11
+ import type { AbstractStereoAudio, IStereoAudioOptions } from "./subProperties/abstractStereoAudio";
12
+ /** @internal */
13
+ export interface IAbstractSoundOptionsBase {
14
+ /**
15
+ * Whether the sound should start playing automatically. Defaults to `false`.
16
+ */
17
+ autoplay: boolean;
18
+ /**
19
+ * The maximum number of instances that can play at the same time. Defaults to `Infinity`.
20
+ */
21
+ maxInstances: number;
22
+ }
23
+ /** @internal */
24
+ export interface IAbstractSoundPlayOptionsBase {
25
+ /**
26
+ * Whether the sound should loop. Defaults to `false`.
27
+ */
28
+ loop: boolean;
29
+ /**
30
+ * The time within the sound buffer to start playing at, in seconds. Defaults to `0`.
31
+ */
32
+ startOffset: number;
33
+ }
34
+ /**
35
+ * Options for creating a sound.
36
+ */
37
+ export interface IAbstractSoundOptions extends IAbstractSoundOptionsBase, IAbstractSoundPlayOptions, ISpatialAudioOptions, IStereoAudioOptions {
38
+ /**
39
+ * The output bus for the sound. Defaults to `null`.
40
+ * - If not set or `null`, the sound is automatically connected to the audio engine's default main bus.
41
+ * @see {@link AudioEngineV2.defaultMainBus}
42
+ */
43
+ outBus: Nullable<PrimaryAudioBus>;
44
+ }
45
+ /**
46
+ * Options for playing a sound.
47
+ */
48
+ export interface IAbstractSoundPlayOptions extends IAbstractSoundPlayOptionsBase, IVolumeAudioOptions {
49
+ }
50
+ /**
51
+ * Options stored in a sound.
52
+ * @internal
53
+ */
54
+ export interface IAbstractSoundStoredOptions extends IAbstractSoundOptionsBase, IAbstractSoundPlayOptionsBase {
55
+ }
56
+ /**
57
+ * Abstract class representing a sound in the audio engine.
58
+ */
59
+ export declare abstract class AbstractSound extends AbstractNamedAudioNode {
60
+ private _newestInstance;
61
+ private _outBus;
62
+ private _privateInstances;
63
+ private _state;
64
+ protected _instances: ReadonlySet<_AbstractSoundInstance>;
65
+ protected abstract readonly _options: IAbstractSoundStoredOptions;
66
+ protected _spatialAutoUpdate: boolean;
67
+ protected abstract _subGraph: _AbstractAudioSubGraph;
68
+ /**
69
+ * Observable for when the sound stops playing.
70
+ */
71
+ readonly onEndedObservable: Observable<AbstractSound>;
72
+ protected constructor(name: string, engine: AudioEngineV2, options: Partial<IAbstractSoundOptions>);
73
+ /**
74
+ * Whether the sound should start playing automatically. Defaults to `false`.
75
+ */
76
+ get autoplay(): boolean;
77
+ /**
78
+ * The current playback time of the sound, in seconds.
79
+ */
80
+ get currentTime(): number;
81
+ set currentTime(value: number);
82
+ /**
83
+ * Whether the sound should loop. Defaults to `false`.
84
+ */
85
+ get loop(): boolean;
86
+ set loop(value: boolean);
87
+ /**
88
+ * The maximum number of instances that can play at the same time. Defaults to `Infinity`.
89
+ */
90
+ get maxInstances(): number;
91
+ set maxInstances(value: number);
92
+ /**
93
+ * The output bus for the sound. Defaults to `null`.
94
+ * - If not set or `null`, the sound is automatically connected to the audio engine's default main bus.
95
+ * @see {@link AudioEngineV2.defaultMainBus}
96
+ */
97
+ get outBus(): Nullable<PrimaryAudioBus>;
98
+ set outBus(outBus: Nullable<PrimaryAudioBus>);
99
+ /**
100
+ * The spatial properties of the sound.
101
+ */
102
+ abstract spatial: AbstractSpatialAudio;
103
+ /**
104
+ * The time within the sound buffer to start playing at, in seconds. Defaults to `0`.
105
+ */
106
+ get startOffset(): number;
107
+ set startOffset(value: number);
108
+ /**
109
+ * The state of the sound.
110
+ */
111
+ get state(): SoundState;
112
+ /**
113
+ * The stereo properties of the sound.
114
+ */
115
+ abstract stereo: AbstractStereoAudio;
116
+ /**
117
+ * The output volume of the sound.
118
+ */
119
+ get volume(): number;
120
+ set volume(value: number);
121
+ /**
122
+ * Releases associated resources.
123
+ */
124
+ dispose(): void;
125
+ /**
126
+ * Plays the sound.
127
+ * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.
128
+ * @param options The options to use when playing the sound. Options set here override the sound's options.
129
+ */
130
+ abstract play(options?: Partial<IAbstractSoundPlayOptions>): void;
131
+ /**
132
+ * Pauses the sound.
133
+ */
134
+ pause(): void;
135
+ /**
136
+ * Resumes the sound.
137
+ */
138
+ resume(): void;
139
+ /**
140
+ * Stops the sound.
141
+ * - Triggers `onEndedObservable` if the sound is playing.
142
+ */
143
+ abstract stop(): void;
144
+ protected _beforePlay(instance: _AbstractSoundInstance): void;
145
+ protected _afterPlay(instance: _AbstractSoundInstance): void;
146
+ protected _setState(state: SoundState): void;
147
+ protected abstract _createInstance(): _AbstractSoundInstance;
148
+ protected _stopExcessInstances(): void;
149
+ private _getNewestInstance;
150
+ private _onInstanceEnded;
151
+ private _onOutBusDisposed;
152
+ }