Skip to content

Replace AudioStreamPlayer mix target with output channels #106266

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Joseph-DiGiovanni
Copy link
Contributor

@Joseph-DiGiovanni Joseph-DiGiovanni commented May 11, 2025

This PR replaces the limiting mix_target options of AudioStreamPlayer with more granular output_channels. For example, it is currently not possible to output to only the rear speakers, or only one side. This change allows audio to be output to any combination of speakers, or even just a single one.

In addition, I've added a downmix option which will take the desired output channels and use a standard downmixing equation to best preserve positional audio when using an output device with fewer channels. This is enabled by default, but can be disabled to only play audio when the desired channel is available. A good use case for disabling it would be a speaker test.

Screenshot From 2025-05-10 23-22-01

While a majority of the work is done, I need some assistance properly removing mix_target in favor of output_channels to not break existing projects. The conversion should be straightforward, but I'm not familiar with that process at all unfortunately.

@Joseph-DiGiovanni Joseph-DiGiovanni requested review from a team as code owners May 11, 2025 04:57
@Joseph-DiGiovanni Joseph-DiGiovanni force-pushed the audio-stream-player-output-channels branch 2 times, most recently from ae568dc to cb52adb Compare May 11, 2025 05:10
@AThousandShips AThousandShips added this to the 4.x milestone May 11, 2025
@Joseph-DiGiovanni Joseph-DiGiovanni force-pushed the audio-stream-player-output-channels branch from cb52adb to 7dde803 Compare May 11, 2025 14:41
@Joseph-DiGiovanni
Copy link
Contributor Author

It seems documentation translations also need to be removed/updated. Any advice for that would be appreciated as well as I'm also unfamiliar with that process.

@AThousandShips
Copy link
Member

Translations aren't handled here, but the way this breaks compatibility by removing properties is probably incorrect, and some comaptibility code should be added instead

@fkeyzuwu
Copy link
Contributor

Other than breaking compatibility, I feel like this is displaying too much info for the average user. The solution that first came to mind is adding a "Custom" Mix target, which would only then expose those inspector parameters.

@Joseph-DiGiovanni
Copy link
Contributor Author

Sorry, I fat fingered the close button 🙃

Can't say I'm opposed to the idea, but I'll have to look into how to implement conditional options.

@Mickeon
Copy link
Member

Mickeon commented May 11, 2025

Is there a corresponding proposal for this? If not, I would seriously recommend making one proper. This sounds like it has a very niche use-case.

@Joseph-DiGiovanni
Copy link
Contributor Author

It may be a niche use case, but to me its more questionable why stereo, center+LFE, and all speakers are the only options. It seems reasonable to expect a way to output to any audio channel and not have arbitrary groups.

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