-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix spatial audio init issues #16279
Fix spatial audio init issues #16279
Conversation
If spatial audio is not enabled at init time using the `spatialEnabled` option, accessing the `spatial` property on a sound or bus throws error "Sub node not found". This change fixes the issue by creating the underlying spatial audio subnode if it doesn't exist, instead of throwing an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes initialization issues for spatial audio by ensuring that the spatial subnode is created when missing, instead of throwing an error. Key changes include:
- Updating the spatial audio property initialization to clone default values and create the subnode if absent.
- Converting several methods to async and awaiting subnode creation to enforce proper initialization order.
- Adjusting type annotations in subgraph files for consistency.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
packages/dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudio.ts | Replaces error throwing with default cloning and subnode creation for spatial audio. |
packages/dev/core/src/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.ts | Converts callOnSubNode to async and adjusts type annotations. |
packages/dev/core/src/AudioV2/webAudio/subNodes/webAudioBaseSubGraph.ts | Awaits subnode creation to ensure proper asynchronous initialization. |
packages/dev/core/src/AudioV2/webAudio/subNodes/webAudioBusAndSoundSubGraph.ts | Applies similar asynchronous handling for spatial and stereo subnodes. |
packages/dev/core/src/AudioV2/abstractAudio/subProperties/spatialAudio.ts
Show resolved
Hide resolved
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
Snapshot stored with reference name: Test environment: To test a playground add it to the URL, for example: https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/refs/pull/16279/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16279/merge To test the snapshot in the playground with a playground ID add it after the snapshot query string: https://playground.babylonjs.com/?snapshot=refs/pull/16279/merge#BCU1XR#0 |
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
packages/dev/core/src/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.ts
Outdated
Show resolved
Hide resolved
WebGL2 visualization test reporter: |
Visualization tests for WebGPU |
If spatial audio is not enabled at init time using the
spatialEnabled
option, accessing thespatial
property on a sound or bus throws error "Sub node not found".This change fixes the issue by creating the underlying spatial audio subnode if it doesn't exist, instead of throwing an error.