Skip to content
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

Implement DisplayServer.beep. #99371

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

Implement DisplayServer.beep. #99371

wants to merge 1 commit into from

Conversation

bruvzg
Copy link
Member

@bruvzg bruvzg commented Nov 17, 2024

Implements DisplayServer.beep method to make annoying sounds.

Implements godotengine/godot-proposals#11179

Comment on lines +16 to +17
Plays the system beep sound, if possible.
[b]Note:[/b] This method is implemented on macOS, Linux (X11/Wayland) and Windows.
Copy link
Member

@Calinou Calinou Nov 17, 2024

Choose a reason for hiding this comment

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

Suggested change
Plays the system beep sound, if possible.
[b]Note:[/b] This method is implemented on macOS, Linux (X11/Wayland) and Windows.
Plays the system beep sound, if possible. This can be used to get the user's attention, e.g. if an error occurs in the application.
The system beep sound depends on the operating system, but it can be changed or disabled at an OS level by the user. Unlike application-level audio playback, the system beep sound will be audible even if the application is muted in the engine's Master bus or in the system audio mixer. See also [method Window.request_attention].
[b]Note:[/b] This method is implemented on macOS, Linux (X11/Wayland) and Windows.

Copy link
Contributor

@Mickeon Mickeon Nov 17, 2024

Choose a reason for hiding this comment

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

I don't think there's much need to be overly specific but this extra addendum is good.

Suggested change
Plays the system beep sound, if possible.
[b]Note:[/b] This method is implemented on macOS, Linux (X11/Wayland) and Windows.
Plays the beep sound from the operative system, if possible. Because it comes from the OS, the beep sound will be audible even if the application is muted. It may also be disabled for the entire OS by the user.
[b]Note:[/b] This method is implemented on macOS, Linux (X11/Wayland), and Windows.

Or similar.

Copy link
Contributor

@Riteo Riteo left a comment

Choose a reason for hiding this comment

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

Wayland implementation checks out!

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

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

Tested locally on Windows 11 23H2, it works as expected.

@mhilbrunner
Copy link
Member

Why DisplayServer.beep() and not OS.beep()?

@bruvzg
Copy link
Member Author

bruvzg commented Nov 18, 2024

Why DisplayServer.beep() and not OS.beep()?

It depends on X11 and Wayland to work.

Copy link
Member

@mhilbrunner mhilbrunner left a comment

Choose a reason for hiding this comment

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

Truly tragic that you didn't expose the parameter to use the exclamation sound on Windows :p

Docs, style, code and Git commit LGTM. Haven't built and tested as Calinou was faster.

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.

5 participants