Skip to content

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

Merged
merged 3 commits into from
Jul 21, 2025

Conversation

docEdub
Copy link
Contributor

@docEdub docEdub commented Jul 18, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

Copy link
Contributor

@Copilot Copilot AI left a 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

@docEdub docEdub enabled auto-merge (squash) July 18, 2025 02:22
@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@sebavan
Copy link
Member

sebavan commented Jul 18, 2025

So strange it only saves 3k ?

@docEdub
Copy link
Contributor Author

docEdub commented Jul 18, 2025

So strange it only saves 3k ?

Ya, this just replaces the AudioEngine class, which is only 400 lines, so not too surprising. I expect the Sound class replacement will save a lot more when I get to it.

@sebavan
Copy link
Member

sebavan commented Jul 18, 2025

oh yes, makes sense

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jul 18, 2025

@docEdub docEdub merged commit 96deeeb into BabylonJS:master Jul 21, 2025
18 checks passed
@docEdub docEdub deleted the 250717-reimplement-old-audio-engine branch July 21, 2025 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants