Skip to content

Conversation

@BuzzLord
Copy link

@BuzzLord BuzzLord commented Apr 30, 2025

Updated: Refactored this to only handle setting/overriding the speaker_mode of a project. Channel remapping will be moved to another PR.

Adds support (via project settings under audio/general/speaker_mode) to the AudioServer to change the speaker mode (i.e. number of channels) that Godot uses internally, independent of the audio driver used. It can be used to test more channels (e.g. 7.1 surround when using a stereo audio setup), or fewer channels (e.g. stereo when using a 7.1 surround setup). This is intended to be used to help troubleshoot audio issues when testing with different speaker setups, or hard coding a speaker mode for a project.

This PR also adds the ability to remap internal channels onto different output channels of the audio device. For example, you can remap the rear or side stereo channels of a 7.1 surround system into the front channels of a stereo system in order to verify the audio is correct.

This is a extension of, and replacement for #105682. Like that PR, this feature makes it possible for Godot developers without the necessary surround sound peripheral to reproduce bugs and review fixes to issues that are the result of an unanticipated number of channels, such as: #92532

@BuzzLord
Copy link
Author

BuzzLord commented May 16, 2025

Updated based on the feedback from the most recent audio team meeting. I left the new commit as is for now (i.e. didn't --amend), to make it clear what I changed. I'll rebase and squash it into one commit once its done.

I also made a little project to help show off the functionality.

test-godot-channel-override.zip

SpeakerMode

@adamscott
Copy link
Member

I think the PR should be split in two:

  • one for adding "speaker mode" (which is something that Godot is sorely missing)
  • the other one for overriding speaker channels (which needs tweaking, as it cannot really reside in the project configs, as discussed in the last audio meeting)

@BuzzLord
Copy link
Author

  • the other one for overriding speaker channels (which needs tweaking, as it cannot really reside in the project configs, as discussed in the last audio meeting)

It has been with the most recent update. Overriding is not in project settings, its done with get/set methods on AudioServer.

@adamscott
Copy link
Member

  • the other one for overriding speaker channels (which needs tweaking, as it cannot really reside in the project configs, as discussed in the last audio meeting)

It has been with the most recent update. Overriding is not in project settings, its done with get/set methods on AudioServer.

Ohhh, I see. The settings I saw in the project were lingering options then. Sorry.

@BuzzLord BuzzLord force-pushed the audio-server-override-channels branch from de3521e to e195f67 Compare June 10, 2025 16:39
@BuzzLord BuzzLord changed the title Support overriding and remapping audio channels in AudioServer Support overriding speaker_mode in AudioServer Jun 10, 2025
@BuzzLord
Copy link
Author

Refactored this to only handle setting/overriding the speaker_mode of a project.

Channel remapping will be moved to another PR.

@adamscott adamscott changed the title Support overriding speaker_mode in AudioServer Support overriding speaker_mode in AudioServer Jun 10, 2025
BuzzLord added a commit to BuzzLord/godot that referenced this pull request Jun 10, 2025
The AudioServer processes audio samples as a number of stereo channels,
which are copied to the audio driver buffers. This commit adds
the ability to remap AudioServer channels to different driver
channels, primarily for debugging purposes. The way it is configured
is with get/set methods on AudioServer, exposed in GDScript/C#.

This depends on the speaker_mode override PR godotengine#105934.

It only allows for remapping the stereo channels Godot works with, and
not for mixing left/right samples between channels.
Copy link
Member

@adamscott adamscott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed during the 2025-06-24 audio meeting. Seems ok so far. Would be great to add it to 4.5. This is a feature after the feature freeze, but it's quite a small change for the functionality it brings to the table.
Will test it and comment afterwards later today.

Comment on lines +1561 to 1568
ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &AudioServer::project_settings_changed));
}

void AudioServer::project_settings_changed() {
lock();
speaker_mode_config = GLOBAL_GET("audio/general/speaker_mode");
unlock();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if there's another setting that works like this in the project. This is primarily for the editor side, so should we wrap this behind a is_editor_hint()?

Add support (via project settings) to AudioServer to change the speaker_mode
that Godot uses internally, independent of the audio driver used. Can accept a 'Default'
value, using the audio driver speaker_mode, or use the specified mode.

This is intended to be used to help troubleshoot audio issues when testing with different
speaker setups, but can be used to force a specific speaker_mode on projects where
appropriate.

Co-authored-by: A Thousand Ships <[email protected]>
@BuzzLord BuzzLord force-pushed the audio-server-override-channels branch from e9058c7 to 70688bf Compare September 30, 2025 05:34
@BuzzLord
Copy link
Author

After today's discussion, it seems that we're leaning towards the idea that this PR probably only applies to developers troubleshooting engine issues, and not as a useful feature to be exposed in games. It was suggested that this could be done from the OS level, so I did some poking around to try it.

I was able to use the VB-Audio VB-CABLE driver to effectively do what this PR does. It should work for Windows and Mac. Linux almost certainly also has an equivalent feature.

For Windows:

  1. Install the VB-CABLE driver.
  2. In the Sound configuration window, under the CABLE Output Recording device properties, enable Listen to this device, and set the playback device to the actual output device.
  3. Configure CABLE Input to be an appropriate speaker configuration (e.g. 7.1 Surround).
  4. Set CABLE Input to be the default playback device.

This results in the engine using 7.1 surround, and I confirmed the AudioEffectCapture/AudioEffectRecord bugs can be reproduced this way on a stereo audio device.

Would it make more sense to just write some documentation describing how to configure these external methods rather than include this PR in the engine itself?

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.

3 participants