-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Audio getting progressively worse. (By default) #13508
Comments
I believe the audio entities by default don't get despawned. You can change the behavior to |
I have already tried that. Here is the full code: |
Nevermind, I hadn't set it in every instance that I spawned an AudioBundle. May I ask why it isn't Despawn by default? |
I think it's not the default because it creates very undesirable behavior when an |
It's possible that spawning audio as a component is not a good idea. Wouldn't it be better if it was a resource that could be accessed from anywhere, like Commands or something? Maybe something like this?
Although now that I think about it, it is really convenient how it is right now, because you can spawn AudioBundles along with enities and they can access and play them whenever they want, without having to necessarily know what they are playing. I could be picking up a rock or a stick for example, and they could be playing different audio with the same code, just by being spawned differently |
How would you do spatial audio with a resource? |
I have no idea and no experience. I was just typing what I was thinking. Forget the spatial audio, I just thought it could be simpler to use a resource to play sounds. |
See also #12359 |
#12359 is much clearer to track: I'm going to close this out in favor of that issue. |
Bevy version
0.13.2
[Optional] Relevant system information
Windows 11 x64, Ryzen 7 4700U with Radeon Graphics
What you did
I searched up how to play a sound in bevy, and used this code from a bevy example to play some mp3 files for my pong clone.
https://github.com/bevyengine/bevy/blob/main/examples/audio/audio.rs
commands.spawn(AudioBundle { source: asset_server.load("sounds/Windless Slopes.ogg"), ..default() });
What went wrong
Every time a sound plays, the audio quality gets worse. At 100 sounds played, it is unrecognisable. I have a video here to show it more clearly:
2024-05-25.20-50-58.mp4
The text was updated successfully, but these errors were encountered: