Skip to content

Add button hover sound effect - #2885

Merged
manuq merged 9 commits into
endlessm:mainfrom
FinalRed:hover-sound-1027
Sep 22, 2026
Merged

manuq merged 9 commits into
endlessm:mainfrom
FinalRed:hover-sound-1027

Conversation

@FinalRed

Copy link
Copy Markdown
Contributor

Fixes #1027

This time, the sound was created acoustically by moving the teeth of a hair comb.

Added hover sound effect to UI buttons:

  1. Registered mouse_entered signal connection for BaseButton nodes in menu_ui_player.gd.
  2. Added %HoverSFXPlayer node to menu_ui_player.tscn assigned to the SFX bus.
  3. Adjusted max_polyphony to prevent audio dropouts during fast cursor movement across menu items.

@FinalRed
FinalRed requested a review from a team as a code owner September 12, 2026 15:05
Comment thread how --name-only a7d12177 Outdated

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.

Remove please

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.

removed!

Comment thread project.godot

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.

Revert please

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.

I've already removed that line of code

Comment thread Proyectos - Acceso directo.lnk Outdated

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.

Remove please

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.

done!

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.

There are two (different) Hover.wav files, which one is the correct oen?

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.

The correct file is sounds/ui/Hover.wav. The duplicate in scenes/ has been removed.

Comment on lines -33 to -35
func _connect_once(sig: Signal, callable: Callable) -> void:
if not sig.is_connected(callable):
sig.connect(callable)

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 don't think you meant to delete the _connect_once function!

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.

When I tried to submit the pull request, I got an error before it was sent. The error appeared starting at the line “<<<<HEAD,” so I tried moving the code around until the error disappeared. However, it has already been reverted.

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 think this duplicate scene is unnecessary?

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.

Yes! The .wav file that plays is the one in the iu/Hover.wav folder. The duplicate has already been removed.

Comment on lines +24 to +25
if node is BaseButton:
_connect_once(node.mouse_entered, _on_button_hovered)

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.

Have you tried navigating with the keyboard or a gamepad? I wonder if we should play the same sound for the Control.focus_entered signal.

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.

Yes, the sound is the same whether you click the button with the mouse or navigate the menu with the keyboard. I don't know about gamepads; I don't have one to test it with.

I've been testing it, and it does recognize the keyboard!

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.

Why only BaseButton? There are other Control subclasses that can be focused/hovered, e.g. Slider. I agree that we don't want to bind to Control.mouse_entered on every control though.

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.

Ahhh, I hadn't realized that. I updated the hover function to check whether the node is a BaseButton or a Slider: that way, the sliders now also play the hover sound when you hover over them.

Actually, now that I’ve done the latest test, I think it would be good if the music slider—instead of the click sound—used the random sound feature to play the melody from “The Musical Rocks.”

@FinalRed

Copy link
Copy Markdown
Contributor Author

I've already updated the pull request.

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown

Test build no longer available.

@manuq

manuq commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator

@FinalRed please address the comments made by Will. Thanks!

@FinalRed

Copy link
Copy Markdown
Contributor Author

All of Will's comments have been addressed! The accidental files were removed, project.godot was reverted, _connect_once was restored.

Comment thread project.godot Outdated
[editor]

movie_writer/movie_file="user://recording.ogv"
movie_writer/movie_file="user://recording.mp4"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be reverted! To verify, come to the Files Changed tab of this pull request and check that there project.godot is not in the list of changed files.

Image

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.

project.godot is gone

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Excellent! All works as expected. I agree that applying this just to BaseButton and Slider seems limiting, but I couldn't find an existing control that doesn't play the sound when hovered. We can enlarge the list of affected Control nodes in the future.

@manuq
manuq merged commit 5c32376 into endlessm:main Sep 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create a UI sound effect: hover

3 participants