@babylonjs/lite-compat 1.5.0-preview → 1.6.0-preview

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/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { AnimationGroup as AnimationGroup_2 } from '@babylonjs/lite';
2
2
  import { AnisotropyProps } from '@babylonjs/lite';
3
3
  import { AssetContainer as AssetContainer_2 } from '@babylonjs/lite';
4
+ import { AudioGraphHost } from '@babylonjs/lite';
4
5
  import { ClearCoatProps } from '@babylonjs/lite';
5
6
  import { EngineContext } from '@babylonjs/lite';
6
7
  import { EngineOptions } from '@babylonjs/lite';
@@ -26,6 +27,78 @@ export declare abstract class AbstractAssetTask {
26
27
  /** Run the task. Subclasses populate their result fields here. */
27
28
  abstract runAsync(): Promise<void>;
28
29
 
30
+ /** Babylon.js `AbstractAudioAnalyzer` — the `sound.analyzer` / `bus.analyzer` sub-property. */
31
+ export declare class AbstractAudioAnalyzer {
32
+ private readonly _host;
33
+ private _fftSize;
34
+ private _minDecibels;
35
+ private _maxDecibels;
36
+ private _smoothing;
37
+ private _enabled;
29
38
  /** FFT window size. */
39
+ get fftSize(): AudioAnalyzerFFTSizeType;
40
+ set fftSize(value: AudioAnalyzerFFTSizeType);
41
+ /** Number of frequency bins (`fftSize / 2`). */
42
+ get frequencyBinCount(): number;
43
+ /** Whether the analyzer is enabled. */
44
+ get isEnabled(): boolean;
45
+ /** Minimum dB. */
46
+ get minDecibels(): number;
47
+ set minDecibels(value: number);
48
+ /** Maximum dB. */
49
+ get maxDecibels(): number;
50
+ set maxDecibels(value: number);
51
+ /** Time-averaging constant `[0, 1]`. */
52
+ get smoothing(): number;
53
+ set smoothing(value: number);
54
+ /** Builds (enables) the analyzer tap. */
55
+ enableAsync(): Promise<void>;
56
+ /** Returns the byte frequency-domain data. Empty when disabled. */
57
+ getByteFrequencyData(): Uint8Array;
58
+ /** Returns the float frequency-domain data. Empty when disabled. */
59
+ getFloatFrequencyData(): Float32Array;
60
+ /** Returns the byte time-domain data. Empty when disabled. */
61
+ getByteTimeDomainData(): Uint8Array;
62
+ /** Returns the float time-domain data. Empty when disabled. */
63
+ getFloatTimeDomainData(): Float32Array;
64
+ /** Disposes the analyzer (Lite tears it down with the host). */
65
+ dispose(): void;
66
+ private _apply;
67
+ private _reapply;
68
+ }
69
+
70
+ /** Babylon.js `AbstractAudioBus` — base class for both bus kinds. */
71
+ export declare abstract class AbstractAudioBus extends AbstractAudioOutNode {
72
+ }
73
+
74
+ /** Babylon.js `AbstractAudioNode` — the root of the AudioV2 node hierarchy. */
75
+ export declare abstract class AbstractAudioNode {
76
+ /** The engine that owns this node. */
77
+ readonly engine: AudioEngineV2;
78
+ /** Fires when this node is disposed. */
79
+ readonly onDisposeObservable: Observable<AbstractAudioNode>;
80
+ protected constructor(engine: AudioEngineV2);
81
+ /** Disposes the node. */
82
+ dispose(): void;
83
+ /** The class name (mirrors Babylon.js `getClassName()`). */
84
+ abstract getClassName(): string;
85
+ }
86
+
87
+ /**
88
+ * Babylon.js `AbstractAudioOutNode` — a named node with a volume and a lazily
89
+ * created analyzer.
90
+ */
91
+ export declare abstract class AbstractAudioOutNode extends AbstractNamedAudioNode {
92
+ protected _volume: number;
93
+ private _analyzer;
94
+ /** The node output volume. */
95
+ get volume(): number;
96
+ set volume(value: number);
97
+ /** Lazily-built audio analyzer for this node's output. */
98
+ get analyzer(): AbstractAudioAnalyzer;
99
+ /** Sets the volume, optionally ramping. */
100
+ setVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;
101
+ dispose(): void;
102
+
30
103
  export declare abstract class AbstractEngine {
31
104
  protected readonly _canvas: RenderCanvas;
32
105
  private readonly _options;
33
106
  protected readonly _scenes: Scene[];
@@ -170,6 +243,18 @@ export declare class AbstractMesh extends TransformNode {
170
243
  private _material;
171
244
  dispose(): void;
172
245
  }
173
246
 
247
+ /** Babylon.js `AbstractNamedAudioNode` — an `AbstractAudioNode` with a mutable name. */
248
+ export declare abstract class AbstractNamedAudioNode extends AbstractAudioNode {
249
+ /** Fires when {@link name} changes. */
250
+ readonly onNameChangedObservable: Observable<IAudioNodeNameChange>;
251
+ private _name;
252
+ protected constructor(name: string, engine: AudioEngineV2);
253
+ /** The node name. */
254
+ get name(): string;
255
+ set name(value: string);
256
+ dispose(): void;
257
+ }
258
+
174
259
  export declare abstract class AbstractScene {
175
260
  /**
176
261
  * Babylon.js `scene.meshes`. Babylon Lite does not expose a public scene-mesh
177
262
  * registry, so this tracks the meshes the compat layer creates against a scene
@@ -211,6 +296,150 @@ export declare abstract class AbstractScene {
211
296
  /**
212
297
  getNodeById(id: string): Node_2 | null;
213
298
  }
214
299
 
300
+ /** Babylon.js `AbstractSound` — a playable sound (static or streaming). */
301
+ export declare abstract class AbstractSound extends AbstractSoundSource {
302
+ /** Fires when the sound finishes (all instances ended). */
303
+ readonly onEndedObservable: Observable<AbstractSound>;
304
+ protected constructor(name: string, engine: AudioEngineV2, outBus: PrimaryAudioBus | null);
305
+ /** Number of live playing instances. */
306
+ abstract get activeInstancesCount(): number;
307
+ /** Whether the sound auto-plays on creation. */
308
+ abstract get autoplay(): boolean;
309
+ /** Current playback state. */
310
+ abstract get state(): SoundState;
311
+ /** Whether the sound loops. */
312
+ abstract get loop(): boolean;
313
+ abstract set loop(value: boolean);
314
+ /** Start offset, seconds. */
315
+ abstract get startOffset(): number;
316
+ abstract set startOffset(value: number);
317
+ /** Maximum simultaneous instances. */
318
+ abstract get maxInstances(): number;
319
+ abstract set maxInstances(value: number);
320
+ /** Current playback time of the newest instance, seconds. */
321
+ abstract get currentTime(): number;
322
+ abstract set currentTime(value: number);
323
+ /** Plays the sound. */
324
+ abstract play(options?: Partial<IStaticSoundPlayOptions & IStreamingSoundPlayOptions>): void;
325
+ /** Pauses the sound. */
326
+ abstract pause(): void;
327
+ /** Resumes the sound. */
328
+ abstract resume(options?: Partial<IStaticSoundPlayOptions & IStreamingSoundPlayOptions>): void;
329
+ /** Stops the sound. */
330
+ abstract stop(options?: Partial<IStaticSoundStopOptions>): void;
331
+ dispose(): void;
332
+ }
333
+
334
+ /** Babylon.js `AbstractSoundSource` — an out-node with an output bus + spatial/stereo. */
335
+ export declare abstract class AbstractSoundSource extends AbstractAudioOutNode {
336
+ private _spatial;
337
+ private _stereo;
338
+ protected _outBus: PrimaryAudioBus | null;
339
+ protected constructor(name: string, engine: AudioEngineV2, outBus: PrimaryAudioBus | null);
340
+ /** The output bus this source routes to. */
341
+ get outBus(): PrimaryAudioBus | null;
342
+ set outBus(value: PrimaryAudioBus | null);
343
+ /** Lazily-built spatial sub-property. */
344
+ get spatial(): AbstractSpatialAudio;
345
+ /** Lazily-built stereo sub-property. */
346
+ get stereo(): AbstractStereoAudio;
347
+ }
348
+
349
+ /** Babylon.js `AbstractSpatialAudio` — the `sound.spatial` / `bus.spatial` sub-property. */
350
+ export declare class AbstractSpatialAudio {
351
+ private readonly _host;
352
+ private _enabled;
353
+ private _position;
354
+ private _orientation;
355
+ private _rotationQuaternion;
356
+ /** Cone inner angle, radians. */
357
+ coneInnerAngle: number;
358
+ /** Cone outer angle, radians. */
359
+ coneOuterAngle: number;
360
+ /** Volume outside the cone. */
361
+ coneOuterVolume: number;
362
+ /** Distance attenuation model. */
363
+ distanceModel: DistanceModelType;
364
+ /** Max distance. */
365
+ maxDistance: number;
366
+ /** Reference / min distance. */
367
+ minDistance: number;
368
+ /** Minimum time between auto-updates, seconds. */
369
+ minUpdateTime: number;
370
+ /** Enable left/right panning. */
371
+ panningEnabled: boolean;
372
+ /** Panning algorithm. */
373
+ panningModel: PanningModelType;
374
+ /** Roll-off factor. */
375
+ rolloffFactor: number;
376
+ /** Whether following a scene node. */
377
+ useBoundingBox: boolean;
378
+ /** Which transform components are followed. */
379
+ attachmentType: SpatialAudioAttachmentType;
380
+ private _attachedNode;
215
381
  /** Source world position. */
382
+ get position(): Vector3;
383
+ set position(value: Vector3);
384
+ /** Source facing direction. */
385
+ get orientation(): Vector3;
386
+ set orientation(value: Vector3);
387
+ /** Source rotation quaternion. */
388
+ get rotationQuaternion(): Quaternion;
389
+ set rotationQuaternion(value: Quaternion);
390
+ /** Whether attached to a scene node. */
391
+ get isAttached(): boolean;
392
+ /** The scene node this source follows, if any. */
393
+ get attachedNode(): SpatialNodeLike | null;
394
+ /** Follows a scene node's world transform. */
395
+ attach(sceneNode: SpatialNodeLike | null, useBoundingBox?: boolean, attachmentType?: SpatialAudioAttachmentType): void;
396
+ /** Stops following a scene node. */
397
+ detach(): void;
398
+ /** Pulls the attached node's current world position/rotation into the source. */
399
+ update(): void;
400
+ /** Disposes the spatial sub-node (Lite tears it down with the host). */
401
+ dispose(): void;
402
+ private _ensure;
403
+ private _reapply;
404
+ private _options;
405
+ }
406
+
407
+ /** Babylon.js `AbstractSpatialAudioListener` — the engine's `listener` (the "ears"). */
408
+ export declare class AbstractSpatialAudioListener {
409
+ private readonly _engine;
410
+ private _position;
411
+ private _rotation;
412
+ private _rotationQuaternion;
413
+ private _attachedNode;
414
+ /** Minimum time between auto-updates, seconds. */
415
+ minUpdateTime: number;
216
416
  /** Whether attached to a scene node. */
417
+ get isAttached(): boolean;
418
+ /** The scene node the listener follows, if any. */
419
+ get attachedNode(): SpatialNodeLike | null;
420
+ /** Listener world position. */
421
+ get position(): Vector3;
422
+ set position(value: Vector3);
423
+ /** Listener Euler rotation. */
424
+ get rotation(): Vector3;
425
+ set rotation(value: Vector3);
426
+ /** Listener rotation quaternion. */
427
+ get rotationQuaternion(): Quaternion;
428
+ set rotationQuaternion(value: Quaternion);
429
+ /** Follows a scene node's world transform. */
430
+ attach(sceneNode: SpatialNodeLike | null): void;
431
+ /** Stops following a scene node. */
432
+ detach(): void;
433
+ /** Pulls the attached node's current world position/rotation into the listener. */
434
+ update(): void;
435
+ }
436
+
437
+ /** Babylon.js `AbstractStereoAudio` — the `sound.stereo` / `bus.stereo` sub-property. */
438
+ export declare class AbstractStereoAudio {
439
+ private readonly _host;
440
+ private _pan;
441
+ private _enabled;
217
442
  /** Stereo pan, `-1` (left) to `1` (right). */
443
+ get pan(): number;
444
+ set pan(value: number);
445
+ }
446
+
218
447
  /** Base class for actions. `execute` is implemented by subclasses. */
219
448
  export declare abstract class Action {
220
449
  trigger: number;
@@ -496,10 +725,110 @@ export declare class AssetsManager {
496
725
  loadAsync(): Promise<AbstractAssetTask[]>;
497
726
  }
498
727
 
728
+ /** FFT window sizes accepted by the analyzer (mirrors `AudioAnalyzerFFTSizeType`). */
729
+ export declare type AudioAnalyzerFFTSizeType = 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096 | 8192 | 16384 | 32768;
730
+
731
+ /** Babylon.js `AudioBus` — a generic mixer bus. */
732
+ export declare class AudioBus extends AbstractAudioBus {
499
733
  private _spatial;
734
+ private _stereo;
735
+ private _outBus;
500
736
  /** The output bus this bus routes to. */
737
+ get outBus(): PrimaryAudioBus | null;
738
+ set outBus(value: PrimaryAudioBus | null);
739
+ /** Lazily-built spatial sub-property. */
740
+ get spatial(): AbstractSpatialAudio;
741
+ /** Lazily-built stereo sub-property. */
742
+ get stereo(): AbstractStereoAudio;
743
+ getClassName(): string;
744
+ dispose(): void;
745
+ protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;
746
+ protected _spatialHost(): AudioGraphHost;
747
+ }
748
+
501
749
  export declare class AudioEngine {
502
750
  constructor();
503
751
  }
504
752
 
753
+ /**
754
+ * Babylon.js `AudioEngineV2` — the AudioV2 engine. Backed by a Lite audio engine.
755
+ * Created via {@link CreateAudioEngineAsync}.
756
+ */
757
+ export declare class AudioEngineV2 {
758
+ private static _Instances;
759
+ /** All live audio engines. */
760
+ static get Instances(): readonly AudioEngineV2[];
761
+ /** Fires when a named node is added to the engine. */
762
+ readonly onNodeAddedObservable: Observable<AbstractNamedAudioNode>;
763
+ /** Fires when a named node is removed from the engine. */
764
+ readonly onNodeRemovedObservable: Observable<AbstractNamedAudioNode>;
765
+ /** Fires when the engine is disposed. */
766
+ readonly onDisposeObservable: Observable<AudioEngineV2>;
505
767
  private readonly _sounds;
768
+ private readonly _nodes;
769
+ private _defaultMainBus;
770
+ private _listener;
771
+ private _mainOut;
506
772
  /** The audio context's current time, seconds. */
773
+ get currentTime(): number;
774
+ /** The context state. */
775
+ get state(): AudioEngineV2State;
776
+ /** Master output volume. */
777
+ get volume(): number;
778
+ set volume(value: number);
779
+ /** Default parameter ramp duration, seconds. */
780
+ get parameterRampDuration(): number;
781
+ set parameterRampDuration(value: number);
782
+ /** The default main bus all sounds route to. */
783
+ get defaultMainBus(): MainAudioBus | null;
784
+ /** The spatial-audio listener (the "ears"). */
785
+ get listener(): AbstractSpatialAudioListener;
786
+ /** The engine output node. */
787
+ get mainOut(): AbstractAudioNode;
788
+ /** All live sounds. */
789
+ get sounds(): readonly AbstractSound[];
790
+ /** All live named nodes. */
791
+ get nodes(): ReadonlySet<AbstractNamedAudioNode>;
792
+ /** Sets the master volume, optionally ramping. */
793
+ setVolume(value: number, options?: Partial<IAudioParameterRampOptions>): void;
794
+ /** Whether the given audio format/extension can be decoded. */
795
+ isFormatValid(format: string): boolean;
796
+ /** Suspends the engine context. */
797
+ pauseAsync(): Promise<void>;
798
+ /** Resumes the engine context. */
799
+ resumeAsync(): Promise<void>;
800
+ /** Resumes the engine context (alias of {@link resumeAsync}). */
801
+ unlockAsync(): Promise<void>;
802
+ /** Creates a buffer-backed sound. */
803
+ createSoundAsync(name: string, source: StaticSoundSource, options?: Partial<IStaticSoundOptions>): Promise<StaticSound>;
804
+ /** Creates a decoded sound buffer. */
805
+ createSoundBufferAsync(source: StaticSoundSource, options?: Partial<IStaticSoundBufferOptions>): Promise<StaticSoundBuffer>;
806
+ /** Creates a streaming, media-element-backed sound. */
807
+ createStreamingSoundAsync(name: string, source: HTMLMediaElement | string | string[], options?: Partial<IStreamingSoundOptions>): Promise<StreamingSound>;
808
+ /** Creates a generic mixer bus. */
809
+ createBusAsync(name: string, options?: Partial<IAudioBusOptions>): Promise<AudioBus>;
810
+ /**
811
+ * Creates a main bus. Babylon Lite builds a single default main bus per engine
812
+ * and does not expose creating additional ones, so this resolves the default
813
+ * main bus.
814
+ */
815
+ createMainBusAsync(_name: string, _options?: Partial<IMainAudioBusOptions>): Promise<MainAudioBus>;
816
+ /** Wraps an arbitrary Web Audio node as a sound source. */
817
+ createSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>): Promise<SoundSource>;
818
+ /** Creates a microphone-backed sound source. */
819
+ createMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>): Promise<SoundSource>;
820
+ /** Disposes the engine and all its sounds/buses. */
821
+ dispose(): void;
822
+
823
+ /** Engine context state (mirrors `AudioEngineV2State`). */
824
+ export declare type AudioEngineV2State = "closed" | "interrupted" | "running" | "suspended";
825
+
826
+ /** Ramp shape used when changing an audio parameter (mirrors `AudioParameterRampShape`). */
827
+ export declare const AudioParameterRampShape: {
828
+ readonly Linear: "linear";
829
+ readonly Exponential: "exponential";
830
+ readonly Logarithmic: "logarithmic";
831
+ readonly None: "none";
832
+ };
833
+
834
+ export declare type AudioParameterRampShape = (typeof AudioParameterRampShape)[keyof typeof AudioParameterRampShape];
835
+
507
836
  /** Idle auto-rotation of an `ArcRotateCamera` (spins `alpha` when not interacting). */
508
837
  export declare class AutoRotationBehavior implements Behavior<ArcRotateCamera> {
509
838
  readonly name = "AutoRotation";
@@ -809,6 +1138,12 @@ export declare const Constants: {
809
1138
  readonly TEXTURE_MIRROR_ADDRESSMODE: 2;
810
1139
  };
811
1140
 
1141
+ /** Babylon.js `CreateAudioBusAsync`. */
1142
+ export declare function CreateAudioBusAsync(name: string, options?: Partial<IAudioBusOptions>, engine?: AudioEngineV2 | null): Promise<AudioBus>;
1143
+
1144
+ /** Babylon.js `CreateAudioEngineAsync` — creates and initialises an AudioV2 engine. */
1145
+ export declare function CreateAudioEngineAsync(options?: Partial<IWebAudioEngineOptions>): Promise<AudioEngineV2>;
1146
+
812
1147
  /** Babylon.js `CreateBox(name, options, scene)` (boxBuilder). */
813
1148
  export declare function CreateBox(name: string, options: BoxOptions, scene: Scene): Mesh;
814
1149
 
@@ -821,12 +1156,30 @@ export declare function CreateDisc(name: string, options: object, scene: Scene):
821
1156
  /** Babylon.js `CreateGround(name, options, scene)` (groundBuilder). */
822
1157
  export declare function CreateGround(name: string, options: GroundOptions, scene: Scene): Mesh;
823
1158
 
1159
+ /** Babylon.js `CreateMainAudioBusAsync`. */
1160
+ export declare function CreateMainAudioBusAsync(name: string, options?: Partial<IMainAudioBusOptions>, engine?: AudioEngineV2 | null): Promise<MainAudioBus>;
1161
+
1162
+ /** Babylon.js `CreateMicrophoneSoundSourceAsync`. */
1163
+ export declare function CreateMicrophoneSoundSourceAsync(name: string, options?: Partial<ISoundSourceOptions>, engine?: AudioEngineV2 | null): Promise<SoundSource>;
1164
+
824
1165
  /** Babylon.js `CreatePlane(name, options, scene)` (planeBuilder). */
825
1166
  export declare function CreatePlane(name: string, options: PlaneOptions, scene: Scene): Mesh;
826
1167
 
1168
+ /** Babylon.js `CreateSoundAsync`. */
1169
+ export declare function CreateSoundAsync(name: string, source: StaticSoundSource, options?: Partial<IStaticSoundOptions>, engine?: AudioEngineV2 | null): Promise<StaticSound>;
1170
+
1171
+ /** Babylon.js `CreateSoundBufferAsync`. */
1172
+ export declare function CreateSoundBufferAsync(source: StaticSoundSource, options?: Partial<IStaticSoundBufferOptions>, engine?: AudioEngineV2 | null): Promise<StaticSoundBuffer>;
1173
+
1174
+ /** Babylon.js `CreateSoundSourceAsync`. */
1175
+ export declare function CreateSoundSourceAsync(name: string, source: AudioNode, options?: Partial<ISoundSourceOptions>, engine?: AudioEngineV2 | null): Promise<SoundSource>;
1176
+
827
1177
  /** Babylon.js `CreateSphere(name, options, scene)` (sphereBuilder). */
828
1178
  export declare function CreateSphere(name: string, options: SphereOptions, scene: Scene): Mesh;
829
1179
 
1180
+ /** Babylon.js `CreateStreamingSoundAsync`. */
1181
+ export declare function CreateStreamingSoundAsync(name: string, source: HTMLMediaElement | string | string[], options?: Partial<IStreamingSoundOptions>, engine?: AudioEngineV2 | null): Promise<StreamingSound>;
1182
+
830
1183
  /** Babylon.js `CreateTorus(name, options, scene)` (torusBuilder). */
831
1184
  export declare function CreateTorus(name: string, options: object, scene: Scene): Mesh;
832
1185
 
@@ -1348,6 +1701,20 @@ export declare class HighlightLayer {
1348
1701
  constructor();
1349
1702
  }
1350
1703
 
1704
+ /** Babylon.js `IAbstractSoundOptions` (subset). */
1705
+ export declare interface IAbstractSoundOptions extends Partial<IVolumeAudioOptions> {
1706
+ /** Play immediately once ready. Defaults to `false`. */
1707
+ autoplay?: boolean;
1708
+ /** Maximum simultaneous instances. Defaults to `Infinity`. */
1709
+ maxInstances?: number;
1710
+ /** Loop playback. Defaults to `false`. */
1711
+ loop?: boolean;
1712
+ /** Start offset in seconds. Defaults to `0`. */
1713
+ startOffset?: number;
1714
+ /** Output bus. */
1715
+ outBus?: PrimaryAudioBus;
1716
+ }
1717
+
1351
1718
  export declare interface IAnimationKey {
1352
1719
  frame: number;
1353
1720
  value: number | number[];
@@ -1355,6 +1722,52 @@ export declare interface IAnimationKey {
1355
1722
  interpolation?: number;
1356
1723
  }
1357
1724
 
1725
+ /** Babylon.js `IAudioAnalyzerOptions`. */
1726
+ export declare interface IAudioAnalyzerOptions {
1727
+ /** Build the analyzer immediately. Defaults to `false`. */
1728
+ analyzerEnabled: boolean;
1729
+ /** FFT window size. Defaults to `2048`. */
1730
+ analyzerFFTSize: AudioAnalyzerFFTSizeType;
1731
+ /** Minimum dB. Defaults to `-100`. */
1732
+ analyzerMinDecibels: number;
1733
+ /** Maximum dB. Defaults to `-30`. */
1734
+ analyzerMaxDecibels: number;
1735
+ /** Time-averaging constant `[0, 1]`. Defaults to `0.8`. */
1736
+ analyzerSmoothing: number;
1737
+ }
1738
+
1739
+ /** Babylon.js `IAudioBusOptions` (subset). */
1740
+ export declare interface IAudioBusOptions extends Partial<IVolumeAudioOptions> {
1741
+ /** Output bus. Defaults to the engine's default main bus. */
1742
+ outBus?: PrimaryAudioBus;
1743
+ }
1744
+
1745
+ /** Babylon.js `IAudioEngineV2Options` (subset backed by Lite). */
1746
+ export declare interface IAudioEngineV2Options {
1747
+ /** Default parameter ramp duration, in seconds. Defaults to `0.01`. */
1748
+ parameterRampDuration: number;
1749
+ /** Initial output volume. Defaults to `1`. */
1750
+ volume: number;
1751
+ }
1752
+
1753
+ /** Payload for `AbstractNamedAudioNode.onNameChangedObservable`. */
1754
+ export declare interface IAudioNodeNameChange {
1755
+ /** The new name. */
1756
+ newName: string;
1757
+ /** The previous name. */
1758
+ oldName: string;
1759
+ /** The node whose name changed. */
1760
+ node: AbstractNamedAudioNode;
1761
+ }
1762
+
1763
+ /** Babylon.js `IAudioParameterRampOptions`. */
1764
+ export declare interface IAudioParameterRampOptions {
1765
+ /** Ramp time, in seconds. */
1766
+ duration: number;
1767
+ /** Ramp shape. */
1768
+ shape: AudioParameterRampShape;
1769
+ }
1770
+
1358
1771
  /** Result of a multi-point GPU pick. Mirrors Babylon.js `IGPUMultiPickingInfo`. */
1359
1772
  export declare interface IGPUMultiPickingInfo {
1360
1773
  meshes: Array<PickableMesh | null>;
@@ -1378,6 +1791,10 @@ export declare class ImageProcessingConfiguration {
1378
1791
  static readonly TONEMAPPING_KHR_PBR_NEUTRAL = 2;
1379
1792
  }
1380
1793
 
1794
+ /** Babylon.js `IMainAudioBusOptions`. */
1795
+ export declare interface IMainAudioBusOptions extends Partial<IVolumeAudioOptions> {
1796
+ }
1797
+
1381
1798
  /** Babylon.js `ImportMeshAsync(source, scene, options?)` — imports an asset into the scene. */
1382
1799
  export declare function ImportMeshAsync(source: string, scene: Scene, _options?: unknown): Promise<ImportResult>;
1383
1800
 
@@ -1409,6 +1826,140 @@ export declare class InstancedMesh {
1409
1826
  constructor();
1410
1827
  }
1411
1828
 
1829
+ /** Babylon.js `ISoundSourceOptions` (subset). */
1830
+ export declare interface ISoundSourceOptions extends Partial<IVolumeAudioOptions> {
1831
+ /** Name. */
1832
+ name?: string;
1833
+ /** Output bus. */
1834
+ outBus?: PrimaryAudioBus | null;
1835
+ /** Auto-assign the default main bus when `outBus` is null. */
1836
+ outBusAutoDefault?: boolean;
1837
+ }
1838
+
1839
+ /** Babylon.js `ISpatialAudioOptions` (subset backed by Lite). */
1840
+ export declare interface ISpatialAudioOptions {
1841
+ /** Build spatial immediately. */
1842
+ spatialEnabled: boolean;
1843
+ /** Cone inner angle, radians. */
1844
+ spatialConeInnerAngle: number;
1845
+ /** Cone outer angle, radians. */
1846
+ spatialConeOuterAngle: number;
1847
+ /** Volume outside the cone. */
1848
+ spatialConeOuterVolume: number;
1849
+ /** Distance attenuation model. */
1850
+ spatialDistanceModel: DistanceModelType;
1851
+ /** Max distance. */
1852
+ spatialMaxDistance: number;
1853
+ /** Reference / min distance. */
1854
+ spatialMinDistance: number;
1855
+ /** Source facing direction. */
1856
+ spatialOrientation: Vector3;
1857
+ /** Enable left/right panning. */
1858
+ spatialPanningEnabled: boolean;
1859
+ /** Panning algorithm. */
1860
+ spatialPanningModel: PanningModelType;
1861
+ /** Source world position. */
1862
+ spatialPosition: Vector3;
1863
+ /** Roll-off factor. */
1864
+ spatialRolloffFactor: number;
1865
+ /** Source rotation quaternion. */
1866
+ spatialRotationQuaternion: Quaternion;
1867
+ }
1868
+
1869
+ /** Babylon.js `IStaticSoundBufferOptions`. */
1870
+ export declare interface IStaticSoundBufferOptions {
1871
+ /** Skip codec checks when the source is a URL list. Defaults to `false`. */
1872
+ skipCodecCheck: boolean;
1873
+ }
1874
+
1875
+ /** Babylon.js `IStaticSoundCloneOptions`. */
1876
+ export declare interface IStaticSoundCloneOptions {
1877
+ /** Clone the underlying buffer (Lite reuses the same buffer). Defaults to `false`. */
1878
+ cloneBuffer?: boolean;
1879
+ /** Output bus for the clone. */
1880
+ outBus?: PrimaryAudioBus | null;
1881
+ }
1882
+
1883
+ /** Babylon.js `IStaticSoundOptions`. */
1884
+ export declare interface IStaticSoundOptions extends IAbstractSoundOptions, Partial<IStaticSoundBufferOptions> {
1885
+ /** Play duration in seconds (`0` = full). */
1886
+ duration?: number;
1887
+ /** Loop end, seconds. */
1888
+ loopEnd?: number;
1889
+ /** Loop start, seconds. */
1890
+ loopStart?: number;
1891
+ /** Detune in cents. */
1892
+ pitch?: number;
1893
+ /** Playback rate multiplier. */
1894
+ playbackRate?: number;
1895
+ }
1896
+
1897
+ /** Babylon.js `IStaticSoundPlayOptions`. */
1898
+ export declare interface IStaticSoundPlayOptions {
1899
+ /** Loop playback. */
1900
+ loop?: boolean;
1901
+ /** Start offset in seconds. */
1902
+ startOffset?: number;
1903
+ /** Play duration in seconds. */
1904
+ duration?: number;
1905
+ /** Loop start, seconds. */
1906
+ loopStart?: number;
1907
+ /** Loop end, seconds. */
1908
+ loopEnd?: number;
1909
+ /** Per-instance volume. */
1910
+ volume?: number;
1911
+ /** Delay before playback, seconds. */
1912
+ waitTime?: number;
1913
+ }
1914
+
1915
+ /** Babylon.js `IStaticSoundStopOptions`. */
1916
+ export declare interface IStaticSoundStopOptions {
1917
+ /** Delay before stopping, seconds. */
1918
+ waitTime?: number;
1919
+ }
1920
+
1921
+ /** Babylon.js `IStereoAudioOptions`. */
1922
+ export declare interface IStereoAudioOptions {
1923
+ /** Build stereo immediately. Defaults to `false`. */
1924
+ stereoEnabled: boolean;
1925
+ /** Pan `-1` (left) to `1` (right). Defaults to `0`. */
1926
+ stereoPan: number;
1927
+ }
1928
+
1929
+ /** Babylon.js `IStreamingSoundOptions`. */
1930
+ export declare interface IStreamingSoundOptions extends IAbstractSoundOptions {
1931
+ /** Number of instances to preload. Defaults to `1`. */
1932
+ preloadCount?: number;
1933
+ }
1934
+
1935
+ /** Babylon.js `IStreamingSoundPlayOptions`. */
1936
+ export declare interface IStreamingSoundPlayOptions {
1937
+ /** Loop playback. */
1938
+ loop?: boolean;
1939
+ /** Start offset in seconds. */
1940
+ startOffset?: number;
1941
+ /** Per-instance volume. */
1942
+ volume?: number;
1943
+ }
1944
+
1945
+ /** Babylon.js `IVolumeAudioOptions`. */
1946
+ export declare interface IVolumeAudioOptions {
1947
+ /** Volume / gain. Defaults to `1`. */
1948
+ volume: number;
1949
+ }
1950
+
1951
+ /** Babylon.js `IWebAudioEngineOptions`. */
1952
+ export declare interface IWebAudioEngineOptions extends IAudioEngineV2Options {
1953
+ /** An existing audio context (pass an `OfflineAudioContext` for headless rendering). */
1954
+ audioContext: BaseAudioContext;
1955
+ /** Auto-resume the context on user interaction. Defaults to `true`. */
1956
+ resumeOnInteraction: boolean;
1957
+ /** Auto-resume the context if the browser pauses playback. Defaults to `true`. */
1958
+ resumeOnPause: boolean;
1959
+ /** Retry interval (ms) for `resumeOnPause`. Defaults to `1000`. */
1960
+ resumeOnPauseRetryInterval: number;
1961
+ }
1962
+
1412
1963
  /**
1413
1964
  * Babylon.js `KHR_materials_variants` extension helpers. Mirrors the static
1414
1965
  * surface ported code calls (`SelectVariant` / `GetAvailableVariants` / `Reset`)
@@ -1423,6 +1974,9 @@ export declare const KHR_materials_variants: {
1423
1974
  Reset(rootMesh: unknown): void;
1424
1975
  };
1425
1976
 
1977
+ /** Babylon.js `LastCreatedAudioEngine()` — the most recently created engine, if any. */
1978
+ export declare function LastCreatedAudioEngine(): AudioEngineV2 | null;
1979
+
1426
1980
  export declare class Layer {
1427
1981
  constructor();
1428
1982
  }
@@ -1511,6 +2065,12 @@ export declare const Logger: {
1511
2065
  Error(message: string): void;
1512
2066
  };
1513
2067
 
2068
+ /** Babylon.js `MainAudioBus` — a bus that connects directly to the engine output. */
2069
+ export declare class MainAudioBus extends AbstractAudioBus {
1514
2070
  getClassName(): string;
2071
+ protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;
2072
+ protected _spatialHost(): AudioGraphHost;
2073
+ }
2074
+
1515
2075
  /** Babylon.js `Material` — base class for all materials. */
1516
2076
  export declare abstract class Material {
1517
2077
  name: string;
@@ -1833,6 +2393,9 @@ export declare class Observable<T> {
1833
2393
  */
1834
2394
  declare type ObserverCallback<T> = (eventData: T) => void;
1835
2395
 
2396
+ /** Babylon.js `OnAudioEngineV2CreatedObservable` — fires when an engine is created. */
2397
+ export declare const OnAudioEngineV2CreatedObservable: Observable<AudioEngineV2>;
2398
+
1836
2399
  export declare class OutlineRenderer {
1837
2400
  constructor();
1838
2401
  }
@@ -2147,6 +2710,9 @@ export declare class PredicateCondition extends Condition {
2147
2710
  isValid(): boolean;
2148
2711
  }
2149
2712
 
2713
+ /** A bus a sound or bus can output to (mirrors AudioV2 `PrimaryAudioBus`). */
2714
+ export declare type PrimaryAudioBus = MainAudioBus | AudioBus;
2715
+
2150
2716
  /** Babylon.js `PushMaterial` — intermediate base; behaves like {@link Material} here. */
2151
2717
  export declare abstract class PushMaterial extends Material {
2152
2718
  getClassName(): string;
@@ -2607,12 +3173,65 @@ export declare class Sound {
2607
3173
  constructor();
2608
3174
  }
2609
3175
 
3176
+ /** A live input source (e.g. microphone) wrapping a Lite `AudioInputSource`. */
3177
+ export declare class SoundSource extends AbstractSoundSource {
2610
3178
  getClassName(): string;
3179
+ dispose(): void;
3180
+ protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;
3181
+ protected _spatialHost(): AudioGraphHost;
3182
+ }
3183
+
3184
+ /** Playback state of a sound (mirrors `@babylonjs/core` `SoundState`). */
3185
+ export declare const SoundState: {
3186
+ readonly Stopping: 0;
3187
+ readonly Stopped: 1;
3188
+ readonly Starting: 2;
3189
+ readonly Started: 3;
3190
+ readonly FailedToStart: 4;
3191
+ readonly Paused: 5;
3192
+ };
3193
+
3194
+ export declare type SoundState = (typeof SoundState)[keyof typeof SoundState];
3195
+
2611
3196
  export declare enum Space {
2612
3197
  LOCAL = 0,
2613
3198
  WORLD = 1,
2614
3199
  BONE = 2
2615
3200
  }
2616
3201
 
3202
+ /** Which transform components a spatial sound/listener follows (mirrors `SpatialAudioAttachmentType`). */
3203
+ export declare const SpatialAudioAttachmentType: {
3204
+ readonly Position: 1;
3205
+ readonly Rotation: 2;
3206
+ readonly PositionAndRotation: 3;
3207
+ };
3208
+
3209
+ export declare type SpatialAudioAttachmentType = (typeof SpatialAudioAttachmentType)[keyof typeof SpatialAudioAttachmentType];
3210
+
3211
+ /** A node that can have a world transform (subset of the compat `Node`). */
3212
+ export declare interface SpatialNodeLike {
3213
+ getAbsolutePosition?: () => {
3214
+ x: number;
3215
+ y: number;
3216
+ z: number;
3217
+ };
3218
+ absolutePosition?: {
3219
+ x: number;
3220
+ y: number;
3221
+ z: number;
3222
+ };
3223
+ position?: {
3224
+ x: number;
3225
+ y: number;
3226
+ z: number;
3227
+ };
3228
+ rotationQuaternion?: {
3229
+ x: number;
3230
+ y: number;
3231
+ z: number;
3232
+ w: number;
3233
+ } | null;
3234
+ }
3235
+
2617
3236
  declare interface SphereOptions {
2618
3237
  diameter?: number;
2619
3238
  segments?: number;
@@ -2790,10 +3409,102 @@ export declare class StandardMaterial extends PushMaterial {
2790
3409
  constructor(nam
2791
3410
  private _bumpTexture;
2792
3411
  private _emissiveTexture;
2793
3412
 
3413
+ /** Babylon.js `StaticSound` — a buffer-backed sound wrapping a Lite `StaticSound`. */
3414
+ export declare class StaticSound extends AbstractSound {
2794
3415
  private readonly _autoplay;
3416
+ private _buffer;
2795
3417
  /** The decoded buffer this sound plays. */
3418
+ get buffer(): StaticSoundBuffer;
3419
+ get activeInstancesCount(): number;
3420
+ get autoplay(): boolean;
3421
+ get state(): SoundState;
3422
+ get loop(): boolean;
3423
+ set loop(value: boolean);
3424
+ get startOffset(): number;
3425
+ set startOffset(value: number);
3426
+ get maxInstances(): number;
3427
+ set maxInstances(value: number);
3428
+ get duration(): number;
3429
+ set duration(value: number);
3430
+ get loopStart(): number;
3431
+ set loopStart(value: number);
3432
+ get loopEnd(): number;
3433
+ set loopEnd(value: number);
3434
+ get pitch(): number;
3435
+ set pitch(value: number);
3436
+ get playbackRate(): number;
3437
+ set playbackRate(value: number);
3438
+ get currentTime(): number;
3439
+ set currentTime(value: number);
3440
+ play(options?: Partial<IStaticSoundPlayOptions>): void;
3441
+ pause(): void;
3442
+ resume(options?: Partial<IStaticSoundPlayOptions>): void;
3443
+ stop(options?: Partial<IStaticSoundStopOptions>): void;
3444
+ /** Clones the sound (shares the decoded buffer). */
3445
+ cloneAsync(options?: Partial<IStaticSoundCloneOptions>): Promise<StaticSound>;
3446
+ getClassName(): string;
3447
+ dispose(): void;
3448
+ protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;
3449
+ protected _spatialHost(): AudioGraphHost;
3450
+ }
3451
+
3452
+ /** Babylon.js `StaticSoundBuffer` — a decoded buffer wrapping a Lite `SoundBuffer`. */
3453
+ export declare class StaticSoundBuffer {
3454
+ /** The engine that owns this buffer. */
3455
+ readonly engine: AudioEngineV2;
3456
+ /** The buffer name. */
3457
+ name: string;
2796
3458
  /** Sample rate, Hz. */
3459
+ get sampleRate(): number;
3460
+ /** Length in sample frames. */
3461
+ get length(): number;
3462
+ /** Duration, seconds. */
3463
+ get duration(): number;
3464
+ /** Number of channels. */
3465
+ get channelCount(): number;
3466
+ /** Clones the buffer. Lite buffers are immutable, so the clone shares the data. */
3467
+ clone(options?: Partial<{
3468
+ name: string;
3469
+ }>): StaticSoundBuffer;
3470
+ }
3471
+
3472
+ /** Source accepted by `createSoundAsync` / `createSoundBufferAsync`. */
3473
+ export declare type StaticSoundSource = ArrayBuffer | AudioBuffer | StaticSoundBuffer | string | string[];
3474
+
2797
3475
  export declare class STLFileLoader {
2798
3476
  constructor();
2799
3477
  }
2800
3478
 
3479
+ /** Babylon.js `StreamingSound` — a media-element-backed sound. */
3480
+ export declare class StreamingSound extends AbstractSound {
2801
3481
  private readonly _autoplay;
3482
+ private _loop;
3483
+ private _startOffset;
3484
+ private _maxInstances;
2802
3485
  /** Number of instances configured to preload. */
3486
+ get preloadCount(): number;
3487
+ /** Number of instances that have finished preloading. */
3488
+ get preloadCompletedCount(): number;
3489
+ get activeInstancesCount(): number;
3490
+ get autoplay(): boolean;
3491
+ get state(): SoundState;
3492
+ get loop(): boolean;
3493
+ set loop(value: boolean);
3494
+ get startOffset(): number;
3495
+ set startOffset(value: number);
3496
+ get maxInstances(): number;
3497
+ set maxInstances(value: number);
3498
+ get currentTime(): number;
3499
+ set currentTime(value: number);
3500
+ play(options?: Partial<IStreamingSoundPlayOptions>): void;
3501
+ pause(): void;
3502
+ resume(options?: Partial<IStreamingSoundPlayOptions>): void;
3503
+ stop(): void;
3504
+ /** Preloads a single instance. */
3505
+ preloadInstanceAsync(): Promise<void>;
3506
+ /** Preloads `count` instances. */
3507
+ preloadInstancesAsync(count: number): Promise<void>;
3508
+ getClassName(): string;
3509
+ dispose(): void;
3510
+ protected _applyVolume(value: number, options?: Partial<IAudioParameterRampOptions> | null): void;
3511
+ protected _spatialHost(): AudioGraphHost;
3512
+ }
3513
+
2803
3514
  /** A string-keyed dictionary with the Babylon.js `StringDictionary` surface. */
2804
3515
  export declare class StringDictionary<T> {
2805
3516
  private _store;