Skip to content

implementation of audio output switching or whatever#6531

Open
Aidenkrz wants to merge 1 commit into
space-wizards:masterfrom
Aidenkrz:change-audio-device
Open

implementation of audio output switching or whatever#6531
Aidenkrz wants to merge 1 commit into
space-wizards:masterfrom
Aidenkrz:change-audio-device

Conversation

@Aidenkrz
Copy link
Copy Markdown
Contributor

Essentially I got sick of restarting whenever my audio disconnects or switches
Automatically switches whenever device becomes unavailable, content unable to switch devices without a engine confirmation popup so no evil forks making a smite that changes to your speakers and plays ERP sounds or some shit
Content PR will drop if this gets merged
Screencast_20260417_231059.webm

@Aidenkrz Aidenkrz changed the title implementation of device switching or whatever implementation of audio output switching or whatever Apr 18, 2026
Copy link
Copy Markdown

@Verbalase Verbalase left a comment

Choose a reason for hiding this comment

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

Because this PR is so awesome, I approve.

return true;
}

private void ShowDeviceConfirmation(string deviceName)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Doing a popup box with the in-engine UI system is not a security boundary, content could just manipulate the UI tree directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Didn't think about that, any alternatives off the top of your head? Or do we just trust forks not to be evil

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Didn't think about that, any alternatives off the top of your head? Or do we just trust forks not to be evil

It's probably fine to just not care tbh.

Comment on lines +23 to +51

/// <summary>
/// Gets the list of available audio output device names.
/// </summary>
IReadOnlyList<string> GetAudioDevices();

/// <summary>
/// Gets the name of the currently active audio device.
/// Empty string means "system default".
/// </summary>
string GetCurrentDeviceName();

/// <summary>
/// Whether the engine supports live audio device switching. (May not be supported on MacOS)
/// </summary>
bool CanSwitchDevice();

/// <summary>
/// Requests switching to the given audio device.
/// This will show a confirmation dialog to the user.
/// </summary>
/// <param name="deviceName">Device name, or null/empty for system default.</param>
/// <returns>True if the switch was initiated, false if unsupported or another switch is pending.</returns>
bool RequestDeviceSwitch(string? deviceName);

/// <summary>
/// Raised when the audio device has changed.
/// </summary>
event Action? AudioDeviceChanged;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I really do not see what the point of all these public APIs is?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Used by content settings menu

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Then shouldn't this be controlled by some CVar at least?

@PJB3005 PJB3005 added A: Audio Audio playback / recording A: Platform Integration Connecting the engine to OS functionality labels May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A: Audio Audio playback / recording A: Platform Integration Connecting the engine to OS functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants