@onerjs/core 8.30.6 → 8.30.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/AudioV2/abstractAudio/audioEngineV2.d.ts +0 -4
  2. package/AudioV2/abstractAudio/audioEngineV2.js +0 -4
  3. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  4. package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js +1 -1
  5. package/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.js.map +1 -1
  6. package/AudioV2/audioParameter.d.ts +5 -1
  7. package/AudioV2/audioParameter.js +4 -0
  8. package/AudioV2/audioParameter.js.map +1 -1
  9. package/AudioV2/webAudio/components/webAudioParameterComponent.d.ts +0 -18
  10. package/AudioV2/webAudio/components/webAudioParameterComponent.js +7 -67
  11. package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
  12. package/Debug/debugLayer.d.ts +1 -1
  13. package/Debug/debugLayer.js.map +1 -1
  14. package/Engines/WebGPU/webgpuCacheSampler.js +4 -0
  15. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  16. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.d.ts +1 -1
  17. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js +1 -1
  18. package/FrameGraph/Node/Blocks/PostProcesses/basePostProcessBlock.js.map +1 -1
  19. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.d.ts +1 -1
  20. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js +1 -1
  21. package/FrameGraph/Node/Blocks/PostProcesses/baseWithPropertiesPostProcessBlock.js.map +1 -1
  22. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js +1 -1
  23. package/FrameGraph/Node/Blocks/Rendering/csmShadowGeneratorBlock.js.map +1 -1
  24. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js +1 -1
  25. package/FrameGraph/Node/Blocks/Rendering/shadowGeneratorBlock.js.map +1 -1
  26. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.d.ts +3 -0
  27. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js +13 -0
  28. package/FrameGraph/Node/Blocks/Textures/copyTextureBlock.js.map +1 -1
  29. package/FrameGraph/Node/Blocks/index.d.ts +1 -0
  30. package/FrameGraph/Node/Blocks/index.js +1 -0
  31. package/FrameGraph/Node/Blocks/index.js.map +1 -1
  32. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.d.ts +4 -4
  33. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js +3 -4
  34. package/FrameGraph/Tasks/Rendering/csmShadowGeneratorTask.js.map +1 -1
  35. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.d.ts +2 -3
  36. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +1 -2
  37. package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
  38. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.d.ts +3 -1
  39. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js +11 -1
  40. package/FrameGraph/Tasks/Rendering/utilityLayerRendererTask.js.map +1 -1
  41. package/FrameGraph/Tasks/Texture/copyToTextureTask.d.ts +4 -0
  42. package/FrameGraph/Tasks/Texture/copyToTextureTask.js +7 -1
  43. package/FrameGraph/Tasks/Texture/copyToTextureTask.js.map +1 -1
  44. package/FrameGraph/frameGraphRenderContext.d.ts +2 -1
  45. package/FrameGraph/frameGraphRenderContext.js +22 -3
  46. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  47. package/Materials/PBR/openpbrMaterial.js +2 -1
  48. package/Materials/PBR/openpbrMaterial.js.map +1 -1
  49. package/Meshes/Node/Blocks/randomBlock.js +11 -11
  50. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  51. package/Misc/copyTextureToTexture.d.ts +8 -1
  52. package/Misc/copyTextureToTexture.js +16 -2
  53. package/Misc/copyTextureToTexture.js.map +1 -1
  54. package/Particles/EmitterTypes/sphereParticleEmitter.d.ts +3 -1
  55. package/Particles/EmitterTypes/sphereParticleEmitter.js +7 -1
  56. package/Particles/EmitterTypes/sphereParticleEmitter.js.map +1 -1
  57. package/Particles/Node/Blocks/Emitters/boxShapeBlock.d.ts +1 -1
  58. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +2 -1
  59. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  60. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.d.ts +10 -1
  61. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +50 -17
  62. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
  63. package/Particles/Node/Blocks/Emitters/emitters.functions.d.ts +6 -0
  64. package/Particles/Node/Blocks/Emitters/emitters.functions.js +13 -0
  65. package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -0
  66. package/Particles/Node/Blocks/Emitters/meshShapeBlock.d.ts +2 -2
  67. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +5 -1
  68. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  69. package/Particles/Node/Blocks/Emitters/pointShapeBlock.d.ts +1 -1
  70. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +3 -1
  71. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
  72. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.d.ts +10 -1
  73. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +45 -13
  74. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  75. package/Particles/Node/Blocks/particleInputBlock.js +1 -0
  76. package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
  77. package/Particles/Node/Blocks/particleRandomBlock.js +10 -10
  78. package/Particles/Node/Blocks/particleRandomBlock.js.map +1 -1
  79. package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
  80. package/Particles/Node/Blocks/systemBlock.js +9 -0
  81. package/Particles/Node/Blocks/systemBlock.js.map +1 -1
  82. package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +3 -1
  83. package/Particles/Node/Enums/nodeParticleContextualSources.js +2 -0
  84. package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
  85. package/Particles/Node/nodeParticleBuildState.js +5 -0
  86. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  87. package/Particles/Node/nodeParticleSystemSet.helper.js +40 -12
  88. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  89. package/Particles/Node/nodeParticleSystemSet.js +1 -1
  90. package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
  91. package/Particles/thinParticleSystem.function.d.ts +2 -2
  92. package/Particles/thinParticleSystem.function.js +2 -2
  93. package/Particles/thinParticleSystem.function.js.map +1 -1
  94. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +2 -1
  95. package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
  96. package/Rendering/prePassRenderer.js +4 -1
  97. package/Rendering/prePassRenderer.js.map +1 -1
  98. package/Shaders/copyTextureToTexture.fragment.js +2 -2
  99. package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
  100. package/ShadersWGSL/copyTextureToTexture.fragment.js +3 -3
  101. package/ShadersWGSL/copyTextureToTexture.fragment.js.map +1 -1
  102. package/XR/webXRSessionManager.js +4 -0
  103. package/XR/webXRSessionManager.js.map +1 -1
  104. package/package.json +1 -1
@@ -83,10 +83,6 @@ export declare abstract class AudioEngineV2 {
83
83
  abstract volume: number;
84
84
  /**
85
85
  * The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).
86
- *
87
- * Due to limitations in some browsers, it is not recommended to set this value to longer than `0.01` seconds.
88
- *
89
- * Setting this value to longer than `0.01` seconds may result in errors being throw when setting audio parameters.
90
86
  */
91
87
  get parameterRampDuration(): number;
92
88
  set parameterRampDuration(value: number);
@@ -45,10 +45,6 @@ export class AudioEngineV2 {
45
45
  }
46
46
  /**
47
47
  * The smoothing duration to use when changing audio parameters, in seconds. Defaults to `0.01` (10 milliseconds).
48
- *
49
- * Due to limitations in some browsers, it is not recommended to set this value to longer than `0.01` seconds.
50
- *
51
- * Setting this value to longer than `0.01` seconds may result in errors being throw when setting audio parameters.
52
48
  */
53
49
  get parameterRampDuration() {
54
50
  return this._parameterRampDuration;
@@ -1 +1 @@
1
- {"version":3,"file":"audioEngineV2.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/audioEngineV2.ts"],"names":[],"mappings":"AAYA,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;IAa/B,YAAsB,OAAuC;QAZ7D,qFAAqF;QACpE,eAAU,GAAG,IAAI,GAAG,EAAgB,CAAC;QACrC,YAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;QAC5C,iBAAY,GAAmC,IAAI,CAAC;QAE5D,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,IAAI,CA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C,SAAkC,IAAI;IAEtC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,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 { IAudioParameterRampOptions } from \"../audioParameter\";\nimport type { AbstractAudioNode, AbstractNamedAudioNode } from \"./abstractAudioNode\";\nimport type { AbstractSound } from \"./abstractSound\";\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 private readonly _sounds = new Set<AbstractSound>();\n private _soundsArray: Nullable<Array<AbstractSound>> = null;\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 * The list of static and streaming sounds created by the audio engine.\n */\n public get sounds(): ReadonlyArray<AbstractSound> {\n if (!this._soundsArray) {\n this._soundsArray = Array.from(this._sounds);\n }\n return this._soundsArray;\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 * @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 * @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 this._sounds.clear();\n\n this._disposeSoundsArray();\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 protected _addSound(sound: AbstractSound): void {\n this._disposeSoundsArray();\n this._sounds.add(sound);\n this._addNode(sound);\n }\n\n protected _removeSound(sound: AbstractSound): void {\n this._disposeSoundsArray();\n this._sounds.delete(sound);\n this._removeNode(sound);\n }\n\n private _disposeSoundsArray(): void {\n if (this._soundsArray) {\n this._soundsArray.length = 0;\n this._soundsArray = null;\n }\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":"AAYA,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;IAa/B,YAAsB,OAAuC;QAZ7D,qFAAqF;QACpE,eAAU,GAAG,IAAI,GAAG,EAAgB,CAAC;QACrC,YAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;QAC5C,iBAAY,GAAmC,IAAI,CAAC;QAE5D,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,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACxB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,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,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 { IAudioParameterRampOptions } from \"../audioParameter\";\nimport type { AbstractAudioNode, AbstractNamedAudioNode } from \"./abstractAudioNode\";\nimport type { AbstractSound } from \"./abstractSound\";\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 private readonly _sounds = new Set<AbstractSound>();\n private _soundsArray: Nullable<Array<AbstractSound>> = null;\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 * The list of static and streaming sounds created by the audio engine.\n */\n public get sounds(): ReadonlyArray<AbstractSound> {\n if (!this._soundsArray) {\n this._soundsArray = Array.from(this._sounds);\n }\n return this._soundsArray;\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 * @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 * @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 this._sounds.clear();\n\n this._disposeSoundsArray();\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 protected _addSound(sound: AbstractSound): void {\n this._disposeSoundsArray();\n this._sounds.add(sound);\n this._addNode(sound);\n }\n\n protected _removeSound(sound: AbstractSound): void {\n this._disposeSoundsArray();\n this._sounds.delete(sound);\n this._removeNode(sound);\n }\n\n private _disposeSoundsArray(): void {\n if (this._soundsArray) {\n this._soundsArray.length = 0;\n this._soundsArray = null;\n }\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"]}
@@ -10,7 +10,7 @@ export class _VolumeAudioSubNode extends _AbstractAudioSubNode {
10
10
  }
11
11
  /** @internal */
12
12
  setOptions(options) {
13
- this.volume = options.volume ?? _VolumeAudioDefaults.volume;
13
+ this.setVolume(options.volume ?? _VolumeAudioDefaults.volume, { shape: "none" /* AudioParameterRampShape.None */ });
14
14
  }
15
15
  }
16
16
  /** @internal */
@@ -1 +1 @@
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"]}
1
+ {"version":3,"file":"volumeAudioSubNode.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/abstractAudio/subNodes/volumeAudioSubNode.ts"],"names":[],"mappings":"AAIA,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,SAAS,CAAC,OAAO,CAAC,MAAM,IAAI,oBAAoB,CAAC,MAAM,EAAE,EAAE,KAAK,2CAA8B,EAAE,CAAC,CAAC;IAC3G,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 { AudioParameterRampShape } 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.setVolume(options.volume ?? _VolumeAudioDefaults.volume, { shape: AudioParameterRampShape.None });\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"]}
@@ -13,7 +13,11 @@ export declare enum AudioParameterRampShape {
13
13
  /**
14
14
  * The ramp is logarithmic.
15
15
  */
16
- Logarithmic = "logarithmic"
16
+ Logarithmic = "logarithmic",
17
+ /**
18
+ * No ramp is used; the value is set immediately.
19
+ */
20
+ None = "none"
17
21
  }
18
22
  /**
19
23
  * Options for ramping an audio parameter's value.
@@ -15,5 +15,9 @@ export var AudioParameterRampShape;
15
15
  * The ramp is logarithmic.
16
16
  */
17
17
  AudioParameterRampShape["Logarithmic"] = "logarithmic";
18
+ /**
19
+ * No ramp is used; the value is set immediately.
20
+ */
21
+ AudioParameterRampShape["None"] = "none";
18
22
  })(AudioParameterRampShape || (AudioParameterRampShape = {}));
19
23
  //# sourceMappingURL=audioParameter.js.map
@@ -1 +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"]}
1
+ {"version":3,"file":"audioParameter.js","sourceRoot":"","sources":["../../../../dev/core/src/AudioV2/audioParameter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAkB,uBAiBjB;AAjBD,WAAkB,uBAAuB;IACrC;;OAEG;IACH,4CAAiB,CAAA;IACjB;;OAEG;IACH,sDAA2B,CAAA;IAC3B;;OAEG;IACH,sDAA2B,CAAA;IAC3B;;OAEG;IACH,wCAAa,CAAA;AACjB,CAAC,EAjBiB,uBAAuB,KAAvB,uBAAuB,QAiBxC","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 * No ramp is used; the value is set immediately.\n */\n None = \"none\",\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"]}
@@ -3,9 +3,6 @@ import type { IAudioParameterRampOptions } from "../../audioParameter.js";
3
3
  import type { _WebAudioEngine } from "../webAudioEngine.js";
4
4
  /** @internal */
5
5
  export declare class _WebAudioParameterComponent {
6
- private _deferredRampOptions;
7
- private _deferredTargetValue;
8
- private _isObservingUpdates;
9
6
  private _rampEndTime;
10
7
  private _engine;
11
8
  private _param;
@@ -24,22 +21,7 @@ export declare class _WebAudioParameterComponent {
24
21
  /**
25
22
  * Sets the target value of the audio parameter with an optional ramping duration and shape.
26
23
  *
27
- * If a ramp is close to finishing, it will wait for the ramp to finish before setting the new value; otherwise it
28
- * will throw an error because of a bug in Firefox that prevents active ramps from being cancelled with
29
- * `cancelScheduledValues`. See https://bugzilla.mozilla.org/show_bug.cgi?id=1752775. Other browsers do not have
30
- * this issue, but we throw an error in all browsers to ensure consistent behavior.
31
- *
32
- * There are other similar WebAudio APIs for ramping parameters, (e.g. `linearRampToValueAtTime` and
33
- * `exponentialRampToValueAtTime`) but they don't work in Firefox and Meta Quest Chrome.
34
- *
35
- * It may be better in the long run to implement our own ramping logic with a WASM audio worklet instead of using
36
- * `setValueCurveAtTime`. Another alternative is to use `setValueAtTime` wtih a custom shape, but that will
37
- * probably be a performance hit to maintain quality at audio rates.
38
- *
39
24
  * @internal
40
25
  */
41
26
  setTargetValue(value: number, options?: Nullable<Partial<IAudioParameterRampOptions>>): void;
42
- private _deferRamp;
43
- private _applyDeferredRamp;
44
- private _clearDeferredRamp;
45
27
  }
@@ -1,16 +1,4 @@
1
1
  import { _GetAudioParamCurveValues } from "../../audioUtils.js";
2
- /**
3
- * Maximum time in seconds to wait for an active ramp to finish before starting a new ramp.
4
- *
5
- * New ramps will throw an error if the active ramp has more than this amount of time remaining.
6
- *
7
- * This is needed because short ramps are used to avoid pops and clicks when setting audio parameters, and we
8
- * don't want to throw an error if a short ramp is active.
9
- *
10
- * This constant is set to 11 milliseconds, which is short enough to avoid perceptual differences in most cases, but
11
- * long enough to allow for short ramps to be completed in a reasonable time frame.
12
- */
13
- const MaxWaitTime = 0.011;
14
2
  /**
15
3
  * Minimum duration in seconds for a ramp to be considered valid.
16
4
  *
@@ -22,18 +10,7 @@ const MinRampDuration = 0.000001;
22
10
  export class _WebAudioParameterComponent {
23
11
  /** @internal */
24
12
  constructor(engine, param) {
25
- this._deferredRampOptions = {
26
- duration: 0,
27
- shape: "linear" /* AudioParameterRampShape.Linear */,
28
- };
29
- this._deferredTargetValue = -1;
30
- this._isObservingUpdates = false;
31
13
  this._rampEndTime = 0;
32
- this._applyDeferredRamp = () => {
33
- if (0 < this._deferredRampOptions.duration && this._rampEndTime < this._engine.currentTime) {
34
- this.setTargetValue(this._deferredTargetValue, this._deferredRampOptions);
35
- }
36
- };
37
14
  this._engine = engine;
38
15
  this._param = param;
39
16
  this._targetValue = param.value;
@@ -55,68 +32,31 @@ export class _WebAudioParameterComponent {
55
32
  }
56
33
  /** @internal */
57
34
  dispose() {
58
- this._clearDeferredRamp();
59
35
  this._param = null;
60
36
  this._engine = null;
61
37
  }
62
38
  /**
63
39
  * Sets the target value of the audio parameter with an optional ramping duration and shape.
64
40
  *
65
- * If a ramp is close to finishing, it will wait for the ramp to finish before setting the new value; otherwise it
66
- * will throw an error because of a bug in Firefox that prevents active ramps from being cancelled with
67
- * `cancelScheduledValues`. See https://bugzilla.mozilla.org/show_bug.cgi?id=1752775. Other browsers do not have
68
- * this issue, but we throw an error in all browsers to ensure consistent behavior.
69
- *
70
- * There are other similar WebAudio APIs for ramping parameters, (e.g. `linearRampToValueAtTime` and
71
- * `exponentialRampToValueAtTime`) but they don't work in Firefox and Meta Quest Chrome.
72
- *
73
- * It may be better in the long run to implement our own ramping logic with a WASM audio worklet instead of using
74
- * `setValueCurveAtTime`. Another alternative is to use `setValueAtTime` wtih a custom shape, but that will
75
- * probably be a performance hit to maintain quality at audio rates.
76
- *
77
41
  * @internal
78
42
  */
79
43
  setTargetValue(value, options = null) {
80
- if (this._targetValue === value) {
81
- return;
82
- }
83
44
  const shape = typeof options?.shape === "string" ? options.shape : "linear" /* AudioParameterRampShape.Linear */;
84
- let duration = typeof options?.duration === "number" ? Math.max(options.duration, this._engine.parameterRampDuration) : this._engine.parameterRampDuration;
85
45
  const startTime = this._engine.currentTime;
86
- if (startTime < this._rampEndTime) {
87
- const timeLeft = this._rampEndTime - startTime;
88
- if (MaxWaitTime < timeLeft) {
89
- throw new Error("Audio parameter not set. Wait for current ramp to finish.");
90
- }
91
- else {
92
- this._deferRamp(value, duration, shape);
93
- return;
94
- }
46
+ if (shape === "none" /* AudioParameterRampShape.None */) {
47
+ this._param.cancelScheduledValues(startTime);
48
+ this._param.value = this._targetValue = value;
49
+ this._rampEndTime = startTime;
50
+ return;
95
51
  }
52
+ let duration = typeof options?.duration === "number" ? Math.max(options.duration, this._engine.parameterRampDuration) : this._engine.parameterRampDuration;
96
53
  if ((duration = Math.max(this._engine.parameterRampDuration, duration)) < MinRampDuration) {
97
54
  this._param.setValueAtTime((this._targetValue = value), startTime);
98
55
  return;
99
56
  }
100
57
  this._param.cancelScheduledValues(startTime);
101
- this._param.setValueCurveAtTime(_GetAudioParamCurveValues(shape, this._targetValue, (this._targetValue = value)), startTime, duration);
102
- this._clearDeferredRamp();
58
+ this._param.setValueCurveAtTime(_GetAudioParamCurveValues(shape, this._param.value, (this._targetValue = value)), startTime, duration);
103
59
  this._rampEndTime = startTime + duration;
104
60
  }
105
- _deferRamp(value, duration, shape) {
106
- this._deferredRampOptions.duration = duration;
107
- this._deferredRampOptions.shape = shape;
108
- this._deferredTargetValue = value;
109
- if (!this._isObservingUpdates) {
110
- this._engine._addUpdateObserver(this._applyDeferredRamp);
111
- this._isObservingUpdates = true;
112
- }
113
- }
114
- _clearDeferredRamp() {
115
- this._deferredRampOptions.duration = 0;
116
- if (this._isObservingUpdates) {
117
- this._engine._removeUpdateObserver(this._applyDeferredRamp);
118
- this._isObservingUpdates = false;
119
- }
120
- }
121
61
  }
122
62
  //# sourceMappingURL=webAudioParameterComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webAudioParameterComponent.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/webAudio/components/webAudioParameterComponent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG7D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,eAAe,GAAG,QAAQ,CAAC;AAEjC,gBAAgB;AAChB,MAAM,OAAO,2BAA2B;IAYpC,gBAAgB;IAChB,YAAY,MAAuB,EAAE,KAAiB;QAZ9C,yBAAoB,GAAG;YAC3B,QAAQ,EAAE,CAAC;YACX,KAAK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,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEvI,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAE1B,IAAI,CAAC,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC7C,CAAC;IAEO,UAAU,CAAC,KAAa,EAAE,QAAgB,EAAE,KAA8B;QAC9E,IAAI,CAAC,oBAAoB,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC9C,IAAI,CAAC,oBAAoB,CAAC,KAAK,GAAG,KAAK,CAAC;QACxC,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAElC,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YACzD,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QACpC,CAAC;IACL,CAAC;IAQO,kBAAkB;QACtB,IAAI,CAAC,oBAAoB,CAAC,QAAQ,GAAG,CAAC,CAAC;QAEvC,IAAI,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3B,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC5D,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACrC,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../../types\";\nimport type { IAudioParameterRampOptions } from \"../../audioParameter\";\nimport { AudioParameterRampShape } from \"../../audioParameter\";\nimport { _GetAudioParamCurveValues } from \"../../audioUtils\";\nimport type { _WebAudioEngine } from \"../webAudioEngine\";\n\n/**\n * Maximum time in seconds to wait for an active ramp to finish before starting a new ramp.\n *\n * New ramps will throw an error if the active ramp has more than this amount of time remaining.\n *\n * This is needed because short ramps are used to avoid pops and clicks when setting audio parameters, and we\n * don't want to throw an error if a short ramp is active.\n *\n * This constant is set to 11 milliseconds, which is short enough to avoid perceptual differences in most cases, but\n * long enough to allow for short ramps to be completed in a reasonable time frame.\n */\nconst MaxWaitTime = 0.011;\n\n/**\n * Minimum duration in seconds for a ramp to be considered valid.\n *\n * If the duration is less than this value, the value will be set immediately instead of being ramped smoothly since\n * there is no perceptual difference for such short durations, so a ramp is not needed.\n */\nconst MinRampDuration = 0.000001;\n\n/** @internal */\nexport class _WebAudioParameterComponent {\n private _deferredRampOptions = {\n duration: 0,\n shape: AudioParameterRampShape.Linear,\n };\n private _deferredTargetValue = -1;\n private _isObservingUpdates = false;\n private _rampEndTime: number = 0;\n private _engine: _WebAudioEngine;\n private _param: AudioParam;\n private _targetValue: number;\n\n /** @internal */\n constructor(engine: _WebAudioEngine, param: AudioParam) {\n this._engine = engine;\n this._param = param;\n this._targetValue = param.value;\n }\n\n /** @internal */\n public get isRamping(): boolean {\n return this._engine.currentTime < this._rampEndTime;\n }\n\n /** @internal */\n public get targetValue(): number {\n return this._targetValue;\n }\n\n public set targetValue(value: number) {\n this.setTargetValue(value);\n }\n\n /** @internal */\n public get value(): number {\n return this._param.value;\n }\n\n /** @internal */\n public dispose(): void {\n this._clearDeferredRamp();\n\n this._param = null!;\n this._engine = null!;\n }\n\n /**\n * Sets the target value of the audio parameter with an optional ramping duration and shape.\n *\n * If a ramp is close to finishing, it will wait for the ramp to finish before setting the new value; otherwise it\n * will throw an error because of a bug in Firefox that prevents active ramps from being cancelled with\n * `cancelScheduledValues`. See https://bugzilla.mozilla.org/show_bug.cgi?id=1752775. Other browsers do not have\n * this issue, but we throw an error in all browsers to ensure consistent behavior.\n *\n * There are other similar WebAudio APIs for ramping parameters, (e.g. `linearRampToValueAtTime` and\n * `exponentialRampToValueAtTime`) but they don't work in Firefox and Meta Quest Chrome.\n *\n * It may be better in the long run to implement our own ramping logic with a WASM audio worklet instead of using\n * `setValueCurveAtTime`. Another alternative is to use `setValueAtTime` wtih a custom shape, but that will\n * probably be a performance hit to maintain quality at audio rates.\n *\n * @internal\n */\n public setTargetValue(value: number, options: Nullable<Partial<IAudioParameterRampOptions>> = null): void {\n if (this._targetValue === value) {\n return;\n }\n\n const shape = typeof options?.shape === \"string\" ? options.shape : AudioParameterRampShape.Linear;\n\n let duration = typeof options?.duration === \"number\" ? Math.max(options.duration, this._engine.parameterRampDuration) : this._engine.parameterRampDuration;\n const startTime = this._engine.currentTime;\n\n if (startTime < this._rampEndTime) {\n const timeLeft = this._rampEndTime - startTime;\n\n if (MaxWaitTime < timeLeft) {\n throw new Error(\"Audio parameter not set. Wait for current ramp to finish.\");\n } else {\n this._deferRamp(value, duration, shape);\n return;\n }\n }\n\n if ((duration = Math.max(this._engine.parameterRampDuration, duration)) < MinRampDuration) {\n this._param.setValueAtTime((this._targetValue = value), startTime);\n return;\n }\n\n this._param.cancelScheduledValues(startTime);\n this._param.setValueCurveAtTime(_GetAudioParamCurveValues(shape, this._targetValue, (this._targetValue = value)), startTime, duration);\n\n this._clearDeferredRamp();\n\n this._rampEndTime = startTime + duration;\n }\n\n private _deferRamp(value: number, duration: number, shape: AudioParameterRampShape): void {\n this._deferredRampOptions.duration = duration;\n this._deferredRampOptions.shape = shape;\n this._deferredTargetValue = value;\n\n if (!this._isObservingUpdates) {\n this._engine._addUpdateObserver(this._applyDeferredRamp);\n this._isObservingUpdates = true;\n }\n }\n\n private _applyDeferredRamp = () => {\n if (0 < this._deferredRampOptions.duration && this._rampEndTime < this._engine.currentTime) {\n this.setTargetValue(this._deferredTargetValue, this._deferredRampOptions);\n }\n };\n\n private _clearDeferredRamp(): void {\n this._deferredRampOptions.duration = 0;\n\n if (this._isObservingUpdates) {\n this._engine._removeUpdateObserver(this._applyDeferredRamp);\n this._isObservingUpdates = false;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"webAudioParameterComponent.js","sourceRoot":"","sources":["../../../../../../dev/core/src/AudioV2/webAudio/components/webAudioParameterComponent.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAG7D;;;;;GAKG;AACH,MAAM,eAAe,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C,YAAY,GAAG,SAAS,CAAC;YAC9B,OAAO;QACX,CAAC;QAED,IAAI,QAAQ,GAAG,OAAO,OAAO,EAAE,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC;QAE3J,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,QAAQ,CAAC,CAAC,GAAG,eAAe,EAAE,CAAC;YACxF,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;YACnE,OAAO;QACX,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,yBAAyB,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEvI,IAAI,CAAC,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC7C,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../../types\";\nimport type { IAudioParameterRampOptions } from \"../../audioParameter\";\nimport { AudioParameterRampShape } from \"../../audioParameter\";\nimport { _GetAudioParamCurveValues } from \"../../audioUtils\";\nimport type { _WebAudioEngine } from \"../webAudioEngine\";\n\n/**\n * Minimum duration in seconds for a ramp to be considered valid.\n *\n * If the duration is less than this value, the value will be set immediately instead of being ramped smoothly since\n * there is no perceptual difference for such short durations, so a ramp is not needed.\n */\nconst MinRampDuration = 0.000001;\n\n/** @internal */\nexport class _WebAudioParameterComponent {\n private _rampEndTime: number = 0;\n private _engine: _WebAudioEngine;\n private _param: AudioParam;\n private _targetValue: number;\n\n /** @internal */\n constructor(engine: _WebAudioEngine, param: AudioParam) {\n this._engine = engine;\n this._param = param;\n this._targetValue = param.value;\n }\n\n /** @internal */\n public get isRamping(): boolean {\n return this._engine.currentTime < this._rampEndTime;\n }\n\n /** @internal */\n public get targetValue(): number {\n return this._targetValue;\n }\n\n public set targetValue(value: number) {\n this.setTargetValue(value);\n }\n\n /** @internal */\n public get value(): number {\n return this._param.value;\n }\n\n /** @internal */\n public dispose(): void {\n this._param = null!;\n this._engine = null!;\n }\n\n /**\n * Sets the target value of the audio parameter with an optional ramping duration and shape.\n *\n * @internal\n */\n public setTargetValue(value: number, options: Nullable<Partial<IAudioParameterRampOptions>> = null): void {\n const shape = typeof options?.shape === \"string\" ? options.shape : AudioParameterRampShape.Linear;\n\n const startTime = this._engine.currentTime;\n\n if (shape === AudioParameterRampShape.None) {\n this._param.cancelScheduledValues(startTime);\n this._param.value = this._targetValue = value;\n this._rampEndTime = startTime;\n return;\n }\n\n let duration = typeof options?.duration === \"number\" ? Math.max(options.duration, this._engine.parameterRampDuration) : this._engine.parameterRampDuration;\n\n if ((duration = Math.max(this._engine.parameterRampDuration, duration)) < MinRampDuration) {\n this._param.setValueAtTime((this._targetValue = value), startTime);\n return;\n }\n\n this._param.cancelScheduledValues(startTime);\n this._param.setValueCurveAtTime(_GetAudioParamCurveValues(shape, this._param.value, (this._targetValue = value)), startTime, duration);\n\n this._rampEndTime = startTime + duration;\n }\n}\n"]}
@@ -202,7 +202,7 @@ export declare class DebugLayer {
202
202
  */
203
203
  static Config: IInspectorOptions;
204
204
  private _scene;
205
- private BJSINSPECTOR;
205
+ protected BJSINSPECTOR: any;
206
206
  private _onPropertyChangedObservable?;
207
207
  /**
208
208
  * Observable triggered when a property is changed through the inspector.
@@ -1 +1 @@
1
- {"version":3,"file":"debugLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Debug/debugLayer.ts"],"names":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AAE,KAAK;IAChB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;CACpB,AAPmB,CAOlB","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { IInspectable } from \"../Misc/iInspectable\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare INSPECTOR namespace for compilation issue\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let INSPECTOR: any;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let BABYLON: any;\r\n// load the inspector using require, if not present in the global namespace.\r\n\r\n/**\r\n * Interface used to define scene explorer extensibility option\r\n */\r\nexport interface IExplorerExtensibilityOption {\r\n /**\r\n * Define the option label\r\n */\r\n label: string;\r\n /**\r\n * Defines the action to execute on click\r\n */\r\n action: (entity: any) => void;\r\n /**\r\n * Keep popup open after click\r\n */\r\n keepOpenAfterClick?: boolean;\r\n}\r\n\r\n/**\r\n * Defines a group of actions associated with a predicate to use when extending the Inspector scene explorer\r\n */\r\nexport interface IExplorerExtensibilityGroup {\r\n /**\r\n * Defines a predicate to test if a given type mut be extended\r\n */\r\n predicate: (entity: any) => boolean;\r\n /**\r\n * Gets the list of options added to a type\r\n */\r\n entries: IExplorerExtensibilityOption[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalChild {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the class name of the child node\r\n */\r\n getClassName(): string;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n inspectableCustomProperties: IInspectable[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalNode {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the list of child entries\r\n */\r\n getContent(): IExplorerAdditionalChild[];\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IInspectorContextMenuType = \"pipeline\" | \"node\" | \"materials\" | \"spriteManagers\" | \"particleSystems\" | \"frameGraphs\";\r\n\r\n/**\r\n * Context menu item\r\n */\r\nexport interface IInspectorContextMenuItem {\r\n /**\r\n * Display label - menu item\r\n */\r\n label: string;\r\n /**\r\n * Callback function that will be called when the menu item is selected\r\n * @param entity the entity that is currently selected in the scene explorer\r\n */\r\n action: (entity?: unknown) => void;\r\n}\r\n\r\n/**\r\n * Interface used to define the options to use to create the Inspector\r\n */\r\nexport interface IInspectorOptions {\r\n /**\r\n * Display in overlay mode (default: false)\r\n */\r\n overlay?: boolean;\r\n /**\r\n * HTML element to use as root (the parent of the rendering canvas will be used as default value)\r\n */\r\n globalRoot?: HTMLElement;\r\n /**\r\n * Display the Scene explorer\r\n */\r\n showExplorer?: boolean;\r\n /**\r\n * Display the property inspector\r\n */\r\n showInspector?: boolean;\r\n /**\r\n * Display in embed mode (both panes on the right)\r\n */\r\n embedMode?: boolean;\r\n /**\r\n * let the Inspector handles resize of the canvas when panes are resized (default to true)\r\n */\r\n handleResize?: boolean;\r\n /**\r\n * Allow the panes to popup (default: true)\r\n */\r\n enablePopup?: boolean;\r\n /**\r\n * Allow the panes to be closed by users (default: true)\r\n */\r\n enableClose?: boolean;\r\n /**\r\n * Optional list of extensibility entries\r\n */\r\n explorerExtensibility?: IExplorerExtensibilityGroup[];\r\n /**\r\n * Optional list of additional top level nodes\r\n */\r\n additionalNodes?: IExplorerAdditionalNode[];\r\n /**\r\n * Optional URL to get the inspector script from (by default it uses the babylonjs CDN).\r\n */\r\n inspectorURL?: string;\r\n /**\r\n * Optional initial tab (default to DebugLayerTab.Properties)\r\n */\r\n initialTab?: DebugLayerTab;\r\n /**\r\n * Optional camera to use to render the gizmos from the inspector (default to the scene.activeCamera or the latest from scene.activeCameras)\r\n */\r\n gizmoCamera?: Camera;\r\n /**\r\n * Context menu for inspector tools such as \"Post Process\", \"Nodes\", \"Materials\", etc.\r\n */\r\n contextMenu?: Partial<Record<IInspectorContextMenuType, IInspectorContextMenuItem[]>>;\r\n /**\r\n * List of context menu items that should be completely overridden by custom items from the contextMenu property.\r\n */\r\n contextMenuOverride?: IInspectorContextMenuType[];\r\n\r\n /**\r\n * Should the default font loading be skipped\r\n */\r\n skipDefaultFontLoading?: boolean;\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * @internal\r\n * Backing field\r\n */\r\n _debugLayer: DebugLayer;\r\n\r\n /**\r\n * Gets the debug layer (aka Inspector) associated with the scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\n debugLayer: DebugLayer;\r\n }\r\n}\r\nObject.defineProperty(Scene.prototype, \"debugLayer\", {\r\n get: function (this: Scene) {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Enum of inspector action tab\r\n */\r\nexport const enum DebugLayerTab {\r\n /**\r\n * Properties tag (default)\r\n */\r\n Properties = 0,\r\n /**\r\n * Debug tab\r\n */\r\n Debug = 1,\r\n /**\r\n * Statistics tab\r\n */\r\n Statistics = 2,\r\n /**\r\n * Tools tab\r\n */\r\n Tools = 3,\r\n /**\r\n * Settings tab\r\n */\r\n Settings = 4,\r\n}\r\n\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\nexport class DebugLayer {\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n public static InspectorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/inspector/babylon.inspector.bundle.js`;\r\n\r\n /**\r\n * The default configuration of the inspector\r\n */\r\n public static Config: IInspectorOptions = {\r\n overlay: false,\r\n showExplorer: true,\r\n showInspector: true,\r\n embedMode: false,\r\n handleResize: true,\r\n enablePopup: true,\r\n };\r\n\r\n private _scene: Scene;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n private BJSINSPECTOR = this._getGlobalInspector();\r\n\r\n private _onPropertyChangedObservable?: Observable<{ object: any; property: string; value: any; initialValue: any }>;\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n public get onPropertyChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new Observable<{ object: any; property: string; value: any; initialValue: any }>();\r\n }\r\n\r\n return this._onPropertyChangedObservable;\r\n }\r\n\r\n private _onSelectionChangedObservable?: Observable<any>;\r\n /**\r\n * Observable triggered when the selection is changed through the inspector.\r\n */\r\n public get onSelectionChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable;\r\n }\r\n\r\n if (!this._onSelectionChangedObservable) {\r\n this._onSelectionChangedObservable = new Observable<any>();\r\n }\r\n\r\n return this._onSelectionChangedObservable;\r\n }\r\n\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n * @param scene Defines the scene to inspect\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this._scene.onDisposeObservable.add(() => {\r\n // Debug layer\r\n if (this._scene._debugLayer) {\r\n this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the inspector window.\r\n * @param config\r\n */\r\n private _createInspector(config?: Partial<IInspectorOptions>) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n\r\n if (this._onPropertyChangedObservable) {\r\n for (const observer of this._onPropertyChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n\r\n if (this._onSelectionChangedObservable) {\r\n for (const observer of this._onSelectionChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(observer);\r\n }\r\n this._onSelectionChangedObservable.clear();\r\n this._onSelectionChangedObservable = undefined;\r\n }\r\n\r\n const userOptions: IInspectorOptions = {\r\n ...DebugLayer.Config,\r\n ...config,\r\n };\r\n\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n }\r\n\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitles defines the specific blocks to highlight (could be a string or an array of strings)\r\n */\r\n public select(entity: any, lineContainerTitles?: string | string[]) {\r\n if (this.BJSINSPECTOR) {\r\n if (lineContainerTitles) {\r\n if (Object.prototype.toString.call(lineContainerTitles) == \"[object String]\") {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitles);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(lineContainerTitles);\r\n }\r\n }\r\n if (!this.BJSINSPECTOR.Inspector.IsVisible) {\r\n setTimeout(() => {\r\n this.select(entity, lineContainerTitles);\r\n }, 100);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get the inspector from bundle or global\r\n * @returns the inspector instance if found otherwise, null\r\n */\r\n private _getGlobalInspector(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof INSPECTOR !== \"undefined\") {\r\n return INSPECTOR;\r\n }\r\n\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.Inspector !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n public isVisible(): boolean {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n }\r\n\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n public hide() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n }\r\n\r\n /**\r\n * Get the number of opened panes in the inspector\r\n */\r\n public get openedPanes() {\r\n if (this.BJSINSPECTOR) {\r\n return this.BJSINSPECTOR.Inspector._OpenedPane;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Update the scene in the inspector\r\n */\r\n public setAsActiveScene() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector._SetNewScene(this._scene);\r\n }\r\n }\r\n\r\n public popupSceneExplorer() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupSceneExplorer();\r\n }\r\n }\r\n\r\n public popupInspector() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupInspector();\r\n }\r\n }\r\n\r\n public popupEmbed() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupEmbed();\r\n }\r\n }\r\n\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @returns a promise fulfilled when the debug layer is visible\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async show(config?: IInspectorOptions): Promise<DebugLayer> {\r\n return await new Promise((resolve) => {\r\n if (typeof this.BJSINSPECTOR == \"undefined\") {\r\n const inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n\r\n // Load inspector and add it to the DOM\r\n Tools.LoadBabylonScript(inspectorUrl, () => {\r\n this._createInspector(config);\r\n resolve(this);\r\n });\r\n } else {\r\n // Otherwise creates the inspector\r\n this._createInspector(config);\r\n resolve(this);\r\n }\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"debugLayer.js","sourceRoot":"","sources":["../../../../dev/core/src/Debug/debugLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,cAAc,EAAE,qCAAoC;AAmL7D,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,YAAY,EAAE;IACjD,GAAG,EAAE;QACD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,IAAI,CAAC,WAAW,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IACD,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAN,IAAkB,aAqBjB;AArBD,WAAkB,aAAa;IAC3B;;OAEG;IACH,6DAAc,CAAA;IACd;;OAEG;IACH,mDAAS,CAAA;IACT;;OAEG;IACH,6DAAc,CAAA;IACd;;OAEG;IACH,mDAAS,CAAA;IACT;;OAEG;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C9B,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC;YACP,CAAC;iBAAM,CAAC;gBACJ,kCAAkC;gBAClC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;gBAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;;AAtOD;;;;GAIG;AACW,uBAAY,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,wCAAwC,AAA7F,CAA8F;AAExH;;GAEG;AACW,iBAAM,GAAsB;IACtC,OAAO,EAAE,KAAK;IACd,YAAY,EAAE,IAAI;IAClB,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,KAAK;IAChB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;CACpB,AAPmB,CAOlB","sourcesContent":["import { Tools } from \"../Misc/tools\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport { Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { IInspectable } from \"../Misc/iInspectable\";\r\nimport type { Camera } from \"../Cameras/camera\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n// declare INSPECTOR namespace for compilation issue\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let INSPECTOR: any;\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let BABYLON: any;\r\n// load the inspector using require, if not present in the global namespace.\r\n\r\n/**\r\n * Interface used to define scene explorer extensibility option\r\n */\r\nexport interface IExplorerExtensibilityOption {\r\n /**\r\n * Define the option label\r\n */\r\n label: string;\r\n /**\r\n * Defines the action to execute on click\r\n */\r\n action: (entity: any) => void;\r\n /**\r\n * Keep popup open after click\r\n */\r\n keepOpenAfterClick?: boolean;\r\n}\r\n\r\n/**\r\n * Defines a group of actions associated with a predicate to use when extending the Inspector scene explorer\r\n */\r\nexport interface IExplorerExtensibilityGroup {\r\n /**\r\n * Defines a predicate to test if a given type mut be extended\r\n */\r\n predicate: (entity: any) => boolean;\r\n /**\r\n * Gets the list of options added to a type\r\n */\r\n entries: IExplorerExtensibilityOption[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalChild {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the class name of the child node\r\n */\r\n getClassName(): string;\r\n /**\r\n * List of inspectable custom properties (used by the Inspector)\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility\r\n */\r\n inspectableCustomProperties: IInspectable[];\r\n}\r\n\r\n/**\r\n * Defines a new node that will be displayed as top level node in the explorer\r\n */\r\nexport interface IExplorerAdditionalNode {\r\n /**\r\n * Gets the name of the additional node\r\n */\r\n name: string;\r\n /**\r\n * Function used to return the list of child entries\r\n */\r\n getContent(): IExplorerAdditionalChild[];\r\n}\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IInspectorContextMenuType = \"pipeline\" | \"node\" | \"materials\" | \"spriteManagers\" | \"particleSystems\" | \"frameGraphs\";\r\n\r\n/**\r\n * Context menu item\r\n */\r\nexport interface IInspectorContextMenuItem {\r\n /**\r\n * Display label - menu item\r\n */\r\n label: string;\r\n /**\r\n * Callback function that will be called when the menu item is selected\r\n * @param entity the entity that is currently selected in the scene explorer\r\n */\r\n action: (entity?: unknown) => void;\r\n}\r\n\r\n/**\r\n * Interface used to define the options to use to create the Inspector\r\n */\r\nexport interface IInspectorOptions {\r\n /**\r\n * Display in overlay mode (default: false)\r\n */\r\n overlay?: boolean;\r\n /**\r\n * HTML element to use as root (the parent of the rendering canvas will be used as default value)\r\n */\r\n globalRoot?: HTMLElement;\r\n /**\r\n * Display the Scene explorer\r\n */\r\n showExplorer?: boolean;\r\n /**\r\n * Display the property inspector\r\n */\r\n showInspector?: boolean;\r\n /**\r\n * Display in embed mode (both panes on the right)\r\n */\r\n embedMode?: boolean;\r\n /**\r\n * let the Inspector handles resize of the canvas when panes are resized (default to true)\r\n */\r\n handleResize?: boolean;\r\n /**\r\n * Allow the panes to popup (default: true)\r\n */\r\n enablePopup?: boolean;\r\n /**\r\n * Allow the panes to be closed by users (default: true)\r\n */\r\n enableClose?: boolean;\r\n /**\r\n * Optional list of extensibility entries\r\n */\r\n explorerExtensibility?: IExplorerExtensibilityGroup[];\r\n /**\r\n * Optional list of additional top level nodes\r\n */\r\n additionalNodes?: IExplorerAdditionalNode[];\r\n /**\r\n * Optional URL to get the inspector script from (by default it uses the babylonjs CDN).\r\n */\r\n inspectorURL?: string;\r\n /**\r\n * Optional initial tab (default to DebugLayerTab.Properties)\r\n */\r\n initialTab?: DebugLayerTab;\r\n /**\r\n * Optional camera to use to render the gizmos from the inspector (default to the scene.activeCamera or the latest from scene.activeCameras)\r\n */\r\n gizmoCamera?: Camera;\r\n /**\r\n * Context menu for inspector tools such as \"Post Process\", \"Nodes\", \"Materials\", etc.\r\n */\r\n contextMenu?: Partial<Record<IInspectorContextMenuType, IInspectorContextMenuItem[]>>;\r\n /**\r\n * List of context menu items that should be completely overridden by custom items from the contextMenu property.\r\n */\r\n contextMenuOverride?: IInspectorContextMenuType[];\r\n\r\n /**\r\n * Should the default font loading be skipped\r\n */\r\n skipDefaultFontLoading?: boolean;\r\n}\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /**\r\n * @internal\r\n * Backing field\r\n */\r\n _debugLayer: DebugLayer;\r\n\r\n /**\r\n * Gets the debug layer (aka Inspector) associated with the scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\n debugLayer: DebugLayer;\r\n }\r\n}\r\nObject.defineProperty(Scene.prototype, \"debugLayer\", {\r\n get: function (this: Scene) {\r\n if (!this._debugLayer) {\r\n this._debugLayer = new DebugLayer(this);\r\n }\r\n return this._debugLayer;\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\n/**\r\n * Enum of inspector action tab\r\n */\r\nexport const enum DebugLayerTab {\r\n /**\r\n * Properties tag (default)\r\n */\r\n Properties = 0,\r\n /**\r\n * Debug tab\r\n */\r\n Debug = 1,\r\n /**\r\n * Statistics tab\r\n */\r\n Statistics = 2,\r\n /**\r\n * Tools tab\r\n */\r\n Tools = 3,\r\n /**\r\n * Settings tab\r\n */\r\n Settings = 4,\r\n}\r\n\r\n/**\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n */\r\nexport class DebugLayer {\r\n /**\r\n * Define the url to get the inspector script from.\r\n * By default it uses the babylonjs CDN.\r\n * @ignoreNaming\r\n */\r\n public static InspectorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/inspector/babylon.inspector.bundle.js`;\r\n\r\n /**\r\n * The default configuration of the inspector\r\n */\r\n public static Config: IInspectorOptions = {\r\n overlay: false,\r\n showExplorer: true,\r\n showInspector: true,\r\n embedMode: false,\r\n handleResize: true,\r\n enablePopup: true,\r\n };\r\n\r\n private _scene: Scene;\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected BJSINSPECTOR = this._getGlobalInspector();\r\n\r\n private _onPropertyChangedObservable?: Observable<{ object: any; property: string; value: any; initialValue: any }>;\r\n /**\r\n * Observable triggered when a property is changed through the inspector.\r\n */\r\n public get onPropertyChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable;\r\n }\r\n\r\n if (!this._onPropertyChangedObservable) {\r\n this._onPropertyChangedObservable = new Observable<{ object: any; property: string; value: any; initialValue: any }>();\r\n }\r\n\r\n return this._onPropertyChangedObservable;\r\n }\r\n\r\n private _onSelectionChangedObservable?: Observable<any>;\r\n /**\r\n * Observable triggered when the selection is changed through the inspector.\r\n */\r\n public get onSelectionChangedObservable() {\r\n if (this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector) {\r\n return this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable;\r\n }\r\n\r\n if (!this._onSelectionChangedObservable) {\r\n this._onSelectionChangedObservable = new Observable<any>();\r\n }\r\n\r\n return this._onSelectionChangedObservable;\r\n }\r\n\r\n /**\r\n * Instantiates a new debug layer.\r\n * The debug layer (aka Inspector) is the go to tool in order to better understand\r\n * what is happening in your scene\r\n * @see https://doc.babylonjs.com/toolsAndResources/inspector\r\n * @param scene Defines the scene to inspect\r\n */\r\n constructor(scene?: Scene) {\r\n this._scene = scene || <Scene>EngineStore.LastCreatedScene;\r\n if (!this._scene) {\r\n return;\r\n }\r\n this._scene.onDisposeObservable.add(() => {\r\n // Debug layer\r\n if (this._scene._debugLayer) {\r\n this._scene._debugLayer.hide();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Creates the inspector window.\r\n * @param config\r\n */\r\n private _createInspector(config?: Partial<IInspectorOptions>) {\r\n if (this.isVisible()) {\r\n return;\r\n }\r\n\r\n if (this._onPropertyChangedObservable) {\r\n for (const observer of this._onPropertyChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnPropertyChangedObservable.add(observer);\r\n }\r\n this._onPropertyChangedObservable.clear();\r\n this._onPropertyChangedObservable = undefined;\r\n }\r\n\r\n if (this._onSelectionChangedObservable) {\r\n for (const observer of this._onSelectionChangedObservable.observers) {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangedObservable.add(observer);\r\n }\r\n this._onSelectionChangedObservable.clear();\r\n this._onSelectionChangedObservable = undefined;\r\n }\r\n\r\n const userOptions: IInspectorOptions = {\r\n ...DebugLayer.Config,\r\n ...config,\r\n };\r\n\r\n this.BJSINSPECTOR = this.BJSINSPECTOR || this._getGlobalInspector();\r\n\r\n this.BJSINSPECTOR.Inspector.Show(this._scene, userOptions);\r\n }\r\n\r\n /**\r\n * Select a specific entity in the scene explorer and highlight a specific block in that entity property grid\r\n * @param entity defines the entity to select\r\n * @param lineContainerTitles defines the specific blocks to highlight (could be a string or an array of strings)\r\n */\r\n public select(entity: any, lineContainerTitles?: string | string[]) {\r\n if (this.BJSINSPECTOR) {\r\n if (lineContainerTitles) {\r\n if (Object.prototype.toString.call(lineContainerTitles) == \"[object String]\") {\r\n this.BJSINSPECTOR.Inspector.MarkLineContainerTitleForHighlighting(lineContainerTitles);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.MarkMultipleLineContainerTitlesForHighlighting(lineContainerTitles);\r\n }\r\n }\r\n if (!this.BJSINSPECTOR.Inspector.IsVisible) {\r\n setTimeout(() => {\r\n this.select(entity, lineContainerTitles);\r\n }, 100);\r\n } else {\r\n this.BJSINSPECTOR.Inspector.OnSelectionChangeObservable.notifyObservers(entity);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Get the inspector from bundle or global\r\n * @returns the inspector instance if found otherwise, null\r\n */\r\n private _getGlobalInspector(): any {\r\n // UMD Global name detection from Webpack Bundle UMD Name.\r\n if (typeof INSPECTOR !== \"undefined\") {\r\n return INSPECTOR;\r\n }\r\n\r\n // In case of module let s check the global emitted from the Inspector entry point.\r\n if (typeof BABYLON !== \"undefined\" && typeof BABYLON.Inspector !== \"undefined\") {\r\n return BABYLON;\r\n }\r\n\r\n return undefined;\r\n }\r\n\r\n /**\r\n * Get if the inspector is visible or not.\r\n * @returns true if visible otherwise, false\r\n */\r\n public isVisible(): boolean {\r\n return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;\r\n }\r\n\r\n /**\r\n * Hide the inspector and close its window.\r\n */\r\n public hide() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.Hide();\r\n }\r\n }\r\n\r\n /**\r\n * Get the number of opened panes in the inspector\r\n */\r\n public get openedPanes() {\r\n if (this.BJSINSPECTOR) {\r\n return this.BJSINSPECTOR.Inspector._OpenedPane;\r\n }\r\n\r\n return 0;\r\n }\r\n\r\n /**\r\n * Update the scene in the inspector\r\n */\r\n public setAsActiveScene() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector._SetNewScene(this._scene);\r\n }\r\n }\r\n\r\n public popupSceneExplorer() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupSceneExplorer();\r\n }\r\n }\r\n\r\n public popupInspector() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupInspector();\r\n }\r\n }\r\n\r\n public popupEmbed() {\r\n if (this.BJSINSPECTOR) {\r\n this.BJSINSPECTOR.Inspector.PopupEmbed();\r\n }\r\n }\r\n\r\n /**\r\n * Launch the debugLayer.\r\n * @param config Define the configuration of the inspector\r\n * @returns a promise fulfilled when the debug layer is visible\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async show(config?: IInspectorOptions): Promise<DebugLayer> {\r\n return await new Promise((resolve) => {\r\n if (typeof this.BJSINSPECTOR == \"undefined\") {\r\n const inspectorUrl = config && config.inspectorURL ? config.inspectorURL : DebugLayer.InspectorURL;\r\n\r\n // Load inspector and add it to the DOM\r\n Tools.LoadBabylonScript(inspectorUrl, () => {\r\n this._createInspector(config);\r\n resolve(this);\r\n });\r\n } else {\r\n // Otherwise creates the inspector\r\n this._createInspector(config);\r\n resolve(this);\r\n }\r\n });\r\n }\r\n}\r\n"]}
@@ -1,4 +1,8 @@
1
1
 
2
+ /**
3
+ * Note: we don't make a difference between mipmaps enabled or not when computing these bits (so, TEXTURE_NEAREST_NEAREST and TEXTURE_NEAREST_NEAREST_MIPNEAREST have the same bits, for example).
4
+ * There's another bit in the hash code for that (see FilterNoMipToBits).
5
+ */
2
6
  const FilterToBits = [
3
7
  0 | (0 << 1) | (0 << 2), // not used
4
8
  0 | (0 << 1) | (0 << 2), // TEXTURE_NEAREST_SAMPLINGMODE / TEXTURE_NEAREST_NEAREST