Add Audio V2 support to Inspector v2#18480
Conversation
The single-line form in b9cade8 doesn't match prettier (printWidth=180); master's multi-line form is what prettier and the generator produce together. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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/18480/merge/index.html#WGZLGJ#4600 Links to test your changes to core in the published versions of the Babylon tools (does not contain changes you made to the tools themselves): https://playground.babylonjs.com/?snapshot=refs/pull/18480/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/18480/merge#BCU1XR#0 If you made changes to the sandbox or playground in this PR, additional comments will be generated soon containing links to the dev versions of those tools. |
|
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
⚡ Performance Test Results🟢 All performance tests passed — no regressions detected. |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18480/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
🟢 Memory Leak Test Results13 passed, 0 leaked out of 13 scenarios 🟢 All memory leak tests passed — no leaks detected. Passed Scenarios (13)
|
- Defer OnAudioEngineV2CreatedObservable notification to CreateAudioEngineAsync so observers don't see a partially constructed subclass (fixes a critical initialization-ordering hazard for _WebAudioEngine). - Expose useBoundingBox + attachmentType down the spatial-audio API chain and honor them in SpatialAudioGizmo so the gizmo pose matches Position-only, Rotation-only, and bounding-box attachments. - Surface routable nodes with outBus === null (e.g. microphone sources, manually disconnected nodes) directly under the engine in the Audio V2 scene explorer so they don't disappear from the tree. - Wire SpatialAudioGizmo.onClickedObservable to ISelectionService so clicking the gizmo in the viewport selects the underlying sound source. - useSoundState now also listens to AbstractSound.onEndedObservable and intercepts the engine's _onSoundPlaybackStateChanged so natural end / async Starting -> Started / FailedToStart transitions all refresh the UI. - Add Listener section to the Audio V2 engine property pane with a link to the scene node the listener is attached to. (Skip a dedicated Unlock button — AudioEngineV2.unlockAsync is a thin wrapper around resumeAsync so Resume already covers the autoplay-blocked path.) - Refactor getSpatialAudioGizmo to route shared cleanup through a closure- captured lambda instead of overriding gizmo.dispose, avoiding Function.bind / Function.call (both prohibited by the repo's performance/style rules). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Self code review completed by the code-review skill. Review fixes: c9491cce06
|
⚡ Performance Test Results🟢 All performance tests passed — no regressions detected. |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
🟢 Memory Leak Test Results13 passed, 0 leaked out of 13 scenarios 🟢 All memory leak tests passed — no leaks detected. Passed Scenarios (13)
|
⚡ Performance Test Results🟢 All performance tests passed — no regressions detected. |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18480/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
|
Visualization tests for WebGPU |
|
WebGL2 visualization test reporter: |
🟢 Memory Leak Test Results13 passed, 0 leaked out of 13 scenarios 🟢 All memory leak tests passed — no leaks detected. Passed Scenarios (13)
|
|
Building or testing the sandbox has failed. If the tests failed, results can be found here: |
|
You have changed file(s) that made possible changes to the sandbox. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/SANDBOX/refs/pull/18480/merge/ |
|
You have made possible changes to the playground. https://snapshots-cvgtc2eugrd3cgfd.z01.azurefd.net/PLAYGROUND/refs/pull/18480/merge/ The snapshot playground with the CDN snapshot (only when available): Note that neither Babylon scenes nor textures are uploaded to the snapshot directory, so some playgrounds won't work correctly. |
|
WebGL2 visualization test reporter: |
|
Visualization tests for WebGPU |
⚡ Performance Test Results🟢 All performance tests passed — no regressions detected. |
🟢 Memory Leak Test Results13 passed, 0 leaked out of 13 scenarios 🟢 All memory leak tests passed — no leaks detected. Passed Scenarios (13)
|
Adds Audio V2 support to Inspector v2 (scene explorer + property panes + scene gizmo), plus the underlying engine observables and spatial-audio APIs the inspector needs.
Highlights
Core – AudioV2
OnAudioEngineV2CreatedObservableandAudioEngineV2.Instancesso consumers can track engine lifetime without polling.AudioEngineV2now implementsIDisposableand exposes:onNodeAddedObservable/onNodeRemovedObservablefor top-level audio nodes (sounds, sound sources, buses).onDisposeObservablethat fires after the engine is removed fromInstances.AbstractSpatialAudio.attachedNode_SpatialAudio.attachedNode(internal)_SpatialAudioSubNode.attachedNode(internal)_SpatialAudioAttacherComponent.sceneNode(internal)Core – Gizmos
SpatialAudioGizmo(andISpatialAudioGizmointerface) that visualizes the position/orientation of a v2 spatial sound source on the utility layer and fires anonClickedObservablewhen clicked.Inspector v2
GizmoServicegainedgetSpatialAudioGizmo(soundSource, scene)(ref-counted, mirroring camera/light gizmo lifecycle).InterceptPropertyfix: getters/setters now forwardthiscorrectly, so intercepted prototype properties behave the same as the originals when read/written from subclasses.core/pureand to spin up a small spatial v2 sound demo so the new inspector surfaces are exercised end-to-end.Notes
_SpatialAudioAttacherComponent).scripts/treeshaking/side-effects-manifest.jsonupdated to reflect the new gizmo entry point.