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

Using an AudioStreamRandomizer with play_sound will error on the third attempt. #31

Open
dicemaster5 opened this issue Jun 6, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@dicemaster5
Copy link
Contributor

Describe the bug
When playing a sound with SoundManager.play_sound() using an AudioStreamRandomizer as the audiostream resource the addon will error on the third use of play_sound() at sound_manager/abstract_audio_player_pool.gd on line 62 due to a missing/null player stream.

Commenting out lines 39 and 40 fixes the issue as it plays the AudioStreamRandomizer as a normal AudioStream without going into get_player_with_resource() (I'm a bit confused as to why AudioStreamRandomizer is being handled differently with this method).

The cause of the missing/null player stream is happening on line 79 in mark_player_as_available(), that's where the player gets destroyed with a queue_free().

Affected version

  • Addon version: 2.6.1
  • Godot version: 4.2.2

To Reproduce
Play a sound with SoundManager.play_sound() using an AudioStreamRandomizer as the AudioStream resource and play the sound 3 or more times, should trigger the error.

Screenshots
image

@oxeron
Copy link

oxeron commented Nov 4, 2024

Bug confirmed

@oxeron
Copy link

oxeron commented Nov 5, 2024

Removing get_player_with_resource() for AudioStreamRandomizer solves the problem, but maybe with another side effect I did not find
Another approach would be not to queue_free a player with AudioStreamRandomizer as resource ?

@Elementus353
Copy link

Hi! Did you get it why AudioStreamRandomizer was being handled differently? Because i face the same problem and don't find any other solution but commenting 39 and 40 lines. Did you face any problems after commenting these lines?

@dicemaster5
Copy link
Contributor Author

Hi! Did you get it why AudioStreamRandomizer was being handled differently? Because i face the same problem and don't find any other solution but commenting 39 and 40 lines. Did you face any problems after commenting these lines?

Hey! No unfortunatley I never figured it out.
But commenting out those lines never caused any issues for me so I kept to that solution.

@Elementus353
Copy link

Hi! Did you get it why AudioStreamRandomizer was being handled differently? Because i face the same problem and don't find any other solution but commenting 39 and 40 lines. Did you face any problems after commenting these lines?

Hey! No unfortunatley I never figured it out. But commenting out those lines never caused any issues for me so I kept to that solution.

Haha, that's nice

Thank you for your reply!

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

No branches or pull requests

4 participants