@babylonjs/core 8.13.0 → 8.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AudioV2/abstractAudio/abstractAudioBus.d.ts +4 -21
- package/AudioV2/abstractAudio/abstractAudioBus.js +2 -34
- package/AudioV2/abstractAudio/abstractAudioBus.js.map +1 -1
- package/AudioV2/abstractAudio/abstractAudioOutNode.d.ts +40 -0
- package/AudioV2/abstractAudio/abstractAudioOutNode.js +56 -0
- package/AudioV2/abstractAudio/abstractAudioOutNode.js.map +1 -0
- package/AudioV2/abstractAudio/abstractSoundSource.d.ts +5 -16
- package/AudioV2/abstractAudio/abstractSoundSource.js +2 -27
- package/AudioV2/abstractAudio/abstractSoundSource.js.map +1 -1
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +13 -0
- package/AudioV2/abstractAudio/audioEngineV2.js +4 -0
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/abstractAudio/index.d.ts +1 -0
- package/AudioV2/abstractAudio/index.js +1 -0
- package/AudioV2/abstractAudio/index.js.map +1 -1
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.d.ts +3 -0
- package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js.map +1 -1
- package/AudioV2/audioParameter.d.ts +31 -0
- package/AudioV2/audioParameter.js +19 -0
- package/AudioV2/audioParameter.js.map +1 -0
- package/AudioV2/audioUtils.d.ts +3 -0
- package/AudioV2/audioUtils.js +61 -0
- package/AudioV2/audioUtils.js.map +1 -1
- package/AudioV2/index.d.ts +1 -0
- package/AudioV2/index.js +1 -0
- package/AudioV2/index.js.map +1 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.d.ts +37 -0
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +89 -0
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.d.ts +8 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +24 -6
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.d.ts +2 -0
- package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js +9 -4
- package/AudioV2/webAudio/subNodes/stereoWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.d.ts +7 -1
- package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js +14 -5
- package/AudioV2/webAudio/subNodes/volumeWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +92 -30
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.d.ts +4 -2
- package/AudioV2/webAudio/webAudioEngine.js +9 -4
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioMainOut.d.ts +6 -2
- package/AudioV2/webAudio/webAudioMainOut.js +15 -10
- package/AudioV2/webAudio/webAudioMainOut.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +4 -2
- package/AudioV2/webAudio/webAudioStaticSound.js +17 -14
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/BakedVertexAnimation/vertexAnimationBaker.js +17 -20
- package/BakedVertexAnimation/vertexAnimationBaker.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.d.ts +5 -0
- package/Behaviors/Meshes/pointerDragBehavior.js +7 -1
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +6 -0
- package/Gizmos/boundingBoxGizmo.js +16 -1
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +2 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js +3 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +1 -0
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +5 -5
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.d.ts +10 -3
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +16 -5
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +6 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +11 -4
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/linesMesh.d.ts +2 -11
- package/Meshes/linesMesh.js +10 -24
- package/Meshes/linesMesh.js.map +1 -1
- package/Particles/Node/Blocks/particleDebugBlock.d.ts +6 -0
- package/Particles/Node/Blocks/particleDebugBlock.js +10 -0
- package/Particles/Node/Blocks/particleDebugBlock.js.map +1 -1
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js +16 -2
- package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +2 -3
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js +17 -2
- package/ShadersWGSL/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +2 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +3 -3
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IAbstractAudioOutNodeOptions } from "./abstractAudioOutNode.js";
|
|
2
|
+
import { AbstractAudioOutNode } from "./abstractAudioOutNode.js";
|
|
2
3
|
import type { AudioEngineV2 } from "./audioEngineV2.js";
|
|
3
|
-
import type { _AbstractAudioSubGraph } from "./subNodes/abstractAudioSubGraph.js";
|
|
4
|
-
import type { IVolumeAudioOptions } from "./subNodes/volumeAudioSubNode.js";
|
|
5
|
-
import type { AbstractAudioAnalyzer, IAudioAnalyzerOptions } from "./subProperties/abstractAudioAnalyzer.js";
|
|
6
4
|
/** @internal */
|
|
7
|
-
export interface IAbstractAudioBusOptions extends
|
|
5
|
+
export interface IAbstractAudioBusOptions extends IAbstractAudioOutNodeOptions {
|
|
8
6
|
}
|
|
9
7
|
/**
|
|
10
8
|
* Abstract class representing an audio bus with volume control.
|
|
@@ -12,21 +10,6 @@ export interface IAbstractAudioBusOptions extends IAudioAnalyzerOptions, IVolume
|
|
|
12
10
|
* An audio bus is a node in the audio graph that can have multiple inputs and outputs. It is typically used to group
|
|
13
11
|
* sounds together and apply effects to them.
|
|
14
12
|
*/
|
|
15
|
-
export declare abstract class AbstractAudioBus extends
|
|
16
|
-
private _analyzer;
|
|
17
|
-
protected abstract _subGraph: _AbstractAudioSubGraph;
|
|
13
|
+
export declare abstract class AbstractAudioBus extends AbstractAudioOutNode {
|
|
18
14
|
protected constructor(name: string, engine: AudioEngineV2);
|
|
19
|
-
/**
|
|
20
|
-
* The analyzer features of the bus.
|
|
21
|
-
*/
|
|
22
|
-
get analyzer(): AbstractAudioAnalyzer;
|
|
23
|
-
/**
|
|
24
|
-
* The output volume of the bus.
|
|
25
|
-
*/
|
|
26
|
-
get volume(): number;
|
|
27
|
-
set volume(value: number);
|
|
28
|
-
/**
|
|
29
|
-
* Releases associated resources.
|
|
30
|
-
*/
|
|
31
|
-
dispose(): void;
|
|
32
15
|
}
|
|
@@ -1,45 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _GetVolumeAudioProperty, _GetVolumeAudioSubNode } from "./subNodes/volumeAudioSubNode.js";
|
|
3
|
-
import { _AudioAnalyzer } from "./subProperties/audioAnalyzer.js";
|
|
1
|
+
import { AbstractAudioOutNode } from "./abstractAudioOutNode.js";
|
|
4
2
|
/**
|
|
5
3
|
* Abstract class representing an audio bus with volume control.
|
|
6
4
|
*
|
|
7
5
|
* An audio bus is a node in the audio graph that can have multiple inputs and outputs. It is typically used to group
|
|
8
6
|
* sounds together and apply effects to them.
|
|
9
7
|
*/
|
|
10
|
-
export class AbstractAudioBus extends
|
|
8
|
+
export class AbstractAudioBus extends AbstractAudioOutNode {
|
|
11
9
|
constructor(name, engine) {
|
|
12
10
|
super(name, engine, 3 /* AudioNodeType.HAS_INPUTS_AND_OUTPUTS */);
|
|
13
|
-
this._analyzer = null;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* The analyzer features of the bus.
|
|
17
|
-
*/
|
|
18
|
-
get analyzer() {
|
|
19
|
-
return this._analyzer ?? (this._analyzer = new _AudioAnalyzer(this._subGraph));
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* The output volume of the bus.
|
|
23
|
-
*/
|
|
24
|
-
get volume() {
|
|
25
|
-
return _GetVolumeAudioProperty(this._subGraph, "volume");
|
|
26
|
-
}
|
|
27
|
-
set volume(value) {
|
|
28
|
-
// The volume subnode is created on initialization and should always exist.
|
|
29
|
-
const node = _GetVolumeAudioSubNode(this._subGraph);
|
|
30
|
-
if (!node) {
|
|
31
|
-
throw new Error("No volume subnode");
|
|
32
|
-
}
|
|
33
|
-
node.volume = value;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Releases associated resources.
|
|
37
|
-
*/
|
|
38
|
-
dispose() {
|
|
39
|
-
super.dispose();
|
|
40
|
-
this._analyzer?.dispose();
|
|
41
|
-
this._analyzer = null;
|
|
42
|
-
this._subGraph.dispose();
|
|
43
11
|
}
|
|
44
12
|
}
|
|
45
13
|
//# sourceMappingURL=abstractAudioBus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractAudioBus.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractAudioBus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"abstractAudioBus.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractAudioBus.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9D;;;;;GAKG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,oBAAoB;IAC/D,YAAsB,IAAY,EAAE,MAAqB;QACrD,KAAK,CAAC,IAAI,EAAE,MAAM,+CAAuC,CAAC;IAC9D,CAAC;CACJ","sourcesContent":["import { AudioNodeType } from \"./abstractAudioNode\";\nimport type { IAbstractAudioOutNodeOptions } from \"./abstractAudioOutNode\";\nimport { AbstractAudioOutNode } from \"./abstractAudioOutNode\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\n\n/** @internal */\nexport interface IAbstractAudioBusOptions extends IAbstractAudioOutNodeOptions {}\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 AbstractAudioOutNode {\n protected constructor(name: string, engine: AudioEngineV2) {\n super(name, engine, AudioNodeType.HAS_INPUTS_AND_OUTPUTS);\n }\n}\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Nullable } from "../../types.js";
|
|
2
|
+
import type { IAudioParameterRampOptions } from "../audioParameter.js";
|
|
3
|
+
import type { AudioNodeType } from "./abstractAudioNode.js";
|
|
4
|
+
import { AbstractNamedAudioNode } from "./abstractAudioNode.js";
|
|
5
|
+
import type { AudioEngineV2 } from "./audioEngineV2.js";
|
|
6
|
+
import type { _AbstractAudioSubGraph } from "./subNodes/abstractAudioSubGraph.js";
|
|
7
|
+
import type { IVolumeAudioOptions } from "./subNodes/volumeAudioSubNode.js";
|
|
8
|
+
import type { AbstractAudioAnalyzer, IAudioAnalyzerOptions } from "./subProperties/abstractAudioAnalyzer.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export interface IAbstractAudioOutNodeOptions extends IAudioAnalyzerOptions, IVolumeAudioOptions {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Abstract class representing and audio output node with an analyzer and volume control.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class AbstractAudioOutNode extends AbstractNamedAudioNode {
|
|
16
|
+
private _analyzer;
|
|
17
|
+
protected abstract _subGraph: _AbstractAudioSubGraph;
|
|
18
|
+
protected constructor(name: string, engine: AudioEngineV2, nodeType: AudioNodeType);
|
|
19
|
+
/**
|
|
20
|
+
* The analyzer features of the bus.
|
|
21
|
+
*/
|
|
22
|
+
get analyzer(): AbstractAudioAnalyzer;
|
|
23
|
+
/**
|
|
24
|
+
* The audio output volume.
|
|
25
|
+
*/
|
|
26
|
+
get volume(): number;
|
|
27
|
+
set volume(value: number);
|
|
28
|
+
/**
|
|
29
|
+
* Releases associated resources.
|
|
30
|
+
*/
|
|
31
|
+
dispose(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Sets the audio output volume with optional ramping.
|
|
34
|
+
* If the duration is 0 then the volume is set immediately, otherwise it is ramped to the new value over the given duration using the given shape.
|
|
35
|
+
* If a ramp is already in progress then the volume is not set and an error is thrown.
|
|
36
|
+
* @param value The value to set the volume to.
|
|
37
|
+
* @param options The options to use for ramping the volume change.
|
|
38
|
+
*/
|
|
39
|
+
setVolume(value: number, options?: Nullable<Partial<IAudioParameterRampOptions>>): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { AbstractNamedAudioNode } from "./abstractAudioNode.js";
|
|
2
|
+
import { _GetVolumeAudioProperty, _GetVolumeAudioSubNode } from "./subNodes/volumeAudioSubNode.js";
|
|
3
|
+
import { _AudioAnalyzer } from "./subProperties/audioAnalyzer.js";
|
|
4
|
+
/**
|
|
5
|
+
* Abstract class representing and audio output node with an analyzer and volume control.
|
|
6
|
+
*/
|
|
7
|
+
export class AbstractAudioOutNode extends AbstractNamedAudioNode {
|
|
8
|
+
constructor(name, engine, nodeType) {
|
|
9
|
+
super(name, engine, nodeType);
|
|
10
|
+
this._analyzer = null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The analyzer features of the bus.
|
|
14
|
+
*/
|
|
15
|
+
get analyzer() {
|
|
16
|
+
return this._analyzer ?? (this._analyzer = new _AudioAnalyzer(this._subGraph));
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The audio output volume.
|
|
20
|
+
*/
|
|
21
|
+
get volume() {
|
|
22
|
+
return _GetVolumeAudioProperty(this._subGraph, "volume");
|
|
23
|
+
}
|
|
24
|
+
set volume(value) {
|
|
25
|
+
// The volume subnode is created on initialization and should always exist.
|
|
26
|
+
const node = _GetVolumeAudioSubNode(this._subGraph);
|
|
27
|
+
if (!node) {
|
|
28
|
+
throw new Error("No volume subnode");
|
|
29
|
+
}
|
|
30
|
+
node.volume = value;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Releases associated resources.
|
|
34
|
+
*/
|
|
35
|
+
dispose() {
|
|
36
|
+
super.dispose();
|
|
37
|
+
this._analyzer?.dispose();
|
|
38
|
+
this._analyzer = null;
|
|
39
|
+
this._subGraph.dispose();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Sets the audio output volume with optional ramping.
|
|
43
|
+
* If the duration is 0 then the volume is set immediately, otherwise it is ramped to the new value over the given duration using the given shape.
|
|
44
|
+
* If a ramp is already in progress then the volume is not set and an error is thrown.
|
|
45
|
+
* @param value The value to set the volume to.
|
|
46
|
+
* @param options The options to use for ramping the volume change.
|
|
47
|
+
*/
|
|
48
|
+
setVolume(value, options = null) {
|
|
49
|
+
const node = _GetVolumeAudioSubNode(this._subGraph);
|
|
50
|
+
if (!node) {
|
|
51
|
+
throw new Error("No volume subnode");
|
|
52
|
+
}
|
|
53
|
+
node.setVolume(value, options);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=abstractAudioOutNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstractAudioOutNode.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractAudioOutNode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAI7D,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEhG,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAK/D;;GAEG;AACH,MAAM,OAAgB,oBAAqB,SAAQ,sBAAsB;IAKrE,YAAsB,IAAY,EAAE,MAAqB,EAAE,QAAuB;QAC9E,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QAL1B,cAAS,GAAoC,IAAI,CAAC;IAM1D,CAAC;IAED;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACnF,CAAC;IAED;;OAEG;IAEH,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;QAEhB,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QAEtB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACI,SAAS,CAAC,KAAa,EAAE,UAAyD,IAAI;QACzF,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,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnC,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\nimport type { IAudioParameterRampOptions } from \"../audioParameter\";\nimport type { AudioNodeType } from \"./abstractAudioNode\";\nimport { AbstractNamedAudioNode } from \"./abstractAudioNode\";\nimport type { AudioEngineV2 } from \"./audioEngineV2\";\nimport type { _AbstractAudioSubGraph } from \"./subNodes/abstractAudioSubGraph\";\nimport type { IVolumeAudioOptions } from \"./subNodes/volumeAudioSubNode\";\nimport { _GetVolumeAudioProperty, _GetVolumeAudioSubNode } from \"./subNodes/volumeAudioSubNode\";\nimport type { AbstractAudioAnalyzer, IAudioAnalyzerOptions } from \"./subProperties/abstractAudioAnalyzer\";\nimport { _AudioAnalyzer } from \"./subProperties/audioAnalyzer\";\n\n/** @internal */\nexport interface IAbstractAudioOutNodeOptions extends IAudioAnalyzerOptions, IVolumeAudioOptions {}\n\n/**\n * Abstract class representing and audio output node with an analyzer and volume control.\n */\nexport abstract class AbstractAudioOutNode extends AbstractNamedAudioNode {\n private _analyzer: Nullable<AbstractAudioAnalyzer> = null;\n\n protected abstract _subGraph: _AbstractAudioSubGraph;\n\n protected constructor(name: string, engine: AudioEngineV2, nodeType: AudioNodeType) {\n super(name, engine, nodeType);\n }\n\n /**\n * The analyzer features of the bus.\n */\n public get analyzer(): AbstractAudioAnalyzer {\n return this._analyzer ?? (this._analyzer = new _AudioAnalyzer(this._subGraph));\n }\n\n /**\n * The audio output volume.\n */\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\n this._analyzer?.dispose();\n this._analyzer = null;\n\n this._subGraph.dispose();\n }\n\n /**\n * Sets the audio output volume with optional ramping.\n * If the duration is 0 then the volume is set immediately, otherwise it is ramped to the new value over the given duration using the given shape.\n * If a ramp is already in progress then the volume is not set and an error is thrown.\n * @param value The value to set the volume to.\n * @param options The options to use for ramping the volume change.\n */\n public setVolume(value: number, options: Nullable<Partial<IAudioParameterRampOptions>> = null): void {\n const node = _GetVolumeAudioSubNode(this._subGraph);\n if (!node) {\n throw new Error(\"No volume subnode\");\n }\n\n node.setVolume(value, options);\n }\n}\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { Nullable } from "../../types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { AudioNodeType } from "./abstractAudioNode.js";
|
|
3
|
+
import type { IAbstractAudioOutNodeOptions } from "./abstractAudioOutNode.js";
|
|
4
|
+
import { AbstractAudioOutNode } from "./abstractAudioOutNode.js";
|
|
3
5
|
import type { PrimaryAudioBus } from "./audioBus.js";
|
|
4
6
|
import type { AudioEngineV2 } from "./audioEngineV2.js";
|
|
5
|
-
import type { _AbstractAudioSubGraph } from "./subNodes/abstractAudioSubGraph.js";
|
|
6
|
-
import type { AbstractAudioAnalyzer, IAudioAnalyzerOptions } from "./subProperties/abstractAudioAnalyzer.js";
|
|
7
7
|
import type { AbstractSpatialAudio, ISpatialAudioOptions } from "./subProperties/abstractSpatialAudio.js";
|
|
8
8
|
import type { AbstractStereoAudio, IStereoAudioOptions } from "./subProperties/abstractStereoAudio.js";
|
|
9
9
|
/**
|
|
10
10
|
* Options for creating a sound source.
|
|
11
11
|
*/
|
|
12
|
-
export interface ISoundSourceOptions extends
|
|
12
|
+
export interface ISoundSourceOptions extends IAbstractAudioOutNodeOptions, ISpatialAudioOptions, IStereoAudioOptions {
|
|
13
13
|
/**
|
|
14
14
|
* The output bus for the sound source. Defaults to `null`.
|
|
15
15
|
* - If not set or `null`, and `outBusAutoDefault` is `true`, then the sound source is automatically connected to the audio engine's default main bus.
|
|
@@ -24,15 +24,9 @@ export interface ISoundSourceOptions extends IAudioAnalyzerOptions, ISpatialAudi
|
|
|
24
24
|
/**
|
|
25
25
|
* Abstract class representing a sound in the audio engine.
|
|
26
26
|
*/
|
|
27
|
-
export declare abstract class AbstractSoundSource extends
|
|
28
|
-
private _analyzer;
|
|
27
|
+
export declare abstract class AbstractSoundSource extends AbstractAudioOutNode {
|
|
29
28
|
private _outBus;
|
|
30
|
-
protected abstract _subGraph: _AbstractAudioSubGraph;
|
|
31
29
|
protected constructor(name: string, engine: AudioEngineV2, nodeType?: AudioNodeType);
|
|
32
|
-
/**
|
|
33
|
-
* The analyzer features of the sound.
|
|
34
|
-
*/
|
|
35
|
-
get analyzer(): AbstractAudioAnalyzer;
|
|
36
30
|
/**
|
|
37
31
|
* The output bus for the sound.
|
|
38
32
|
* @see {@link AudioEngineV2.defaultMainBus}
|
|
@@ -47,11 +41,6 @@ export declare abstract class AbstractSoundSource extends AbstractNamedAudioNode
|
|
|
47
41
|
* The stereo features of the sound.
|
|
48
42
|
*/
|
|
49
43
|
abstract stereo: AbstractStereoAudio;
|
|
50
|
-
/**
|
|
51
|
-
* The output volume of the sound.
|
|
52
|
-
*/
|
|
53
|
-
get volume(): number;
|
|
54
|
-
set volume(value: number);
|
|
55
44
|
/**
|
|
56
45
|
* Releases associated resources.
|
|
57
46
|
*/
|
|
@@ -1,24 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _GetVolumeAudioProperty, _GetVolumeAudioSubNode } from "./subNodes/volumeAudioSubNode.js";
|
|
3
|
-
import { _AudioAnalyzer } from "./subProperties/audioAnalyzer.js";
|
|
1
|
+
import { AbstractAudioOutNode } from "./abstractAudioOutNode.js";
|
|
4
2
|
/**
|
|
5
3
|
* Abstract class representing a sound in the audio engine.
|
|
6
4
|
*/
|
|
7
|
-
export class AbstractSoundSource extends
|
|
5
|
+
export class AbstractSoundSource extends AbstractAudioOutNode {
|
|
8
6
|
constructor(name, engine, nodeType = 2 /* AudioNodeType.HAS_OUTPUTS */) {
|
|
9
7
|
super(name, engine, nodeType);
|
|
10
|
-
this._analyzer = null;
|
|
11
8
|
this._outBus = null;
|
|
12
9
|
this._onOutBusDisposed = () => {
|
|
13
10
|
this._outBus = null;
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
|
-
/**
|
|
17
|
-
* The analyzer features of the sound.
|
|
18
|
-
*/
|
|
19
|
-
get analyzer() {
|
|
20
|
-
return this._analyzer ?? (this._analyzer = new _AudioAnalyzer(this._subGraph));
|
|
21
|
-
}
|
|
22
13
|
/**
|
|
23
14
|
* The output bus for the sound.
|
|
24
15
|
* @see {@link AudioEngineV2.defaultMainBus}
|
|
@@ -44,27 +35,11 @@ export class AbstractSoundSource extends AbstractNamedAudioNode {
|
|
|
44
35
|
}
|
|
45
36
|
}
|
|
46
37
|
}
|
|
47
|
-
/**
|
|
48
|
-
* The output volume of the sound.
|
|
49
|
-
*/
|
|
50
|
-
get volume() {
|
|
51
|
-
return _GetVolumeAudioProperty(this._subGraph, "volume");
|
|
52
|
-
}
|
|
53
|
-
set volume(value) {
|
|
54
|
-
// The volume subnode is created on initialization and should always exist.
|
|
55
|
-
const node = _GetVolumeAudioSubNode(this._subGraph);
|
|
56
|
-
if (!node) {
|
|
57
|
-
throw new Error("No volume subnode");
|
|
58
|
-
}
|
|
59
|
-
node.volume = value;
|
|
60
|
-
}
|
|
61
38
|
/**
|
|
62
39
|
* Releases associated resources.
|
|
63
40
|
*/
|
|
64
41
|
dispose() {
|
|
65
42
|
super.dispose();
|
|
66
|
-
this._analyzer?.dispose();
|
|
67
|
-
this._analyzer = null;
|
|
68
43
|
this._outBus = null;
|
|
69
44
|
}
|
|
70
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractSoundSource.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractSoundSource.ts"],"names":[],"mappings":"
|
|
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,4 +1,5 @@
|
|
|
1
1
|
import type { Nullable } from "../../types.js";
|
|
2
|
+
import type { IAudioParameterRampOptions } from "../audioParameter.js";
|
|
2
3
|
import type { AbstractAudioNode, AbstractNamedAudioNode } from "./abstractAudioNode.js";
|
|
3
4
|
import type { AbstractSoundSource, ISoundSourceOptions } from "./abstractSoundSource.js";
|
|
4
5
|
import type { AudioBus, IAudioBusOptions } from "./audioBus.js";
|
|
@@ -79,6 +80,10 @@ export declare abstract class AudioEngineV2 {
|
|
|
79
80
|
abstract volume: number;
|
|
80
81
|
/**
|
|
81
82
|
* The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).
|
|
83
|
+
*
|
|
84
|
+
* Due to limitations in some browsers, it is not recommended to set this value to longer than `0.01` seconds.
|
|
85
|
+
*
|
|
86
|
+
* Setting this value to longer than `0.01` seconds may result in errors being throw when setting audio parameters.
|
|
82
87
|
*/
|
|
83
88
|
get parameterRampDuration(): number;
|
|
84
89
|
set parameterRampDuration(value: number);
|
|
@@ -156,6 +161,14 @@ export declare abstract class AudioEngineV2 {
|
|
|
156
161
|
* @returns A promise that resolves when the audio engine is running.
|
|
157
162
|
*/
|
|
158
163
|
abstract resumeAsync(): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Sets the audio output volume with optional ramping.
|
|
166
|
+
* If the duration is 0 then the volume is set immediately, otherwise it is ramped to the new value over the given duration using the given shape.
|
|
167
|
+
* If a ramp is already in progress then the volume is not set and an error is thrown.
|
|
168
|
+
* @param value The value to set the volume to.
|
|
169
|
+
* @param options The options to use for ramping the volume change.
|
|
170
|
+
*/
|
|
171
|
+
abstract setVolume(value: number, options?: Partial<IAudioParameterRampOptions>): void;
|
|
159
172
|
/**
|
|
160
173
|
* Unlocks the audio engine if it is locked.
|
|
161
174
|
* - Note that the returned promise may already be resolved if the audio engine is already unlocked.
|
|
@@ -43,6 +43,10 @@ export class AudioEngineV2 {
|
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).
|
|
46
|
+
*
|
|
47
|
+
* Due to limitations in some browsers, it is not recommended to set this value to longer than `0.01` seconds.
|
|
48
|
+
*
|
|
49
|
+
* Setting this value to longer than `0.01` seconds may result in errors being throw when setting audio parameters.
|
|
46
50
|
*/
|
|
47
51
|
get parameterRampDuration() {
|
|
48
52
|
return this._parameterRampDuration;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audioEngineV2.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/audioEngineV2.ts"],"names":[],"mappings":"AAUA,MAA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,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CACxC,MAAyE,EACzE,UAA8C,EAAE,EAChD,SAAkC,IAAI;IAEtC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,MAAM,CAAC,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;GAOG;AACH,2FAA2F;AAC3F,MAAM,UAAU,sBAAsB,CAClC,IAAY,EACZ,MAAiB,EACjB,UAAwC,EAAE,EAC1C,SAAkC,IAAI;IAEtC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;GAOG;AACH,2FAA2F;AAC3F,MAAM,UAAU,yBAAyB,CACrC,IAAY,EACZ,MAA4C,EAC5C,UAA2C,EAAE,EAC7C,SAAkC,IAAI;IAEtC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\nimport type { AbstractAudioNode, AbstractNamedAudioNode } from \"./abstractAudioNode\";\nimport type { AbstractSoundSource, ISoundSourceOptions } from \"./abstractSoundSource\";\nimport type { AudioBus, IAudioBusOptions } from \"./audioBus\";\nimport type { IMainAudioBusOptions, MainAudioBus } from \"./mainAudioBus\";\nimport type { IStaticSoundOptions, StaticSound } from \"./staticSound\";\nimport type { IStaticSoundBufferOptions, StaticSoundBuffer } from \"./staticSoundBuffer\";\nimport type { IStreamingSoundOptions, StreamingSound } from \"./streamingSound\";\nimport type { AbstractSpatialAudioListener, ISpatialAudioListenerOptions } from \"./subProperties/abstractSpatialAudioListener\";\n\nconst Instances: AudioEngineV2[] = [];\n\n/**\n * Gets the most recently created v2 audio engine.\n * @returns The most recently created v2 audio engine.\n */\nexport function LastCreatedAudioEngine(): Nullable<AudioEngineV2> {\n if (Instances.length === 0) {\n return null;\n }\n\n return Instances[Instances.length - 1];\n}\n\n/**\n * Options for creating a v2 audio engine.\n */\nexport interface IAudioEngineV2Options extends ISpatialAudioListenerOptions {\n /**\n * The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).\n */\n parameterRampDuration: number;\n /**\n * The initial output volume of the audio engine. Defaults to `1`.\n */\n volume: number;\n}\n\n/**\n * The state of a v2 audio engine.\n * @see {@link AudioEngineV2.state}\n */\nexport type AudioEngineV2State = \"closed\" | \"interrupted\" | \"running\" | \"suspended\";\n\n/**\n * Abstract base class for v2 audio engines.\n *\n * A v2 audio engine based on the WebAudio API can be created with the {@link CreateAudioEngineAsync} function.\n */\nexport abstract class AudioEngineV2 {\n /** Not owned, but all items should be in `_nodes` container, too, which is owned. */\n private readonly _mainBuses = new Set<MainAudioBus>();\n\n /** Owned top-level sound and bus nodes. */\n private readonly _nodes = new Set<AbstractNamedAudioNode>();\n\n private _defaultMainBus: Nullable<MainAudioBus> = null;\n\n private _parameterRampDuration: number = 0.01;\n\n protected constructor(options: Partial<IAudioEngineV2Options>) {\n Instances.push(this);\n\n if (typeof options.parameterRampDuration === \"number\") {\n this.parameterRampDuration = options.parameterRampDuration;\n }\n }\n\n /**\n * The elapsed time since the audio engine was started, in seconds.\n */\n public abstract readonly currentTime: number;\n\n /**\n * The default main bus that will be used for audio buses and sounds if their `outBus` option is not set.\n * @see {@link IAudioBusOptions.outBus}\n * @see {@link IAbstractSoundOptions.outBus}\n */\n public get defaultMainBus(): Nullable<MainAudioBus> {\n if (this._mainBuses.size === 0) {\n return null;\n }\n\n if (!this._defaultMainBus) {\n this._defaultMainBus = Array.from(this._mainBuses)[0];\n }\n\n return this._defaultMainBus;\n }\n\n /**\n * The spatial audio listener properties for the audio engine.\n * - Each audio engine has exactly one listener.\n */\n public abstract readonly listener: AbstractSpatialAudioListener;\n\n /**\n * The main output node.\n * - This is the last node in the audio graph before the audio is sent to the speakers.\n */\n public abstract readonly mainOut: AbstractAudioNode;\n\n /**\n * The current state of the audio engine.\n *\n * Possible values are:\n * - `\"closed\"`: The audio engine has been closed.\n * - `\"interrupted\"`: The audio engine has been interrupted and is not running.\n * - `\"running\"`: The audio engine is running normally.\n * - `\"suspended\"`: The audio engine is suspended and is not running.\n */\n public abstract readonly state: AudioEngineV2State;\n\n /**\n * The output volume of the audio engine.\n */\n public abstract volume: number;\n\n /**\n * The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).\n */\n public get parameterRampDuration(): number {\n return this._parameterRampDuration;\n }\n\n public set parameterRampDuration(value: number) {\n this._parameterRampDuration = Math.max(0, value);\n }\n\n /**\n * Creates a new audio bus.\n * @param name - The name of the audio bus.\n * @param options - The options to use when creating the audio bus.\n * @param engine - The audio engine.\n * @returns A promise that resolves with the created audio bus.\n */\n public abstract createBusAsync(name: string, options?: Partial<IAudioBusOptions>): Promise<AudioBus>;\n\n /**\n * Creates a new main audio bus.\n * @param name - The name of the main audio bus.\n * @param options - The options to use when creating the main audio bus.\n * @returns A promise that resolves with the created main audio bus.\n */\n public abstract createMainBusAsync(name: string, options?: Partial<IMainAudioBusOptions>): Promise<MainAudioBus>;\n\n /**\n * Creates a new microphone sound source.\n * @param name - The name of the sound.\n * @param options - The options for the sound source.\n * @returns A promise that resolves to the created sound source.\n */\n public abstract createMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>): Promise<AbstractSoundSource>;\n\n /**\n * Creates a new static sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the static sound.\n * @returns A promise that resolves to the created static sound.\n */\n public abstract createSoundAsync(\n name: string,\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options?: Partial<IStaticSoundOptions>\n ): Promise<StaticSound>;\n\n /**\n * Creates a new static sound buffer.\n * @param source - The source of the sound buffer.\n * @param options - The options for the static sound buffer.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created static sound buffer.\n */\n public abstract createSoundBufferAsync(\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options?: Partial<IStaticSoundBufferOptions>\n ): Promise<StaticSoundBuffer>;\n\n /**\n * Creates a new sound source.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the sound source.\n * @returns A promise that resolves to the created sound source.\n */\n public abstract createSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>): Promise<AbstractSoundSource>;\n\n /**\n * Creates a new streaming sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the streaming sound.\n * @returns A promise that resolves to the created streaming sound.\n */\n public abstract createStreamingSoundAsync(name: string, source: HTMLMediaElement | string | string[], options?: Partial<IStreamingSoundOptions>): Promise<StreamingSound>;\n\n /**\n * Releases associated resources.\n */\n public dispose(): void {\n if (Instances.includes(this)) {\n Instances.splice(Instances.indexOf(this), 1);\n }\n\n const nodeIt = this._nodes.values();\n for (let next = nodeIt.next(); !next.done; next = nodeIt.next()) {\n next.value.dispose();\n }\n\n this._mainBuses.clear();\n this._nodes.clear();\n\n this._defaultMainBus = null;\n }\n\n /**\n * Checks if the specified format is valid.\n * @param format The format to check as an audio file extension like \"mp3\" or \"wav\".\n * @returns `true` if the format is valid; otherwise `false`.\n */\n public abstract isFormatValid(format: string): boolean;\n\n /**\n * Pauses the audio engine if it is running.\n * @returns A promise that resolves when the audio engine is paused.\n */\n public abstract pauseAsync(): Promise<void>;\n\n /**\n * Resumes the audio engine if it is not running.\n * @returns A promise that resolves when the audio engine is running.\n */\n public abstract resumeAsync(): Promise<void>;\n\n /**\n * Unlocks the audio engine if it is locked.\n * - Note that the returned promise may already be resolved if the audio engine is already unlocked.\n * @returns A promise that is resolved when the audio engine is unlocked.\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\n public unlockAsync(): Promise<void> {\n return this.resumeAsync();\n }\n\n protected _addMainBus(mainBus: MainAudioBus): void {\n this._mainBuses.add(mainBus);\n\n this._addNode(mainBus);\n }\n\n protected _removeMainBus(mainBus: MainAudioBus): void {\n this._mainBuses.delete(mainBus);\n this._defaultMainBus = null;\n\n this._removeNode(mainBus);\n }\n\n protected _addNode(node: AbstractNamedAudioNode): void {\n this._nodes.add(node);\n }\n\n protected _removeNode(node: AbstractNamedAudioNode): void {\n this._nodes.delete(node);\n }\n}\n\n/**\n * @internal\n * @param engine - The given audio engine. If `null` then the last created audio engine is used.\n * @returns the given audio engine or the last created audio engine.\n * @throws An error if the resulting engine is `null`.\n */\nexport function _GetAudioEngine(engine: Nullable<AudioEngineV2>): AudioEngineV2 {\n if (!engine) {\n engine = LastCreatedAudioEngine();\n }\n\n if (engine) {\n return engine;\n }\n\n throw new Error(\"No audio engine.\");\n}\n\n/**\n * Creates a new audio bus.\n * @param name - The name of the audio bus.\n * @param options - The options to use when creating the audio bus.\n * @param engine - The audio engine.\n * @returns A promise that resolves with the created audio bus.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateAudioBusAsync(name: string, options: Partial<IAudioBusOptions> = {}, engine: Nullable<AudioEngineV2> = null): Promise<AudioBus> {\n engine = _GetAudioEngine(engine);\n return engine.createBusAsync(name, options);\n}\n\n/**\n * Creates a new main audio bus.\n * @param name - The name of the main audio bus.\n * @param options - The options to use when creating the main audio bus.\n * @param engine - The audio engine.\n * @returns A promise that resolves with the created main audio bus.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateMainAudioBusAsync(name: string, options: Partial<IMainAudioBusOptions> = {}, engine: Nullable<AudioEngineV2> = null): Promise<MainAudioBus> {\n engine = _GetAudioEngine(engine);\n return engine.createMainBusAsync(name, options);\n}\n\n/**\n * Creates a new microphone sound source.\n * @param name - The name of the sound.\n * @param options - The options for the sound source.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created sound source.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateMicrophoneSoundSourceAsync(name: string, options: Partial<ISoundSourceOptions> = {}, engine: Nullable<AudioEngineV2> = null): Promise<AbstractSoundSource> {\n engine = _GetAudioEngine(engine);\n return engine.createMicrophoneSoundSourceAsync(name, options);\n}\n\n/**\n * Creates a new static sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the static sound.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created static sound.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateSoundAsync(\n name: string,\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options: Partial<IStaticSoundOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<StaticSound> {\n engine = _GetAudioEngine(engine);\n return engine.createSoundAsync(name, source, options);\n}\n\n/**\n * Creates a new static sound buffer.\n * @param source - The source of the sound buffer.\n * @param options - The options for the static sound buffer.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created static sound buffer.\n */\nexport async function CreateSoundBufferAsync(\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options: Partial<IStaticSoundBufferOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<StaticSoundBuffer> {\n engine = _GetAudioEngine(engine);\n return await engine.createSoundBufferAsync(source, options);\n}\n\n/**\n * Creates a new sound source.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the sound source.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created sound source.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateSoundSourceAsync(\n name: string,\n source: AudioNode,\n options: Partial<ISoundSourceOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<AbstractSoundSource> {\n engine = _GetAudioEngine(engine);\n return engine.createSoundSourceAsync(name, source, options);\n}\n\n/**\n * Creates a new streaming sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the streaming sound.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created streaming sound.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateStreamingSoundAsync(\n name: string,\n source: HTMLMediaElement | string | string[],\n options: Partial<IStreamingSoundOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<StreamingSound> {\n engine = _GetAudioEngine(engine);\n return engine.createStreamingSoundAsync(name, source, options);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"audioEngineV2.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/audioEngineV2.ts"],"names":[],"mappings":"AAWA,MAAM,SAAS,GAAoB,EAAE,CAAC;AAEtC;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IAClC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AAC3C,CAAC;AAsBD;;;;GAIG;AACH,MAAM,OAAgB,aAAa;IAW/B,YAAsB,OAAuC;QAV7D,qFAAqF;QACpE,eAAU,GAAG,IAAI,GAAG,EAAgB,CAAC;QAEtD,2CAA2C;QAC1B,WAAM,GAAG,IAAI,GAAG,EAA0B,CAAC;QAEpD,oBAAe,GAA2B,IAAI,CAAC;QAE/C,2BAAsB,GAAW,IAAI,CAAC;QAG1C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAErB,IAAI,OAAO,OAAO,CAAC,qBAAqB,KAAK,QAAQ,EAAE,CAAC;YACpD,IAAI,CAAC,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAC/D,CAAC;IACL,CAAC;IAOD;;;;OAIG;IACH,IAAW,cAAc;QACrB,IAAI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OAAO,MAAM,CAAC,yBAAyB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC","sourcesContent":["import type { Nullable } from \"../../types\";\nimport type { IAudioParameterRampOptions } from \"../audioParameter\";\nimport type { AbstractAudioNode, AbstractNamedAudioNode } from \"./abstractAudioNode\";\nimport type { AbstractSoundSource, ISoundSourceOptions } from \"./abstractSoundSource\";\nimport type { AudioBus, IAudioBusOptions } from \"./audioBus\";\nimport type { IMainAudioBusOptions, MainAudioBus } from \"./mainAudioBus\";\nimport type { IStaticSoundOptions, StaticSound } from \"./staticSound\";\nimport type { IStaticSoundBufferOptions, StaticSoundBuffer } from \"./staticSoundBuffer\";\nimport type { IStreamingSoundOptions, StreamingSound } from \"./streamingSound\";\nimport type { AbstractSpatialAudioListener, ISpatialAudioListenerOptions } from \"./subProperties/abstractSpatialAudioListener\";\n\nconst Instances: AudioEngineV2[] = [];\n\n/**\n * Gets the most recently created v2 audio engine.\n * @returns The most recently created v2 audio engine.\n */\nexport function LastCreatedAudioEngine(): Nullable<AudioEngineV2> {\n if (Instances.length === 0) {\n return null;\n }\n\n return Instances[Instances.length - 1];\n}\n\n/**\n * Options for creating a v2 audio engine.\n */\nexport interface IAudioEngineV2Options extends ISpatialAudioListenerOptions {\n /**\n * The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).\n */\n parameterRampDuration: number;\n /**\n * The initial output volume of the audio engine. Defaults to `1`.\n */\n volume: number;\n}\n\n/**\n * The state of a v2 audio engine.\n * @see {@link AudioEngineV2.state}\n */\nexport type AudioEngineV2State = \"closed\" | \"interrupted\" | \"running\" | \"suspended\";\n\n/**\n * Abstract base class for v2 audio engines.\n *\n * A v2 audio engine based on the WebAudio API can be created with the {@link CreateAudioEngineAsync} function.\n */\nexport abstract class AudioEngineV2 {\n /** Not owned, but all items should be in `_nodes` container, too, which is owned. */\n private readonly _mainBuses = new Set<MainAudioBus>();\n\n /** Owned top-level sound and bus nodes. */\n private readonly _nodes = new Set<AbstractNamedAudioNode>();\n\n private _defaultMainBus: Nullable<MainAudioBus> = null;\n\n private _parameterRampDuration: number = 0.01;\n\n protected constructor(options: Partial<IAudioEngineV2Options>) {\n Instances.push(this);\n\n if (typeof options.parameterRampDuration === \"number\") {\n this.parameterRampDuration = options.parameterRampDuration;\n }\n }\n\n /**\n * The elapsed time since the audio engine was started, in seconds.\n */\n public abstract readonly currentTime: number;\n\n /**\n * The default main bus that will be used for audio buses and sounds if their `outBus` option is not set.\n * @see {@link IAudioBusOptions.outBus}\n * @see {@link IAbstractSoundOptions.outBus}\n */\n public get defaultMainBus(): Nullable<MainAudioBus> {\n if (this._mainBuses.size === 0) {\n return null;\n }\n\n if (!this._defaultMainBus) {\n this._defaultMainBus = Array.from(this._mainBuses)[0];\n }\n\n return this._defaultMainBus;\n }\n\n /**\n * The spatial audio listener properties for the audio engine.\n * - Each audio engine has exactly one listener.\n */\n public abstract readonly listener: AbstractSpatialAudioListener;\n\n /**\n * The main output node.\n * - This is the last node in the audio graph before the audio is sent to the speakers.\n */\n public abstract readonly mainOut: AbstractAudioNode;\n\n /**\n * The current state of the audio engine.\n *\n * Possible values are:\n * - `\"closed\"`: The audio engine has been closed.\n * - `\"interrupted\"`: The audio engine has been interrupted and is not running.\n * - `\"running\"`: The audio engine is running normally.\n * - `\"suspended\"`: The audio engine is suspended and is not running.\n */\n public abstract readonly state: AudioEngineV2State;\n\n /**\n * The output volume of the audio engine.\n */\n public abstract volume: number;\n\n /**\n * The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).\n *\n * Due to limitations in some browsers, it is not recommended to set this value to longer than `0.01` seconds.\n *\n * Setting this value to longer than `0.01` seconds may result in errors being throw when setting audio parameters.\n */\n public get parameterRampDuration(): number {\n return this._parameterRampDuration;\n }\n\n public set parameterRampDuration(value: number) {\n this._parameterRampDuration = Math.max(0, value);\n }\n\n /**\n * Creates a new audio bus.\n * @param name - The name of the audio bus.\n * @param options - The options to use when creating the audio bus.\n * @param engine - The audio engine.\n * @returns A promise that resolves with the created audio bus.\n */\n public abstract createBusAsync(name: string, options?: Partial<IAudioBusOptions>): Promise<AudioBus>;\n\n /**\n * Creates a new main audio bus.\n * @param name - The name of the main audio bus.\n * @param options - The options to use when creating the main audio bus.\n * @returns A promise that resolves with the created main audio bus.\n */\n public abstract createMainBusAsync(name: string, options?: Partial<IMainAudioBusOptions>): Promise<MainAudioBus>;\n\n /**\n * Creates a new microphone sound source.\n * @param name - The name of the sound.\n * @param options - The options for the sound source.\n * @returns A promise that resolves to the created sound source.\n */\n public abstract createMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>): Promise<AbstractSoundSource>;\n\n /**\n * Creates a new static sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the static sound.\n * @returns A promise that resolves to the created static sound.\n */\n public abstract createSoundAsync(\n name: string,\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options?: Partial<IStaticSoundOptions>\n ): Promise<StaticSound>;\n\n /**\n * Creates a new static sound buffer.\n * @param source - The source of the sound buffer.\n * @param options - The options for the static sound buffer.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created static sound buffer.\n */\n public abstract createSoundBufferAsync(\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options?: Partial<IStaticSoundBufferOptions>\n ): Promise<StaticSoundBuffer>;\n\n /**\n * Creates a new sound source.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the sound source.\n * @returns A promise that resolves to the created sound source.\n */\n public abstract createSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>): Promise<AbstractSoundSource>;\n\n /**\n * Creates a new streaming sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the streaming sound.\n * @returns A promise that resolves to the created streaming sound.\n */\n public abstract createStreamingSoundAsync(name: string, source: HTMLMediaElement | string | string[], options?: Partial<IStreamingSoundOptions>): Promise<StreamingSound>;\n\n /**\n * Releases associated resources.\n */\n public dispose(): void {\n if (Instances.includes(this)) {\n Instances.splice(Instances.indexOf(this), 1);\n }\n\n const nodeIt = this._nodes.values();\n for (let next = nodeIt.next(); !next.done; next = nodeIt.next()) {\n next.value.dispose();\n }\n\n this._mainBuses.clear();\n this._nodes.clear();\n\n this._defaultMainBus = null;\n }\n\n /**\n * Checks if the specified format is valid.\n * @param format The format to check as an audio file extension like \"mp3\" or \"wav\".\n * @returns `true` if the format is valid; otherwise `false`.\n */\n public abstract isFormatValid(format: string): boolean;\n\n /**\n * Pauses the audio engine if it is running.\n * @returns A promise that resolves when the audio engine is paused.\n */\n public abstract pauseAsync(): Promise<void>;\n\n /**\n * Resumes the audio engine if it is not running.\n * @returns A promise that resolves when the audio engine is running.\n */\n public abstract resumeAsync(): Promise<void>;\n\n /**\n * Sets the audio output volume with optional ramping.\n * If the duration is 0 then the volume is set immediately, otherwise it is ramped to the new value over the given duration using the given shape.\n * If a ramp is already in progress then the volume is not set and an error is thrown.\n * @param value The value to set the volume to.\n * @param options The options to use for ramping the volume change.\n */\n public abstract setVolume(value: number, options?: Partial<IAudioParameterRampOptions>): void;\n\n /**\n * Unlocks the audio engine if it is locked.\n * - Note that the returned promise may already be resolved if the audio engine is already unlocked.\n * @returns A promise that is resolved when the audio engine is unlocked.\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\n public unlockAsync(): Promise<void> {\n return this.resumeAsync();\n }\n\n protected _addMainBus(mainBus: MainAudioBus): void {\n this._mainBuses.add(mainBus);\n\n this._addNode(mainBus);\n }\n\n protected _removeMainBus(mainBus: MainAudioBus): void {\n this._mainBuses.delete(mainBus);\n this._defaultMainBus = null;\n\n this._removeNode(mainBus);\n }\n\n protected _addNode(node: AbstractNamedAudioNode): void {\n this._nodes.add(node);\n }\n\n protected _removeNode(node: AbstractNamedAudioNode): void {\n this._nodes.delete(node);\n }\n}\n\n/**\n * @internal\n * @param engine - The given audio engine. If `null` then the last created audio engine is used.\n * @returns the given audio engine or the last created audio engine.\n * @throws An error if the resulting engine is `null`.\n */\nexport function _GetAudioEngine(engine: Nullable<AudioEngineV2>): AudioEngineV2 {\n if (!engine) {\n engine = LastCreatedAudioEngine();\n }\n\n if (engine) {\n return engine;\n }\n\n throw new Error(\"No audio engine.\");\n}\n\n/**\n * Creates a new audio bus.\n * @param name - The name of the audio bus.\n * @param options - The options to use when creating the audio bus.\n * @param engine - The audio engine.\n * @returns A promise that resolves with the created audio bus.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateAudioBusAsync(name: string, options: Partial<IAudioBusOptions> = {}, engine: Nullable<AudioEngineV2> = null): Promise<AudioBus> {\n engine = _GetAudioEngine(engine);\n return engine.createBusAsync(name, options);\n}\n\n/**\n * Creates a new main audio bus.\n * @param name - The name of the main audio bus.\n * @param options - The options to use when creating the main audio bus.\n * @param engine - The audio engine.\n * @returns A promise that resolves with the created main audio bus.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateMainAudioBusAsync(name: string, options: Partial<IMainAudioBusOptions> = {}, engine: Nullable<AudioEngineV2> = null): Promise<MainAudioBus> {\n engine = _GetAudioEngine(engine);\n return engine.createMainBusAsync(name, options);\n}\n\n/**\n * Creates a new microphone sound source.\n * @param name - The name of the sound.\n * @param options - The options for the sound source.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created sound source.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateMicrophoneSoundSourceAsync(name: string, options: Partial<ISoundSourceOptions> = {}, engine: Nullable<AudioEngineV2> = null): Promise<AbstractSoundSource> {\n engine = _GetAudioEngine(engine);\n return engine.createMicrophoneSoundSourceAsync(name, options);\n}\n\n/**\n * Creates a new static sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the static sound.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created static sound.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateSoundAsync(\n name: string,\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options: Partial<IStaticSoundOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<StaticSound> {\n engine = _GetAudioEngine(engine);\n return engine.createSoundAsync(name, source, options);\n}\n\n/**\n * Creates a new static sound buffer.\n * @param source - The source of the sound buffer.\n * @param options - The options for the static sound buffer.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created static sound buffer.\n */\nexport async function CreateSoundBufferAsync(\n source: ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[],\n options: Partial<IStaticSoundBufferOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<StaticSoundBuffer> {\n engine = _GetAudioEngine(engine);\n return await engine.createSoundBufferAsync(source, options);\n}\n\n/**\n * Creates a new sound source.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the sound source.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created sound source.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateSoundSourceAsync(\n name: string,\n source: AudioNode,\n options: Partial<ISoundSourceOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<AbstractSoundSource> {\n engine = _GetAudioEngine(engine);\n return engine.createSoundSourceAsync(name, source, options);\n}\n\n/**\n * Creates a new streaming sound.\n * @param name - The name of the sound.\n * @param source - The source of the sound.\n * @param options - The options for the streaming sound.\n * @param engine - The audio engine.\n * @returns A promise that resolves to the created streaming sound.\n */\n// eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\nexport function CreateStreamingSoundAsync(\n name: string,\n source: HTMLMediaElement | string | string[],\n options: Partial<IStreamingSoundOptions> = {},\n engine: Nullable<AudioEngineV2> = null\n): Promise<StreamingSound> {\n engine = _GetAudioEngine(engine);\n return engine.createStreamingSoundAsync(name, source, options);\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable import/no-internal-modules */
|
|
2
2
|
export * from "./abstractAudioBus.js";
|
|
3
3
|
export * from "./abstractAudioNode.js";
|
|
4
|
+
export * from "./abstractAudioOutNode.js";
|
|
4
5
|
export * from "./abstractSound.js";
|
|
5
6
|
export * from "./audioBus.js";
|
|
6
7
|
export * from "./audioEngineV2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nexport * from \"./abstractAudioBus\";\nexport * from \"./abstractAudioNode\";\nexport * from \"./abstractSound\";\nexport * from \"./audioBus\";\nexport * from \"./audioEngineV2\";\nexport * from \"./mainAudioBus\";\nexport * from \"./staticSound\";\nexport * from \"./staticSoundBuffer\";\nexport * from \"./streamingSound\";\nexport * from \"./subProperties/index\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\nexport * from \"./abstractAudioBus\";\nexport * from \"./abstractAudioNode\";\nexport * from \"./abstractAudioOutNode\";\nexport * from \"./abstractSound\";\nexport * from \"./audioBus\";\nexport * from \"./audioEngineV2\";\nexport * from \"./mainAudioBus\";\nexport * from \"./staticSound\";\nexport * from \"./staticSoundBuffer\";\nexport * from \"./streamingSound\";\nexport * from \"./subProperties/index\";\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Nullable } from "../../../types.js";
|
|
2
|
+
import type { IAudioParameterRampOptions } from "../../audioParameter.js";
|
|
2
3
|
import type { AudioEngineV2 } from "../audioEngineV2.js";
|
|
3
4
|
import { _AbstractAudioSubNode } from "../subNodes/abstractAudioSubNode.js";
|
|
4
5
|
import type { _AbstractAudioSubGraph } from "./abstractAudioSubGraph.js";
|
|
@@ -21,6 +22,8 @@ export declare abstract class _VolumeAudioSubNode extends _AbstractAudioSubNode
|
|
|
21
22
|
abstract volume: number;
|
|
22
23
|
/** @internal */
|
|
23
24
|
setOptions(options: Partial<IVolumeAudioOptions>): void;
|
|
25
|
+
/** @internal */
|
|
26
|
+
abstract setVolume(value: number, options?: Nullable<Partial<IAudioParameterRampOptions>>): void;
|
|
24
27
|
}
|
|
25
28
|
/** @internal */
|
|
26
29
|
export declare function _GetVolumeAudioSubNode(subGraph: _AbstractAudioSubGraph): Nullable<_VolumeAudioSubNode>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumeAudioSubNode.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"volumeAudioSubNode.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAIzE,gBAAgB;AAChB,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,MAAM,EAAE,CAAW;CACb,CAAC;AAYX,gBAAgB;AAChB,MAAM,OAAgB,mBAAoB,SAAQ,qBAAqB;IACnE,YAAsB,MAAqB;QACvC,KAAK,qCAAsB,MAAM,CAAC,CAAC;IACvC,CAAC;IAID,gBAAgB;IACT,UAAU,CAAC,OAAqC;QACnD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,CAAC;IAChE,CAAC;CAIJ;AAED,gBAAgB;AAChB,MAAM,UAAU,sBAAsB,CAAC,QAAgC;IACnE,OAAO,QAAQ,CAAC,UAAU,oCAA0C,CAAC;AACzE,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,uBAAuB,CAA8C,QAAgC,EAAE,QAAW;IAC9H,OAAO,sBAAsB,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAC1F,CAAC","sourcesContent":["import type { Nullable } from \"../../../types\";\nimport type { IAudioParameterRampOptions } from \"../../audioParameter\";\nimport type { AudioEngineV2 } from \"../audioEngineV2\";\nimport { _AbstractAudioSubNode } from \"../subNodes/abstractAudioSubNode\";\nimport { AudioSubNode } from \"../subNodes/audioSubNode\";\nimport type { _AbstractAudioSubGraph } from \"./abstractAudioSubGraph\";\n\n/** @internal */\nexport const _VolumeAudioDefaults = {\n volume: 1 as number,\n} as const;\n\n/**\n * Volume options.\n */\nexport interface IVolumeAudioOptions {\n /**\n * The volume/gain. Defaults to 1.\n */\n volume: number;\n}\n\n/** @internal */\nexport abstract class _VolumeAudioSubNode extends _AbstractAudioSubNode {\n protected constructor(engine: AudioEngineV2) {\n super(AudioSubNode.VOLUME, engine);\n }\n\n public abstract volume: number;\n\n /** @internal */\n public setOptions(options: Partial<IVolumeAudioOptions>): void {\n this.volume = options.volume ?? _VolumeAudioDefaults.volume;\n }\n\n /** @internal */\n public abstract setVolume(value: number, options?: Nullable<Partial<IAudioParameterRampOptions>>): void;\n}\n\n/** @internal */\nexport function _GetVolumeAudioSubNode(subGraph: _AbstractAudioSubGraph): Nullable<_VolumeAudioSubNode> {\n return subGraph.getSubNode<_VolumeAudioSubNode>(AudioSubNode.VOLUME);\n}\n\n/** @internal */\nexport function _GetVolumeAudioProperty<K extends keyof typeof _VolumeAudioDefaults>(subGraph: _AbstractAudioSubGraph, property: K): (typeof _VolumeAudioDefaults)[K] {\n return _GetVolumeAudioSubNode(subGraph)?.[property] ?? _VolumeAudioDefaults[property];\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of the audio ramp used to set an audio parameter's value, such as a sound's volume.
|
|
3
|
+
*/
|
|
4
|
+
export declare enum AudioParameterRampShape {
|
|
5
|
+
/**
|
|
6
|
+
* The ramp is linear.
|
|
7
|
+
*/
|
|
8
|
+
Linear = "linear",
|
|
9
|
+
/**
|
|
10
|
+
* The ramp is exponential.
|
|
11
|
+
*/
|
|
12
|
+
Exponential = "exponential",
|
|
13
|
+
/**
|
|
14
|
+
* The ramp is logarithmic.
|
|
15
|
+
*/
|
|
16
|
+
Logarithmic = "logarithmic"
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Options for ramping an audio parameter's value.
|
|
20
|
+
*/
|
|
21
|
+
export interface IAudioParameterRampOptions {
|
|
22
|
+
/**
|
|
23
|
+
* The ramp time, in seconds. Must be greater than 0. Defaults to 0.01 seconds.
|
|
24
|
+
* The audio parameter's value will reach the target value at the end of the duration.
|
|
25
|
+
*/
|
|
26
|
+
duration: number;
|
|
27
|
+
/**
|
|
28
|
+
* The shape of the ramp to use for the parameter change. Defaults to {@link AudioParameterRampShape.Linear}.
|
|
29
|
+
*/
|
|
30
|
+
shape: AudioParameterRampShape;
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of the audio ramp used to set an audio parameter's value, such as a sound's volume.
|
|
3
|
+
*/
|
|
4
|
+
export var AudioParameterRampShape;
|
|
5
|
+
(function (AudioParameterRampShape) {
|
|
6
|
+
/**
|
|
7
|
+
* The ramp is linear.
|
|
8
|
+
*/
|
|
9
|
+
AudioParameterRampShape["Linear"] = "linear";
|
|
10
|
+
/**
|
|
11
|
+
* The ramp is exponential.
|
|
12
|
+
*/
|
|
13
|
+
AudioParameterRampShape["Exponential"] = "exponential";
|
|
14
|
+
/**
|
|
15
|
+
* The ramp is logarithmic.
|
|
16
|
+
*/
|
|
17
|
+
AudioParameterRampShape["Logarithmic"] = "logarithmic";
|
|
18
|
+
})(AudioParameterRampShape || (AudioParameterRampShape = {}));
|
|
19
|
+
//# sourceMappingURL=audioParameter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audioParameter.js","sourceRoot":"","sources":["../../../../dev/core/src/AudioV2/audioParameter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAkB,uBAajB;AAbD,WAAkB,uBAAuB;IACrC;;OAEG;IACH,4CAAiB,CAAA;IACjB;;OAEG;IACH,sDAA2B,CAAA;IAC3B;;OAEG;IACH,sDAA2B,CAAA;AAC/B,CAAC,EAbiB,uBAAuB,KAAvB,uBAAuB,QAaxC","sourcesContent":["/**\n * The shape of the audio ramp used to set an audio parameter's value, such as a sound's volume.\n */\nexport const enum AudioParameterRampShape {\n /**\n * The ramp is linear.\n */\n Linear = \"linear\",\n /**\n * The ramp is exponential.\n */\n Exponential = \"exponential\",\n /**\n * The ramp is logarithmic.\n */\n Logarithmic = \"logarithmic\",\n}\n\n/**\n * Options for ramping an audio parameter's value.\n */\nexport interface IAudioParameterRampOptions {\n /**\n * The ramp time, in seconds. Must be greater than 0. Defaults to 0.01 seconds.\n * The audio parameter's value will reach the target value at the end of the duration.\n */\n duration: number;\n /**\n * The shape of the ramp to use for the parameter change. Defaults to {@link AudioParameterRampShape.Linear}.\n */\n shape: AudioParameterRampShape;\n}\n"]}
|
package/AudioV2/audioUtils.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { AudioParameterRampShape } from "./audioParameter.js";
|
|
1
2
|
export declare const _FileExtensionRegex: RegExp;
|
|
2
3
|
/** @internal */
|
|
4
|
+
export declare function _GetAudioParamCurveValues(shape: AudioParameterRampShape, from: number, to: number): Float32Array;
|
|
5
|
+
/** @internal */
|
|
3
6
|
export declare function _CleanUrl(url: string): string;
|