Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

pop sound plays more than once at a high framerate #1

Open
Novaenia opened this issue Jul 13, 2024 · 3 comments
Open

pop sound plays more than once at a high framerate #1

Novaenia opened this issue Jul 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Novaenia
Copy link

steps to reproduce:

  1. uncap your framerate
  2. get enough frames
  3. go swimming
@IllagerCaptain IllagerCaptain added the bug Something isn't working label Jul 13, 2024
@IllagerCaptain
Copy link
Owner

When you say more than once, do you mean twice, three times, every frame? It's hard for me to test this particular issue myself because my computer is a potato.

@Novaenia
Copy link
Author

it sounds like a new instance of the pop sound is being made every frame that a bubble's half-popped sprite is visible

@pajicadvance
Copy link

This most likely happens because playSound is called in a mixin to a rendering method which runs every frame.

if (z == s && playerEntity.isSubmergedIn(FluidTags.WATER)) {

This condition is probably true during multiple frames so the sound plays once for each frame. You need to somehow make sure that the sound only plays in the first frame when the condition is true and not in the frames that come after.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants