@babylonjs/core 9.13.0 → 9.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/runtimeAnimation.js +11 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
- package/AudioV2/abstractAudio/abstractSound.js +3 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
- package/AudioV2/abstractAudio/staticSound.js +9 -1
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
- package/AudioV2/abstractAudio/streamingSound.js +9 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +6 -3
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +7 -4
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.js +9 -3
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/targetCamera.pure.js +18 -18
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.js +23 -13
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +3 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +24 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +8 -1
- package/Engines/abstractEngine.pure.js +4 -3
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.d.ts +113 -0
- package/Engines/thinNativeEngine.pure.d.ts +2 -0
- package/Engines/thinNativeEngine.pure.js +115 -9
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/FlowGraph/flowGraph.js +9 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
- package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +11 -0
- package/FlowGraph/serialization.js +11 -1
- package/FlowGraph/serialization.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +63 -35
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +2 -2
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/areaLight.pure.js +5 -0
- package/Lights/areaLight.pure.js.map +1 -1
- package/Lights/light.d.ts +4 -2
- package/Lights/light.js +10 -4
- package/Lights/light.js.map +1 -1
- package/Lights/rectAreaLight.pure.d.ts +17 -0
- package/Lights/rectAreaLight.pure.js +67 -0
- package/Lights/rectAreaLight.pure.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
- package/Materials/Textures/HTML/htmlTexture.js +455 -0
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
- package/Materials/Textures/HTML/index.d.ts +4 -0
- package/Materials/Textures/HTML/index.js +5 -0
- package/Materials/Textures/HTML/index.js.map +1 -0
- package/Materials/Textures/HTML/pure.d.ts +5 -0
- package/Materials/Textures/HTML/pure.js +6 -0
- package/Materials/Textures/HTML/pure.js.map +1 -0
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/pure.d.ts +1 -0
- package/Materials/Textures/pure.js +1 -0
- package/Materials/Textures/pure.js.map +1 -1
- package/Materials/Textures/videoTexture.pure.d.ts +3 -0
- package/Materials/Textures/videoTexture.pure.js +30 -0
- package/Materials/Textures/videoTexture.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +9 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +12 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +20 -6
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/package.json +1 -1
|
@@ -395,6 +395,17 @@ export class RuntimeAnimation {
|
|
|
395
395
|
*/
|
|
396
396
|
_getCorrectLoopMode() {
|
|
397
397
|
if (this._target && this._target.animationPropertiesOverride) {
|
|
398
|
+
// A morph target with no per-target override inherits the scene-level animationPropertiesOverride.
|
|
399
|
+
// That loop mode is meant for transform/bone animations: honoring it here would force the morph
|
|
400
|
+
// influence into (for example) RELATIVE mode and make it accumulate offset * repeatCount every loop.
|
|
401
|
+
// When the override is the inherited scene one, use the animation's own loop mode instead.
|
|
402
|
+
// An override set explicitly on the morph target is still respected.
|
|
403
|
+
const isMorphTarget = this._target.getClassName?.() === "MorphTarget";
|
|
404
|
+
// MorphTarget.animationPropertiesOverride getter inherits from the scene when no per-target override is set.
|
|
405
|
+
// Only bypass the override when it is truly inherited (ie. the target has no local override).
|
|
406
|
+
if (isMorphTarget && this._target._animationPropertiesOverride == null) {
|
|
407
|
+
return this._animation.loopMode;
|
|
408
|
+
}
|
|
398
409
|
return this._target.animationPropertiesOverride.loopMode;
|
|
399
410
|
}
|
|
400
411
|
return this._animation.loopMode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeAnimation.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/runtimeAnimation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAEH,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AC;wBACZ,CAAC;wBACD,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;wBACpB,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;oBAC/B,CAAC,CAAC,wDAAwD;gBAC9D,CAAC;YACL,CAAC;QACL,CAAC;QAED,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzB,CAAC;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { Matrix } from \"../Maths/math.vector.pure\";\r\nimport {\r\n type _IAnimationState,\r\n Animation,\r\n _StaticOffsetValueColor3,\r\n _StaticOffsetValueColor4,\r\n _StaticOffsetValueQuaternion,\r\n _StaticOffsetValueSize,\r\n _StaticOffsetValueVector2,\r\n _StaticOffsetValueVector3,\r\n} from \"./animation.pure\";\r\nimport { type AnimationEvent } from \"./animationEvent\";\r\nimport { type Animatable } from \"./animatable\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type IAnimationKey } from \"./animationKey\";\r\n\r\n/**\r\n * Defines a runtime animation\r\n */\r\nexport class RuntimeAnimation {\r\n private _events = new Array<AnimationEvent>();\r\n\r\n /**\r\n * The current frame of the runtime animation\r\n */\r\n private _currentFrame: number = 0;\r\n\r\n /**\r\n * The animation used by the runtime animation\r\n */\r\n public _animation: Animation;\r\n\r\n /**\r\n * The target of the runtime animation\r\n */\r\n private _target: any;\r\n\r\n /**\r\n * The initiating animatable\r\n */\r\n private _host: Animatable;\r\n\r\n /**\r\n * The original value of the runtime animation\r\n */\r\n private _originalValue = new Array<any>();\r\n\r\n /**\r\n * The original blend value of the runtime animation\r\n */\r\n private _originalBlendValue: Nullable<any> = null;\r\n\r\n /**\r\n * The offsets cache of the runtime animation\r\n */\r\n private _offsetsCache: { [key: string]: any } = {};\r\n\r\n /**\r\n * The high limits cache of the runtime animation\r\n */\r\n private _highLimitsCache: { [key: string]: any } = {};\r\n\r\n /**\r\n * Specifies if the runtime animation has been stopped\r\n */\r\n private _stopped = false;\r\n\r\n /**\r\n * The blending factor of the runtime animation\r\n */\r\n private _blendingFactor = 0;\r\n\r\n /**\r\n * The BabylonJS scene\r\n */\r\n private _scene: Scene;\r\n\r\n /**\r\n * The current value of the runtime animation\r\n */\r\n private _currentValue: Nullable<any> = null;\r\n\r\n /** @internal */\r\n public _animationState: _IAnimationState;\r\n\r\n /**\r\n * The active target of the runtime animation\r\n */\r\n private _activeTargets: any[];\r\n private _currentActiveTarget: Nullable<any> = null;\r\n private _directTarget: Nullable<any> = null;\r\n\r\n /**\r\n * The target path of the runtime animation\r\n */\r\n private _targetPath: string = \"\";\r\n\r\n /**\r\n * The weight of the runtime animation\r\n */\r\n private _weight = 1.0;\r\n\r\n /**\r\n * The absolute frame offset of the runtime animation\r\n */\r\n private _absoluteFrameOffset = 0;\r\n\r\n /**\r\n * The previous elapsed time (since start of animation) of the runtime animation\r\n */\r\n private _previousElapsedTime: number = 0;\r\n\r\n private _yoyoDirection: number = 1;\r\n\r\n /**\r\n * The previous absolute frame of the runtime animation (meaning, without taking into account the from/to values, only the elapsed time and the fps)\r\n */\r\n private _previousAbsoluteFrame: number = 0;\r\n\r\n private _enableBlending: boolean;\r\n\r\n private _keys: IAnimationKey[];\r\n private _minFrame: number;\r\n private _maxFrame: number;\r\n private _targetIsArray = false;\r\n\r\n /** @internal */\r\n public _coreRuntimeAnimation: RuntimeAnimation | null = null;\r\n\r\n /**\r\n * Gets the current frame of the runtime animation\r\n */\r\n public get currentFrame(): number {\r\n return this._currentFrame;\r\n }\r\n\r\n /**\r\n * Gets the weight of the runtime animation\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n /**\r\n * Gets the current value of the runtime animation\r\n */\r\n public get currentValue(): any {\r\n return this._currentValue;\r\n }\r\n\r\n /**\r\n * Gets or sets the target path of the runtime animation\r\n */\r\n public get targetPath(): string {\r\n return this._targetPath;\r\n }\r\n\r\n /**\r\n * Gets the actual target of the runtime animation\r\n */\r\n public get target(): any {\r\n return this._currentActiveTarget;\r\n }\r\n\r\n /**\r\n * Gets the additive state of the runtime animation\r\n */\r\n public get isAdditive(): boolean {\r\n return this._host && this._host.isAdditive;\r\n }\r\n\r\n /** @internal */\r\n public _onLoop: () => void;\r\n\r\n /**\r\n * Create a new RuntimeAnimation object\r\n * @param target defines the target of the animation\r\n * @param animation defines the source animation object\r\n * @param scene defines the hosting scene\r\n * @param host defines the initiating Animatable\r\n */\r\n public constructor(target: any, animation: Animation, scene: Scene, host: Animatable) {\r\n this._animation = animation;\r\n this._target = target;\r\n this._scene = scene;\r\n this._host = host;\r\n this._activeTargets = [];\r\n\r\n animation._runtimeAnimations.push(this);\r\n\r\n // State\r\n this._animationState = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: this._getCorrectLoopMode(),\r\n };\r\n\r\n if (this._animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\r\n this._animationState.workValue = Matrix.Zero();\r\n }\r\n\r\n // Limits\r\n this._keys = this._animation.getKeys();\r\n this._minFrame = this._keys[0].frame;\r\n this._maxFrame = this._keys[this._keys.length - 1].frame;\r\n\r\n // Add a start key at frame 0 if missing\r\n if (this._minFrame !== 0) {\r\n const newKey = { frame: 0, value: this._keys[0].value };\r\n this._keys.splice(0, 0, newKey);\r\n }\r\n\r\n // Check data\r\n if (this._target instanceof Array) {\r\n let index = 0;\r\n for (const target of this._target) {\r\n this._preparePath(target, index);\r\n this._getOriginalValues(index);\r\n index++;\r\n }\r\n this._targetIsArray = true;\r\n } else {\r\n this._preparePath(this._target);\r\n this._getOriginalValues();\r\n this._targetIsArray = false;\r\n this._directTarget = this._activeTargets[0];\r\n }\r\n\r\n // Cloning events locally\r\n const events = animation.getEvents();\r\n if (events && events.length > 0) {\r\n for (const e of events) {\r\n this._events.push(e._clone());\r\n }\r\n }\r\n\r\n this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;\r\n }\r\n\r\n private _preparePath(target: any, targetIndex = 0) {\r\n const targetPropertyPath = this._animation.targetPropertyPath;\r\n\r\n if (targetPropertyPath.length > 1) {\r\n let property = target;\r\n for (let index = 0; index < targetPropertyPath.length - 1; index++) {\r\n const name = targetPropertyPath[index];\r\n property = property[name];\r\n if (property === undefined) {\r\n throw new Error(`Invalid property (${name}) in property path (${targetPropertyPath.join(\".\")})`);\r\n }\r\n }\r\n\r\n this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];\r\n this._activeTargets[targetIndex] = property;\r\n } else {\r\n this._targetPath = targetPropertyPath[0];\r\n this._activeTargets[targetIndex] = target;\r\n }\r\n\r\n if (this._activeTargets[targetIndex][this._targetPath] === undefined) {\r\n throw new Error(`Invalid property (${this._targetPath}) in property path (${targetPropertyPath.join(\".\")})`);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the animation from the runtime animation\r\n */\r\n public get animation(): Animation {\r\n return this._animation;\r\n }\r\n\r\n /**\r\n * Resets the runtime animation to the beginning\r\n * @param restoreOriginal defines whether to restore the target property to the original value\r\n */\r\n public reset(restoreOriginal = false): void {\r\n if (restoreOriginal) {\r\n if (this._target instanceof Array) {\r\n let index = 0;\r\n for (const target of this._target) {\r\n if (this._originalValue[index] !== undefined) {\r\n this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);\r\n }\r\n index++;\r\n }\r\n } else {\r\n if (this._originalValue[0] !== undefined) {\r\n this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);\r\n }\r\n }\r\n }\r\n\r\n this._offsetsCache = {};\r\n this._highLimitsCache = {};\r\n this._currentFrame = 0;\r\n this._blendingFactor = 0;\r\n\r\n // Events\r\n for (let index = 0; index < this._events.length; index++) {\r\n this._events[index].isDone = false;\r\n }\r\n }\r\n\r\n /**\r\n * Specifies if the runtime animation is stopped\r\n * @returns Boolean specifying if the runtime animation is stopped\r\n */\r\n public isStopped(): boolean {\r\n return this._stopped;\r\n }\r\n\r\n /**\r\n * Disposes of the runtime animation\r\n */\r\n public dispose(): void {\r\n const index = this._animation.runtimeAnimations.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._animation.runtimeAnimations.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Apply the interpolated value to the target\r\n * @param currentValue defines the value computed by the animation\r\n * @param weight defines the weight to apply to this value (Defaults to 1.0)\r\n */\r\n public setValue(currentValue: any, weight: number) {\r\n if (this._targetIsArray) {\r\n for (let index = 0; index < this._target.length; index++) {\r\n const target = this._target[index];\r\n this._setValue(target, this._activeTargets[index], currentValue, weight, index);\r\n }\r\n return;\r\n }\r\n this._setValue(this._target, this._directTarget, currentValue, weight, 0);\r\n }\r\n\r\n private _getOriginalValues(targetIndex = 0) {\r\n let originalValue: any;\r\n const target = this._activeTargets[targetIndex];\r\n\r\n if (Animation.InheritOriginalValueFromActiveAnimations) {\r\n // When another active animation is already driving the same target+property,\r\n // inherit its _originalValue instead of snapshotting the live (mid-animation) value.\r\n // This prevents the \"stuck value\" bug when overlapping animations interrupt each other.\r\n const activeAnimatables = this._scene._activeAnimatables;\r\n for (let animIndex = 0; animIndex < activeAnimatables.length; animIndex++) {\r\n const runtimeAnimations = activeAnimatables[animIndex]._runtimeAnimations;\r\n for (let rtIndex = 0; rtIndex < runtimeAnimations.length; rtIndex++) {\r\n const rtAnim = runtimeAnimations[rtIndex];\r\n if (rtAnim === this) {\r\n continue;\r\n }\r\n if (rtAnim._targetPath === this._targetPath) {\r\n for (let i = 0; i < rtAnim._activeTargets.length; i++) {\r\n if (rtAnim._activeTargets[i] === target && rtAnim._originalValue[i] !== undefined) {\r\n if (rtAnim._originalValue[i] && rtAnim._originalValue[i].clone) {\r\n this._originalValue[targetIndex] = rtAnim._originalValue[i].clone();\r\n } else {\r\n this._originalValue[targetIndex] = rtAnim._originalValue[i];\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (target.getLocalMatrix && this._targetPath === \"_matrix\") {\r\n // For bones\r\n originalValue = target.getLocalMatrix();\r\n } else {\r\n originalValue = target[this._targetPath];\r\n }\r\n\r\n if (originalValue && originalValue.clone) {\r\n this._originalValue[targetIndex] = originalValue.clone();\r\n } else {\r\n this._originalValue[targetIndex] = originalValue;\r\n }\r\n }\r\n\r\n private _registerTargetForLateAnimationBinding(runtimeAnimation: RuntimeAnimation, originalValue: any): void {\r\n const target = runtimeAnimation.target;\r\n this._scene._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n totalAdditiveWeight: 0,\r\n animations: [],\r\n additiveAnimations: [],\r\n originalValue: originalValue,\r\n };\r\n }\r\n\r\n if (runtimeAnimation.isAdditive) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;\r\n } else {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n }\r\n }\r\n\r\n private _setValue(target: any, destination: any, currentValue: any, weight: number, targetIndex: number): void {\r\n // Set value\r\n this._currentActiveTarget = destination;\r\n\r\n this._weight = weight;\r\n\r\n if (this._enableBlending && this._blendingFactor <= 1.0) {\r\n if (!this._originalBlendValue) {\r\n const originalValue = destination[this._targetPath];\r\n\r\n if (originalValue.clone) {\r\n this._originalBlendValue = originalValue.clone();\r\n } else {\r\n this._originalBlendValue = originalValue;\r\n }\r\n }\r\n\r\n if (this._originalBlendValue.m) {\r\n // Matrix\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (this._currentValue) {\r\n Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n } else {\r\n this._currentValue = Matrix.DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n } else {\r\n if (this._currentValue) {\r\n Matrix.LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n } else {\r\n this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n } else {\r\n this._currentValue = Animation._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n\r\n const blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;\r\n this._blendingFactor += blendingSpeed;\r\n } else {\r\n if (!this._currentValue) {\r\n if (currentValue?.clone) {\r\n this._currentValue = currentValue.clone();\r\n } else {\r\n this._currentValue = currentValue;\r\n }\r\n } else if (this._currentValue.copyFrom) {\r\n this._currentValue.copyFrom(currentValue);\r\n } else {\r\n this._currentValue = currentValue;\r\n }\r\n }\r\n\r\n if (weight !== -1.0) {\r\n this._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);\r\n } else {\r\n if (this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT) {\r\n if (this._currentValue.addToRef) {\r\n this._currentValue.addToRef(this._originalValue[targetIndex], destination[this._targetPath]);\r\n } else {\r\n destination[this._targetPath] = this._originalValue[targetIndex] + this._currentValue;\r\n }\r\n } else {\r\n destination[this._targetPath] = this._currentValue;\r\n }\r\n }\r\n\r\n if (target.markAsDirty) {\r\n target.markAsDirty(this._animation.targetProperty);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the loop pmode of the runtime animation\r\n * @returns Loop Mode\r\n */\r\n private _getCorrectLoopMode(): number | undefined {\r\n if (this._target && this._target.animationPropertiesOverride) {\r\n return this._target.animationPropertiesOverride.loopMode as number;\r\n }\r\n\r\n return this._animation.loopMode;\r\n }\r\n\r\n /**\r\n * Move the current animation to a given frame\r\n * @param frame defines the frame to move to\r\n * @param weight defines the weight to apply to the animation (-1.0 by default)\r\n */\r\n public goToFrame(frame: number, weight = -1): void {\r\n const keys = this._animation.getKeys();\r\n\r\n if (frame < keys[0].frame) {\r\n frame = keys[0].frame;\r\n } else if (frame > keys[keys.length - 1].frame) {\r\n frame = keys[keys.length - 1].frame;\r\n }\r\n\r\n // Need to reset animation events\r\n const events = this._events;\r\n if (events.length) {\r\n for (let index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset events in the future\r\n events[index].isDone = events[index].frame < frame;\r\n }\r\n }\r\n }\r\n\r\n this._currentFrame = frame;\r\n const currentValue = this._animation._interpolate(frame, this._animationState);\r\n\r\n this.setValue(currentValue, weight);\r\n }\r\n\r\n /**\r\n * @internal Internal use only\r\n */\r\n public _prepareForSpeedRatioChange(newSpeedRatio: number): void {\r\n const newAbsoluteFrame = (this._previousElapsedTime * (this._animation.framePerSecond * newSpeedRatio)) / 1000.0;\r\n\r\n this._absoluteFrameOffset = this._previousAbsoluteFrame - newAbsoluteFrame;\r\n }\r\n\r\n /**\r\n * Execute the current animation\r\n * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started\r\n * @param from defines the lower frame of the animation range\r\n * @param to defines the upper frame of the animation range\r\n * @param loop defines if the current animation must loop\r\n * @param speedRatio defines the current speed ratio\r\n * @param weight defines the weight of the animation (default is -1 so no weight)\r\n * @returns a boolean indicating if the animation is running\r\n */\r\n public animate(elapsedTimeSinceAnimationStart: number, from: number, to: number, loop: boolean, speedRatio: number, weight = -1.0): boolean {\r\n const animation = this._animation;\r\n const targetPropertyPath = animation.targetPropertyPath;\r\n if (!targetPropertyPath || targetPropertyPath.length < 1) {\r\n this._stopped = true;\r\n return false;\r\n }\r\n\r\n let returnValue = true;\r\n let currentFrame: number;\r\n const events = this._events;\r\n let frameRange: number;\r\n\r\n if (!this._coreRuntimeAnimation) {\r\n // Check limits\r\n if (from < this._minFrame || from > this._maxFrame) {\r\n from = this._minFrame;\r\n }\r\n if (to < this._minFrame || to > this._maxFrame) {\r\n to = this._maxFrame;\r\n }\r\n\r\n frameRange = to - from;\r\n let offsetValue: any;\r\n\r\n // Compute the frame according to the elapsed time and the fps of the animation (\"from\" and \"to\" are not factored in!)\r\n let absoluteFrame = (elapsedTimeSinceAnimationStart * (animation.framePerSecond * speedRatio)) / 1000.0 + this._absoluteFrameOffset;\r\n let highLimitValue = 0;\r\n\r\n // Apply the yoyo function if required\r\n let yoyoLoop = false;\r\n const yoyoMode = loop && this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_YOYO;\r\n if (yoyoMode) {\r\n const position = (absoluteFrame - from) / frameRange;\r\n\r\n // Apply the yoyo curve\r\n const sin = Math.sin(position * Math.PI);\r\n const yoyoPosition = Math.abs(sin);\r\n\r\n // Map the yoyo position back to the range\r\n absoluteFrame = yoyoPosition * frameRange + from;\r\n\r\n const direction = sin >= 0 ? 1 : -1;\r\n if (this._yoyoDirection !== direction) {\r\n yoyoLoop = true;\r\n }\r\n\r\n this._yoyoDirection = direction;\r\n }\r\n\r\n this._previousElapsedTime = elapsedTimeSinceAnimationStart;\r\n this._previousAbsoluteFrame = absoluteFrame;\r\n\r\n if (!loop && to >= from && ((absoluteFrame >= frameRange && speedRatio > 0) || (absoluteFrame <= 0 && speedRatio < 0))) {\r\n // If we are out of range and not looping get back to caller\r\n returnValue = false;\r\n highLimitValue = animation.evaluate(to);\r\n } else if (!loop && from >= to && ((absoluteFrame <= frameRange && speedRatio < 0) || (absoluteFrame >= 0 && speedRatio > 0))) {\r\n returnValue = false;\r\n highLimitValue = animation.evaluate(from);\r\n } else if (this._animationState.loopMode !== Animation.ANIMATIONLOOPMODE_CYCLE) {\r\n const keyOffset = to.toString() + from.toString();\r\n if (!this._offsetsCache[keyOffset]) {\r\n this._animationState.repeatCount = 0;\r\n this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE; // force a specific codepath in animation._interpolate()!\r\n const fromValue = animation._interpolate(from, this._animationState);\r\n const toValue = animation._interpolate(to, this._animationState);\r\n\r\n this._animationState.loopMode = this._getCorrectLoopMode();\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n this._offsetsCache[keyOffset] = toValue - fromValue;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n this._highLimitsCache[keyOffset] = toValue;\r\n }\r\n\r\n highLimitValue = this._highLimitsCache[keyOffset];\r\n offsetValue = this._offsetsCache[keyOffset];\r\n }\r\n\r\n if (offsetValue === undefined) {\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n offsetValue = 0;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n offsetValue = _StaticOffsetValueQuaternion;\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n offsetValue = _StaticOffsetValueVector3;\r\n break;\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n offsetValue = _StaticOffsetValueVector2;\r\n break;\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n offsetValue = _StaticOffsetValueSize;\r\n break;\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n offsetValue = _StaticOffsetValueColor3;\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n offsetValue = _StaticOffsetValueColor4;\r\n break;\r\n }\r\n }\r\n\r\n // Compute value\r\n\r\n if (this._host && this._host.syncRoot) {\r\n // If we must sync with an animatable, calculate the current frame based on the frame of the root animatable\r\n const syncRoot = this._host.syncRoot;\r\n const hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);\r\n currentFrame = from + frameRange * hostNormalizedFrame;\r\n } else {\r\n if ((absoluteFrame > 0 && from > to) || (absoluteFrame < 0 && from < to)) {\r\n currentFrame = returnValue && frameRange !== 0 ? to + (absoluteFrame % frameRange) : from;\r\n } else {\r\n currentFrame = returnValue && frameRange !== 0 ? from + (absoluteFrame % frameRange) : to;\r\n }\r\n }\r\n\r\n // Reset event/state if looping\r\n if ((!yoyoMode && ((speedRatio > 0 && this.currentFrame > currentFrame) || (speedRatio < 0 && this.currentFrame < currentFrame))) || (yoyoMode && yoyoLoop)) {\r\n this._onLoop();\r\n\r\n // Need to reset animation events\r\n for (let index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset event, the animation is looping\r\n events[index].isDone = false;\r\n }\r\n }\r\n\r\n this._animationState.key = speedRatio > 0 ? 0 : animation.getKeys().length - 1;\r\n }\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = frameRange === 0 ? 0 : (absoluteFrame / frameRange) >> 0;\r\n this._animationState.highLimitValue = highLimitValue;\r\n this._animationState.offsetValue = offsetValue;\r\n } else {\r\n frameRange = to - from;\r\n currentFrame = this._coreRuntimeAnimation.currentFrame;\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = this._coreRuntimeAnimation._animationState.repeatCount;\r\n this._animationState.highLimitValue = this._coreRuntimeAnimation._animationState.highLimitValue;\r\n this._animationState.offsetValue = this._coreRuntimeAnimation._animationState.offsetValue;\r\n }\r\n\r\n const currentValue = animation._interpolate(currentFrame, this._animationState);\r\n\r\n // Set value\r\n this.setValue(currentValue, weight);\r\n\r\n // Check events\r\n if (events.length) {\r\n for (let index = 0; index < events.length; index++) {\r\n // Make sure current frame has passed event frame and that event frame is within the current range\r\n // Also, handle both forward and reverse animations\r\n if (\r\n (frameRange >= 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||\r\n (frameRange < 0 && currentFrame <= events[index].frame && events[index].frame <= from)\r\n ) {\r\n const event = events[index];\r\n if (!event.isDone) {\r\n // If event should be done only once, remove it.\r\n if (event.onlyOnce) {\r\n events.splice(index, 1);\r\n index--;\r\n }\r\n event.isDone = true;\r\n event.action(currentFrame);\r\n } // Don't do anything if the event has already been done.\r\n }\r\n }\r\n }\r\n\r\n if (!returnValue) {\r\n this._stopped = true;\r\n }\r\n\r\n return returnValue;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"runtimeAnimation.js","sourceRoot":"","sources":["../../../../dev/core/src/Animations/runtimeAnimation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAEH,SAAS,EACT,wBAAwB,EACxB,wBAAwB,EACxB,4BAA4B,EAC5B,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,GAC5B,MAAM,kBAAkB,CAAC;AAM1B;;GAEG;AACH,MAAM,OAAO,gBAAgB;IA8GzB;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,oBAAo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AE,CAAC;YACf,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACzB,CAAC;QAED,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { Matrix } from \"../Maths/math.vector.pure\";\r\nimport {\r\n type _IAnimationState,\r\n Animation,\r\n _StaticOffsetValueColor3,\r\n _StaticOffsetValueColor4,\r\n _StaticOffsetValueQuaternion,\r\n _StaticOffsetValueSize,\r\n _StaticOffsetValueVector2,\r\n _StaticOffsetValueVector3,\r\n} from \"./animation.pure\";\r\nimport { type AnimationEvent } from \"./animationEvent\";\r\nimport { type Animatable } from \"./animatable\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type IAnimationKey } from \"./animationKey\";\r\n\r\n/**\r\n * Defines a runtime animation\r\n */\r\nexport class RuntimeAnimation {\r\n private _events = new Array<AnimationEvent>();\r\n\r\n /**\r\n * The current frame of the runtime animation\r\n */\r\n private _currentFrame: number = 0;\r\n\r\n /**\r\n * The animation used by the runtime animation\r\n */\r\n public _animation: Animation;\r\n\r\n /**\r\n * The target of the runtime animation\r\n */\r\n private _target: any;\r\n\r\n /**\r\n * The initiating animatable\r\n */\r\n private _host: Animatable;\r\n\r\n /**\r\n * The original value of the runtime animation\r\n */\r\n private _originalValue = new Array<any>();\r\n\r\n /**\r\n * The original blend value of the runtime animation\r\n */\r\n private _originalBlendValue: Nullable<any> = null;\r\n\r\n /**\r\n * The offsets cache of the runtime animation\r\n */\r\n private _offsetsCache: { [key: string]: any } = {};\r\n\r\n /**\r\n * The high limits cache of the runtime animation\r\n */\r\n private _highLimitsCache: { [key: string]: any } = {};\r\n\r\n /**\r\n * Specifies if the runtime animation has been stopped\r\n */\r\n private _stopped = false;\r\n\r\n /**\r\n * The blending factor of the runtime animation\r\n */\r\n private _blendingFactor = 0;\r\n\r\n /**\r\n * The BabylonJS scene\r\n */\r\n private _scene: Scene;\r\n\r\n /**\r\n * The current value of the runtime animation\r\n */\r\n private _currentValue: Nullable<any> = null;\r\n\r\n /** @internal */\r\n public _animationState: _IAnimationState;\r\n\r\n /**\r\n * The active target of the runtime animation\r\n */\r\n private _activeTargets: any[];\r\n private _currentActiveTarget: Nullable<any> = null;\r\n private _directTarget: Nullable<any> = null;\r\n\r\n /**\r\n * The target path of the runtime animation\r\n */\r\n private _targetPath: string = \"\";\r\n\r\n /**\r\n * The weight of the runtime animation\r\n */\r\n private _weight = 1.0;\r\n\r\n /**\r\n * The absolute frame offset of the runtime animation\r\n */\r\n private _absoluteFrameOffset = 0;\r\n\r\n /**\r\n * The previous elapsed time (since start of animation) of the runtime animation\r\n */\r\n private _previousElapsedTime: number = 0;\r\n\r\n private _yoyoDirection: number = 1;\r\n\r\n /**\r\n * The previous absolute frame of the runtime animation (meaning, without taking into account the from/to values, only the elapsed time and the fps)\r\n */\r\n private _previousAbsoluteFrame: number = 0;\r\n\r\n private _enableBlending: boolean;\r\n\r\n private _keys: IAnimationKey[];\r\n private _minFrame: number;\r\n private _maxFrame: number;\r\n private _targetIsArray = false;\r\n\r\n /** @internal */\r\n public _coreRuntimeAnimation: RuntimeAnimation | null = null;\r\n\r\n /**\r\n * Gets the current frame of the runtime animation\r\n */\r\n public get currentFrame(): number {\r\n return this._currentFrame;\r\n }\r\n\r\n /**\r\n * Gets the weight of the runtime animation\r\n */\r\n public get weight(): number {\r\n return this._weight;\r\n }\r\n\r\n /**\r\n * Gets the current value of the runtime animation\r\n */\r\n public get currentValue(): any {\r\n return this._currentValue;\r\n }\r\n\r\n /**\r\n * Gets or sets the target path of the runtime animation\r\n */\r\n public get targetPath(): string {\r\n return this._targetPath;\r\n }\r\n\r\n /**\r\n * Gets the actual target of the runtime animation\r\n */\r\n public get target(): any {\r\n return this._currentActiveTarget;\r\n }\r\n\r\n /**\r\n * Gets the additive state of the runtime animation\r\n */\r\n public get isAdditive(): boolean {\r\n return this._host && this._host.isAdditive;\r\n }\r\n\r\n /** @internal */\r\n public _onLoop: () => void;\r\n\r\n /**\r\n * Create a new RuntimeAnimation object\r\n * @param target defines the target of the animation\r\n * @param animation defines the source animation object\r\n * @param scene defines the hosting scene\r\n * @param host defines the initiating Animatable\r\n */\r\n public constructor(target: any, animation: Animation, scene: Scene, host: Animatable) {\r\n this._animation = animation;\r\n this._target = target;\r\n this._scene = scene;\r\n this._host = host;\r\n this._activeTargets = [];\r\n\r\n animation._runtimeAnimations.push(this);\r\n\r\n // State\r\n this._animationState = {\r\n key: 0,\r\n repeatCount: 0,\r\n loopMode: this._getCorrectLoopMode(),\r\n };\r\n\r\n if (this._animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {\r\n this._animationState.workValue = Matrix.Zero();\r\n }\r\n\r\n // Limits\r\n this._keys = this._animation.getKeys();\r\n this._minFrame = this._keys[0].frame;\r\n this._maxFrame = this._keys[this._keys.length - 1].frame;\r\n\r\n // Add a start key at frame 0 if missing\r\n if (this._minFrame !== 0) {\r\n const newKey = { frame: 0, value: this._keys[0].value };\r\n this._keys.splice(0, 0, newKey);\r\n }\r\n\r\n // Check data\r\n if (this._target instanceof Array) {\r\n let index = 0;\r\n for (const target of this._target) {\r\n this._preparePath(target, index);\r\n this._getOriginalValues(index);\r\n index++;\r\n }\r\n this._targetIsArray = true;\r\n } else {\r\n this._preparePath(this._target);\r\n this._getOriginalValues();\r\n this._targetIsArray = false;\r\n this._directTarget = this._activeTargets[0];\r\n }\r\n\r\n // Cloning events locally\r\n const events = animation.getEvents();\r\n if (events && events.length > 0) {\r\n for (const e of events) {\r\n this._events.push(e._clone());\r\n }\r\n }\r\n\r\n this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;\r\n }\r\n\r\n private _preparePath(target: any, targetIndex = 0) {\r\n const targetPropertyPath = this._animation.targetPropertyPath;\r\n\r\n if (targetPropertyPath.length > 1) {\r\n let property = target;\r\n for (let index = 0; index < targetPropertyPath.length - 1; index++) {\r\n const name = targetPropertyPath[index];\r\n property = property[name];\r\n if (property === undefined) {\r\n throw new Error(`Invalid property (${name}) in property path (${targetPropertyPath.join(\".\")})`);\r\n }\r\n }\r\n\r\n this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];\r\n this._activeTargets[targetIndex] = property;\r\n } else {\r\n this._targetPath = targetPropertyPath[0];\r\n this._activeTargets[targetIndex] = target;\r\n }\r\n\r\n if (this._activeTargets[targetIndex][this._targetPath] === undefined) {\r\n throw new Error(`Invalid property (${this._targetPath}) in property path (${targetPropertyPath.join(\".\")})`);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the animation from the runtime animation\r\n */\r\n public get animation(): Animation {\r\n return this._animation;\r\n }\r\n\r\n /**\r\n * Resets the runtime animation to the beginning\r\n * @param restoreOriginal defines whether to restore the target property to the original value\r\n */\r\n public reset(restoreOriginal = false): void {\r\n if (restoreOriginal) {\r\n if (this._target instanceof Array) {\r\n let index = 0;\r\n for (const target of this._target) {\r\n if (this._originalValue[index] !== undefined) {\r\n this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);\r\n }\r\n index++;\r\n }\r\n } else {\r\n if (this._originalValue[0] !== undefined) {\r\n this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);\r\n }\r\n }\r\n }\r\n\r\n this._offsetsCache = {};\r\n this._highLimitsCache = {};\r\n this._currentFrame = 0;\r\n this._blendingFactor = 0;\r\n\r\n // Events\r\n for (let index = 0; index < this._events.length; index++) {\r\n this._events[index].isDone = false;\r\n }\r\n }\r\n\r\n /**\r\n * Specifies if the runtime animation is stopped\r\n * @returns Boolean specifying if the runtime animation is stopped\r\n */\r\n public isStopped(): boolean {\r\n return this._stopped;\r\n }\r\n\r\n /**\r\n * Disposes of the runtime animation\r\n */\r\n public dispose(): void {\r\n const index = this._animation.runtimeAnimations.indexOf(this);\r\n\r\n if (index > -1) {\r\n this._animation.runtimeAnimations.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Apply the interpolated value to the target\r\n * @param currentValue defines the value computed by the animation\r\n * @param weight defines the weight to apply to this value (Defaults to 1.0)\r\n */\r\n public setValue(currentValue: any, weight: number) {\r\n if (this._targetIsArray) {\r\n for (let index = 0; index < this._target.length; index++) {\r\n const target = this._target[index];\r\n this._setValue(target, this._activeTargets[index], currentValue, weight, index);\r\n }\r\n return;\r\n }\r\n this._setValue(this._target, this._directTarget, currentValue, weight, 0);\r\n }\r\n\r\n private _getOriginalValues(targetIndex = 0) {\r\n let originalValue: any;\r\n const target = this._activeTargets[targetIndex];\r\n\r\n if (Animation.InheritOriginalValueFromActiveAnimations) {\r\n // When another active animation is already driving the same target+property,\r\n // inherit its _originalValue instead of snapshotting the live (mid-animation) value.\r\n // This prevents the \"stuck value\" bug when overlapping animations interrupt each other.\r\n const activeAnimatables = this._scene._activeAnimatables;\r\n for (let animIndex = 0; animIndex < activeAnimatables.length; animIndex++) {\r\n const runtimeAnimations = activeAnimatables[animIndex]._runtimeAnimations;\r\n for (let rtIndex = 0; rtIndex < runtimeAnimations.length; rtIndex++) {\r\n const rtAnim = runtimeAnimations[rtIndex];\r\n if (rtAnim === this) {\r\n continue;\r\n }\r\n if (rtAnim._targetPath === this._targetPath) {\r\n for (let i = 0; i < rtAnim._activeTargets.length; i++) {\r\n if (rtAnim._activeTargets[i] === target && rtAnim._originalValue[i] !== undefined) {\r\n if (rtAnim._originalValue[i] && rtAnim._originalValue[i].clone) {\r\n this._originalValue[targetIndex] = rtAnim._originalValue[i].clone();\r\n } else {\r\n this._originalValue[targetIndex] = rtAnim._originalValue[i];\r\n }\r\n return;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n if (target.getLocalMatrix && this._targetPath === \"_matrix\") {\r\n // For bones\r\n originalValue = target.getLocalMatrix();\r\n } else {\r\n originalValue = target[this._targetPath];\r\n }\r\n\r\n if (originalValue && originalValue.clone) {\r\n this._originalValue[targetIndex] = originalValue.clone();\r\n } else {\r\n this._originalValue[targetIndex] = originalValue;\r\n }\r\n }\r\n\r\n private _registerTargetForLateAnimationBinding(runtimeAnimation: RuntimeAnimation, originalValue: any): void {\r\n const target = runtimeAnimation.target;\r\n this._scene._registeredForLateAnimationBindings.pushNoDuplicate(target);\r\n\r\n if (!target._lateAnimationHolders) {\r\n target._lateAnimationHolders = {};\r\n }\r\n\r\n if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath] = {\r\n totalWeight: 0,\r\n totalAdditiveWeight: 0,\r\n animations: [],\r\n additiveAnimations: [],\r\n originalValue: originalValue,\r\n };\r\n }\r\n\r\n if (runtimeAnimation.isAdditive) {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;\r\n } else {\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);\r\n target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;\r\n }\r\n }\r\n\r\n private _setValue(target: any, destination: any, currentValue: any, weight: number, targetIndex: number): void {\r\n // Set value\r\n this._currentActiveTarget = destination;\r\n\r\n this._weight = weight;\r\n\r\n if (this._enableBlending && this._blendingFactor <= 1.0) {\r\n if (!this._originalBlendValue) {\r\n const originalValue = destination[this._targetPath];\r\n\r\n if (originalValue.clone) {\r\n this._originalBlendValue = originalValue.clone();\r\n } else {\r\n this._originalBlendValue = originalValue;\r\n }\r\n }\r\n\r\n if (this._originalBlendValue.m) {\r\n // Matrix\r\n if (Animation.AllowMatrixDecomposeForInterpolation) {\r\n if (this._currentValue) {\r\n Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n } else {\r\n this._currentValue = Matrix.DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n } else {\r\n if (this._currentValue) {\r\n Matrix.LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);\r\n } else {\r\n this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n }\r\n } else {\r\n this._currentValue = Animation._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);\r\n }\r\n\r\n const blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;\r\n this._blendingFactor += blendingSpeed;\r\n } else {\r\n if (!this._currentValue) {\r\n if (currentValue?.clone) {\r\n this._currentValue = currentValue.clone();\r\n } else {\r\n this._currentValue = currentValue;\r\n }\r\n } else if (this._currentValue.copyFrom) {\r\n this._currentValue.copyFrom(currentValue);\r\n } else {\r\n this._currentValue = currentValue;\r\n }\r\n }\r\n\r\n if (weight !== -1.0) {\r\n this._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);\r\n } else {\r\n if (this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT) {\r\n if (this._currentValue.addToRef) {\r\n this._currentValue.addToRef(this._originalValue[targetIndex], destination[this._targetPath]);\r\n } else {\r\n destination[this._targetPath] = this._originalValue[targetIndex] + this._currentValue;\r\n }\r\n } else {\r\n destination[this._targetPath] = this._currentValue;\r\n }\r\n }\r\n\r\n if (target.markAsDirty) {\r\n target.markAsDirty(this._animation.targetProperty);\r\n }\r\n }\r\n\r\n /**\r\n * Gets the loop pmode of the runtime animation\r\n * @returns Loop Mode\r\n */\r\n private _getCorrectLoopMode(): number | undefined {\r\n if (this._target && this._target.animationPropertiesOverride) {\r\n // A morph target with no per-target override inherits the scene-level animationPropertiesOverride.\r\n // That loop mode is meant for transform/bone animations: honoring it here would force the morph\r\n // influence into (for example) RELATIVE mode and make it accumulate offset * repeatCount every loop.\r\n // When the override is the inherited scene one, use the animation's own loop mode instead.\r\n // An override set explicitly on the morph target is still respected.\r\n const isMorphTarget = this._target.getClassName?.() === \"MorphTarget\";\r\n\r\n // MorphTarget.animationPropertiesOverride getter inherits from the scene when no per-target override is set.\r\n\r\n // Only bypass the override when it is truly inherited (ie. the target has no local override).\r\n\r\n if (isMorphTarget && (this._target as any)._animationPropertiesOverride == null) {\r\n return this._animation.loopMode;\r\n }\r\n\r\n return this._target.animationPropertiesOverride.loopMode as number;\r\n }\r\n\r\n return this._animation.loopMode;\r\n }\r\n\r\n /**\r\n * Move the current animation to a given frame\r\n * @param frame defines the frame to move to\r\n * @param weight defines the weight to apply to the animation (-1.0 by default)\r\n */\r\n public goToFrame(frame: number, weight = -1): void {\r\n const keys = this._animation.getKeys();\r\n\r\n if (frame < keys[0].frame) {\r\n frame = keys[0].frame;\r\n } else if (frame > keys[keys.length - 1].frame) {\r\n frame = keys[keys.length - 1].frame;\r\n }\r\n\r\n // Need to reset animation events\r\n const events = this._events;\r\n if (events.length) {\r\n for (let index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset events in the future\r\n events[index].isDone = events[index].frame < frame;\r\n }\r\n }\r\n }\r\n\r\n this._currentFrame = frame;\r\n const currentValue = this._animation._interpolate(frame, this._animationState);\r\n\r\n this.setValue(currentValue, weight);\r\n }\r\n\r\n /**\r\n * @internal Internal use only\r\n */\r\n public _prepareForSpeedRatioChange(newSpeedRatio: number): void {\r\n const newAbsoluteFrame = (this._previousElapsedTime * (this._animation.framePerSecond * newSpeedRatio)) / 1000.0;\r\n\r\n this._absoluteFrameOffset = this._previousAbsoluteFrame - newAbsoluteFrame;\r\n }\r\n\r\n /**\r\n * Execute the current animation\r\n * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started\r\n * @param from defines the lower frame of the animation range\r\n * @param to defines the upper frame of the animation range\r\n * @param loop defines if the current animation must loop\r\n * @param speedRatio defines the current speed ratio\r\n * @param weight defines the weight of the animation (default is -1 so no weight)\r\n * @returns a boolean indicating if the animation is running\r\n */\r\n public animate(elapsedTimeSinceAnimationStart: number, from: number, to: number, loop: boolean, speedRatio: number, weight = -1.0): boolean {\r\n const animation = this._animation;\r\n const targetPropertyPath = animation.targetPropertyPath;\r\n if (!targetPropertyPath || targetPropertyPath.length < 1) {\r\n this._stopped = true;\r\n return false;\r\n }\r\n\r\n let returnValue = true;\r\n let currentFrame: number;\r\n const events = this._events;\r\n let frameRange: number;\r\n\r\n if (!this._coreRuntimeAnimation) {\r\n // Check limits\r\n if (from < this._minFrame || from > this._maxFrame) {\r\n from = this._minFrame;\r\n }\r\n if (to < this._minFrame || to > this._maxFrame) {\r\n to = this._maxFrame;\r\n }\r\n\r\n frameRange = to - from;\r\n let offsetValue: any;\r\n\r\n // Compute the frame according to the elapsed time and the fps of the animation (\"from\" and \"to\" are not factored in!)\r\n let absoluteFrame = (elapsedTimeSinceAnimationStart * (animation.framePerSecond * speedRatio)) / 1000.0 + this._absoluteFrameOffset;\r\n let highLimitValue = 0;\r\n\r\n // Apply the yoyo function if required\r\n let yoyoLoop = false;\r\n const yoyoMode = loop && this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_YOYO;\r\n if (yoyoMode) {\r\n const position = (absoluteFrame - from) / frameRange;\r\n\r\n // Apply the yoyo curve\r\n const sin = Math.sin(position * Math.PI);\r\n const yoyoPosition = Math.abs(sin);\r\n\r\n // Map the yoyo position back to the range\r\n absoluteFrame = yoyoPosition * frameRange + from;\r\n\r\n const direction = sin >= 0 ? 1 : -1;\r\n if (this._yoyoDirection !== direction) {\r\n yoyoLoop = true;\r\n }\r\n\r\n this._yoyoDirection = direction;\r\n }\r\n\r\n this._previousElapsedTime = elapsedTimeSinceAnimationStart;\r\n this._previousAbsoluteFrame = absoluteFrame;\r\n\r\n if (!loop && to >= from && ((absoluteFrame >= frameRange && speedRatio > 0) || (absoluteFrame <= 0 && speedRatio < 0))) {\r\n // If we are out of range and not looping get back to caller\r\n returnValue = false;\r\n highLimitValue = animation.evaluate(to);\r\n } else if (!loop && from >= to && ((absoluteFrame <= frameRange && speedRatio < 0) || (absoluteFrame >= 0 && speedRatio > 0))) {\r\n returnValue = false;\r\n highLimitValue = animation.evaluate(from);\r\n } else if (this._animationState.loopMode !== Animation.ANIMATIONLOOPMODE_CYCLE) {\r\n const keyOffset = to.toString() + from.toString();\r\n if (!this._offsetsCache[keyOffset]) {\r\n this._animationState.repeatCount = 0;\r\n this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE; // force a specific codepath in animation._interpolate()!\r\n const fromValue = animation._interpolate(from, this._animationState);\r\n const toValue = animation._interpolate(to, this._animationState);\r\n\r\n this._animationState.loopMode = this._getCorrectLoopMode();\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n this._offsetsCache[keyOffset] = toValue - fromValue;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n this._offsetsCache[keyOffset] = toValue.subtract(fromValue);\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n this._highLimitsCache[keyOffset] = toValue;\r\n }\r\n\r\n highLimitValue = this._highLimitsCache[keyOffset];\r\n offsetValue = this._offsetsCache[keyOffset];\r\n }\r\n\r\n if (offsetValue === undefined) {\r\n switch (animation.dataType) {\r\n // Float\r\n case Animation.ANIMATIONTYPE_FLOAT:\r\n offsetValue = 0;\r\n break;\r\n // Quaternion\r\n case Animation.ANIMATIONTYPE_QUATERNION:\r\n offsetValue = _StaticOffsetValueQuaternion;\r\n break;\r\n // Vector3\r\n case Animation.ANIMATIONTYPE_VECTOR3:\r\n offsetValue = _StaticOffsetValueVector3;\r\n break;\r\n // Vector2\r\n case Animation.ANIMATIONTYPE_VECTOR2:\r\n offsetValue = _StaticOffsetValueVector2;\r\n break;\r\n // Size\r\n case Animation.ANIMATIONTYPE_SIZE:\r\n offsetValue = _StaticOffsetValueSize;\r\n break;\r\n // Color3\r\n case Animation.ANIMATIONTYPE_COLOR3:\r\n offsetValue = _StaticOffsetValueColor3;\r\n break;\r\n case Animation.ANIMATIONTYPE_COLOR4:\r\n offsetValue = _StaticOffsetValueColor4;\r\n break;\r\n }\r\n }\r\n\r\n // Compute value\r\n\r\n if (this._host && this._host.syncRoot) {\r\n // If we must sync with an animatable, calculate the current frame based on the frame of the root animatable\r\n const syncRoot = this._host.syncRoot;\r\n const hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);\r\n currentFrame = from + frameRange * hostNormalizedFrame;\r\n } else {\r\n if ((absoluteFrame > 0 && from > to) || (absoluteFrame < 0 && from < to)) {\r\n currentFrame = returnValue && frameRange !== 0 ? to + (absoluteFrame % frameRange) : from;\r\n } else {\r\n currentFrame = returnValue && frameRange !== 0 ? from + (absoluteFrame % frameRange) : to;\r\n }\r\n }\r\n\r\n // Reset event/state if looping\r\n if ((!yoyoMode && ((speedRatio > 0 && this.currentFrame > currentFrame) || (speedRatio < 0 && this.currentFrame < currentFrame))) || (yoyoMode && yoyoLoop)) {\r\n this._onLoop();\r\n\r\n // Need to reset animation events\r\n for (let index = 0; index < events.length; index++) {\r\n if (!events[index].onlyOnce) {\r\n // reset event, the animation is looping\r\n events[index].isDone = false;\r\n }\r\n }\r\n\r\n this._animationState.key = speedRatio > 0 ? 0 : animation.getKeys().length - 1;\r\n }\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = frameRange === 0 ? 0 : (absoluteFrame / frameRange) >> 0;\r\n this._animationState.highLimitValue = highLimitValue;\r\n this._animationState.offsetValue = offsetValue;\r\n } else {\r\n frameRange = to - from;\r\n currentFrame = this._coreRuntimeAnimation.currentFrame;\r\n this._currentFrame = currentFrame;\r\n this._animationState.repeatCount = this._coreRuntimeAnimation._animationState.repeatCount;\r\n this._animationState.highLimitValue = this._coreRuntimeAnimation._animationState.highLimitValue;\r\n this._animationState.offsetValue = this._coreRuntimeAnimation._animationState.offsetValue;\r\n }\r\n\r\n const currentValue = animation._interpolate(currentFrame, this._animationState);\r\n\r\n // Set value\r\n this.setValue(currentValue, weight);\r\n\r\n // Check events\r\n if (events.length) {\r\n for (let index = 0; index < events.length; index++) {\r\n // Make sure current frame has passed event frame and that event frame is within the current range\r\n // Also, handle both forward and reverse animations\r\n if (\r\n (frameRange >= 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||\r\n (frameRange < 0 && currentFrame <= events[index].frame && events[index].frame <= from)\r\n ) {\r\n const event = events[index];\r\n if (!event.isDone) {\r\n // If event should be done only once, remove it.\r\n if (event.onlyOnce) {\r\n events.splice(index, 1);\r\n index--;\r\n }\r\n event.isDone = true;\r\n event.action(currentFrame);\r\n } // Don't do anything if the event has already been done.\r\n }\r\n }\r\n }\r\n\r\n if (!returnValue) {\r\n this._stopped = true;\r\n }\r\n\r\n return returnValue;\r\n }\r\n}\r\n"]}
|
|
@@ -105,8 +105,9 @@ export declare abstract class AbstractSound extends AbstractSoundSource {
|
|
|
105
105
|
pause(): void;
|
|
106
106
|
/**
|
|
107
107
|
* Resumes the sound.
|
|
108
|
+
* @param options The options to use when resuming the sound. Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.
|
|
108
109
|
*/
|
|
109
|
-
resume(): void;
|
|
110
|
+
resume(options?: Partial<IAbstractSoundPlayOptions>): void;
|
|
110
111
|
/**
|
|
111
112
|
* Stops the sound.
|
|
112
113
|
* - Triggers `onEndedObservable` if the sound is playing.
|
|
@@ -113,14 +113,15 @@ export class AbstractSound extends AbstractSoundSource {
|
|
|
113
113
|
}
|
|
114
114
|
/**
|
|
115
115
|
* Resumes the sound.
|
|
116
|
+
* @param options The options to use when resuming the sound. Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.
|
|
116
117
|
*/
|
|
117
|
-
resume() {
|
|
118
|
+
resume(options) {
|
|
118
119
|
if (this._state !== 5 /* SoundState.Paused */) {
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
122
|
const it = this._instances.values();
|
|
122
123
|
for (let next = it.next(); !next.done; next = it.next()) {
|
|
123
|
-
next.value.resume();
|
|
124
|
+
next.value.resume(options);
|
|
124
125
|
}
|
|
125
126
|
this._state = 3 /* SoundState.Started */;
|
|
126
127
|
this.engine._onSoundPlaybackStateChanged();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractSound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAKnD,OAAO,EAAE,mBAAmB,EAA4B,MAAM,uBAAuB,CAAC;AA4CtF;;GAEG;AACH,MAAM,OAAgB,aAAc,SAAQ,mBAAmB;IAa3D,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAuC;QAC9F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,+CAAuC,CAAC,CAAC,4BAA4B;QAb5F,oBAAe,GAAqC,IAAI,CAAC;QACzD,sBAAiB,GAAG,IAAI,GAAG,EAA0B,CAAC;QACtD,WAAM,8BAAkC;QAEtC,eAAU,GAAwC,IAAI,CAAC,iBAAiB,CAAC;QAGnF;;WAEG;QACa,sBAAiB,GAAG,IAAI,UAAU,EAAiB,CAAC;QAuL5D,qBAAgB,GAA+C,CAAC,QAAQ,EAAE,EAAE;YAChF,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE,CAAC;gBACpC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;YAChC,CAAC;YAED,QAAQ,CAAC,wBAAwB,CAAC,cAAc,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;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C,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;gBACtD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC;YACtC,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAES,SAAS,CAAC,KAAiB;QACjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAIS,oBAAoB;QAC1B,IAAI,IAAI,CAAC,YAAY,GAAG,QAAQ,EAAE,CAAC;YAC/B,MAAM,gBAAgB,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,+BAAuB,CAAC,CAAC;YACjH,MAAM,uBAAuB,GAAG,gBAAgB,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;YAE5E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAuB,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC/C,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;CAuBJ","sourcesContent":["import { Observable } from \"../../Misc/observable\";\nimport { type Nullable } from \"../../types\";\nimport { SoundState } from \"../soundState\";\nimport { AudioNodeType } from \"./abstractAudioNode\";\nimport { type _AbstractSoundInstance } from \"./abstractSoundInstance\";\nimport { AbstractSoundSource, type ISoundSourceOptions } from \"./abstractSoundSource\";\nimport { type AudioEngineV2 } from \"./audioEngineV2\";\nimport { type IVolumeAudioOptions } from \"./subNodes/volumeAudioSubNode\";\n\n/** @internal */\nexport interface IAbstractSoundOptionsBase {\n /**\n * Whether the sound should start playing automatically. Defaults to `false`.\n */\n autoplay: boolean;\n /**\n * The maximum number of instances that can play at the same time. Defaults to `Infinity`.\n */\n maxInstances: number;\n}\n\n/** @internal */\nexport interface IAbstractSoundPlayOptionsBase {\n /**\n * Whether the sound should loop. Defaults to `false`.\n */\n loop: boolean;\n /**\n * The time within the sound buffer to start playing at, in seconds. Defaults to `0`.\n */\n startOffset: number;\n}\n\n/**\n * Options for creating a sound.\n */\nexport interface IAbstractSoundOptions extends IAbstractSoundOptionsBase, IAbstractSoundPlayOptions, ISoundSourceOptions {}\n\n/**\n * Options for playing a sound.\n */\nexport interface IAbstractSoundPlayOptions extends IAbstractSoundPlayOptionsBase, IVolumeAudioOptions {}\n\n/**\n * Options stored in a sound.\n * @internal\n */\nexport interface IAbstractSoundStoredOptions extends IAbstractSoundOptionsBase, IAbstractSoundPlayOptionsBase {}\n\n/**\n * Abstract class representing a sound in the audio engine.\n */\nexport abstract class AbstractSound extends AbstractSoundSource {\n private _newestInstance: Nullable<_AbstractSoundInstance> = null;\n private _privateInstances = new Set<_AbstractSoundInstance>();\n private _state: SoundState = SoundState.Stopped;\n\n protected _instances: ReadonlySet<_AbstractSoundInstance> = this._privateInstances;\n protected abstract readonly _options: IAbstractSoundStoredOptions;\n\n /**\n * Observable for when the sound stops playing.\n */\n public readonly onEndedObservable = new Observable<AbstractSound>();\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IAbstractSoundOptions>) {\n super(name, engine, options, AudioNodeType.HAS_INPUTS_AND_OUTPUTS); // Inputs are for instances.\n }\n\n /**\n * The number of active instances of the sound that are currently playing.\n */\n public get activeInstancesCount(): number {\n return this._instances.size;\n }\n\n /**\n * Whether the sound should start playing automatically. Defaults to `false`.\n */\n public get autoplay(): boolean {\n return this._options.autoplay;\n }\n\n /**\n * The current playback time of the sound, in seconds.\n */\n public get currentTime(): number {\n const instance = this._getNewestInstance();\n return instance ? instance.currentTime : 0;\n }\n\n public set currentTime(value: number) {\n this.startOffset = value;\n\n const instance = this._getNewestInstance();\n if (instance) {\n instance.currentTime = value;\n }\n }\n\n /**\n * Whether the sound should loop. Defaults to `false`.\n */\n public get loop(): boolean {\n return this._options.loop;\n }\n\n public set loop(value: boolean) {\n this._options.loop = value;\n }\n\n /**\n * The maximum number of instances that can play at the same time. Defaults to `Infinity`.\n */\n public get maxInstances(): number {\n return this._options.maxInstances;\n }\n\n public set maxInstances(value: number) {\n this._options.maxInstances = value;\n }\n\n /**\n * The time within the sound buffer to start playing at, in seconds. Defaults to `0`.\n */\n public get startOffset(): number {\n return this._options.startOffset;\n }\n\n public set startOffset(value: number) {\n this._options.startOffset = value;\n }\n\n /**\n * The state of the sound.\n */\n public get state(): SoundState {\n return this._state;\n }\n\n /**\n * Releases associated resources.\n */\n public override dispose(): void {\n super.dispose();\n\n this.stop();\n\n this._newestInstance = null;\n\n this._privateInstances.clear();\n this.onEndedObservable.clear();\n }\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public abstract play(options?: Partial<IAbstractSoundPlayOptions>): void;\n\n /**\n * Pauses the sound.\n */\n public pause(): void {\n const it = this._instances.values();\n for (let next = it.next(); !next.done; next = it.next()) {\n next.value.pause();\n }\n\n this._state = SoundState.Paused;\n this.engine._onSoundPlaybackStateChanged();\n }\n\n /**\n * Resumes the sound.\n */\n public resume(): void {\n if (this._state !== SoundState.Paused) {\n return;\n }\n\n const it = this._instances.values();\n for (let next = it.next(); !next.done; next = it.next()) {\n next.value.resume();\n }\n\n this._state = SoundState.Started;\n this.engine._onSoundPlaybackStateChanged();\n }\n\n /**\n * Stops the sound.\n * - Triggers `onEndedObservable` if the sound is playing.\n */\n public abstract stop(): void;\n\n protected _beforePlay(instance: _AbstractSoundInstance): void {\n if (this.state === SoundState.Paused && this._instances.size > 0) {\n this.resume();\n return;\n }\n\n instance.onEndedObservable.addOnce(this._onInstanceEnded);\n instance.onStateChangedObservable.add(this._onInstanceStateChanged);\n this._privateInstances.add(instance);\n this._newestInstance = instance;\n }\n\n protected _afterPlay(instance: _AbstractSoundInstance): void {\n this._state = instance.state;\n this.engine._onSoundPlaybackStateChanged();\n }\n\n protected _getNewestInstance(): Nullable<_AbstractSoundInstance> {\n if (this._instances.size === 0) {\n return null;\n }\n\n if (!this._newestInstance) {\n const it = this._instances.values();\n for (let next = it.next(); !next.done; next = it.next()) {\n this._newestInstance = next.value;\n }\n }\n\n return this._newestInstance;\n }\n\n protected _setState(state: SoundState): void {\n this._state = state;\n }\n\n protected abstract _createInstance(): _AbstractSoundInstance;\n\n protected _stopExcessInstances(): void {\n if (this.maxInstances < Infinity) {\n const startedInstances = Array.from(this._instances).filter((instance) => instance.state === SoundState.Started);\n const numberOfInstancesToStop = startedInstances.length - this.maxInstances;\n\n for (let i = 0; i < numberOfInstancesToStop; i++) {\n startedInstances[i].stop();\n }\n }\n }\n\n private _onInstanceEnded: (instance: _AbstractSoundInstance) => void = (instance) => {\n if (this._newestInstance === instance) {\n this._newestInstance = null;\n }\n\n instance.onStateChangedObservable.removeCallback(this._onInstanceStateChanged);\n this._privateInstances.delete(instance);\n\n if (this._instances.size === 0) {\n this._state = SoundState.Stopped;\n this.onEndedObservable.notifyObservers(this);\n }\n\n instance.dispose();\n\n this.engine._onSoundPlaybackStateChanged();\n };\n\n private _onInstanceStateChanged: (instance: _AbstractSoundInstance) => void = (_instance) => {\n this.engine._onSoundPlaybackStateChanged();\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"abstractSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractSound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAKnD,OAAO,EAAE,mBAAmB,EAA4B,MAAM,uBAAuB,CAAC;AA4CtF;;GAEG;AACH,MAAM,OAAgB,aAAc,SAAQ,mBAAmB;IAa3D,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAuC;QAC9F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,+CAAuC,CAAC,CAAC,4BAA4B;QAb5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C;YAC/B,CAAC;QACL,CAAC;IACL,CAAC;CAuBJ","sourcesContent":["import { Observable } from \"../../Misc/observable\";\nimport { type Nullable } from \"../../types\";\nimport { SoundState } from \"../soundState\";\nimport { AudioNodeType } from \"./abstractAudioNode\";\nimport { type _AbstractSoundInstance } from \"./abstractSoundInstance\";\nimport { AbstractSoundSource, type ISoundSourceOptions } from \"./abstractSoundSource\";\nimport { type AudioEngineV2 } from \"./audioEngineV2\";\nimport { type IVolumeAudioOptions } from \"./subNodes/volumeAudioSubNode\";\n\n/** @internal */\nexport interface IAbstractSoundOptionsBase {\n /**\n * Whether the sound should start playing automatically. Defaults to `false`.\n */\n autoplay: boolean;\n /**\n * The maximum number of instances that can play at the same time. Defaults to `Infinity`.\n */\n maxInstances: number;\n}\n\n/** @internal */\nexport interface IAbstractSoundPlayOptionsBase {\n /**\n * Whether the sound should loop. Defaults to `false`.\n */\n loop: boolean;\n /**\n * The time within the sound buffer to start playing at, in seconds. Defaults to `0`.\n */\n startOffset: number;\n}\n\n/**\n * Options for creating a sound.\n */\nexport interface IAbstractSoundOptions extends IAbstractSoundOptionsBase, IAbstractSoundPlayOptions, ISoundSourceOptions {}\n\n/**\n * Options for playing a sound.\n */\nexport interface IAbstractSoundPlayOptions extends IAbstractSoundPlayOptionsBase, IVolumeAudioOptions {}\n\n/**\n * Options stored in a sound.\n * @internal\n */\nexport interface IAbstractSoundStoredOptions extends IAbstractSoundOptionsBase, IAbstractSoundPlayOptionsBase {}\n\n/**\n * Abstract class representing a sound in the audio engine.\n */\nexport abstract class AbstractSound extends AbstractSoundSource {\n private _newestInstance: Nullable<_AbstractSoundInstance> = null;\n private _privateInstances = new Set<_AbstractSoundInstance>();\n private _state: SoundState = SoundState.Stopped;\n\n protected _instances: ReadonlySet<_AbstractSoundInstance> = this._privateInstances;\n protected abstract readonly _options: IAbstractSoundStoredOptions;\n\n /**\n * Observable for when the sound stops playing.\n */\n public readonly onEndedObservable = new Observable<AbstractSound>();\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IAbstractSoundOptions>) {\n super(name, engine, options, AudioNodeType.HAS_INPUTS_AND_OUTPUTS); // Inputs are for instances.\n }\n\n /**\n * The number of active instances of the sound that are currently playing.\n */\n public get activeInstancesCount(): number {\n return this._instances.size;\n }\n\n /**\n * Whether the sound should start playing automatically. Defaults to `false`.\n */\n public get autoplay(): boolean {\n return this._options.autoplay;\n }\n\n /**\n * The current playback time of the sound, in seconds.\n */\n public get currentTime(): number {\n const instance = this._getNewestInstance();\n return instance ? instance.currentTime : 0;\n }\n\n public set currentTime(value: number) {\n this.startOffset = value;\n\n const instance = this._getNewestInstance();\n if (instance) {\n instance.currentTime = value;\n }\n }\n\n /**\n * Whether the sound should loop. Defaults to `false`.\n */\n public get loop(): boolean {\n return this._options.loop;\n }\n\n public set loop(value: boolean) {\n this._options.loop = value;\n }\n\n /**\n * The maximum number of instances that can play at the same time. Defaults to `Infinity`.\n */\n public get maxInstances(): number {\n return this._options.maxInstances;\n }\n\n public set maxInstances(value: number) {\n this._options.maxInstances = value;\n }\n\n /**\n * The time within the sound buffer to start playing at, in seconds. Defaults to `0`.\n */\n public get startOffset(): number {\n return this._options.startOffset;\n }\n\n public set startOffset(value: number) {\n this._options.startOffset = value;\n }\n\n /**\n * The state of the sound.\n */\n public get state(): SoundState {\n return this._state;\n }\n\n /**\n * Releases associated resources.\n */\n public override dispose(): void {\n super.dispose();\n\n this.stop();\n\n this._newestInstance = null;\n\n this._privateInstances.clear();\n this.onEndedObservable.clear();\n }\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public abstract play(options?: Partial<IAbstractSoundPlayOptions>): void;\n\n /**\n * Pauses the sound.\n */\n public pause(): void {\n const it = this._instances.values();\n for (let next = it.next(); !next.done; next = it.next()) {\n next.value.pause();\n }\n\n this._state = SoundState.Paused;\n this.engine._onSoundPlaybackStateChanged();\n }\n\n /**\n * Resumes the sound.\n * @param options The options to use when resuming the sound. Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.\n */\n public resume(options?: Partial<IAbstractSoundPlayOptions>): void {\n if (this._state !== SoundState.Paused) {\n return;\n }\n\n const it = this._instances.values();\n for (let next = it.next(); !next.done; next = it.next()) {\n next.value.resume(options);\n }\n\n this._state = SoundState.Started;\n this.engine._onSoundPlaybackStateChanged();\n }\n\n /**\n * Stops the sound.\n * - Triggers `onEndedObservable` if the sound is playing.\n */\n public abstract stop(): void;\n\n protected _beforePlay(instance: _AbstractSoundInstance): void {\n if (this.state === SoundState.Paused && this._instances.size > 0) {\n this.resume();\n return;\n }\n\n instance.onEndedObservable.addOnce(this._onInstanceEnded);\n instance.onStateChangedObservable.add(this._onInstanceStateChanged);\n this._privateInstances.add(instance);\n this._newestInstance = instance;\n }\n\n protected _afterPlay(instance: _AbstractSoundInstance): void {\n this._state = instance.state;\n this.engine._onSoundPlaybackStateChanged();\n }\n\n protected _getNewestInstance(): Nullable<_AbstractSoundInstance> {\n if (this._instances.size === 0) {\n return null;\n }\n\n if (!this._newestInstance) {\n const it = this._instances.values();\n for (let next = it.next(); !next.done; next = it.next()) {\n this._newestInstance = next.value;\n }\n }\n\n return this._newestInstance;\n }\n\n protected _setState(state: SoundState): void {\n this._state = state;\n }\n\n protected abstract _createInstance(): _AbstractSoundInstance;\n\n protected _stopExcessInstances(): void {\n if (this.maxInstances < Infinity) {\n const startedInstances = Array.from(this._instances).filter((instance) => instance.state === SoundState.Started);\n const numberOfInstancesToStop = startedInstances.length - this.maxInstances;\n\n for (let i = 0; i < numberOfInstancesToStop; i++) {\n startedInstances[i].stop();\n }\n }\n }\n\n private _onInstanceEnded: (instance: _AbstractSoundInstance) => void = (instance) => {\n if (this._newestInstance === instance) {\n this._newestInstance = null;\n }\n\n instance.onStateChangedObservable.removeCallback(this._onInstanceStateChanged);\n this._privateInstances.delete(instance);\n\n if (this._instances.size === 0) {\n this._state = SoundState.Stopped;\n this.onEndedObservable.notifyObservers(this);\n }\n\n instance.dispose();\n\n this.engine._onSoundPlaybackStateChanged();\n };\n\n private _onInstanceStateChanged: (instance: _AbstractSoundInstance) => void = (_instance) => {\n this.engine._onSoundPlaybackStateChanged();\n };\n}\n"]}
|
|
@@ -28,7 +28,7 @@ export declare abstract class _AbstractSoundInstance extends AbstractAudioNode {
|
|
|
28
28
|
dispose(): void;
|
|
29
29
|
abstract play(options: Partial<IAbstractSoundPlayOptions>): void;
|
|
30
30
|
abstract pause(): void;
|
|
31
|
-
abstract resume(): void;
|
|
31
|
+
abstract resume(options?: Partial<IAbstractSoundPlayOptions>): void;
|
|
32
32
|
abstract stop(): void;
|
|
33
33
|
protected _setState(value: SoundState): void;
|
|
34
34
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abstractSoundInstance.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractSoundInstance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAiB,MAAM,qBAAqB,CAAC;AASvE,gBAAgB;AAChB,MAAM,OAAgB,sBAAuB,SAAQ,iBAAiB;IAelE,YAAsB,KAAoB;QACtC,KAAK,CAAC,KAAK,CAAC,MAAM,oCAA4B,CAAC;QAdzC,WAAM,8BAAkC;QAElD,mEAAmE;QACnD,sBAAiB,GAAG,IAAI,UAAU,EAA0B,CAAC;QAE7E,2FAA2F;QAC3E,sBAAiB,GAAG,IAAI,UAAU,EAAO,CAAC;QAE1D,mEAAmE;QACnD,6BAAwB,GAAG,IAAI,UAAU,EAA0B,CAAC;QAOhF,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAMD,+CAA+C;IAC/C,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,gBAAgB;IACA,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;IAOS,SAAS,CAAC,KAAiB;QACjC,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YACxB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,+BAAuB,EAAE,CAAC;YACrC,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../../Misc/observable\";\nimport { SoundState } from \"../soundState\";\nimport { AbstractAudioNode, AudioNodeType } from \"./abstractAudioNode\";\nimport { type AbstractSound, type IAbstractSoundPlayOptions, type IAbstractSoundPlayOptionsBase } from \"./abstractSound\";\n\n/**\n * Options for creating a sound instance.\n * @internal\n * */\nexport interface IAbstractSoundInstanceOptions extends IAbstractSoundPlayOptionsBase {}\n\n/** @internal */\nexport abstract class _AbstractSoundInstance extends AbstractAudioNode {\n protected _sound: AbstractSound;\n protected _state: SoundState = SoundState.Stopped;\n\n /** Observable triggered when the sound instance's playback ends */\n public readonly onEndedObservable = new Observable<_AbstractSoundInstance>();\n\n /** Observable triggered if the sound instance encounters an error and can not be played */\n public readonly onErrorObservable = new Observable<any>();\n\n /** Observable triggered when the sound instance's state changes */\n public readonly onStateChangedObservable = new Observable<_AbstractSoundInstance>();\n\n protected abstract readonly _options: IAbstractSoundInstanceOptions;\n\n protected constructor(sound: AbstractSound) {\n super(sound.engine, AudioNodeType.HAS_OUTPUTS);\n\n this._sound = sound;\n }\n\n public abstract currentTime: number;\n\n public abstract readonly startTime: number;\n\n /** The playback state of the sound instance */\n public get state(): SoundState {\n return this._state;\n }\n\n /** @internal */\n public override dispose(): void {\n super.dispose();\n this.stop();\n this.onEndedObservable.clear();\n this.onStateChangedObservable.clear();\n }\n\n public abstract play(options: Partial<IAbstractSoundPlayOptions>): void;\n public abstract pause(): void;\n public abstract resume(): void;\n public abstract stop(): void;\n\n protected _setState(value: SoundState) {\n if (this._state === value) {\n return;\n }\n\n this._state = value;\n this.onStateChangedObservable.notifyObservers(this);\n\n if (this._state === SoundState.Stopped) {\n this.onEndedObservable.notifyObservers(this);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"abstractSoundInstance.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/abstractSoundInstance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,iBAAiB,EAAiB,MAAM,qBAAqB,CAAC;AASvE,gBAAgB;AAChB,MAAM,OAAgB,sBAAuB,SAAQ,iBAAiB;IAelE,YAAsB,KAAoB;QACtC,KAAK,CAAC,KAAK,CAAC,MAAM,oCAA4B,CAAC;QAdzC,WAAM,8BAAkC;QAElD,mEAAmE;QACnD,sBAAiB,GAAG,IAAI,UAAU,EAA0B,CAAC;QAE7E,2FAA2F;QAC3E,sBAAiB,GAAG,IAAI,UAAU,EAAO,CAAC;QAE1D,mEAAmE;QACnD,6BAAwB,GAAG,IAAI,UAAU,EAA0B,CAAC;QAOhF,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACxB,CAAC;IAMD,+CAA+C;IAC/C,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,gBAAgB;IACA,OAAO;QACnB,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;IAC1C,CAAC;IAOS,SAAS,CAAC,KAAiB;QACjC,IAAI,IAAI,CAAC,MAAM,KAAK,KAAK,EAAE,CAAC;YACxB,OAAO;QACX,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,+BAAuB,EAAE,CAAC;YACrC,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACjD,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../../Misc/observable\";\nimport { SoundState } from \"../soundState\";\nimport { AbstractAudioNode, AudioNodeType } from \"./abstractAudioNode\";\nimport { type AbstractSound, type IAbstractSoundPlayOptions, type IAbstractSoundPlayOptionsBase } from \"./abstractSound\";\n\n/**\n * Options for creating a sound instance.\n * @internal\n * */\nexport interface IAbstractSoundInstanceOptions extends IAbstractSoundPlayOptionsBase {}\n\n/** @internal */\nexport abstract class _AbstractSoundInstance extends AbstractAudioNode {\n protected _sound: AbstractSound;\n protected _state: SoundState = SoundState.Stopped;\n\n /** Observable triggered when the sound instance's playback ends */\n public readonly onEndedObservable = new Observable<_AbstractSoundInstance>();\n\n /** Observable triggered if the sound instance encounters an error and can not be played */\n public readonly onErrorObservable = new Observable<any>();\n\n /** Observable triggered when the sound instance's state changes */\n public readonly onStateChangedObservable = new Observable<_AbstractSoundInstance>();\n\n protected abstract readonly _options: IAbstractSoundInstanceOptions;\n\n protected constructor(sound: AbstractSound) {\n super(sound.engine, AudioNodeType.HAS_OUTPUTS);\n\n this._sound = sound;\n }\n\n public abstract currentTime: number;\n\n public abstract readonly startTime: number;\n\n /** The playback state of the sound instance */\n public get state(): SoundState {\n return this._state;\n }\n\n /** @internal */\n public override dispose(): void {\n super.dispose();\n this.stop();\n this.onEndedObservable.clear();\n this.onStateChangedObservable.clear();\n }\n\n public abstract play(options: Partial<IAbstractSoundPlayOptions>): void;\n public abstract pause(): void;\n public abstract resume(options?: Partial<IAbstractSoundPlayOptions>): void;\n public abstract stop(): void;\n\n protected _setState(value: SoundState) {\n if (this._state === value) {\n return;\n }\n\n this._state = value;\n this.onStateChangedObservable.notifyObservers(this);\n\n if (this._state === SoundState.Stopped) {\n this.onEndedObservable.notifyObservers(this);\n }\n }\n}\n"]}
|
|
@@ -145,6 +145,12 @@ export declare abstract class StaticSound extends AbstractSound {
|
|
|
145
145
|
* @param options The options to use when playing the sound. Options set here override the sound's options.
|
|
146
146
|
*/
|
|
147
147
|
play(options?: Partial<IStaticSoundPlayOptions>): void;
|
|
148
|
+
/**
|
|
149
|
+
* Resumes the sound.
|
|
150
|
+
* - Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.
|
|
151
|
+
* @param options The options to use when resuming the sound.
|
|
152
|
+
*/
|
|
153
|
+
resume(options?: Partial<IStaticSoundPlayOptions>): void;
|
|
148
154
|
/**
|
|
149
155
|
* Stops the sound.
|
|
150
156
|
* - Triggers `onEndedObservable` if the sound is playing.
|
|
@@ -80,7 +80,7 @@ export class StaticSound extends AbstractSound {
|
|
|
80
80
|
*/
|
|
81
81
|
play(options = {}) {
|
|
82
82
|
if (this.state === 5 /* SoundState.Paused */) {
|
|
83
|
-
this.resume();
|
|
83
|
+
this.resume(options);
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
options.duration ?? (options.duration = this.duration);
|
|
@@ -96,6 +96,14 @@ export class StaticSound extends AbstractSound {
|
|
|
96
96
|
this._afterPlay(instance);
|
|
97
97
|
this._stopExcessInstances();
|
|
98
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Resumes the sound.
|
|
101
|
+
* - Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.
|
|
102
|
+
* @param options The options to use when resuming the sound.
|
|
103
|
+
*/
|
|
104
|
+
resume(options) {
|
|
105
|
+
super.resume(options);
|
|
106
|
+
}
|
|
99
107
|
/**
|
|
100
108
|
* Stops the sound.
|
|
101
109
|
* - Triggers `onEndedObservable` if the sound is playing.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staticSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/staticSound.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgG,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0F9I;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,WAAY,SAAQ,aAAa;IAWnD,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAqC;QAC5F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED,IAAW,QAAQ,CAAC,KAAa;QAC7B,IAAI,CAAC,QAAQ,CAAC,QAAQ,GAAG,KAAK,CAAC;IACnC,CAAC;IAED;;;OAGG;IACH,IAAW,SAAS;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;IACnC,CAAC;IAED,IAAW,SAAS,CAAC,KAAa;QAC9B,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,KAAK,CAAC;IACpC,CAAC;IAED;;;OAGG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC;IACjC,CAAC;IAED,IAAW,OAAO,CAAC,KAAa;QAC5B,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,KAAK,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,IAAW,KAAK;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;IAC/B,CAAC;IAED,IAAW,KAAK,CAAC,KAAa;QAC1B,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC;QAE5B,MAAM,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,MA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I,CAAC,WAAW,EAAC;QACzC,OAAO,CAAC,MAAM,KAAd,OAAO,CAAC,MAAM,GAAK,CAAC,EAAC;QACrB,OAAO,CAAC,QAAQ,KAAhB,OAAO,CAAC,QAAQ,GAAK,CAAC,EAAC;QAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;QACxC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC3B,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAE1B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,UAA4C,EAAE;QACtD,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,6BAAqB,CAAC;QACxC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,SAAS,4BAAoB,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;CAGJ","sourcesContent":["import { type Nullable } from \"../../types\";\nimport { SoundState } from \"../soundState\";\nimport { type IAbstractSoundOptions, type IAbstractSoundPlayOptions, type IAbstractSoundStoredOptions, AbstractSound } from \"./abstractSound\";\nimport { type PrimaryAudioBus } from \"./audioBus\";\nimport { type AudioEngineV2 } from \"./audioEngineV2\";\nimport { type IStaticSoundBufferOptions, type StaticSoundBuffer } from \"./staticSoundBuffer\";\nimport { type _StaticSoundInstance } from \"./staticSoundInstance\";\n\n/** @internal */\nexport interface IStaticSoundOptionsBase {\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n duration: number;\n /**\n * The end of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n * - Has no effect if {@link loop} is `false`.\n */\n loopEnd: number;\n /**\n * The start of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n * - Has no effect if {@link loop} is `false`.\n *\n */\n loopStart: number;\n}\n\n/**\n * Options stored in a static sound.\n * @internal\n */\nexport interface IStaticSoundStoredOptions extends IAbstractSoundStoredOptions, IStaticSoundOptionsBase {\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Can be combined with {@link playbackRate}.\n */\n pitch: number;\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Can be combined with {@link pitch}.\n */\n playbackRate: number;\n}\n\n/**\n * Options for creating a static sound.\n */\nexport interface IStaticSoundOptions extends IAbstractSoundOptions, IStaticSoundBufferOptions, IStaticSoundStoredOptions {}\n\n/**\n * Options for playing a static sound.\n */\nexport interface IStaticSoundPlayOptions extends IAbstractSoundPlayOptions, IStaticSoundOptionsBase {\n /**\n * The time to wait before playing the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for stopping a static sound.\n */\nexport interface IStaticSoundStopOptions {\n /**\n * The time to wait before stopping the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for cloning a static sound.\n * - @see {@link StaticSound.clone}.\n */\nexport interface IStaticSoundCloneOptions {\n /**\n * Whether to clone the sound buffer when cloning the sound. Defaults to `false`.\n * - If `true`, the original sound's buffer is cloned, and the cloned sound will use its own copy.\n * - If `false`, the sound buffer is shared with the original sound.\n */\n cloneBuffer: boolean;\n\n /**\n * The output bus for the cloned sound. Defaults to `null`.\n * - If not set or `null`, the cloned sound uses the original sound's `outBus`.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: Nullable<PrimaryAudioBus>;\n}\n\n/**\n * Abstract class representing a static sound.\n *\n * A static sound has a sound buffer that is loaded into memory all at once. This allows it to have more capabilities\n * than a streaming sound, such as loop points and playback rate changes, but it also means that the sound must be\n * fully downloaded and decoded before it can be played, which may take a long time for sounds with long durations.\n *\n * To prevent downloading and decoding a sound multiple times, a sound's buffer can be shared with other sounds.\n * See {@link CreateSoundBufferAsync}, {@link StaticSoundBuffer} and {@link StaticSound.buffer} for more information.\n *\n * Static sounds are created by the {@link CreateSoundAsync} function.\n */\nexport abstract class StaticSound extends AbstractSound {\n protected override _instances: Set<_StaticSoundInstance>;\n protected abstract override readonly _options: IStaticSoundStoredOptions;\n\n /**\n * The sound buffer that the sound uses.\n *\n * This buffer can be shared with other static sounds.\n */\n public abstract readonly buffer: StaticSoundBuffer;\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IStaticSoundOptions>) {\n super(name, engine, options);\n }\n\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n public get duration(): number {\n return this._options.duration;\n }\n\n public set duration(value: number) {\n this._options.duration = value;\n }\n\n /**\n * The start of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n */\n public get loopStart(): number {\n return this._options.loopStart;\n }\n\n public set loopStart(value: number) {\n this._options.loopStart = value;\n }\n\n /**\n * The end of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n */\n public get loopEnd(): number {\n return this._options.loopEnd;\n }\n\n public set loopEnd(value: number) {\n this._options.loopEnd = value;\n }\n\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Gets combined with {@link playbackRate} to determine the final pitch.\n */\n public get pitch(): number {\n return this._options.pitch;\n }\n\n public set pitch(value: number) {\n this._options.pitch = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.pitch = value;\n }\n }\n\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Gets combined with {@link pitch} to determine the final playback rate.\n */\n public get playbackRate(): number {\n return this._options.playbackRate;\n }\n\n public set playbackRate(value: number) {\n this._options.playbackRate = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.playbackRate = value;\n }\n }\n\n /**\n * Clones the sound.\n * @param options Options for cloning the sound.\n */\n public abstract cloneAsync(options?: Partial<IStaticSoundCloneOptions>): Promise<StaticSound>;\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public play(options: Partial<IStaticSoundPlayOptions> = {}): void {\n if (this.state === SoundState.Paused) {\n this.resume();\n return;\n }\n\n options.duration ??= this.duration;\n options.loop ??= this.loop;\n options.loopStart ??= this.loopStart;\n options.loopEnd ??= this.loopEnd;\n options.startOffset ??= this.startOffset;\n options.volume ??= 1;\n options.waitTime ??= 0;\n\n const instance = this._createInstance();\n this._beforePlay(instance);\n instance.play(options);\n this._afterPlay(instance);\n\n this._stopExcessInstances();\n }\n\n /**\n * Stops the sound.\n * - Triggers `onEndedObservable` if the sound is playing.\n * @param options - The options to use when stopping the sound.\n */\n public stop(options: Partial<IStaticSoundStopOptions> = {}): void {\n if (options.waitTime && 0 < options.waitTime) {\n this._setState(SoundState.Stopping);\n } else {\n this._setState(SoundState.Stopped);\n }\n\n if (!this._instances) {\n return;\n }\n\n for (const instance of Array.from(this._instances)) {\n instance.stop(options);\n }\n }\n\n protected abstract override _createInstance(): _StaticSoundInstance;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"staticSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/staticSound.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgG,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA0F9I;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,WAAY,SAAQ,aAAa;IAWnD,YAAsB,IAAY,EAA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,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAE1B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACa,MAAM,CAAC,OAA0C;QAC7D,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,IAAI,CAAC,UAA4C,EAAE;QACtD,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC3C,IAAI,CAAC,SAAS,6BAAqB,CAAC;QACxC,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,SAAS,4BAAoB,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,OAAO;QACX,CAAC;QAED,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACjD,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACL,CAAC;CAGJ","sourcesContent":["import { type Nullable } from \"../../types\";\nimport { SoundState } from \"../soundState\";\nimport { type IAbstractSoundOptions, type IAbstractSoundPlayOptions, type IAbstractSoundStoredOptions, AbstractSound } from \"./abstractSound\";\nimport { type PrimaryAudioBus } from \"./audioBus\";\nimport { type AudioEngineV2 } from \"./audioEngineV2\";\nimport { type IStaticSoundBufferOptions, type StaticSoundBuffer } from \"./staticSoundBuffer\";\nimport { type _StaticSoundInstance } from \"./staticSoundInstance\";\n\n/** @internal */\nexport interface IStaticSoundOptionsBase {\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n duration: number;\n /**\n * The end of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n * - Has no effect if {@link loop} is `false`.\n */\n loopEnd: number;\n /**\n * The start of the loop range in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n * - Has no effect if {@link loop} is `false`.\n *\n */\n loopStart: number;\n}\n\n/**\n * Options stored in a static sound.\n * @internal\n */\nexport interface IStaticSoundStoredOptions extends IAbstractSoundStoredOptions, IStaticSoundOptionsBase {\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Can be combined with {@link playbackRate}.\n */\n pitch: number;\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Can be combined with {@link pitch}.\n */\n playbackRate: number;\n}\n\n/**\n * Options for creating a static sound.\n */\nexport interface IStaticSoundOptions extends IAbstractSoundOptions, IStaticSoundBufferOptions, IStaticSoundStoredOptions {}\n\n/**\n * Options for playing a static sound.\n */\nexport interface IStaticSoundPlayOptions extends IAbstractSoundPlayOptions, IStaticSoundOptionsBase {\n /**\n * The time to wait before playing the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for stopping a static sound.\n */\nexport interface IStaticSoundStopOptions {\n /**\n * The time to wait before stopping the sound, in seconds. Defaults to `0`.\n */\n waitTime: number;\n}\n\n/**\n * Options for cloning a static sound.\n * - @see {@link StaticSound.clone}.\n */\nexport interface IStaticSoundCloneOptions {\n /**\n * Whether to clone the sound buffer when cloning the sound. Defaults to `false`.\n * - If `true`, the original sound's buffer is cloned, and the cloned sound will use its own copy.\n * - If `false`, the sound buffer is shared with the original sound.\n */\n cloneBuffer: boolean;\n\n /**\n * The output bus for the cloned sound. Defaults to `null`.\n * - If not set or `null`, the cloned sound uses the original sound's `outBus`.\n * @see {@link AudioEngineV2.defaultMainBus}\n */\n outBus: Nullable<PrimaryAudioBus>;\n}\n\n/**\n * Abstract class representing a static sound.\n *\n * A static sound has a sound buffer that is loaded into memory all at once. This allows it to have more capabilities\n * than a streaming sound, such as loop points and playback rate changes, but it also means that the sound must be\n * fully downloaded and decoded before it can be played, which may take a long time for sounds with long durations.\n *\n * To prevent downloading and decoding a sound multiple times, a sound's buffer can be shared with other sounds.\n * See {@link CreateSoundBufferAsync}, {@link StaticSoundBuffer} and {@link StaticSound.buffer} for more information.\n *\n * Static sounds are created by the {@link CreateSoundAsync} function.\n */\nexport abstract class StaticSound extends AbstractSound {\n protected override _instances: Set<_StaticSoundInstance>;\n protected abstract override readonly _options: IStaticSoundStoredOptions;\n\n /**\n * The sound buffer that the sound uses.\n *\n * This buffer can be shared with other static sounds.\n */\n public abstract readonly buffer: StaticSoundBuffer;\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IStaticSoundOptions>) {\n super(name, engine, options);\n }\n\n /**\n * The amount of time to play the sound for, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the sound plays for its full duration.\n */\n public get duration(): number {\n return this._options.duration;\n }\n\n public set duration(value: number) {\n this._options.duration = value;\n }\n\n /**\n * The start of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop starts at the beginning of the sound.\n */\n public get loopStart(): number {\n return this._options.loopStart;\n }\n\n public set loopStart(value: number) {\n this._options.loopStart = value;\n }\n\n /**\n * The end of the loop range, in seconds. Defaults to `0`.\n * - If less than or equal to `0`, the loop plays for the sound's full duration.\n */\n public get loopEnd(): number {\n return this._options.loopEnd;\n }\n\n public set loopEnd(value: number) {\n this._options.loopEnd = value;\n }\n\n /**\n * The pitch of the sound, in cents. Defaults to `0`.\n * - Gets combined with {@link playbackRate} to determine the final pitch.\n */\n public get pitch(): number {\n return this._options.pitch;\n }\n\n public set pitch(value: number) {\n this._options.pitch = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.pitch = value;\n }\n }\n\n /**\n * The playback rate of the sound. Defaults to `1`.\n * - Gets combined with {@link pitch} to determine the final playback rate.\n */\n public get playbackRate(): number {\n return this._options.playbackRate;\n }\n\n public set playbackRate(value: number) {\n this._options.playbackRate = value;\n\n const it = this._instances.values();\n for (let instance = it.next(); !instance.done; instance = it.next()) {\n instance.value.playbackRate = value;\n }\n }\n\n /**\n * Clones the sound.\n * @param options Options for cloning the sound.\n */\n public abstract cloneAsync(options?: Partial<IStaticSoundCloneOptions>): Promise<StaticSound>;\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public play(options: Partial<IStaticSoundPlayOptions> = {}): void {\n if (this.state === SoundState.Paused) {\n this.resume(options);\n return;\n }\n\n options.duration ??= this.duration;\n options.loop ??= this.loop;\n options.loopStart ??= this.loopStart;\n options.loopEnd ??= this.loopEnd;\n options.startOffset ??= this.startOffset;\n options.volume ??= 1;\n options.waitTime ??= 0;\n\n const instance = this._createInstance();\n this._beforePlay(instance);\n instance.play(options);\n this._afterPlay(instance);\n\n this._stopExcessInstances();\n }\n\n /**\n * Resumes the sound.\n * - Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.\n * @param options The options to use when resuming the sound.\n */\n public override resume(options?: Partial<IStaticSoundPlayOptions>): void {\n super.resume(options);\n }\n\n /**\n * Stops the sound.\n * - Triggers `onEndedObservable` if the sound is playing.\n * @param options - The options to use when stopping the sound.\n */\n public stop(options: Partial<IStaticSoundStopOptions> = {}): void {\n if (options.waitTime && 0 < options.waitTime) {\n this._setState(SoundState.Stopping);\n } else {\n this._setState(SoundState.Stopped);\n }\n\n if (!this._instances) {\n return;\n }\n\n for (const instance of Array.from(this._instances)) {\n instance.stop(options);\n }\n }\n\n protected abstract override _createInstance(): _StaticSoundInstance;\n}\n"]}
|
|
@@ -66,6 +66,12 @@ export declare abstract class StreamingSound extends AbstractSound {
|
|
|
66
66
|
* @param options The options to use when playing the sound. Options set here override the sound's options.
|
|
67
67
|
*/
|
|
68
68
|
play(options?: Partial<IStreamingSoundPlayOptions>): void;
|
|
69
|
+
/**
|
|
70
|
+
* Resumes the sound.
|
|
71
|
+
* - Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.
|
|
72
|
+
* @param options The options to use when resuming the sound.
|
|
73
|
+
*/
|
|
74
|
+
resume(options?: Partial<IStreamingSoundPlayOptions>): void;
|
|
69
75
|
/**
|
|
70
76
|
* Stops the sound.
|
|
71
77
|
*/
|
|
@@ -58,7 +58,7 @@ export class StreamingSound extends AbstractSound {
|
|
|
58
58
|
*/
|
|
59
59
|
play(options = {}) {
|
|
60
60
|
if (this.state === 5 /* SoundState.Paused */) {
|
|
61
|
-
this.resume();
|
|
61
|
+
this.resume(options);
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
64
|
let instance;
|
|
@@ -84,6 +84,14 @@ export class StreamingSound extends AbstractSound {
|
|
|
84
84
|
instance.play(options);
|
|
85
85
|
this._afterPlay(instance);
|
|
86
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Resumes the sound.
|
|
89
|
+
* - Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.
|
|
90
|
+
* @param options The options to use when resuming the sound.
|
|
91
|
+
*/
|
|
92
|
+
resume(options) {
|
|
93
|
+
super.resume(options);
|
|
94
|
+
}
|
|
87
95
|
/**
|
|
88
96
|
* Stops the sound.
|
|
89
97
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamingSound.js","sourceRoot":"","sources":["../../../../../dev/core/src/AudioV2/abstractAudio/streamingSound.ts"],"names":[],"mappings":"AACA,OAAO,EAAgG,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA4B9I;;;;;;;;;;;;GAYG;AACH,MAAM,OAAgB,cAAe,SAAQ,aAAa;IAKtD,YAAsB,IAAY,EAAE,MAAqB,EAAE,OAAwC;QAC/F,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QALzB,wBAAmB,GAAG,IAAI,KAAK,EAA2B,CAAC;IAMnE,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAW,qBAAqB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AC;IAEO,wBAAwB,CAAC,QAAiC;QAC9D,MAAM,KAAK,GAAG,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACzD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACf,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { SoundState } from \"../soundState\";\nimport { type IAbstractSoundOptions, type IAbstractSoundPlayOptions, type IAbstractSoundStoredOptions, AbstractSound } from \"./abstractSound\";\nimport { type AudioEngineV2 } from \"./audioEngineV2\";\nimport { type _StreamingSoundInstance } from \"./streamingSoundInstance\";\n\n/** @internal */\nexport interface IStreamingSoundOptionsBase {\n /**\n * The number of instances to preload. Defaults to 1.\n * */\n preloadCount: number;\n}\n\n/**\n * Options for creating a streaming sound.\n */\nexport interface IStreamingSoundOptions extends IAbstractSoundOptions, IStreamingSoundOptionsBase {}\n\n/**\n * Options for playing a streaming sound.\n */\nexport interface IStreamingSoundPlayOptions extends IAbstractSoundPlayOptions {}\n\n/**\n * Options stored in a streaming sound.\n * @internal\n */\nexport interface IStreamingSoundStoredOptions extends IAbstractSoundStoredOptions, IStreamingSoundOptionsBase {}\n\n/**\n * Abstract class representing a streaming sound.\n *\n * A streaming sound has a sound buffer that is loaded into memory in chunks as it is played. This allows it to be played\n * more quickly than a static sound, but it also means that it cannot have loop points or playback rate changes.\n *\n * Due to the way streaming sounds are typically implemented, there can be a significant delay when attempting to play\n * a streaming sound for the first time. To prevent this delay, it is recommended to preload instances of the sound\n * using the {@link IStreamingSoundStoredOptions.preloadCount} options, or the {@link preloadInstanceAsync} and\n * {@link preloadInstancesAsync} methods before calling the `play` method.\n *\n * Streaming sounds are created by the {@link CreateStreamingSoundAsync} function.\n */\nexport abstract class StreamingSound extends AbstractSound {\n private _preloadedInstances = new Array<_StreamingSoundInstance>();\n\n protected abstract override readonly _options: IStreamingSoundStoredOptions;\n\n protected constructor(name: string, engine: AudioEngineV2, options: Partial<IStreamingSoundOptions>) {\n super(name, engine, options);\n }\n\n /**\n * The number of instances to preload. Defaults to `1`.\n */\n public get preloadCount(): number {\n return this._options.preloadCount ?? 1;\n }\n\n /**\n * Returns the number of instances that have been preloaded.\n */\n public get preloadCompletedCount(): number {\n return this._preloadedInstances.length;\n }\n\n /**\n * Preloads an instance of the sound.\n * @returns A promise that resolves when the instance is preloaded.\n */\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\n public preloadInstanceAsync(): Promise<void> {\n const instance = this._createInstance();\n\n this._addPreloadedInstance(instance);\n\n return instance.preloadedPromise;\n }\n\n /**\n * Preloads the given number of instances of the sound.\n * @param count - The number of instances to preload.\n * @returns A promise that resolves when all instances are preloaded.\n */\n public async preloadInstancesAsync(count: number): Promise<void> {\n for (let i = 0; i < count; i++) {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.preloadInstanceAsync();\n }\n\n await Promise.all(this._preloadedInstances.map(async (instance) => await instance.preloadedPromise));\n }\n\n /**\n * Plays the sound.\n * - Triggers `onEndedObservable` if played for the full duration and the `loop` option is not set.\n * @param options The options to use when playing the sound. Options set here override the sound's options.\n */\n public play(options: Partial<IStreamingSoundPlayOptions> = {}): void {\n if (this.state === SoundState.Paused) {\n this.resume(options);\n return;\n }\n\n let instance: _StreamingSoundInstance;\n\n if (this.preloadCompletedCount > 0) {\n instance = this._preloadedInstances[0];\n instance.startOffset = this.startOffset;\n this._removePreloadedInstance(instance);\n } else {\n instance = this._createInstance();\n }\n\n const onInstanceStateChanged = () => {\n if (instance.state === SoundState.Started) {\n this._stopExcessInstances();\n instance.onStateChangedObservable.removeCallback(onInstanceStateChanged);\n }\n };\n instance.onStateChangedObservable.add(onInstanceStateChanged);\n\n options.startOffset ??= this.startOffset;\n options.loop ??= this.loop;\n options.volume ??= 1;\n\n this._beforePlay(instance);\n instance.play(options);\n this._afterPlay(instance);\n }\n\n /**\n * Resumes the sound.\n * - Only options explicitly set here override the paused instance's current options; unset options keep their paused values so playback continues from where it was paused.\n * @param options The options to use when resuming the sound.\n */\n public override resume(options?: Partial<IStreamingSoundPlayOptions>): void {\n super.resume(options);\n }\n\n /**\n * Stops the sound.\n */\n public stop(): void {\n this._setState(SoundState.Stopped);\n\n if (!this._instances) {\n return;\n }\n\n for (const instance of Array.from(this._instances)) {\n instance.stop();\n }\n }\n\n protected abstract override _createInstance(): _StreamingSoundInstance;\n\n private _addPreloadedInstance(instance: _StreamingSoundInstance): void {\n if (!this._preloadedInstances.includes(instance)) {\n this._preloadedInstances.push(instance);\n }\n }\n\n private _removePreloadedInstance(instance: _StreamingSoundInstance): void {\n const index = this._preloadedInstances.indexOf(instance);\n if (index !== -1) {\n this._preloadedInstances.splice(index, 1);\n }\n }\n}\n"]}
|
|
@@ -100,7 +100,7 @@ declare class _WebAudioStaticSoundInstance extends _StaticSoundInstance implemen
|
|
|
100
100
|
/** @internal */
|
|
101
101
|
pause(): void;
|
|
102
102
|
/** @internal */
|
|
103
|
-
resume(): void;
|
|
103
|
+
resume(options?: Partial<IStaticSoundPlayOptions>): void;
|
|
104
104
|
/** @internal */
|
|
105
105
|
stop(options?: Partial<IStaticSoundStopOptions>): void;
|
|
106
106
|
protected _connect(node: AbstractAudioNode): boolean;
|