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

Add sound to press events of some formspecs elements #10402

Closed
wants to merge 1 commit into from

Conversation

pyrollo
Copy link
Contributor

@pyrollo pyrollo commented Sep 16, 2020

This PR adds the possibility associate play sound to some formspecs client events (mouse clicks on items).
Sound is played by the client before any client-server-client dialog, avoiding any lag.

Sounds are fetched:

  • among mods and game media when in game;
  • in "sounds" folder when in main menu (sounds forlder is at same level as textures forlder);

To do

This PR is Ready for Review

How to test

Try this formspec using minetest_game:

size[5,3]
no_prepend[]
style[player;sound=player_damage]
button[3,1;1,1;player;player]
style_type[button;sound=default_sand_footstep]
button[1,1;1,1;sand;sand]

@pyrollo pyrollo added @ Client / Audiovisuals Feature ✨ PRs that add or enhance a feature Formspec labels Sep 16, 2020
@pyrollo pyrollo changed the title Add sound to press event of some formspecs elements Add sound to press events of some formspecs elements Sep 16, 2020
@Andrey2470T
Copy link
Contributor

A question: can sounds be played when any button is being at hovered state also (currently afaik only buttons support states)?

@pyrollo
Copy link
Contributor Author

pyrollo commented Sep 19, 2020

A question: can sounds be played when any button is being at hovered state also (currently afaik only buttons support states)?

No, for now it's just on clicks. But technically, nothing prevents that sort of addition.

But this brings a new problem: sounds should be attached to events (enter, exit, click, release, ...) not states (pressed, hovered). So maybe the style states are not adapted to sounds.

@SmallJoker
Copy link
Member

How does it work? I tried the following code but there's no sound: (devtest/testformspec)

	style[one_btn1;sound=soundstuff_mono.ogg]
	button[0,0;2.5,0.8;one_btn1;Button]

If you have a working snippet, would you please be so nice to add it to devtest as well?

@kilbith
Copy link
Contributor

kilbith commented Nov 19, 2020

You need to remove the “.ogg” part

@SmallJoker
Copy link
Member

🤦 haha. Modder newbie mistakes do happen. Thanks, it works now just fine.

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

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

Works \o/

@SmallJoker
Copy link
Member

7827302

@SmallJoker SmallJoker closed this Nov 23, 2020
@Jipok
Copy link

Jipok commented Nov 23, 2020

@SmallJoker
For the sake of interest, why did you close this pr?
I see that you have committed the changes, but the closed pr is discouraging

@v-rob
Copy link
Member

v-rob commented Dec 2, 2020

I wish I had been paying attention to this earlier, but I don't think this PR should have been merged in its present state. Since the sound only applies to press despite any states, it will be hard to change the behaviour without breaking compatibility. I'm also not too happy with the implementation as it puts more stuff in GUIFormSpecMenu.

@kilbith
Copy link
Contributor

kilbith commented Dec 2, 2020

Nothing prevents you to revert since it's not released yet.

HybridDog pushed a commit to HybridDog/minetest that referenced this pull request Dec 17, 2020
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.

None yet

6 participants