-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Reimplement legacy AudioEngine
class with AudioEngineV2 WebAudioEngine
class
#16898
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
base: master
Are you sure you want to change the base?
Reimplement legacy AudioEngine
class with AudioEngineV2 WebAudioEngine
class
#16898
Conversation
Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s). |
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 PR replaces the legacy AudioEngine
class implementation with the new AudioEngineV2 WebAudioEngine
class internally, while maintaining backward compatibility through the existing public API. The change reduces the babylon.js UMD package size by 2.92 KB by eliminating duplicate audio functionality.
Key changes include:
- Converting the legacy AudioEngine to a wrapper around the new _WebAudioEngine
- Adding support for enabling/disabling the unmute UI in the WebAudio implementation
- Refactoring audio destination and gain node management to be more flexible
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
File | Description |
---|---|
audioEngine.ts | Complete reimplementation as a wrapper around _WebAudioEngine while preserving the legacy API |
webAudioEngine.ts | Added legacy compatibility properties for audio destination and unmute UI control |
webAudioMainOut.ts | Enhanced gain node management with setter support and dynamic destination handling |
webAudioUnmuteUI.ts | Added enabled property to control UI visibility independently of engine state |
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/16898/merge/index.html#WGZLGJ#4600 Links to test babylon tools with this snapshot: https://playground.babylonjs.com/?snapshot=refs/pull/16898/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/16898/merge#BCU1XR#0 |
Visualization tests for WebGPU |
WebGL2 visualization test reporter: |
This change replaces the old
AudioEngine
class's internals with the AudioEngineV2WebAudioEngine
class's implementation.This reduces the babylon.js UMD package size by 2.92 KB.
Note that this change only replaces the legacy
AudioEngine
class. More legacy classes will be replaced soon for more reductions in package size.Tested for regressions on all legacy audio engine doc playgrounds: